Browse Source

move sleep commands around

main
Hendrik Langer 6 years ago
parent
commit
c2cdbc00e0
  1. 10
      src/main.cpp

10
src/main.cpp

@ -133,8 +133,6 @@ unsigned long rtcMillis() {
void ICACHE_RAM_ATTR fpm_wakup_cb_func1(void) {
//gpio_pin_wakeup_disable();
//ESP.wdtFeed();
//wifi_fpm_do_wakeup();
wifi_fpm_close();
geiger_counts++;
}
@ -148,8 +146,12 @@ void inline lightsleep() {
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U,FUNC_GPIO13); // PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U,FUNC_GPIO13);
gpio_pin_wakeup_enable(GPIO_ID_PIN(GEIGER_PIN), GPIO_PIN_INTR_LOLEVEL);
wifi_fpm_set_wakeup_cb(fpm_wakup_cb_func1);
Serial.flush();
wifi_fpm_do_sleep(0xFFFFFFF); // Sleep for longest possible time // this does not work: (uint32_t)postingInterval*1000
//delay(500);
delay(1); // go to sleep now
DEBUG_MSG("woken\n");
//wifi_fpm_do_wakeup();
wifi_fpm_close();
}
void ICACHE_FLASH_ATTR getValuesJSON(char* buffer, const size_t buf_len, int format) {
@ -462,8 +464,8 @@ void loop() {
geiger_previousMillis = rtcMillis();
geiger_counts = 0;
}
DEBUG_MSG("sleeping now... (%u)\n", currentMillis);
DEBUG_MSG("heap: %d\n", ESP.getFreeHeap());
DEBUG_MSG("sleeping now... (%u)\n", currentMillis);
delay(10);
detachInterrupt(digitalPinToInterrupt(GEIGER_PIN));

Loading…
Cancel
Save