parent
ebc3aac991
commit
67832da09d
@ -63,7 +63,7 @@ void gps_loop(void *pvParameters) {
|
||||
#endif
|
||||
} // if (cfg.gpsmode)
|
||||
|
||||
vTaskDelay(2 / portTICK_PERIOD_MS); // reset watchdog
|
||||
vTaskDelay(2 / portTICK_PERIOD_MS); // yield to CPU
|
||||
|
||||
} // end of infinite loop
|
||||
|
||||
|
@ -248,7 +248,7 @@ void lorawan_loop(void *pvParameters) {
|
||||
|
||||
while (1) {
|
||||
os_runloop_once(); // execute LMIC jobs
|
||||
vTaskDelay(2 / portTICK_PERIOD_MS); // reset watchdog
|
||||
vTaskDelay(2 / portTICK_PERIOD_MS); // yield to CPU
|
||||
}
|
||||
}
|
||||
|
||||
|
11
src/main.cpp
11
src/main.cpp
@ -236,19 +236,22 @@ void setup() {
|
||||
channelSwitch = timerBegin(1, 800, true);
|
||||
timerAttachInterrupt(channelSwitch, &ChannelSwitchIRQ, true);
|
||||
timerAlarmWrite(channelSwitch, cfg.wifichancycle * 1000, true);
|
||||
timerAlarmEnable(channelSwitch);
|
||||
//ESP_LOGI(TAG, "chanelswitch alarm threshold %d", cfg.wifichancycle * 1000);
|
||||
|
||||
// setup send cycle trigger IRQ using esp32 hardware timer 2
|
||||
sendCycle = timerBegin(2, 8000, true);
|
||||
timerAttachInterrupt(sendCycle, &SendCycleIRQ, true);
|
||||
timerAlarmWrite(sendCycle, cfg.sendcycle * 2 * 10000, true);
|
||||
timerAlarmEnable(sendCycle);
|
||||
|
||||
// setup house keeping cycle trigger IRQ using esp32 hardware timer 3
|
||||
homeCycle = timerBegin(3, 8000, true);
|
||||
timerAttachInterrupt(homeCycle, &homeCycleIRQ, true);
|
||||
timerAlarmWrite(homeCycle, HOMECYCLE * 10000, true);
|
||||
|
||||
//enable timers, caution: order is critical here
|
||||
timerAlarmEnable(homeCycle);
|
||||
timerAlarmEnable(sendCycle);
|
||||
timerAlarmEnable(channelSwitch);
|
||||
|
||||
// show payload encoder
|
||||
#if PAYLOAD_ENCODER == 1
|
||||
@ -324,7 +327,6 @@ void setup() {
|
||||
|
||||
void loop() {
|
||||
|
||||
while (1) {
|
||||
// state machine for switching display, LED, button, housekeeping,
|
||||
// senddata
|
||||
|
||||
@ -346,11 +348,10 @@ void loop() {
|
||||
processSendBuffer();
|
||||
// check send cycle and enqueue payload if cycle is expired
|
||||
sendPayload();
|
||||
// reset watchdog
|
||||
// yield to CPU
|
||||
vTaskDelay(2 / portTICK_PERIOD_MS);
|
||||
|
||||
} // loop()
|
||||
}
|
||||
|
||||
/* end Arduino main loop
|
||||
* ------------------------------------------------------------ */
|
||||
|
@ -58,10 +58,10 @@ void wifi_channel_loop(void *pvParameters) {
|
||||
channel = (channel % WIFI_CHANNEL_MAX) + 1;
|
||||
esp_wifi_set_channel(channel, WIFI_SECOND_CHAN_NONE);
|
||||
ESP_LOGD(TAG, "Wifi set channel %d", channel);
|
||||
|
||||
vTaskDelay(2 / portTICK_PERIOD_MS); // reset watchdog
|
||||
}
|
||||
|
||||
vTaskDelay(2 / portTICK_PERIOD_MS); // yield to CPU
|
||||
|
||||
} // end of infinite wifi channel rotation loop
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user