Vhanged pin assignment to avoid 35,36,37 used in QSPI PSRAM

This commit is contained in:
2026-04-21 21:51:58 +02:00
parent fec59815a6
commit 6f372fcb49
9 changed files with 114 additions and 110 deletions

View File

@@ -6,7 +6,7 @@
//// GLOBAL STATIC FUNCTIONS
// Timeout callback for microsecond precision
void spark_timeout_callback(void *arg)
void IRAM_ATTR spark_timeout_callback(void *arg)
{
TaskHandle_t handle = (TaskHandle_t)arg;
xTaskNotify(handle, SPARK_FLAG_TIMEOUT, eSetValueWithOverwrite);
@@ -21,10 +21,6 @@ void rtIgnitionTask::rtIgnitionTask_manager(void *pvParameters)
while (cls->m_running)
{
cls->run();
// if (millis() - last_loop > 2000) {
// LOG_DEBUG("TASK [", cls->m_name.c_str(), "] Alive -", count++);
// last_loop = millis();
// }
vTaskDelay(pdMS_TO_TICKS(1));
}
}
@@ -47,10 +43,8 @@ void rtIgnitionTask::rtIgnitionTask_realtime(void *pvParameters)
QueueHandle_t rt_queue = params->rt_queue;
Devices *dev = params->dev;
ExternalIO *io = dev->m_ext_io;
// ADS1256 *adc = params->name == "rtIgnTask_A" ? dev->m_adc_a : dev->m_adc_b;
ADS1256 *adc = NULL;
// std::mutex &spi_mutex = params->name == "rtIgnTask_A" ? dev->m_spi_a_mutex : dev->m_spi_b_mutex;
std::mutex spi_mutex;
ADS1256 *adc = params->name == "rtIgnTask_A" ? dev->m_adc_a : dev->m_adc_b;
std::mutex &spi_mutex = params->name == "rtIgnTask_A" ? dev->m_spi_a_mutex : dev->m_spi_b_mutex;
TaskStatus_t rt_task_info;
vTaskGetInfo(NULL, &rt_task_info, pdFALSE, eInvalid);
@@ -321,15 +315,22 @@ rtIgnitionTask::rtIgnitionTask(const rtTaskParams params, const uint32_t history
else
m_params.rt_queue = m_queue;
// create PSram history vectors
m_history_0 = PSHistory(history_size);
m_history_1 = PSHistory(history_size);
// assing active and writable history
m_active_history = std::unique_ptr<PSHistory>(&m_history_0);
m_save_history = std::unique_ptr<PSHistory>(&m_history_1);
try
{
// create PSram history vectors
m_history_0 = PSHistory(history_size);
m_history_1 = PSHistory(history_size);
// assing active and writable history
m_active_history = std::unique_ptr<PSHistory>(&m_history_0);
m_save_history = std::unique_ptr<PSHistory>(&m_history_1);
}
catch (std::bad_alloc &e)
{
LOG_ERROR("Task [", params.name.c_str(), "] Unable to allocate history PSRAM: ", e.what());
return;
}
m_name = (std::string("man_") + m_params.name).c_str();
// auto task_success = pdPASS;
auto task_success = xTaskCreatePinnedToCore(
rtIgnitionTask_manager,
m_name.c_str(),
@@ -379,7 +380,7 @@ void rtIgnitionTask::run()
m_partial_save = false; // reset partial save flag on new data cycle
std::swap(m_active_history, m_save_history);
if (m_enable_save)
// saveHistory(m_save_history, m_history_path); // directly call the save task function to save without delay
saveHistory(*m_save_history, m_history_path); // directly call the save task function to save without delay
LOG_INFO("Save History");
}
@@ -402,9 +403,9 @@ void rtIgnitionTask::run()
if (m_counter_status > 0 && !m_partial_save)
{
LOG_DEBUG("Save Partial: ", m_counter_status);
// m_active_history->resize(m_counter_status);
// saveHistory(m_active_history, m_history_path);
// m_active_history->resize(m_max_history);
m_active_history->resize(m_counter_status);
saveHistory(*m_active_history, m_history_path);
m_active_history->resize(m_max_history);
m_counter_status = 0;
m_partial_save = true;
}