Author Topic: DeepSleepScheduler does not compile for Digispark Pro  (Read 3639 times)

supuflounder

  • Newbie
  • *
  • Posts: 2
DeepSleepScheduler does not compile for Digispark Pro
« on: October 10, 2016, 02:01:39 am »
I was testing on an Adafruit Feather 32U4, and all was well.  I am using the DeepSleepScheduler library, https://github.com/PRosenb/DeepSleepScheduler. I am expecting my Digispark Pro units to arrive within the next couple days, so I switched the board in the Arduino IDE, and got the following compilation errors in the DeepSleepScheduler:
Code: [Select]
In file included from /Users/flounder/OneDrive/Projects/XXX/V2/Sketches/Temperature/Temperature.ino:4:0:
/Users/flounder/Documents/Arduino/libraries/DeepSleepScheduler/DeepSleepScheduler.h: In member function 'Scheduler::SleepMode Scheduler::evaluateSleepModeAndEnableWdtIfRequired()':
/Users/flounder/Documents/Arduino/libraries/DeepSleepScheduler/DeepSleepScheduler.h:707:7: error: 'WDTCSR' was not declared in this scope
       WDTCSR |= (1 << WDCE) | (1 << WDIE);
       ^
/Users/flounder/Documents/Arduino/libraries/DeepSleepScheduler/DeepSleepScheduler.h:715:5: error: 'WDTCSR' was not declared in this scope
     WDTCSR |= (1 << WDCE) | (1 << WDIE);
     ^

I have already submitted this as an issue to the author of the library, but I'm hoping someone can tell me if WDTCR (the symbol apparently defined for the '167) is the same as the WDTCSR used in the above code.  And a suggestion of what compile-time conditionals I might use to detect this, e.g.

#ifdef WHATEVER_IS_A_DIGISPARK_PRO_OR_167
#define WDTCSR WDTCR
#endif

would be a perfectly acceptable solution.
    joe

PeterF

  • Hero Member
  • *****
  • Posts: 881
Re: DeepSleepScheduler does not compile for Digispark Pro
« Reply #1 on: October 22, 2016, 03:26:27 am »
This code should detect the Digispark Pro:

Code: [Select]
#ifdef ARDUINO_AVR_DIGISPARKPRO
//Digispark Pro specific bits here
#endif

I believe it is based on an automatic ARDUINO_ prefix and the build.board name defined in boards.txt.

I can't comment on the WDT registers, I haven't played with that stuff on the Pro/167.