diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 080c0e636..e19958022 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -1078,6 +1078,7 @@ void GPS::publishUpdate() int32_t GPS::runOnce() { +#if !defined(SENSECAP_INDICATOR) if (!GPSInitFinished) { if (!_serial_gps || config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_NOT_PRESENT) { LOG_INFO("GPS set to not-present. Skip probe"); @@ -1093,6 +1094,7 @@ int32_t GPS::runOnce() GPSInitFinished = true; publishUpdate(); } +#endif // Repeaters have no need for GPS if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER) { @@ -1411,8 +1413,10 @@ GPS *GPS::createGps() if (!settingsMap[has_gps]) return nullptr; #endif +#if !defined(SENSECAP_INDICATOR) if (!_rx_gpio || !_serial_gps) // Configured to have no GPS at all return nullptr; +#endif GPS *new_gps = new GPS; new_gps->rx_gpio = _rx_gpio; diff --git a/src/mesh/IndicatorSerial.cpp b/src/mesh/IndicatorSerial.cpp index 2cce4594a..60bdff290 100644 --- a/src/mesh/IndicatorSerial.cpp +++ b/src/mesh/IndicatorSerial.cpp @@ -1,22 +1,23 @@ #ifdef SENSECAP_INDICATOR #include "IndicatorSerial.h" -#include "mesh/comms/FakeUART.h" #include "mesh/comms/FakeI2C.h" +#include "mesh/comms/FakeUART.h" #include #include #include SensecapIndicator *sensecapIndicator; -SensecapIndicator::SensecapIndicator(HardwareSerial &serial) : OSThread("SensecapIndicator") { +SensecapIndicator::SensecapIndicator(HardwareSerial &serial) : OSThread("SensecapIndicator") +{ if (!running) { _serial = &serial; _serial->setRxBufferSize(PB_BUFSIZE); _serial->setPins(SENSOR_RP2040_RXD, SENSOR_RP2040_TXD); _serial->begin(SENSOR_BAUD_RATE); running = true; - LOG_DEBUG("Start communication thread"); + LOG_DEBUG("Start indicator communication thread"); } } @@ -120,7 +121,8 @@ bool SensecapIndicator::handle_packet(size_t payload_len) return false; } switch (message.which_data) { - case meshtastic_InterdeviceMessage_i2c_response_tag: + case meshtastic_InterdeviceMessage_i2c_response_tag: + LOG_DEBUG("Got I2C response"); if (message.data.i2c_response.status != meshtastic_I2CResponse_Status_OK) { LOG_DEBUG("I2C response error: %d", message.data.i2c_response.status); return false; diff --git a/src/mesh/IndicatorSerial.h b/src/mesh/IndicatorSerial.h index f76e9e2b5..4e54858e4 100644 --- a/src/mesh/IndicatorSerial.h +++ b/src/mesh/IndicatorSerial.h @@ -25,7 +25,7 @@ class SensecapIndicator : public concurrency::OSThread { public: - SensecapIndicator(HardwareSerial& serial); + SensecapIndicator(HardwareSerial &serial); int32_t runOnce() override; bool send_uplink(meshtastic_InterdeviceMessage message); @@ -33,7 +33,7 @@ class SensecapIndicator : public concurrency::OSThread pb_byte_t pb_tx_buf[PB_BUFSIZE]; pb_byte_t pb_rx_buf[PB_BUFSIZE]; size_t pb_rx_size = 0; // Number of bytes currently in the buffer - HardwareSerial* _serial = &Serial2; + HardwareSerial *_serial = &Serial2; bool running = false; size_t serial_check(char *buf, size_t space_left); void check_packet(); diff --git a/src/mesh/comms/FakeUART.cpp b/src/mesh/comms/FakeUART.cpp index 6e9f4bb1d..5bd723f6c 100644 --- a/src/mesh/comms/FakeUART.cpp +++ b/src/mesh/comms/FakeUART.cpp @@ -77,6 +77,8 @@ size_t FakeUART::write(char *buffer, size_t size) size = sizeof(message.data.nmea); // Truncate if buffer is too large } memcpy(message.data.nmea, buffer, size); + message.which_data = meshtastic_InterdeviceMessage_nmea_tag; + LOG_DEBUG("FakeUART::write(%s)", message.data.nmea); sensecapIndicator->send_uplink(message); return size; } diff --git a/variants/seeed-sensecap-indicator/variant.h b/variants/seeed-sensecap-indicator/variant.h index 8915395f3..5918a85a2 100644 --- a/variants/seeed-sensecap-indicator/variant.h +++ b/variants/seeed-sensecap-indicator/variant.h @@ -44,13 +44,7 @@ #define TOUCH_I2C_PORT 0 #define TOUCH_SLAVE_ADDRESS 0x48 -// in future, we may want to add a buzzer and add all sensors to the indicator via a data protocol for now only GPS is supported -// // Buzzer -// #define PIN_BUZZER 19 - #define GPS_DEFAULT_NOT_PRESENT 1 -#define GPS_RX_PIN 20 -#define GPS_TX_PIN 19 #define HAS_GPS 1 #define USE_SX1262 @@ -78,3 +72,7 @@ #define USE_VIRTUAL_KEYBOARD 1 #define DISPLAY_CLOCK_FRAME 1 + +// this powers the RP 2040 on boot. +#define SENSOR_POWER_CTRL_EXPANDER (8 | IO_EXPANDER) +#define SENSOR_POWER_ON_EXPANDER 1