Redefinition warning when Compiling for RFM69W-915 Radio
-
Hi,
I'm working on my first MySensors Node. My code is a simple read an analog input function. Now because my radio is a 915MHz version I must add a line to state such. When I do the compiler gives me a warning "warning: "MY_RFM69_FREQUENCY" redefined"Now I know I am redefining the default radio frequency so the warning is understood, however I am wondering if I am coding is a clumsy manor to get this warning.
My Code:// Sensor node code // 2018-01-26 V_01b // Target: Aarduino MiniWirelessW-915 //MySensors API V2.2.0 // from: https://www.mysensors.org/download/sensor_api_20 #define MY_DEBUG // *** Initialization *** // #define MY_RADIO_RFM69 #include <MySensors.h> #define MY_RFM69_FREQUENCY RF69_915MHZ #define CHILD_ID 5 #define sensortype S_MULTIMETER #define analoginputPIN A0 #define LEDPIN 9 //PB1 is pin 9 on ProMini uint16_t analogPinRdg; MyMessage msg_Voltage(CHILD_ID, V_VOLTAGE); void setup() { pinMode(LEDPIN, OUTPUT); digitalWrite(LEDPIN, HIGH); // turn the LED on (doesn't work, may not get here) } void presentation() { present(CHILD_ID, S_MULTIMETER); } void loop() { // digitalWrite(LEDPIN, HIGH); // turn the LED on (HIGH is the voltage level) // delay(1000); // wait for a second // digitalWrite(LEDPIN, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second asm ("sbi %0, %1 \n": : "I" (_SFR_IO_ADDR(PINB)), "I" (PINB1)); // Toggle LED analogPinRdg = analogRead(analoginputPIN); send(msg_Voltage.set(analogPinRdg)); wait(5000); //unsigned long }```
-
@johnrob all defines for MySensors need to be done before including MySensors.h. Otherwise, they won't have any effect.
So move define MY_RFM69_FREQUENCY RF69_915MHZ a few lines up.
-
@mfalkvidd said in Redefinition warning when Compiling for RFM69W-915 Radio:
MySensors.h
Thank you.
I was under the impression that the RFM69 default frequency was 868Mhz and if I placed the "#define MY_RFM69_FREQUENCY RF69_915MHZ" before the MySensors.h the frequency would be reset to 868.
I'm guessing by your answer that this is not the case. Perhaps an if not defined.
-
@johnrob exactly. All MySensors defines are designed that way.