~toykeeper/flashlight-firmware/lume1

« back to all changes in this revision

Viewing changes to ToyKeeper/spaghetti-monster/fsm-standby.c

  • Committer: Selene Scriven
  • Date: 2020-08-23 17:43:11 UTC
  • Revision ID: bzr@toykeeper.net-20200823174311-o3hi5ljwroz5a3lt
attempt to fix laggy voltage readings right after waking, on FW3A
(with no sleep ticks, the voltage value never gets reset to the raw value,
 and instead only goes through the lowpass filter)
(this fix is not yet tested...  will test before uploading)
(also carries a risk of messing up thermal values after being asleep,
 so that needs to be tested too)

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
            go_to_standby = 0;
74
74
        }
75
75
        if (irq_adc) {  // ADC done measuring
 
76
            adc_reset = 1;  // don't lowpass while asleep
76
77
            adc_deferred_enable = 1;
77
78
            adc_deferred();
78
79
            //ADC_off();  // takes care of itself
84
85
    }
85
86
    #endif
86
87
 
87
 
    #ifdef USE_THERMAL_REGULATION
88
 
    // forget what the temperature was last time we were on
89
 
    reset_thermal_history = 1;
90
 
    #endif
 
88
    // don't lowpass immediately after waking
 
89
    // also, reset thermal history
 
90
    adc_reset = 2;
91
91
 
92
92
    // go back to normal running mode
93
93
    // PCINT not needed any more, and can cause problems if on