Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrouch committed Dec 20, 2024
1 parent 15dc1ed commit 7948271
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
24 changes: 24 additions & 0 deletions gpio_240_30_ohm_sensor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifndef gpio_240_30_ohm_sensor_h
#define gpio_240_30_ohm_sensor_h

#include "ResistanceSensor.h"
#include "NmeaXDR.h"

#define Resistance_Sensor_GPIO_PIN G8

ResistanceSensor resistanceSens;

void gpio_240_30_ohm_sensor_report() {
ResistanceSensor_read(&resistanceSens);
gen_nmea0183_xdr("$BBXDR,G,%.1f,O,Ohms_esp32", resistanceSens.measured_resistance);
}

void gpio_240_30_ohm_try_init() {
// for 240-30 Ohm sensors (USA standard). Good for 0-180 Ohm too (EU Standard).
ResistanceSensor_init(&resistanceSens, Resistance_Sensor_GPIO_PIN, DOWNSTREAM, 3.3, 100.0);
app.onRepeat(5000, []() {
gpio_240_30_ohm_sensor_report();
});
}

#endif
2 changes: 2 additions & 0 deletions mcu_sensors.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "gpio_pir_as312.h"
#include "gpio_tds_cqrsentds01.h"
#include "gpio_limit_switch.h"
#include "gpio_240_30_ohm_sensor.h"

void mcu_sensors_scan() {
i2c_ina219_try_init(&Wire1);
Expand All @@ -31,6 +32,7 @@ void mcu_sensors_scan() {
gpio_pir_as312_try_init();
gpio_tds_cqrsentds01_try_init();
gpio_limit_switch_try_init();
gpio_240_30_ohm_try_init();
}

void mcu_sensors_update() {
Expand Down

0 comments on commit 7948271

Please sign in to comment.