Mod to ISR and Tasks ok working

This commit is contained in:
Emanuele Trabattoni
2026-03-31 09:19:11 +02:00
parent ec138553ad
commit 27ad612844
5 changed files with 46 additions and 30 deletions

View File

@@ -77,6 +77,8 @@ void loop()
.rst_io_34p = RST_EXT_A34P,
.rst_io_34n = RST_EXT_A34N}
};
LOG_INFO("Task Variables OK");
#ifndef TEST
QueueHandle_t rt_taskB_queue = xQueueCreate(10, sizeof(ignitionBoxStatus));
rtTaskParams taskB_params {
@@ -100,13 +102,12 @@ void loop()
};
#endif
// Init 2 SPI interfaces
bool spiA_ok = true;
SPIClass SPI_A(FSPI);
spiA_ok = SPI_A.begin(SPI_A_SCK, SPI_A_MISO, SPI_A_MOSI);
bool spiB_ok = true;
#ifndef TEST
// Init 2 SPI interfaces
SPIClass SPI_A(FSPI);
spiA_ok = SPI_A.begin(SPI_A_SCK, SPI_A_MISO, SPI_A_MOSI);
SPIClass SPI_B(HSPI);
spiB_ok = SPI_B.begin(SPI_B_SCK, SPI_B_MISO, SPI_B_MOSI);
#endif
@@ -117,15 +118,15 @@ void loop()
vTaskDelay(pdMS_TO_TICKS(5000));
esp_restart();
}
LOG_INFO("Init SPI [OK]");
LOG_INFO("Init SPI OK");
#ifndef TEST
// Init ADC_A
dev.adc_a = new ADS1256(ADC_A_DRDY, ADC_A_RST, ADC_A_SYNC, ADC_A_CS, 2.5, &SPI_A);
dev.adc_a->InitializeADC();
dev.adc_a->setPGA(PGA_1);
dev.adc_a->setDRATE(DRATE_1000SPS);
#ifndef TEST
// Init ADC_B
dev.adc_a = new ADS1256(ADC_B_DRDY, ADC_B_RST, ADC_B_SYNC, ADC_B_CS, 2.5, &SPI_B);
dev.adc_a->InitializeADC();
@@ -133,7 +134,7 @@ void loop()
dev.adc_a->setDRATE(DRATE_1000SPS);
#endif
LOG_INFO("Init ADC [OK]");
LOG_INFO("Init ADC OK");
// Ignition A on Core 0
auto ignA_task_success = pdPASS;
@@ -151,7 +152,7 @@ void loop()
#ifndef TEST
ignB_task_success = xTaskCreatePinnedToCore(
rtIgnitionTask,
"rtIgnitionTask_boxA",
"rtIgnitionTask_boxB",
TASK_STACK,
(void *)&taskB_params,
TASK_PRIORITY, // priorità leggermente più alta
@@ -173,8 +174,14 @@ void loop()
uint32_t count(0);
while (running)
{
// printTaskList();
delay(10000);
delay(10);
ignitionBoxStatus ignA;
if (xQueueReceive(rt_taskA_queue, &ignA, 0) == pdTRUE){
}
if (!(count++ % 100))
printTaskList();
}
if (trigA_TaskHandle)