|
|
@ -92,6 +92,14 @@ void dumphpp272data(hpp272_data_t *data) { |
|
|
|
printf("water_vapor_saturation_pressure_h2o_h2o2: %d\n", data->water_vapor_saturation_pressure_h2o_h2o2); |
|
|
|
} |
|
|
|
|
|
|
|
int hydrogen_peroxide_volume_get_ppm() { |
|
|
|
uint32_t adc_val = ADC_Get_Average(3, 12); |
|
|
|
float voltage = adc_val * 3.3 / 4096; |
|
|
|
float current_ma = voltage / 150.0; |
|
|
|
float ppm = (current_ma - 4.0) / 16.0 * 2000; |
|
|
|
return ppm; |
|
|
|
} |
|
|
|
|
|
|
|
void Hardware::initialize(int deviceId) { |
|
|
|
m_device_id = deviceId; |
|
|
|
|
|
|
@ -220,14 +228,22 @@ int32_t Hardware::process_rx_packet(from_where_t fromwhere, uint8_t *packet, int |
|
|
|
} |
|
|
|
|
|
|
|
static hpp272_data_t fake_hpp272data; |
|
|
|
//
|
|
|
|
PROCESS_CMD(kcmd_m211887_operation, 0, 1) { |
|
|
|
// hpp272_data_t *hpp272data = hpp272.readVal();
|
|
|
|
|
|
|
|
fake_hpp272data.hydrogen_peroxide_volume = 101; |
|
|
|
fake_hpp272data.h2o_h2o2_rs = 102; |
|
|
|
fake_hpp272data.temperature1 = 103; |
|
|
|
fake_hpp272data.relative_humidity = 104; |
|
|
|
#if 0
|
|
|
|
data.h2o2 = m_hpp272_data_1.hydrogen_peroxide_volume; |
|
|
|
data.humid = m_hpp272_data_1.relative_humidity / 100; |
|
|
|
data.temp = m_hpp272_data_1.temperature1 / 100; |
|
|
|
data.saturation = m_hpp272_data_1.h2o_h2o2_rs / 100; |
|
|
|
#endif
|
|
|
|
|
|
|
|
fake_hpp272data.hydrogen_peroxide_volume = hydrogen_peroxide_volume_get_ppm(); // ppm
|
|
|
|
fake_hpp272data.relative_humidity = 50 * 100; // %RH * 100
|
|
|
|
fake_hpp272data.temperature1 = 25 * 100; // °C * 100
|
|
|
|
fake_hpp272data.h2o_h2o2_rs = 1 * 100; // %RS * 100
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
fake_hpp272data.absolute_hydrogen_peroxide = 105; |
|
|
|
fake_hpp272data.h2o_h2o2dew_point_temperature = 106; |
|
|
|
fake_hpp272data.reserved1 = 107; |
|
|
@ -238,7 +254,9 @@ int32_t Hardware::process_rx_packet(from_where_t fromwhere, uint8_t *packet, int |
|
|
|
fake_hpp272data.temperature2 = 112; |
|
|
|
fake_hpp272data.h2o2_vapor_pressure = 113; |
|
|
|
fake_hpp272data.water_vapor_saturation_pressure_h2o_h2o2 = 114; |
|
|
|
hpp272_data_t *hpp272data = &fake_hpp272data; |
|
|
|
#endif
|
|
|
|
|
|
|
|
hpp272_data_t *hpp272data = &fake_hpp272data; |
|
|
|
if (hpp272data) { |
|
|
|
receipt[0] = 1; |
|
|
|
receipt[1] = 0; |
|
|
|