Compilation error when using LowPower.h library with MySensors
-
Hi all,
I would like to put my node on deepsleep (328p + rfm69hcw + battery):- I first used the
sleep ()but I did not go lower than 3.7mA - I saw on this topic https://forum.mysensors.org/topic/1478/rfm69-sleep-mode?_=1610979868641 that we could go lower with
LowPower.hwith
LowPower.powerDown (SLEEP_8S, ADC_OFF, BOD_OFF);-
I succeeded with going down to 17µA BUT ONLY with the lowpowerlab libraries
-
if I include
LowPower.hin my MySensors sketch :
//===== RFM config ===== #define MY_RADIO_RFM69 #define MY_IS_RFM69HW //with H(CW) #define MY_RFM69_NEW_DRIVER #define MY_RFM69_FREQUENCY RFM69_868MHZ #define MY_SIGNAL_REPORT_ENABLED #define MY_RFM69_IRQ_PIN 2 #define MY_RFM69_CS_PIN 10 //===== LOWPOWERLAB ===== #include <LowPower.h> //get library from: https://github.com/lowpowerlab/lowpower //writeup here: http://www.rocketscream.com/blog/2011/07/04/lightweight-low-power-arduino-library/ #include <MySensors.h> //========== TRANSMISSION ID ========== #define CHILD_ID_RX_RSSI (4) //pr1: ===== vcc ===== #include <Vcc.h> //https://github.com/Yveaux/Arduino_Vcc const float VccMin = 0.0; // Minimum expected Vcc level, in Volts. const float VccMax = 3.3; // Maximum expected Vcc level, in Volts. const float VccCorrection = 3.32 / 3.29; // Measured Vcc by multimeter 4.97 divided by reported Vcc 4.88 Vcc vcc(VccCorrection); #define CHILD_ID_VCC (10) //pr2: ===== sleep ===== unsigned long SLEEP_TIME = 60000; // Sleep time between reads (in milliseconds) 60000=1minute //========== Initialize general MESSAGE ========== MyMessage msgRxRSSI(CHILD_ID_RX_RSSI, V_CUSTOM); MyMessage msgVcc(CHILD_ID_VCC, V_VOLTAGE); //=================================== //= BEFORE = //=================================== void before() { } //FIN de before //=================================== //= SETUP = //=================================== void setup() {//no need Serial.begin(115200) }//FIN du SETUP //========================================== //= PRESENTATION = //========================================== void presentation() { // Send the sketch version information to the gateway and controller sendSketchInfo("ATC_report & Vcc", "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID_RX_RSSI, S_CUSTOM, "RX RSSI"); present(CHILD_ID_VCC, S_MULTIMETER, "Vcc"); } // FIN de PRESENTATION //=================================== //= LOOP = //=================================== void loop() { // send messages to GW // retrieve RSSI / SNR reports from incoming ACK send(msgRxRSSI.set(transportGetSignalReport(SR_RX_RSSI))); Serial.print("Receive RSSI: "); Serial.println( RFM69_getReceivingRSSI ()); //pr1:========== send vcc ========== float v = vcc.Read_Volts(); Serial.print("VCC = "); Serial.print(v); Serial.println(" Volts"); float p = vcc.Read_Perc(VccMin, VccMax); Serial.print("VCC = "); Serial.print(p); Serial.println(" %"); send(msgVcc.set(v, 1)); Serial.println("Enter in sleep time ..."); //pr1:===== sleep ===== LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); //COMPILATION ERROR : libraries\LowPower-master\LowPower.cpp.o: In function `__vector_6': //sleep(SLEEP_TIME); //WORK BUT : go from 25mA to 3.7mA (not µA) //gw.sleep(8000); // MysensorsV1 : 3.7mA }// FIN de LOOPI have this error:
Arduino: 1.8.13 (Windows 10), Card: "ATmega328, Yes (UART0), EEPROM retained, 328P / 328PA, BOD 2.7V, LTO disabled, External 16 MHz " libraries \ LowPower-master \ LowPower.cpp.o: In function `__vector_6 ': D: \ Documents \ Arduino \ SKETCH \ libraries \ LowPower-master / LowPower.cpp: 1190: multiple definition of `__vector_6 ' sketch \ moteino_MySensors_vcc_sleep_pr3.ino.cpp.o: D: \ Documents \ Arduino \ SKETCH \ libraries \ MySensors / hal / architecture / AVR / MyHwAVR.cpp: 79: first defined here collect2.exe: error: ld returned 1 exit status exit status 1 Compilation error for the ATmega328 cardSomeone to help me ?
- I first used the
-
In MySensors/hal/architecture/AVR/MyHwAVR.cpp
find:ISR (WDT_vect) { }// Make it weak to allow local sketch implementation by changing it to
ISR(WDT_vect, __attribute__((weak))) { }Or you can do it like this Compile problem: multiple definition of `__vector_6'
Go to LowPower.cpp, find this linesISR (WDT_vect) { // WDIE & WDIF is cleared in hardware upon entering this ISR wdt_disable(); }and comment it
This last solution worked for me to compile with lowpower lib, but I wanted to use Timer2 on and that is incompatible with Mysensors for now.
-
great thank you for your answer! :+1:
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login