adjust task prios & delays & time cal cycle
This commit is contained in:
parent
69da95cd66
commit
01011013fc
@ -34,6 +34,7 @@ void doHousekeeping() {
|
|||||||
if (rcmdTask != NULL)
|
if (rcmdTask != NULL)
|
||||||
ESP_LOGD(TAG, "Rcommand interpreter %d bytes left | Taskstate = %d",
|
ESP_LOGD(TAG, "Rcommand interpreter %d bytes left | Taskstate = %d",
|
||||||
uxTaskGetStackHighWaterMark(rcmdTask), eTaskGetState(rcmdTask));
|
uxTaskGetStackHighWaterMark(rcmdTask), eTaskGetState(rcmdTask));
|
||||||
|
|
||||||
#if (HAS_LORA)
|
#if (HAS_LORA)
|
||||||
if (lmicTask != NULL)
|
if (lmicTask != NULL)
|
||||||
ESP_LOGD(TAG, "LMiCtask %d bytes left | Taskstate = %d",
|
ESP_LOGD(TAG, "LMiCtask %d bytes left | Taskstate = %d",
|
||||||
@ -43,11 +44,18 @@ void doHousekeeping() {
|
|||||||
uxTaskGetStackHighWaterMark(lorasendTask),
|
uxTaskGetStackHighWaterMark(lorasendTask),
|
||||||
eTaskGetState(lorasendTask));
|
eTaskGetState(lorasendTask));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (HAS_GPS)
|
#if (HAS_GPS)
|
||||||
if (GpsTask != NULL)
|
if (GpsTask != NULL)
|
||||||
ESP_LOGD(TAG, "Gpsloop %d bytes left | Taskstate = %d",
|
ESP_LOGD(TAG, "Gpsloop %d bytes left | Taskstate = %d",
|
||||||
uxTaskGetStackHighWaterMark(GpsTask), eTaskGetState(GpsTask));
|
uxTaskGetStackHighWaterMark(GpsTask), eTaskGetState(GpsTask));
|
||||||
|
// (only) while device time is not set or unsynched, and we have a valid
|
||||||
|
// GPS time, we call calibrateTime to poll time immeditately from GPS
|
||||||
|
if ((timeSource == _unsynced || timeSource == _set) &&
|
||||||
|
(gpstime.isUpdated() && gpstime.isValid() && gpstime.age() < 1000))
|
||||||
|
calibrateTime();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_SPI
|
#ifdef HAS_SPI
|
||||||
if (spiTask != NULL)
|
if (spiTask != NULL)
|
||||||
ESP_LOGD(TAG, "spiloop %d bytes left | Taskstate = %d",
|
ESP_LOGD(TAG, "spiloop %d bytes left | Taskstate = %d",
|
||||||
|
@ -273,23 +273,17 @@ void gps_loop(void *pvParameters) {
|
|||||||
// feed GPS decoder with serial NMEA data from GPS device
|
// feed GPS decoder with serial NMEA data from GPS device
|
||||||
while (GPS_Serial.available())
|
while (GPS_Serial.available())
|
||||||
if (gps.encode(GPS_Serial.read()))
|
if (gps.encode(GPS_Serial.read()))
|
||||||
break; // NMEA sentence complete
|
break; // leave encode loop after each NMEA complete sentence
|
||||||
|
|
||||||
// (only) while device time is not set or unsynched, and we have a valid
|
|
||||||
// GPS time, we call calibrateTime to poll time immeditately from GPS
|
|
||||||
if ((timeSource == _unsynced || timeSource == _set) &&
|
|
||||||
(gpstime.isUpdated() && gpstime.isValid() && gpstime.age() < 1000))
|
|
||||||
calibrateTime();
|
|
||||||
|
|
||||||
// show NMEA data, very noisy, useful only for debugging GPS
|
// show NMEA data, very noisy, useful only for debugging GPS
|
||||||
// ESP_LOGV(TAG, "GPS NMEA data: passed %u / failed: %u / with fix:
|
// ESP_LOGV(TAG, "GPS NMEA data: passed %u / failed: %u / with fix:
|
||||||
// %u", gps.passedChecksum(), gps.failedChecksum(), gps
|
// %u", gps.passedChecksum(), gps.failedChecksum(), gps
|
||||||
// .sentencesWithFix());
|
// .sentencesWithFix());
|
||||||
|
|
||||||
delay(2);
|
delay(5);
|
||||||
} // inner while loop
|
} // inner while loop
|
||||||
|
|
||||||
delay(2);
|
delay(1000);
|
||||||
} // outer while loop
|
} // outer while loop
|
||||||
|
|
||||||
} // gps_loop()
|
} // gps_loop()
|
||||||
|
@ -305,7 +305,7 @@ esp_err_t lmic_init(void) {
|
|||||||
"lmictask", // name of task
|
"lmictask", // name of task
|
||||||
4096, // stack size of task
|
4096, // stack size of task
|
||||||
(void *)1, // parameter of the task
|
(void *)1, // parameter of the task
|
||||||
8, // priority of the task
|
1, // priority of the task
|
||||||
&lmicTask, // task handle
|
&lmicTask, // task handle
|
||||||
1); // CPU core
|
1); // CPU core
|
||||||
|
|
||||||
|
10
src/main.cpp
10
src/main.cpp
@ -29,16 +29,16 @@ Task Core Prio Purpose
|
|||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
ledloop* 0 1 blinks LEDs
|
ledloop* 0 1 blinks LEDs
|
||||||
spiloop# 0 2 reads/writes data on spi interface
|
spiloop# 0 2 reads/writes data on spi interface
|
||||||
lmictask* 1 8 MCCI LMiC LORAWAN stack
|
lmictask* 1 1 MCCI LMiC LORAWAN stack
|
||||||
clockloop# 1 6 generates realtime telegrams for external clock
|
clockloop# 1 6 generates realtime telegrams for external clock
|
||||||
mqttloop# 1 5 reads/writes data on ETH interface
|
mqttloop# 1 5 reads/writes data on ETH interface
|
||||||
timesync_proc# 1 7 processes realtime time sync requests
|
timesync_proc# 1 7 processes realtime time sync requests
|
||||||
irqhandler# 1 4 cyclic tasks (i.e. displayrefresh) triggered by
|
irqhandler# 1 4 application IRQ (i.e. displayrefresh)
|
||||||
gpsloop* 1 3 reads data from GPS via serial or i2c
|
gpsloop* 1 1 reads data from GPS via serial or i2c
|
||||||
lorasendtask# 1 2 feeds data from lora sendqueue to lmcic
|
lorasendtask# 1 2 feeds data from lora sendqueue to lmcic
|
||||||
rmcd_process# 1 1 Remote command interpreter loop
|
rmcd_process# 1 1 Remote command interpreter loop
|
||||||
|
|
||||||
* spinning task
|
* spinning task, always ready
|
||||||
# blocked/waiting task
|
# blocked/waiting task
|
||||||
|
|
||||||
Low priority numbers denote low priority tasks.
|
Low priority numbers denote low priority tasks.
|
||||||
@ -322,7 +322,7 @@ void setup() {
|
|||||||
"gpsloop", // name of task
|
"gpsloop", // name of task
|
||||||
8192, // stack size of task
|
8192, // stack size of task
|
||||||
(void *)1, // parameter of the task
|
(void *)1, // parameter of the task
|
||||||
3, // priority of the task
|
1, // priority of the task
|
||||||
&GpsTask, // task handle
|
&GpsTask, // task handle
|
||||||
1); // CPU core
|
1); // CPU core
|
||||||
}
|
}
|
||||||
|
@ -484,7 +484,7 @@ void rcmd_process(void *pvParameters) {
|
|||||||
rcmd_execute(RcmdBuffer.cmd, RcmdBuffer.cmdLen);
|
rcmd_execute(RcmdBuffer.cmd, RcmdBuffer.cmdLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
delay(2); // yield to CPU
|
delay(5); // yield to CPU
|
||||||
} // rcmd_process()
|
} // rcmd_process()
|
||||||
|
|
||||||
// enqueue remote command
|
// enqueue remote command
|
||||||
|
Loading…
Reference in New Issue
Block a user