~toykeeper/flashlight-firmware/trunk

« back to all changes in this revision

Viewing changes to ToyKeeper/spaghetti-monster/rampingios/rampingiosv3.c

  • Committer: Selene Scriven
  • Date: 2020-07-06 20:24:28 UTC
  • mfrom: (188.1.294 fsm)
  • Revision ID: bzr@toykeeper.net-20200706202428-7pyen2ow9q2rtd9p
merged nearly a year of updates from the fsm branch, including the new product map

Show diffs side-by-side

added added

removed removed

Lines of Context:
123
123
uint8_t battcheck_state(Event event, uint16_t arg);
124
124
#endif
125
125
#ifdef USE_THERMAL_REGULATION
 
126
#define USE_BLINK_NUM
126
127
uint8_t tempcheck_state(Event event, uint16_t arg);
127
128
uint8_t thermal_config_state(Event event, uint16_t arg);
128
129
#endif
930
931
    // calibrate room temperature
931
932
    val = config_state_values[0];
932
933
    if (val) {
933
 
        int8_t rawtemp = (temperature >> 1) - therm_cal_offset;
 
934
        int8_t rawtemp = temperature - therm_cal_offset;
934
935
        therm_cal_offset = val - rawtemp;
 
936
        reset_thermal_history = 1;  // invalidate all recent temperature data
935
937
    }
936
938
 
937
939
    val = config_state_values[1];
938
940
    if (val) {
939
941
        // set maximum heat limit
940
 
        therm_ceil = 30 + val;
 
942
        therm_ceil = 30 + val - 1;
941
943
    }
942
944
    if (therm_ceil > MAX_THERM_CEIL) therm_ceil = MAX_THERM_CEIL;
943
945
}
966
968
inline void beacon_mode_iter() {
967
969
    // one iteration of main loop()
968
970
    set_level(memorized_level);
969
 
    nice_delay_ms(500);
 
971
    nice_delay_ms(100);
970
972
    set_level(0);
971
 
    nice_delay_ms(((beacon_seconds) * 1000) - 500);
 
973
    nice_delay_ms(((beacon_seconds) * 1000) - 100);
972
974
}
973
975
#endif  // #ifdef USE_BEACON_MODE
974
976
 
1235
1237
    #ifdef USE_THERMAL_REGULATION
1236
1238
    // TODO: blink out therm_ceil during thermal_config_state?
1237
1239
    else if (state == tempcheck_state) {
1238
 
        blink_num(temperature>>1);
 
1240
        blink_num(temperature);
1239
1241
        nice_delay_ms(1000);
1240
1242
    }
1241
1243
    #endif