Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrouch committed Dec 12, 2024
1 parent 9cb2c78 commit c082e25
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions i2c_ads1115.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ bool i2c_ads1115_found = false;
float resolution = 0.0;
float calibration_factor = 0.0;

void i2c_ads1115_report() {
int16_t adc_raw = i2c_ads1115_sensor.getSingleConversion();
float voltage = adc_raw * resolution * calibration_factor;
//Serial.printf("Cal ADC:%.0f\n", adc_raw * calibration_factor);
//Serial.printf("Cal Voltage:%.2f mV\n", voltage);
//Serial.printf("Raw ADC:%d\n\n", adc_raw);
gen_nmea0183_xdr("$BBXDR,U,%.3f,V,VOLT", voltage / 1000); // Volt
}

void i2c_ads1115_try_init() {
for (int i = 0; i < 3; i++) {
i2c_ads1115_found = i2c_ads1115_sensor.begin(&Wire, M5_UNIT_VMETER_I2C_ADDR, G2, G1, 100000U);
Expand Down Expand Up @@ -50,13 +59,4 @@ void i2c_ads1115_try_init() {
}
}

void i2c_ads1115_report() {
int16_t adc_raw = i2c_ads1115_sensor.getSingleConversion();
float voltage = adc_raw * resolution * calibration_factor;
//Serial.printf("Cal ADC:%.0f\n", adc_raw * calibration_factor);
//Serial.printf("Cal Voltage:%.2f mV\n", voltage);
//Serial.printf("Raw ADC:%d\n\n", adc_raw);
gen_nmea0183_xdr("$BBXDR,U,%.3f,V,VOLT", voltage / 1000); // Volt
}

#endif

0 comments on commit c082e25

Please sign in to comment.