This commit is contained in:
2026-04-14 14:16:11 +02:00
parent 899c8cffbc
commit 8171cab9cb
5 changed files with 14 additions and 30 deletions

View File

@@ -17,7 +17,7 @@
#include <led.h>
// Defines to enable channel B
#define CH_B_ENABLE
// #define CH_B_ENABLE
// Debug Defines
#define WIFI_SSID "AstroRotaxMonitor"
@@ -32,7 +32,7 @@ void setup()
// Setup Logger
LOG_ATTACH_SERIAL(Serial);
LOG_SET_LEVEL(DebugLogLevel::LVL_DEBUG);
LOG_SET_LEVEL(DebugLogLevel::LVL_INFO);
// Print Processor Info
LOG_DEBUG("ESP32 Chip:", ESP.getChipModel());
@@ -108,37 +108,33 @@ void loop()
{
LOG_ERROR("Unable to Initialize SPI Busses");
LOG_ERROR("5 seconds to restart...");
//vTaskDelay(pdMS_TO_TICKS(5000));
//esp_restart();
vTaskDelay(pdMS_TO_TICKS(5000));
esp_restart();
}
//dev->m_spi_a = std::make_unique<SPIClass*>(&SPI_A);
dev->m_spi_a.reset(&SPI_A);
#ifdef CH_B_ENABLE
//dev->m_spi_b = std::make_unique<SPIClass*>(&SPI_B);
dev->m_spi_b.reset(&SPI_B);
#endif
// Init ADCs
dev->m_adc_a = std::make_unique<ADS1256>(ADC_A_DRDY, ADS1256::PIN_UNUSED, ADS1256::PIN_UNUSED, ADC_A_CS, 2.5, &SPI_A);
LOG_DEBUG("Init ADC A pointer ok");
#ifdef CH_B_ENABLE
dev->m_adc_b = std::make_unique<ADS1256>(ADC_B_DRDY, ADS1256::PIN_UNUSED, ADS1256::PIN_UNUSED, ADC_B_CS, 2.5, &SPI_B);
LOG_DEBUG("Init ADC B pointer ok");
#endif
// Configure ADCs
dev->m_adc_a->InitializeADC();
dev->m_adc_a->setPGA(PGA_1);
dev->m_adc_a->setDRATE(DRATE_7500SPS);
LOG_DEBUG("Init ADC A params ok");
#ifdef CH_B_ENABLE
dev->m_adc_b->InitializeADC();
dev->m_adc_b->setPGA(PGA_1);
dev->m_adc_b->setDRATE(DRATE_7500SPS);
LOG_DEBUG("Init ADC B params ok");
#endif
LOG_DEBUG("Init SPI OK");
//////// INIT I2C INTERFACES ////////
LOG_DEBUG("Init I2C Interfaces");
bool i2c_ok = true;
i2c_ok = Wire.begin();
i2c_ok = Wire.begin(SDA, SCL, 100000);
if (!i2c_ok)
{
LOG_ERROR("Unable to Initialize I2C Bus");
@@ -148,7 +144,7 @@ void loop()
}
// Init IO Expanders
dev->m_ext_io = std::make_unique<ExternalIO>(Wire, dev->m_i2c_mutex, EXPANDER_ALL_INTERRUPT);
// dev->m_ext_io = std::make_unique<ExternalIO>(Wire, dev->m_i2c_mutex, EXPANDER_ALL_INTERRUPT);
//////// INIT REALTIME TASKS PARAMETERS ////////
const rtIgnitionTask::rtTaskParams taskA_params{