commit
339d434b98
@ -30,10 +30,10 @@ description = Paxcounter is a proof-of-concept ESP32 device for metering passeng
|
|||||||
|
|
||||||
[common]
|
[common]
|
||||||
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
|
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
|
||||||
release_version = 1.7.323
|
release_version = 1.7.324
|
||||||
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
|
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
|
||||||
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
|
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
|
||||||
debug_level = 3
|
debug_level = 0
|
||||||
; UPLOAD MODE: select esptool to flash via USB/UART, select custom to upload to cloud for OTA
|
; UPLOAD MODE: select esptool to flash via USB/UART, select custom to upload to cloud for OTA
|
||||||
upload_protocol = esptool
|
upload_protocol = esptool
|
||||||
;upload_protocol = custom
|
;upload_protocol = custom
|
||||||
|
@ -358,13 +358,18 @@ void setup() {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined HAS_IF482 || defined HAS_DCF77
|
||||||
// start pps timepulse
|
// start pps timepulse
|
||||||
ESP_LOGI(TAG, "Starting Timekeeper...");
|
ESP_LOGI(TAG, "Starting Timekeeper...");
|
||||||
assert(timepulse_init()); // setup timepulse
|
assert(timepulse_init()); // setup timepulse
|
||||||
timepulse_start();
|
timepulse_start();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TIME_SYNC_INTERVAL
|
||||||
// set time source and sync time
|
// set time source and sync time
|
||||||
setSyncInterval(TIME_SYNC_INTERVAL * 60);
|
setSyncInterval(TIME_SYNC_INTERVAL * 60);
|
||||||
setSyncProvider(&timeProvider);
|
setSyncProvider(&timeProvider);
|
||||||
|
#endif
|
||||||
|
|
||||||
// start wifi in monitor mode and start channel rotation timer
|
// start wifi in monitor mode and start channel rotation timer
|
||||||
ESP_LOGI(TAG, "Starting Wifi...");
|
ESP_LOGI(TAG, "Starting Wifi...");
|
||||||
|
@ -66,7 +66,7 @@
|
|||||||
#define RESPONSE_TIMEOUT_MS 60000 // firmware binary server connection timeout [milliseconds]
|
#define RESPONSE_TIMEOUT_MS 60000 // firmware binary server connection timeout [milliseconds]
|
||||||
|
|
||||||
// settings for syncing time of node with external time source
|
// settings for syncing time of node with external time source
|
||||||
#define TIME_SYNC_INTERVAL 2 // sync time attempt each .. minutes from time source (GPS/LORA/RTC) [default = 60], comment out means off
|
//#define TIME_SYNC_INTERVAL 2 // sync time attempt each .. minutes from time source (GPS/LORA/RTC) [default = 60], comment out means off
|
||||||
//#define TIME_SYNC_LORA 1 // use LORA network as time source, comment out means off [default = off]
|
//#define TIME_SYNC_LORA 1 // use LORA network as time source, comment out means off [default = off]
|
||||||
|
|
||||||
// time zone, see https://github.com/JChristensen/Timezone/blob/master/examples/WorldClock/WorldClock.ino
|
// time zone, see https://github.com/JChristensen/Timezone/blob/master/examples/WorldClock/WorldClock.ino
|
||||||
|
@ -100,17 +100,23 @@ void timepulse_start(void) {
|
|||||||
// interrupt service routine triggered by either pps or esp32 hardware timer
|
// interrupt service routine triggered by either pps or esp32 hardware timer
|
||||||
void IRAM_ATTR CLOCKIRQ(void) {
|
void IRAM_ATTR CLOCKIRQ(void) {
|
||||||
|
|
||||||
|
BaseType_t xHigherPriorityTaskWoken;
|
||||||
|
|
||||||
time_t t = SyncToPPS(); // calibrates UTC systime, see Time.h
|
time_t t = SyncToPPS(); // calibrates UTC systime, see Time.h
|
||||||
|
xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
if (ClockTask != NULL)
|
if (ClockTask != NULL)
|
||||||
xTaskNotifyFromISR(ClockTask, uint32_t(t), eSetBits, NULL);
|
xTaskNotifyFromISR(ClockTask, uint32_t(t), eSetBits,
|
||||||
|
&xHigherPriorityTaskWoken);
|
||||||
|
|
||||||
#if defined GPS_INT || defined RTC_INT
|
#if defined GPS_INT || defined RTC_INT
|
||||||
xSemaphoreGiveFromISR(TimePulse, NULL);
|
xSemaphoreGiveFromISR(TimePulse, &xHigherPriorityTaskWoken);
|
||||||
TimePulseTick = !TimePulseTick; // flip ticker
|
TimePulseTick = !TimePulseTick; // flip ticker
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
portYIELD_FROM_ISR();
|
// yield only if we should
|
||||||
|
if (xHigherPriorityTaskWoken)
|
||||||
|
portYIELD_FROM_ISR();
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper function to check plausibility of a time
|
// helper function to check plausibility of a time
|
||||||
@ -215,9 +221,9 @@ void clock_loop(void *taskparameter) { // ClockTask
|
|||||||
if (second(t) == DCF77_FRAME_SIZE - 1) // is it time to load new frame?
|
if (second(t) == DCF77_FRAME_SIZE - 1) // is it time to load new frame?
|
||||||
DCFpulse = DCF77_Frame(nextmin(t)); // generate frame for next minute
|
DCFpulse = DCF77_Frame(nextmin(t)); // generate frame for next minute
|
||||||
|
|
||||||
if (minute(nextmin(t)) == // do we still have a recent frame?
|
if (minute(nextmin(t)) == // do we still have a recent frame?
|
||||||
DCFpulse[DCF77_FRAME_SIZE]) // (timepulses could be missed!)
|
DCFpulse[DCF77_FRAME_SIZE]) // (timepulses could be missed!)
|
||||||
DCF77_Pulse(t, DCFpulse); // then output current second's pulse
|
DCF77_Pulse(t, DCFpulse); // then output current second's pulse
|
||||||
else
|
else
|
||||||
continue; // no recent frame -> we suppress clock output
|
continue; // no recent frame -> we suppress clock output
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user