get mostly one directional comms working

This commit is contained in:
2025-04-27 01:43:55 +02:00
parent af4d8654de
commit 3457b76938
12 changed files with 402 additions and 97 deletions

View File

@@ -122,7 +122,6 @@ void i2c_sensors_task(void *pvParameters)
// task loop entry point
for (;;)
{
packetReadiness = 2;
start_time = esp_timer_get_time(); // µs since boot
//
// handle sensor
@@ -174,15 +173,15 @@ void i2c_sensors_task(void *pvParameters)
float VREFVoltage = 2.5;
mics_adc_data_t ADCData;
memset(&ADCData, 0, sizeof(ADCData));
//mics_adc_data_t ADCData = mcp3550_read_all(VREFVoltage);
// mics_adc_data_t ADCData;
// memset(&ADCData, 0, sizeof(ADCData));
mics_adc_data_t ADCData = mcp3550_read_all(VREFVoltage);
//log_mics_adc_values(&ADCData);
log_mics_adc_values(&ADCData);
int32_t nh3val = mcp3550_read(MCP_CS_ADC_NH3);
//int32_t nh3val = mcp3550_read(MCP_CS_ADC_NH3);
ESP_LOGI(TAG_BME, "MICS NH3: %ld -> %fV", nh3val, mcp3550_to_voltage(nh3val, VREFVoltage));
//ESP_LOGI(TAG_BME, "MICS NH3: %ld -> %fV", nh3val, mcp3550_to_voltage(nh3val, VREFVoltage));
//gpio_set_level(BLINK_GPIO, s_led_state);
mcp23018_set_pin(MCP23018_DEV_HANDLE, MCP_CS_ADC_UVC, s_led_state);
@@ -228,7 +227,16 @@ void i2c_sensors_task(void *pvParameters)
telemetryPacket.gas_range = bmeData.raw_data.gas_range;
telemetryPacket.heater_stable = bmeData.raw_data.heater_stable;
telemetryPacket.gas_valid = bmeData.raw_data.gas_valid;
telemetryPacket.air_temperature = bmeData.air_temperature;
telemetryPacket.relative_humidity = bmeData.relative_humidity;
telemetryPacket.barometric_pressure = bmeData.barometric_pressure;
telemetryPacket.gas_resistance = bmeData.gas_resistance;
telemetryPacket.iaq_score = bmeData.iaq_score;
telemetryPacket.temperature_score = bmeData.temperature_score;
telemetryPacket.humidity_score = bmeData.humidity_score;
telemetryPacket.gas_score = bmeData.gas_score;
telemetryPacket.NH3 = ADCData.raw_nh3;
telemetryPacket.CO = ADCData.raw_co;
telemetryPacket.NO2 = ADCData.raw_no2;