@@ -6,7 +6,7 @@ volatile int availableHandlerSpace = 0; // settings.gnssHandlerBufferSize - used
66
77// If the phone has any new data (NTRIP RTCM, etc), read it in over Bluetooth and pass along to ZED
88// Scan for escape characters to enter config menu
9- void F9PSerialWriteTask (void *e)
9+ void btReadTask (void *e)
1010{
1111 while (true )
1212 {
@@ -126,7 +126,7 @@ void F9PSerialWriteTask(void *e)
126126// The ESP32 Arduino FIFO is ~120 bytes by default but overridden to 50 bytes (see pinUART2Task() and
127127// uart_set_rx_full_threshold()). We use this task to harvest from FIFO into circular buffer during SD write blocking
128128// time.
129- void F9PSerialReadTask (void *e)
129+ void gnssReadTask (void *e)
130130{
131131 static PARSE_STATE parse = {waitForPreamble, processUart1Message, " Log" };
132132
@@ -258,7 +258,7 @@ void processUart1Message(PARSE_STATE *parse, uint8_t type)
258258
259259// If new data is in the ringBuffer, dole it out to appropriate interface
260260// Send data out Bluetooth, record to SD, or send over TCP
261- void handleGNSSDataTask (void *e)
261+ void handleGnssDataTask (void *e)
262262{
263263 volatile static uint16_t btTail = 0 ; // BT Tail advances as it is sent over BT
264264 volatile static uint16_t tcpTailWiFi = 0 ; // TCP client tail
@@ -657,8 +657,8 @@ void ButtonCheckTask(void *e)
657657 if (millis () - lastRockerSwitchChange < 500 )
658658 {
659659 if (systemState == STATE_ROVER_NOT_STARTED && online.display == true ) // Catch during Power On
660- requestChangeState (STATE_TEST); // If RTK Surveyor, with display attached, during Rover not
661- // started, then enter test mode
660+ requestChangeState (STATE_TEST); // If RTK Surveyor, with display attached, during Rover not
661+ // started, then enter test mode
662662 else
663663 requestChangeState (STATE_WIFI_CONFIG_NOT_STARTED);
664664 }
@@ -1137,51 +1137,54 @@ void idleTask(void *e)
11371137void tasksStartUART2 ()
11381138{
11391139 // Reads data from ZED and stores data into circular buffer
1140- if (F9PSerialReadTaskHandle == nullptr )
1141- xTaskCreate (F9PSerialReadTask, // Function to call
1142- " F9Read" , // Just for humans
1143- readTaskStackSize, // Stack Size
1144- nullptr , // Task input parameter
1145- F9PSerialReadTaskPriority, // Priority
1146- &F9PSerialReadTaskHandle); // Task handle
1140+ if (gnssReadTaskHandle == nullptr )
1141+ xTaskCreatePinnedToCore (gnssReadTask, // Function to call
1142+ " gnssRead" , // Just for humans
1143+ gnssReadTaskStackSize, // Stack Size
1144+ nullptr , // Task input parameter
1145+ settings.gnssReadTaskPriority , // Priority
1146+ &gnssReadTaskHandle, // Task handle
1147+ settings.gnssReadTaskCore ); // Core where task should run, 0=core, 1=Arduino
11471148
11481149 // Reads data from circular buffer and sends data to SD, SPP, or TCP
1149- if (handleGNSSDataTaskHandle == nullptr )
1150- xTaskCreate (handleGNSSDataTask, // Function to call
1151- " handleGNSSData" , // Just for humans
1152- handleGNSSDataTaskStackSize, // Stack Size
1153- nullptr , // Task input parameter
1154- handleGNSSDataTaskPriority, // Priority
1155- &handleGNSSDataTaskHandle); // Task handle
1150+ if (handleGnssDataTaskHandle == nullptr )
1151+ xTaskCreatePinnedToCore (handleGnssDataTask, // Function to call
1152+ " handleGNSSData" , // Just for humans
1153+ handleGnssDataTaskStackSize, // Stack Size
1154+ nullptr , // Task input parameter
1155+ settings.handleGnssDataTaskPriority , // Priority
1156+ &handleGnssDataTaskHandle, // Task handle
1157+ settings.handleGnssDataTaskCore ); // Core where task should run, 0=core, 1=Arduino
11561158
11571159 // Reads data from BT and sends to ZED
1158- if (F9PSerialWriteTaskHandle == nullptr )
1159- xTaskCreate (F9PSerialWriteTask, // Function to call
1160- " F9Write" , // Just for humans
1161- writeTaskStackSize, // Stack Size
1162- nullptr , // Task input parameter
1163- F9PSerialWriteTaskPriority, // Priority
1164- &F9PSerialWriteTaskHandle); // Task handle
1160+ if (btReadTaskHandle == nullptr )
1161+ xTaskCreatePinnedToCore (btReadTask, // Function to call
1162+ " btRead" , // Just for humans
1163+ btReadTaskStackSize, // Stack Size
1164+ nullptr , // Task input parameter
1165+ settings.btReadTaskPriority , // Priority
1166+ &btReadTaskHandle, // Task handle
1167+ settings.btReadTaskCore ); // Core where task should run, 0=core, 1=Arduino
11651168}
11661169
11671170// Stop tasks - useful when running firmware update or WiFi AP is running
11681171void tasksStopUART2 ()
11691172{
11701173 // Delete tasks if running
1171- if (F9PSerialReadTaskHandle != nullptr )
1174+ if (gnssReadTaskHandle != nullptr )
11721175 {
1173- vTaskDelete (F9PSerialReadTaskHandle );
1174- F9PSerialReadTaskHandle = nullptr ;
1176+ vTaskDelete (gnssReadTaskHandle );
1177+ gnssReadTaskHandle = nullptr ;
11751178 }
1176- if (handleGNSSDataTaskHandle != nullptr )
1179+ if (handleGnssDataTaskHandle != nullptr )
11771180 {
1178- vTaskDelete (handleGNSSDataTaskHandle );
1179- handleGNSSDataTaskHandle = nullptr ;
1181+ vTaskDelete (handleGnssDataTaskHandle );
1182+ handleGnssDataTaskHandle = nullptr ;
11801183 }
1181- if (F9PSerialWriteTaskHandle != nullptr )
1184+ if (btReadTaskHandle != nullptr )
11821185 {
1183- vTaskDelete (F9PSerialWriteTaskHandle );
1184- F9PSerialWriteTaskHandle = nullptr ;
1186+ vTaskDelete (btReadTaskHandle );
1187+ btReadTaskHandle = nullptr ;
11851188 }
11861189
11871190 // Give the other CPU time to finish
0 commit comments