Skip to content

Commit 1fdbc1e

Browse files
committed
Move AT server to core0 thread
1 parent 1378f8f commit 1fdbc1e

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

CompostaUSBBridge/CompostaUSBBridge.ino

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ void CAtHandler::onWiFiEvent(WiFiEvent_t event) {
8888

8989
}
9090

91+
TaskHandle_t atTask;
92+
void atLoop(void* param) {
93+
while (1) {
94+
if (_baud != 1200 && _baud != 2400) {
95+
atHandler.run();
96+
}
97+
yield();
98+
}
99+
}
100+
91101
/* -------------------------------------------------------------------------- */
92102
void setup() {
93103
/* -------------------------------------------------------------------------- */
@@ -124,6 +134,14 @@ void setup() {
124134
WiFi.onEvent(CAtHandler::onWiFiEvent);
125135

126136

137+
xTaskCreatePinnedToCore(
138+
atLoop, /* Function to implement the task */
139+
"Task1", /* Name of the task */
140+
10000, /* Stack size in words */
141+
NULL, /* Task input parameter */
142+
0, /* Priority of the task */
143+
&atTask, /* Task handle. */
144+
0); /* Core where the task should run */
127145
}
128146

129147
/*
@@ -154,10 +172,6 @@ void loop() {
154172
SERIAL_USER.write(buf, i);
155173
}
156174

157-
if (_baud != 1200 && _baud != 2400) {
158-
atHandler.run();
159-
}
160-
161175
yield();
162176
}
163177

0 commit comments

Comments
 (0)