rocketscream / Low-Power

Low Power Library for Arduino
www.rocketscream.com
1.26k stars 345 forks source link

SLEEP_MODE_EXT_STANDBY not declared on ATMega168 #45

Open Erik84750 opened 6 years ago

Erik84750 commented 6 years ago

When compiling with LowPower.h using Arduino Pro Mini 168 there is still an error present. Same error was reported in July 30 2015 (issue #14).

[code]

In file included from C:\Users\Mysafety\Google Drive\documents\Arduino\libraries\Low-Power\LowPower.cpp:32:0:

C:\Users\Mysafety\Google Drive\documents\Arduino\libraries\Low-Power\LowPower.cpp: In member function 'void LowPowerClass::powerExtStandby(period_t, adc_t, bod_t, timer2_t)':

C:\Users\Mysafety\Google Drive\documents\Arduino\libraries\Low-Power\LowPower.cpp:980:18: error: 'SLEEP_MODE_EXT_STANDBY' was not declared in this scope

lowPowerBodOn(SLEEP_MODE_EXT_STANDBY);

              ^

C:\Users\Mysafety\Google Drive\documents\Arduino\libraries\Low-Power\LowPower.cpp:980:4: note: in expansion of macro 'lowPowerBodOn'

lowPowerBodOn(SLEEP_MODE_EXT_STANDBY);

^

C:\Users\Mysafety\Google Drive\documents\Arduino\libraries\Low-Power\LowPower.cpp:985:17: error: 'SLEEP_MODE_EXT_STANDBY' was not declared in this scope

lowPowerBodOn(SLEEP_MODE_EXT_STANDBY);

             ^

C:\Users\Mysafety\Google Drive\documents\Arduino\libraries\Low-Power\LowPower.cpp:985:3: note: in expansion of macro 'lowPowerBodOn'

lowPowerBodOn(SLEEP_MODE_EXT_STANDBY);

^

Bibliotheek Wire op versie 1.0 in map: C:\Users\Mysafety\Google Drive\documents\Arduino\libraries\Wire wordt gebruikt Bibliotheek RTClibExtended op versie 1.0.0 in map: C:\Users\Mysafety\Google Drive\documents\Arduino\libraries\RTClibExtended wordt gebruikt Bibliotheek Low-Power op versie 1.6 in map: C:\Users\Mysafety\Google Drive\documents\Arduino\libraries\Low-Power wordt gebruikt exit status 1 Fout bij het compileren van board Arduino Pro or Pro Mini

[/code]

Erik84750 commented 6 years ago

I solved it by adding to LowPower.h the following:

if defined (__AVR_ATmega168__)

    #define SLEEP_MODE_EXT_STANDBY SLEEP_MODE_STANDBY
  #endif
cjander commented 6 years ago

since you have a solution already, why not just create a pullrequest?

Erik84750 commented 6 years ago

I am sorry!! I am new to this, I have to learn how to use Github. One additional thing I have to mention is that this relates to Atmega 168P, not the plain version.

rocketscream commented 6 years ago

Actually, the non-P version of the ATmega168 does not have extended power standby mode unlike the ATmega168P. If you do that, it will result in error as those bits are not present in the register. I think I would have to allow it to compile for P version only when it comes to that sleep mode and provide warning for non-P.

Erik84750 commented 6 years ago

Thank you.

Erik84750 commented 5 years ago

Hi rocketscream, is it possible you had added this to your low power library? When I open LowPower.h I cannot find my original addition, but it seems replaced by equivalent code?