kopia lustrzana https://github.com/bristol-seds/pico-tracker
[battery,bus] stay in cold out hibernate when the bus voltage is less than 2.5V
rodzic
feadf9dbc2
commit
f80788b26a
|
@ -148,7 +148,15 @@
|
||||||
*/
|
*/
|
||||||
#define RECHARGABLE_BATTERY 1
|
#define RECHARGABLE_BATTERY 1
|
||||||
#define CHG_ENABLE_PIN PIN_PA27
|
#define CHG_ENABLE_PIN PIN_PA27
|
||||||
#define RECHARGABLE_MIN_V (2.6)
|
#define RECHARGABLE_MIN_V (2.7)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Power Bus
|
||||||
|
* bus is currently called solar
|
||||||
|
*/
|
||||||
|
/* bus is low when <2.5V, which corresponds to ~2.7V battery voltage */
|
||||||
|
/* usually evaluated with minimal load on the battery */
|
||||||
|
#define IS_BUS_LOW(dp) (get_solar() < 2.5)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cold out
|
* Cold out
|
||||||
|
|
|
@ -343,7 +343,11 @@ int main(void)
|
||||||
start_adc_sequence();
|
start_adc_sequence();
|
||||||
while (is_adc_sequence_done() == 0); /* wait for adc */
|
while (is_adc_sequence_done() == 0); /* wait for adc */
|
||||||
|
|
||||||
|
#ifdef IS_BUS_LOW
|
||||||
|
if (IS_BUS_LOW()) {
|
||||||
|
set_cycle_time(1); /* set cycle time for cold out */
|
||||||
|
} else {
|
||||||
|
#endif
|
||||||
if (in_cold_out == 1) {
|
if (in_cold_out == 1) {
|
||||||
external_temperature = thermistor_ratio_to_temperature(get_thermistor()); /* read */
|
external_temperature = thermistor_ratio_to_temperature(get_thermistor()); /* read */
|
||||||
if ((external_temperature < COLD_OUT_TEMPERATURE) && /* check temperature */
|
if ((external_temperature < COLD_OUT_TEMPERATURE) && /* check temperature */
|
||||||
|
@ -359,9 +363,11 @@ int main(void)
|
||||||
run_sequencer(n++, cycle_time_s); /* run */
|
run_sequencer(n++, cycle_time_s); /* run */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hibernate timing */
|
set_cycle_time(in_cold_out); /* set cycle time as required */
|
||||||
set_cycle_time(in_cold_out);
|
|
||||||
|
|
||||||
|
#ifdef IS_BUS_LOW
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
system_set_sleepmode(SYSTEM_SLEEPMODE_STANDBY); /* Lowest power */
|
system_set_sleepmode(SYSTEM_SLEEPMODE_STANDBY); /* Lowest power */
|
||||||
|
|
Ładowanie…
Reference in New Issue