From 97969e8cf514aa82a29cbfec64b8c743d7588fe4 Mon Sep 17 00:00:00 2001 From: Mikhail Grushinskiy Date: Tue, 5 Nov 2024 19:42:47 -0500 Subject: [PATCH] Update bbn_m5atomS3_lite_env3.ino --- .../bbn_m5atomS3_lite_env3.ino | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/bbn_m5atomS3_lite_env3/bbn_m5atomS3_lite_env3.ino b/bbn_m5atomS3_lite_env3/bbn_m5atomS3_lite_env3.ino index a0e42eb..6157b72 100644 --- a/bbn_m5atomS3_lite_env3/bbn_m5atomS3_lite_env3.ino +++ b/bbn_m5atomS3_lite_env3/bbn_m5atomS3_lite_env3.ino @@ -1,39 +1,35 @@ #include -#include #include #include #include #include "NmeaXDR.h" +#include "Nmea0183Msg.h" SHT3X sht3x; -QMP6988 qmp; +QMP6988 qmp6988; void setup() { auto cfg = M5.config(); AtomS3.begin(cfg); Wire.begin(); Serial.begin(4800); - - if (!qmp.begin(&Wire, QMP6988_SLAVE_ADDRESS_L, G2, G1, 100000U)) { - Serial.println("Couldn't find QMP6988"); - while (1) delay(1); + + if (!qmp6988.begin(&Wire, QMP6988_SLAVE_ADDRESS_L, G2, G1, 100000U)) { + gen_nmea0183_msg("$BBTXT,01,01,01,Sensor not found type=%s", "QMP6988"); } - if (!sht3x.begin(&Wire, SHT3X_I2C_ADDR, G2, G1, 100000U)) { - Serial.println("Couldn't find SHT3X"); - while (1) delay(1); + gen_nmea0183_msg("$BBTXT,01,01,01,Sensor not found type=%s", "SHT3X"); } } void loop() { if (sht3x.update()) { - gen_nmea0183_xdr("$BBXDR,H,%.2f,P,HUMI", sht3x.humidity); // % - //gen_nmea0183_xdr("$BBXDR,C,%.2f,C,TEMP", sht3x.cTemp); // C + gen_nmea0183_xdr("$BBXDR,H,%.2f,P,HUMI_SHT3X", sht3x.humidity); // % + gen_nmea0183_xdr("$BBXDR,C,%.2f,C,TEMP_SHT3X", sht3x.cTemp); // C } - - if (qmp.update()) { - gen_nmea0183_xdr("$BBXDR,C,%.2f,C,TEMP", qmp.cTemp); // C - gen_nmea0183_xdr("$BBXDR,P,%.2f,P,PRES", qmp.pressure); // Pa + if (qmp6988.update()) { + gen_nmea0183_xdr("$BBXDR,C,%.2f,C,TEMP_QMP6988", qmp6988.cTemp); // C + gen_nmea0183_xdr("$BBXDR,P,%.2f,P,PRES_QMP6988", qmp6988.pressure); // Pa } - delay(5000); + delay(1000); }