refactor continued, at least it compiles
This commit is contained in:
@@ -38,8 +38,8 @@ void rtIgnitionTask::rtIgnitionTask_realtime(void *pvParameters)
|
||||
const rtTaskIOParams rt_rst = params->rt_io; // copy to avoid external override
|
||||
QueueHandle_t rt_queue = params->rt_queue;
|
||||
Devices *dev = params->dev.get();
|
||||
ADS1256 *adc = dev->adc_a;
|
||||
PCA9555 *io = dev->io;
|
||||
ADS1256 *adc = dev->m_adc_a.get();
|
||||
PCA9555 *io = dev->m_expander_a.get();
|
||||
|
||||
TaskStatus_t rt_task_info;
|
||||
vTaskGetInfo(NULL, &rt_task_info, pdFALSE, eInvalid);
|
||||
@@ -282,7 +282,7 @@ void rtIgnitionTask::rtIgnitionTask_realtime(void *pvParameters)
|
||||
}
|
||||
|
||||
///////////// CLASS MEMBER DEFINITIONS /////////////
|
||||
rtIgnitionTask::rtIgnitionTask(const rtTaskParams params, const uint32_t history_size, const uint32_t queue_size, const uint8_t core, std::mutex &fs_mutex, fs::FS &filesystem = LittleFS) : m_params(params), m_filesystem(filesystem), m_fs_mutex(fs_mutex), m_core(core)
|
||||
rtIgnitionTask::rtIgnitionTask(const rtTaskParams params, const uint32_t history_size, const uint32_t queue_size, const uint8_t core, std::mutex &fs_mutex, fs::FS &filesystem) : m_params(params), m_filesystem(filesystem), m_fs_mutex(fs_mutex), m_core(core), m_max_history(history_size)
|
||||
{
|
||||
// create queue buffers
|
||||
m_queue = xQueueCreate(queue_size, sizeof(ignitionBoxStatus));
|
||||
@@ -299,8 +299,8 @@ rtIgnitionTask::rtIgnitionTask(const rtTaskParams params, const uint32_t history
|
||||
m_history_0.resize(history_size);
|
||||
m_history_1.resize(history_size);
|
||||
// assing active and writable history
|
||||
m_active_history = std::make_unique<PSHistory>(m_history_0.data());
|
||||
m_save_history = std::make_unique<PSHistory>(m_history_1.data());
|
||||
m_active_history = std::unique_ptr<PSHistory>(&m_history_0);
|
||||
m_save_history = std::unique_ptr<PSHistory>(&m_history_1);
|
||||
|
||||
LOG_WARN("Starting Manager for [", m_params.name.c_str(), "]");
|
||||
auto task_success = xTaskCreate(
|
||||
@@ -349,7 +349,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)
|
||||
save_history(*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
|
||||
}
|
||||
|
||||
// update filtered data
|
||||
@@ -361,8 +361,16 @@ void rtIgnitionTask::run()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (millis() - m_last_data > c_idle_time)
|
||||
if (millis() - m_last_data > c_idle_time){
|
||||
if (m_counter_status > 0 && !m_partial_save){
|
||||
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;
|
||||
}
|
||||
m_manager_status = rtTaskStatus::IDLE;
|
||||
}
|
||||
delay(5); // yeld to another task
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user