aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spaghetti-monster/anduril/anduril.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c
index 1cc9d7c..7833f4f 100644
--- a/spaghetti-monster/anduril/anduril.c
+++ b/spaghetti-monster/anduril/anduril.c
@@ -37,6 +37,7 @@
#define USE_EEPROM
#define EEPROM_BYTES 12
#define USE_IDLE_MODE
+#define MOON_POWERSAVE // cut clock speed at very low modes for better efficiency
//#define HALFSPEED_LEVEL 30 // looks good, but sounds bad
#define HALFSPEED_LEVEL 14
#include "spaghetti-monster.h"
@@ -962,16 +963,21 @@ void loop() {
#ifdef USE_IDLE_MODE
else if ((state == steady_state)
+ || (state == off_state)
|| (state == goodnight_state)) {
- if (actual_level < HALFSPEED_LEVEL) {
+ #ifdef MOON_POWERSAVE
+ if (actual_level < 5) {
+ // run at quarter speed
+ CLKPR = 1<<CLKPCE; CLKPR = 2;
+ }
+ else if (actual_level < HALFSPEED_LEVEL) {
// run at half speed
- CLKPR = 1<<CLKPCE;
- CLKPR = 1;
+ CLKPR = 1<<CLKPCE; CLKPR = 1;
} else {
// run at full speed
- CLKPR = 1<<CLKPCE;
- CLKPR = 0;
+ CLKPR = 1<<CLKPCE; CLKPR = 0;
}
+ #endif
// doze until next clock tick
idle_mode();
}
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.