Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Compilation error when using LowPower.h library with MySensors

Compilation error when using LowPower.h library with MySensors

Scheduled Pinned Locked Moved Troubleshooting
3 Posts 2 Posters 574 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SuperNinjaS Offline
    SuperNinjaS Offline
    SuperNinja
    wrote on last edited by
    #1

    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.h with
    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.h in 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 LOOP
    

    I 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 card
    

    Someone to help me ?

    1 Reply Last reply
    0
    • alexeliteA Offline
      alexeliteA Offline
      alexelite
      wrote on last edited by
      #2

      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)))
      {
      }
      

      Make WDT_vect weak #717

      Or you can do it like this Compile problem: multiple definition of `__vector_6'
      Go to LowPower.cpp, find this lines

      ISR (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.

      1 Reply Last reply
      0
      • SuperNinjaS Offline
        SuperNinjaS Offline
        SuperNinja
        wrote on last edited by
        #3

        great thank you for your answer! :+1:

        1 Reply Last reply
        0

        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
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        15

        Online

        12.0k

        Users

        11.2k

        Topics

        113.4k

        Posts


        Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • MySensors
        • OpenHardware.io
        • Categories
        • Recent
        • Tags
        • Popular