Replies: 3 comments
-
The task is not allowed to run in this async client queue because
Originally posted by @mobizt in #163 (comment) |
Beta Was this translation helpful? Give feedback.
-
This is not the root cause of device reset. This is the Firebase repository, and you have to ask such programming question in the community forum instead. Task1code is missing. Anyway, you should run your task on CPU core 1 instead of core 0. The task priority should be greater than 1 e.g. 10 or 20 especially when it involves WiFi and internet task. |
Beta Was this translation helpful? Give feedback.
-
Thank you! Which community forum should I use instead of the firebase community? Thanks again for your support, happy to buy you a coffee! |
Beta Was this translation helpful? Give feedback.
-
Error task: task_1030, msg: operation was cancelled, code: -118
I keep receiving this reset error after a few minutes of accessing realtime database. I am using async function like stream contcurrency
This is simplified code of the one I am using, I am trying to run a motor every couple minutes with a run time pulled from realtime data base.
I know about the wificlient bug but even using the timeout() doesn't seem to stop the error, unless I am misunderstanding what is causing this error completely.
Thank you in advance for any advice you can give me, and thanks for making this great library!
`
void printResult(AsyncResult &aResult);
DefaultNetwork network; // initilize with boolean parameter to enable/disable network reconnection
//UserAuth user_auth(API_KEY, USER_EMAIL, USER_PASSWORD);
FirebaseApp app;
WiFiClient basic_client1;
// The ESP_SSLClient uses PSRAM by default (if it is available), for PSRAM usage, see https://github.com/mobizt/FirebaseClient#memory-options
// For ESP_SSLClient documentation, see https://github.com/mobizt/ESP_SSLClient
ESP_SSLClient stream_ssl_client1;
using AsyncClient = AsyncClientClass;
AsyncClient aClient1(stream_ssl_client1, getNetwork(network));
RealtimeDatabase Database;
enum DoseState { DOSE_IDLE, DOSE1_ON, DOSE1_OFF, DOSE2_ON, DOSE2_OFF, DOSE3_ON, DOSE3_OFF };
DoseState doseState = DOSE_IDLE;
unsigned long doseDurations[3] = {0, 0, 0};
int currentDose = 0;
TaskHandle_t DoseTaskHandle = NULL;
void doseSet() {
doseDurations[0] = (60 * Dose1 * 1000) / 120;
doseDurations[1] = (60 * Dose2 * 1000) / 120;
doseDurations[2] = (60 * Dose3 * 1000) / 120;
doseState = DOSE1_ON;
Serial.println("DOSE1 ON ");
digitalWrite(MTR_DOSE1, HIGH);
}
void doseTask(void *pvParameters) {
while (1) {
switch (doseState) {
case DOSE1_ON:
vTaskDelay(pdMS_TO_TICKS(doseDurations[0]));
Serial.println("DOSE1 OFF ");
digitalWrite(MTR_DOSE1, LOW);
doseState = DOSE2_ON;
Serial.println("DOSE2 ON ");
digitalWrite(MTR_DOSE2, HIGH);
break;
}
void setup()
{
}
void loop()
{
// The async task handler should run inside the main loop
// without blocking delay or bypassing with millis code blocks.
//this is updating the database every x number of seconds with the values read from sensors
if (millis() - mstime > 5000 && app.ready())
{
checkWiFiConnection(); // Ensure Wi-Fi stays connected
checkFirebaseConnection(); // Ensure Firebase stays connected
//streamClient1.setSSEFilters("get,put,patch,keep-alive,cancel,auth_revoked");
mstime = millis();
sensors.requestTemperatures();
float temperatureF = sensors.getTempFByIndex(0);
Serial.print(temperatureF);
Serial.println("ºF");
if (millis() - last_dose > 50000) {
Serial.println("Running dosing");
last_dose = millis();
if (DoseTaskHandle == NULL) {
xTaskCreate(doseTask, "DoseTask", 10000, NULL, 1, &DoseTaskHandle);
}
}
}}
`
Beta Was this translation helpful? Give feedback.
All reactions