From a2a6b236b719cf8d5a34dad6d826ad1224325c9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 30 Dec 2024 21:28:31 +0100 Subject: [PATCH 001/381] support indicator sensors through Rp2040 serial (#5696) * support indicator sensors through Rp2040 serial * disable excessive debug printing --- .../Telemetry/EnvironmentTelemetry.cpp | 12 +- .../Telemetry/Sensor/IndicatorSensor.cpp | 167 ++++++++++++++++++ .../Telemetry/Sensor/IndicatorSensor.h | 19 ++ src/serialization/cobs.cpp | 131 ++++++++++++++ src/serialization/cobs.h | 75 ++++++++ variants/seeed-sensecap-indicator/variant.h | 6 + 6 files changed, 409 insertions(+), 1 deletion(-) create mode 100644 src/modules/Telemetry/Sensor/IndicatorSensor.cpp create mode 100644 src/modules/Telemetry/Sensor/IndicatorSensor.h create mode 100644 src/serialization/cobs.cpp create mode 100644 src/serialization/cobs.h diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index 008da5c71..e72b03bd4 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -64,6 +64,10 @@ CGRadSensSensor cgRadSens; #include "Sensor/T1000xSensor.h" T1000xSensor t1000xSensor; #endif +#ifdef SENSECAP_INDICATOR +#include "Sensor/IndicatorSensor.h" +IndicatorSensor indicatorSensor; +#endif #define FAILED_STATE_SENSOR_READ_MULTIPLIER 10 #define DISPLAY_RECEIVEID_MEASUREMENTS_ON_SCREEN true @@ -103,6 +107,9 @@ int32_t EnvironmentTelemetryModule::runOnce() LOG_INFO("Environment Telemetry: init"); // it's possible to have this module enabled, only for displaying values on the screen. // therefore, we should only enable the sensor loop if measurement is also enabled +#ifdef SENSECAP_INDICATOR + result = indicatorSensor.runOnce(); +#endif #ifdef T1000X_SENSOR_EN result = t1000xSensor.runOnce(); #elif !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR_EXTERNAL @@ -298,6 +305,10 @@ bool EnvironmentTelemetryModule::getEnvironmentTelemetry(meshtastic_Telemetry *m m->which_variant = meshtastic_Telemetry_environment_metrics_tag; m->variant.environment_metrics = meshtastic_EnvironmentMetrics_init_zero; +#ifdef SENSECAP_INDICATOR + valid = valid && indicatorSensor.getMetrics(m); + hasSensor = true; +#endif #ifdef T1000X_SENSOR_EN // add by WayenWeng valid = valid && t1000xSensor.getMetrics(m); hasSensor = true; @@ -410,7 +421,6 @@ bool EnvironmentTelemetryModule::getEnvironmentTelemetry(meshtastic_Telemetry *m valid = valid && cgRadSens.getMetrics(m); hasSensor = true; } - #endif return valid && hasSensor; } diff --git a/src/modules/Telemetry/Sensor/IndicatorSensor.cpp b/src/modules/Telemetry/Sensor/IndicatorSensor.cpp new file mode 100644 index 000000000..f3dcd1727 --- /dev/null +++ b/src/modules/Telemetry/Sensor/IndicatorSensor.cpp @@ -0,0 +1,167 @@ +#include "configuration.h" + +#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && defined(SENSECAP_INDICATOR) + +#include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "IndicatorSensor.h" +#include "TelemetrySensor.h" +#include "serialization/cobs.h" +#include +#include + +IndicatorSensor::IndicatorSensor() : TelemetrySensor(meshtastic_TelemetrySensorType_SENSOR_UNSET, "Indicator") {} + +#define SENSOR_BUF_SIZE (512) + +uint8_t buf[SENSOR_BUF_SIZE]; // recv +uint8_t data[SENSOR_BUF_SIZE]; // decode + +#define ACK_PKT_PARA "ACK" + +enum sensor_pkt_type { + PKT_TYPE_ACK = 0x00, // uin32_t + PKT_TYPE_CMD_COLLECT_INTERVAL = 0xA0, // uin32_t + PKT_TYPE_CMD_BEEP_ON = 0xA1, // uin32_t ms: on time + PKT_TYPE_CMD_BEEP_OFF = 0xA2, + PKT_TYPE_CMD_SHUTDOWN = 0xA3, // uin32_t + PKT_TYPE_CMD_POWER_ON = 0xA4, + PKT_TYPE_SENSOR_SCD41_TEMP = 0xB0, // float + PKT_TYPE_SENSOR_SCD41_HUMIDITY = 0xB1, // float + PKT_TYPE_SENSOR_SCD41_CO2 = 0xB2, // float + PKT_TYPE_SENSOR_AHT20_TEMP = 0xB3, // float + PKT_TYPE_SENSOR_AHT20_HUMIDITY = 0xB4, // float + PKT_TYPE_SENSOR_TVOC_INDEX = 0xB5, // float +}; + +static int cmd_send(uint8_t cmd, const char *p_data, uint8_t len) +{ + uint8_t buf[32] = {0}; + uint8_t data[32] = {0}; + + if (len > 31) { + return -1; + } + + uint8_t index = 1; + + data[0] = cmd; + + if (len > 0 && p_data != NULL) { + memcpy(&data[1], p_data, len); + index += len; + } + cobs_encode_result ret = cobs_encode(buf, sizeof(buf), data, index); + + // LOG_DEBUG("cobs TX status:%d, len:%d, type 0x%x", ret.status, ret.out_len, cmd); + + if (ret.status == COBS_ENCODE_OK) { + return uart_write_bytes(SENSOR_PORT_NUM, buf, ret.out_len + 1); + } + + return -1; +} + +int32_t IndicatorSensor::runOnce() +{ + LOG_INFO("%s: init", sensorName); + setup(); + return 2 * DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; // give it some time to start up +} + +void IndicatorSensor::setup() +{ + uart_config_t uart_config = { + .baud_rate = SENSOR_BAUD_RATE, + .data_bits = UART_DATA_8_BITS, + .parity = UART_PARITY_DISABLE, + .stop_bits = UART_STOP_BITS_1, + .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, + .source_clk = UART_SCLK_APB, + }; + int intr_alloc_flags = 0; + char buffer[11]; + + uart_driver_install(SENSOR_PORT_NUM, SENSOR_BUF_SIZE * 2, 0, 0, NULL, intr_alloc_flags); + uart_param_config(SENSOR_PORT_NUM, &uart_config); + uart_set_pin(SENSOR_PORT_NUM, SENSOR_RP2040_TXD, SENSOR_RP2040_RXD, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); + cmd_send(PKT_TYPE_CMD_POWER_ON, NULL, 0); + // measure and send only once every minute, for the phone API + const char *interval = ultoa(60000, buffer, 10); + cmd_send(PKT_TYPE_CMD_COLLECT_INTERVAL, interval, strlen(interval) + 1); +} + +bool IndicatorSensor::getMetrics(meshtastic_Telemetry *measurement) +{ + cobs_decode_result ret; + int len = uart_read_bytes(SENSOR_PORT_NUM, buf, (SENSOR_BUF_SIZE - 1), 100 / portTICK_PERIOD_MS); + + float value = 0.0; + uint8_t pkt_type = 0; + uint8_t *p_buf_start = buf; + uint8_t *p_buf_end = buf; + if (len > 0) { + while (p_buf_start < (buf + len)) { + p_buf_end = p_buf_start; + while (p_buf_end < (buf + len)) { + if (*p_buf_end == 0x00) { + break; + } + p_buf_end++; + } + // decode buf + memset(data, 0, sizeof(data)); + ret = cobs_decode(data, sizeof(data), p_buf_start, p_buf_end - p_buf_start); + + // LOG_DEBUG("cobs RX status:%d, len:%d, type:0x%x ", ret.status, ret.out_len, data[0]); + + if (ret.out_len > 1 && ret.status == COBS_DECODE_OK) { + + value = 0.0; + pkt_type = data[0]; + switch (pkt_type) { + case PKT_TYPE_SENSOR_SCD41_CO2: { + memcpy(&value, &data[1], sizeof(value)); + // LOG_DEBUG("CO2: %.1f", value); + cmd_send(PKT_TYPE_ACK, ACK_PKT_PARA, 4); + break; + } + + case PKT_TYPE_SENSOR_AHT20_TEMP: { + memcpy(&value, &data[1], sizeof(value)); + // LOG_DEBUG("Temp: %.1f", value); + cmd_send(PKT_TYPE_ACK, ACK_PKT_PARA, 4); + measurement->variant.environment_metrics.has_temperature = true; + measurement->variant.environment_metrics.temperature = value; + break; + } + + case PKT_TYPE_SENSOR_AHT20_HUMIDITY: { + memcpy(&value, &data[1], sizeof(value)); + // LOG_DEBUG("Humidity: %.1f", value); + cmd_send(PKT_TYPE_ACK, ACK_PKT_PARA, 4); + measurement->variant.environment_metrics.has_relative_humidity = true; + measurement->variant.environment_metrics.relative_humidity = value; + break; + } + + case PKT_TYPE_SENSOR_TVOC_INDEX: { + memcpy(&value, &data[1], sizeof(value)); + // LOG_DEBUG("Tvoc: %.1f", value); + cmd_send(PKT_TYPE_ACK, ACK_PKT_PARA, 4); + measurement->variant.environment_metrics.has_iaq = true; + measurement->variant.environment_metrics.iaq = value; + break; + } + default: + break; + } + } + + p_buf_start = p_buf_end + 1; // next message + } + return true; + } + return false; +} + +#endif \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/IndicatorSensor.h b/src/modules/Telemetry/Sensor/IndicatorSensor.h new file mode 100644 index 000000000..48ecef8de --- /dev/null +++ b/src/modules/Telemetry/Sensor/IndicatorSensor.h @@ -0,0 +1,19 @@ +#include "configuration.h" + +#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR + +#include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "TelemetrySensor.h" + +class IndicatorSensor : public TelemetrySensor +{ + protected: + virtual void setup() override; + + public: + IndicatorSensor(); + virtual int32_t runOnce() override; + virtual bool getMetrics(meshtastic_Telemetry *measurement) override; +}; + +#endif \ No newline at end of file diff --git a/src/serialization/cobs.cpp b/src/serialization/cobs.cpp new file mode 100644 index 000000000..39ea019fd --- /dev/null +++ b/src/serialization/cobs.cpp @@ -0,0 +1,131 @@ +#include "cobs.h" +#include + +#ifdef SENSECAP_INDICATOR + +cobs_encode_result cobs_encode(uint8_t *dst_buf_ptr, size_t dst_buf_len, const uint8_t *src_ptr, size_t src_len) +{ + cobs_encode_result result = {0, COBS_ENCODE_OK}; + const uint8_t *src_read_ptr = src_ptr; + const uint8_t *src_end_ptr = src_read_ptr + src_len; + uint8_t *dst_buf_start_ptr = dst_buf_ptr; + uint8_t *dst_buf_end_ptr = dst_buf_start_ptr + dst_buf_len; + uint8_t *dst_code_write_ptr = dst_buf_ptr; + uint8_t *dst_write_ptr = dst_code_write_ptr + 1; + uint8_t src_byte = 0; + uint8_t search_len = 1; + + if ((dst_buf_ptr == NULL) || (src_ptr == NULL)) { + result.status = COBS_ENCODE_NULL_POINTER; + return result; + } + + if (src_len != 0) { + for (;;) { + if (dst_write_ptr >= dst_buf_end_ptr) { + result.status = (cobs_encode_status)(result.status | (cobs_encode_status)COBS_ENCODE_OUT_BUFFER_OVERFLOW); + break; + } + + src_byte = *src_read_ptr++; + if (src_byte == 0) { + *dst_code_write_ptr = search_len; + dst_code_write_ptr = dst_write_ptr++; + search_len = 1; + if (src_read_ptr >= src_end_ptr) { + break; + } + } else { + *dst_write_ptr++ = src_byte; + search_len++; + if (src_read_ptr >= src_end_ptr) { + break; + } + if (search_len == 0xFF) { + *dst_code_write_ptr = search_len; + dst_code_write_ptr = dst_write_ptr++; + search_len = 1; + } + } + } + } + + if (dst_code_write_ptr >= dst_buf_end_ptr) { + result.status = (cobs_encode_status)(result.status | (cobs_encode_status)COBS_ENCODE_OUT_BUFFER_OVERFLOW); + dst_write_ptr = dst_buf_end_ptr; + } else { + *dst_code_write_ptr = search_len; + } + + result.out_len = dst_write_ptr - dst_buf_start_ptr; + + return result; +} + +cobs_decode_result cobs_decode(uint8_t *dst_buf_ptr, size_t dst_buf_len, const uint8_t *src_ptr, size_t src_len) +{ + cobs_decode_result result = {0, COBS_DECODE_OK}; + const uint8_t *src_read_ptr = src_ptr; + const uint8_t *src_end_ptr = src_read_ptr + src_len; + uint8_t *dst_buf_start_ptr = dst_buf_ptr; + uint8_t *dst_buf_end_ptr = dst_buf_start_ptr + dst_buf_len; + uint8_t *dst_write_ptr = dst_buf_ptr; + size_t remaining_bytes; + uint8_t src_byte; + uint8_t i; + uint8_t len_code; + + if ((dst_buf_ptr == NULL) || (src_ptr == NULL)) { + result.status = COBS_DECODE_NULL_POINTER; + return result; + } + + if (src_len != 0) { + for (;;) { + len_code = *src_read_ptr++; + if (len_code == 0) { + result.status = (cobs_decode_status)(result.status | (cobs_decode_status)COBS_DECODE_ZERO_BYTE_IN_INPUT); + break; + } + len_code--; + + remaining_bytes = src_end_ptr - src_read_ptr; + if (len_code > remaining_bytes) { + result.status = (cobs_decode_status)(result.status | (cobs_decode_status)COBS_DECODE_INPUT_TOO_SHORT); + len_code = remaining_bytes; + } + + remaining_bytes = dst_buf_end_ptr - dst_write_ptr; + if (len_code > remaining_bytes) { + result.status = (cobs_decode_status)(result.status | (cobs_decode_status)COBS_DECODE_OUT_BUFFER_OVERFLOW); + len_code = remaining_bytes; + } + + for (i = len_code; i != 0; i--) { + src_byte = *src_read_ptr++; + if (src_byte == 0) { + result.status = (cobs_decode_status)(result.status | (cobs_decode_status)COBS_DECODE_ZERO_BYTE_IN_INPUT); + } + *dst_write_ptr++ = src_byte; + } + + if (src_read_ptr >= src_end_ptr) { + break; + } + + if (len_code != 0xFE) { + if (dst_write_ptr >= dst_buf_end_ptr) { + result.status = (cobs_decode_status)(result.status | (cobs_decode_status)COBS_DECODE_OUT_BUFFER_OVERFLOW); + break; + } + *dst_write_ptr++ = 0; + } + } + } + + result.out_len = dst_write_ptr - dst_buf_start_ptr; + + return result; +} + +#endif \ No newline at end of file diff --git a/src/serialization/cobs.h b/src/serialization/cobs.h new file mode 100644 index 000000000..f95e61f62 --- /dev/null +++ b/src/serialization/cobs.h @@ -0,0 +1,75 @@ +#ifndef COBS_H_ +#define COBS_H_ + +#include "configuration.h" + +#ifdef SENSECAP_INDICATOR + +#include +#include + +#define COBS_ENCODE_DST_BUF_LEN_MAX(SRC_LEN) ((SRC_LEN) + (((SRC_LEN) + 253u) / 254u)) +#define COBS_DECODE_DST_BUF_LEN_MAX(SRC_LEN) (((SRC_LEN) == 0) ? 0u : ((SRC_LEN)-1u)) +#define COBS_ENCODE_SRC_OFFSET(SRC_LEN) (((SRC_LEN) + 253u) / 254u) + +typedef enum { + COBS_ENCODE_OK = 0x00, + COBS_ENCODE_NULL_POINTER = 0x01, + COBS_ENCODE_OUT_BUFFER_OVERFLOW = 0x02 +} cobs_encode_status; + +typedef struct { + size_t out_len; + cobs_encode_status status; +} cobs_encode_result; + +typedef enum { + COBS_DECODE_OK = 0x00, + COBS_DECODE_NULL_POINTER = 0x01, + COBS_DECODE_OUT_BUFFER_OVERFLOW = 0x02, + COBS_DECODE_ZERO_BYTE_IN_INPUT = 0x04, + COBS_DECODE_INPUT_TOO_SHORT = 0x08 +} cobs_decode_status; + +typedef struct { + size_t out_len; + cobs_decode_status status; +} cobs_decode_result; + +#ifdef __cplusplus +extern "C" { +#endif + +/* COBS-encode a string of input bytes. + * + * dst_buf_ptr: The buffer into which the result will be written + * dst_buf_len: Length of the buffer into which the result will be written + * src_ptr: The byte string to be encoded + * src_len Length of the byte string to be encoded + * + * returns: A struct containing the success status of the encoding + * operation and the length of the result (that was written to + * dst_buf_ptr) + */ +cobs_encode_result cobs_encode(uint8_t *dst_buf_ptr, size_t dst_buf_len, const uint8_t *src_ptr, size_t src_len); + +/* Decode a COBS byte string. + * + * dst_buf_ptr: The buffer into which the result will be written + * dst_buf_len: Length of the buffer into which the result will be written + * src_ptr: The byte string to be decoded + * src_len Length of the byte string to be decoded + * + * returns: A struct containing the success status of the decoding + * operation and the length of the result (that was written to + * dst_buf_ptr) + */ +cobs_decode_result cobs_decode(uint8_t *dst_buf_ptr, size_t dst_buf_len, const uint8_t *src_ptr, size_t src_len); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SENSECAP_INDICATOR */ + +#endif /* COBS_H_ */ diff --git a/variants/seeed-sensecap-indicator/variant.h b/variants/seeed-sensecap-indicator/variant.h index 6028a3ffa..289fea55b 100644 --- a/variants/seeed-sensecap-indicator/variant.h +++ b/variants/seeed-sensecap-indicator/variant.h @@ -1,6 +1,12 @@ #define I2C_SDA 39 #define I2C_SCL 40 +// This board has a serial coprocessor for sensor readings +#define SENSOR_RP2040_TXD 19 +#define SENSOR_RP2040_RXD 20 +#define SENSOR_PORT_NUM 2 +#define SENSOR_BAUD_RATE 115200 + #define BUTTON_PIN 38 // #define BUTTON_NEED_PULLUP From bfcfca2e462aa238d1c09e1afec73d41e28cb275 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Tue, 31 Dec 2024 11:18:29 +1100 Subject: [PATCH 002/381] add spi_host + missing rotation (#5691) Co-authored-by: mverch67 --- src/graphics/TFTDisplay.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 4f2af670b..4d6c016ed 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -352,7 +352,7 @@ static TFT_eSPI *tft = nullptr; // Invoke library, pins defined in User_Setup.h class LGFX : public lgfx::LGFX_Device { - lgfx::Panel_LCD *_panel_instance; + lgfx::Panel_Device *_panel_instance; lgfx::Bus_SPI _bus_instance; lgfx::ITouch *_touch_instance; @@ -366,10 +366,21 @@ class LGFX : public lgfx::LGFX_Device _panel_instance = new lgfx::Panel_ST7735; else if (settingsMap[displayPanel] == st7735s) _panel_instance = new lgfx::Panel_ST7735S; + else if (settingsMap[displayPanel] == st7796) + _panel_instance = new lgfx::Panel_ST7796; else if (settingsMap[displayPanel] == ili9341) _panel_instance = new lgfx::Panel_ILI9341; else if (settingsMap[displayPanel] == ili9342) _panel_instance = new lgfx::Panel_ILI9342; + else if (settingsMap[displayPanel] == ili9488) + _panel_instance = new lgfx::Panel_ILI9488; + else if (settingsMap[displayPanel] == hx8357d) + _panel_instance = new lgfx::Panel_HX8357D; + else { + _panel_instance = new lgfx::Panel_NULL; + LOG_ERROR("Unknown display panel configured!\n"); + } + auto buscfg = _bus_instance.config(); buscfg.spi_mode = 0; buscfg.spi_host = settingsMap[displayspidev]; @@ -383,12 +394,12 @@ class LGFX : public lgfx::LGFX_Device LOG_DEBUG("Height: %d, Width: %d ", settingsMap[displayHeight], settingsMap[displayWidth]); cfg.pin_cs = settingsMap[displayCS]; // Pin number where CS is connected (-1 = disable) cfg.pin_rst = settingsMap[displayReset]; - cfg.panel_width = settingsMap[displayWidth]; // actual displayable width - cfg.panel_height = settingsMap[displayHeight]; // actual displayable height - cfg.offset_x = settingsMap[displayOffsetX]; // Panel offset amount in X direction - cfg.offset_y = settingsMap[displayOffsetY]; // Panel offset amount in Y direction - cfg.offset_rotation = 0; // Rotation direction value offset 0~7 (4~7 is mirrored) - cfg.invert = settingsMap[displayInvert]; // Set to true if the light/darkness of the panel is reversed + cfg.panel_width = settingsMap[displayWidth]; // actual displayable width + cfg.panel_height = settingsMap[displayHeight]; // actual displayable height + cfg.offset_x = settingsMap[displayOffsetX]; // Panel offset amount in X direction + cfg.offset_y = settingsMap[displayOffsetY]; // Panel offset amount in Y direction + cfg.offset_rotation = settingsMap[displayOffsetRotate]; // Rotation direction value offset 0~7 (4~7 is mirrored) + cfg.invert = settingsMap[displayInvert]; // Set to true if the light/darkness of the panel is reversed _panel_instance->config(cfg); @@ -410,7 +421,7 @@ class LGFX : public lgfx::LGFX_Device touch_cfg.y_max = settingsMap[displayWidth] - 1; touch_cfg.pin_int = settingsMap[touchscreenIRQ]; touch_cfg.bus_shared = true; - touch_cfg.offset_rotation = 1; + touch_cfg.offset_rotation = settingsMap[touchscreenRotate]; if (settingsMap[touchscreenI2CAddr] != -1) { touch_cfg.i2c_addr = settingsMap[touchscreenI2CAddr]; } else { From f9e71c3fb9ea5afc5bfe62494803e0177c32c369 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Tue, 31 Dec 2024 12:01:21 +1100 Subject: [PATCH 003/381] Remove an \n (#5703) --- src/graphics/TFTDisplay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 4d6c016ed..c5187cffc 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -378,7 +378,7 @@ class LGFX : public lgfx::LGFX_Device _panel_instance = new lgfx::Panel_HX8357D; else { _panel_instance = new lgfx::Panel_NULL; - LOG_ERROR("Unknown display panel configured!\n"); + LOG_ERROR("Unknown display panel configured!"); } auto buscfg = _bus_instance.config(); From d1e5be515a63ea16dc21a690070d699ded3f61e1 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Tue, 31 Dec 2024 13:00:37 +1100 Subject: [PATCH 004/381] cherry-pick: disable BT when TFT in use (#5705) * disable BT when TFT in use * add comment BT disable --------- Co-authored-by: mverch67 --- src/mesh/NodeDB.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 9dbe92b7c..994e59d35 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -409,6 +409,13 @@ bool NodeDB::resetRadioConfig(bool factory_reset) rebootAtMsec = millis() + (5 * 1000); } +#if (defined(T_DECK) || defined(T_WATCH_S3) || defined(UNPHONE) || defined(PICOMPUTER_S3)) && defined(HAS_TFT) + // as long as PhoneAPI shares BT and TFT app switch BT off + config.bluetooth.enabled = false; + if (moduleConfig.external_notification.nag_timeout == 60) + moduleConfig.external_notification.nag_timeout = 0; +#endif + return didFactoryReset; } From 58ebd5bcdb02a1935238f6005d3c65a32209549d Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Tue, 31 Dec 2024 00:46:03 -0600 Subject: [PATCH 005/381] Actually use the MAC address from a ch341 (#5704) Co-authored-by: Tom Fifield --- src/platform/portduino/PortduinoGlue.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index 0c981bf16..b020f5991 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -231,6 +232,9 @@ void portduinoSetup() dmac[3] = hash[3]; dmac[4] = hash[4]; dmac[5] = hash[5]; + std::stringstream mactmp; + mactmp << std::hex << +dmac[0] << +dmac[1] << +dmac[2] << +dmac[3] << +dmac[4] << +dmac[5]; + settingsStrings[mac_address] = mactmp.str(); } } From 9af8c58c4075ab0d9d1342c4a87c8ebd11b81c1b Mon Sep 17 00:00:00 2001 From: Bernd Giesecke Date: Tue, 31 Dec 2024 20:36:49 +0800 Subject: [PATCH 006/381] Add Ethernet RAK13800 support to RAK11310 (#5707) --- platformio.ini | 3 ++- src/mesh/eth/ethClient.cpp | 11 +++++++++++ variants/rak11310/pins_arduino.h | 18 +++++++++--------- variants/rak11310/platformio.ini | 5 ++++- variants/rak11310/variant.h | 15 +++++++++++---- 5 files changed, 37 insertions(+), 15 deletions(-) diff --git a/platformio.ini b/platformio.ini index bf50b7646..3129decaa 100644 --- a/platformio.ini +++ b/platformio.ini @@ -30,6 +30,7 @@ default_envs = tbeam ;default_envs = rak4631 ;default_envs = rak4631_eth_gw ;default_envs = rak2560 +;default_envs = rak11310 ;default_envs = rak_wismeshtap ;default_envs = wio-e5 ;default_envs = radiomaster_900_bandit_nano @@ -164,4 +165,4 @@ lib_deps = robtillaart/INA226@0.6.0 ; Health Sensor Libraries - sparkfun/SparkFun MAX3010x Pulse and Proximity Sensor Library@1.1.2 \ No newline at end of file + sparkfun/SparkFun MAX3010x Pulse and Proximity Sensor Library@1.1.2 diff --git a/src/mesh/eth/ethClient.cpp b/src/mesh/eth/ethClient.cpp index 3b4d716f5..08ecb7ce8 100644 --- a/src/mesh/eth/ethClient.cpp +++ b/src/mesh/eth/ethClient.cpp @@ -107,6 +107,11 @@ static int32_t reconnectETH() bool initEthernet() { if (config.network.eth_enabled) { +#ifdef PIN_ETH_POWER_EN + pinMode(PIN_ETH_POWER_EN, OUTPUT); + digitalWrite(PIN_ETH_POWER_EN, HIGH); // Power up. + delay(100); +#endif #ifdef PIN_ETHERNET_RESET pinMode(PIN_ETHERNET_RESET, OUTPUT); @@ -115,6 +120,12 @@ bool initEthernet() digitalWrite(PIN_ETHERNET_RESET, HIGH); // Reset Time. #endif +#ifdef RAK11310 // Initialize the SPI port + ETH_SPI_PORT.setSCK(PIN_SPI0_SCK); + ETH_SPI_PORT.setTX(PIN_SPI0_MOSI); + ETH_SPI_PORT.setRX(PIN_SPI0_MISO); + ETH_SPI_PORT.begin(); +#endif Ethernet.init(ETH_SPI_PORT, PIN_ETHERNET_SS); uint8_t mac[6]; diff --git a/variants/rak11310/pins_arduino.h b/variants/rak11310/pins_arduino.h index 626bed1da..0e2808b19 100644 --- a/variants/rak11310/pins_arduino.h +++ b/variants/rak11310/pins_arduino.h @@ -38,15 +38,15 @@ static const uint8_t A3 = PIN_A3; #define PIN_SERIAL2_RX (5ul) // SPI -#define PIN_SPI0_MISO (12u) -#define PIN_SPI0_MOSI (11u) -#define PIN_SPI0_SCK (10u) -#define PIN_SPI0_SS (13u) +#define PIN_SPI1_MISO (12u) +#define PIN_SPI1_MOSI (11u) +#define PIN_SPI1_SCK (10u) +#define PIN_SPI1_SS (13u) -#define PIN_SPI1_MISO (16u) -#define PIN_SPI1_MOSI (19u) -#define PIN_SPI1_SCK (18u) -#define PIN_SPI1_SS (17u) +#define PIN_SPI0_MISO (16u) +#define PIN_SPI0_MOSI (19u) +#define PIN_SPI0_SCK (18u) +#define PIN_SPI0_SS (17u) // Wire #define PIN_WIRE0_SDA (2u) @@ -65,4 +65,4 @@ static const uint8_t MISO = PIN_SPI0_MISO; static const uint8_t SCK = PIN_SPI0_SCK; static const uint8_t SDA = PIN_WIRE0_SDA; -static const uint8_t SCL = PIN_WIRE0_SCL; \ No newline at end of file +static const uint8_t SCL = PIN_WIRE0_SCL; diff --git a/variants/rak11310/platformio.ini b/variants/rak11310/platformio.ini index 923cedaa3..0cc60bc7c 100644 --- a/variants/rak11310/platformio.ini +++ b/variants/rak11310/platformio.ini @@ -12,7 +12,10 @@ build_flags = ${rp2040_base.build_flags} -Ivariants/rak11310 -DDEBUG_RP2040_PORT=Serial -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" +build_src_filter = ${rp2040_base.build_src_filter} +<../variants/rak11310> + + + lib_deps = ${rp2040_base.lib_deps} + ${networking_base.lib_deps} + https://github.com/RAKWireless/RAK13800-W5100S.git#1.0.2 debug_build_flags = ${rp2040_base.build_flags}, -g -debug_tool = cmsis-dap ; for e.g. Picotool \ No newline at end of file +debug_tool = cmsis-dap ; for e.g. Picotool diff --git a/variants/rak11310/variant.h b/variants/rak11310/variant.h index 54e403ee7..bc8d2d71b 100644 --- a/variants/rak11310/variant.h +++ b/variants/rak11310/variant.h @@ -28,10 +28,10 @@ // RAK BSP somehow uses SPI1 instead of SPI0 #define HW_SPI1_DEVICE -#define LORA_SCK PIN_SPI0_SCK -#define LORA_MOSI PIN_SPI0_MOSI -#define LORA_MISO PIN_SPI0_MISO -#define LORA_CS PIN_SPI0_SS +#define LORA_SCK (10u) +#define LORA_MOSI (11u) +#define LORA_MISO (12u) +#define LORA_CS (13u) #define LORA_DIO0 RADIOLIB_NC #define LORA_RESET 14 @@ -49,3 +49,10 @@ #define SX126X_DIO2_AS_RF_SWITCH #define SX126X_DIO3_TCXO_VOLTAGE 1.8 #endif + +#define HAS_ETHERNET 1 +#define PIN_ETHERNET_RESET 7 // IO3 +#define PIN_ETHERNET_SS 17 +#define ETH_SPI_PORT SPI + +#define PIN_ETH_POWER_EN 22 From 8b34c4ff05eb5ce63e95a2dee671bfacc45bbca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 31 Dec 2024 15:58:59 +0100 Subject: [PATCH 007/381] fix misc cppcheck things and compile time warnings (#5710) --- src/mesh/NodeDB.cpp | 13 +++--- .../Telemetry/Sensor/CGRadSensSensor.cpp | 3 +- .../Telemetry/Sensor/IndicatorSensor.cpp | 15 ++++--- src/platform/portduino/USBHal.h | 2 +- src/serialization/MeshPacketSerializer.cpp | 2 + src/serialization/MeshPacketSerializer.h | 1 - src/serialization/cobs.cpp | 40 +++++++++---------- src/sleep.cpp | 7 ++++ 8 files changed, 45 insertions(+), 38 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 994e59d35..bbc9eb1ea 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -992,8 +992,11 @@ void NodeDB::loadFromDisk() // Make sure we load hard coded admin keys even when the configuration file has none. // Initialize admin_key_count to zero byte numAdminKeys = 0; +#if defined(USERPREFS_USE_ADMIN_KEY_0) || defined(USERPREFS_USE_ADMIN_KEY_1) || defined(USERPREFS_USE_ADMIN_KEY_2) uint16_t sum = 0; +#endif #ifdef USERPREFS_USE_ADMIN_KEY_0 + for (uint8_t b = 0; b < 32; b++) { sum += config.security.admin_key[0].bytes[b]; } @@ -1002,8 +1005,6 @@ void NodeDB::loadFromDisk() LOG_INFO("Admin 0 key zero. Loading hard coded key from user preferences."); memcpy(config.security.admin_key[0].bytes, userprefs_admin_key_0, 32); config.security.admin_key[0].size = 32; - config.security.admin_key_count = numAdminKeys; - saveToDisk(SEGMENT_CONFIG); } #endif @@ -1017,8 +1018,6 @@ void NodeDB::loadFromDisk() LOG_INFO("Admin 1 key zero. Loading hard coded key from user preferences."); memcpy(config.security.admin_key[1].bytes, userprefs_admin_key_1, 32); config.security.admin_key[1].size = 32; - config.security.admin_key_count = numAdminKeys; - saveToDisk(SEGMENT_CONFIG); } #endif @@ -1032,10 +1031,14 @@ void NodeDB::loadFromDisk() LOG_INFO("Admin 2 key zero. Loading hard coded key from user preferences."); memcpy(config.security.admin_key[2].bytes, userprefs_admin_key_2, 32); config.security.admin_key[2].size = 32; + } +#endif + + if (numAdminKeys > 0) { + LOG_INFO("Saving %d hard coded admin keys.", numAdminKeys); config.security.admin_key_count = numAdminKeys; saveToDisk(SEGMENT_CONFIG); } -#endif state = loadProto(moduleConfigFileName, meshtastic_LocalModuleConfig_size, sizeof(meshtastic_LocalModuleConfig), &meshtastic_LocalModuleConfig_msg, &moduleConfig); diff --git a/src/modules/Telemetry/Sensor/CGRadSensSensor.cpp b/src/modules/Telemetry/Sensor/CGRadSensSensor.cpp index 5e69cc22f..ac5df1b81 100644 --- a/src/modules/Telemetry/Sensor/CGRadSensSensor.cpp +++ b/src/modules/Telemetry/Sensor/CGRadSensSensor.cpp @@ -41,13 +41,12 @@ void CGRadSensSensor::begin(TwoWire *wire, uint8_t addr) float CGRadSensSensor::getStaticRadiation() { // Read a register, following the same pattern as the RCWL9620Sensor - uint32_t data; _wire->beginTransmission(_addr); // Transfer data to addr. _wire->write(0x06); // Radiation intensity (static period T = 500 sec) if (_wire->endTransmission() == 0) { if (_wire->requestFrom(_addr, (uint8_t)3)) { ; // Request 3 bytes - data = _wire->read(); + uint32_t data = _wire->read(); data <<= 8; data |= _wire->read(); data <<= 8; diff --git a/src/modules/Telemetry/Sensor/IndicatorSensor.cpp b/src/modules/Telemetry/Sensor/IndicatorSensor.cpp index f3dcd1727..317357137 100644 --- a/src/modules/Telemetry/Sensor/IndicatorSensor.cpp +++ b/src/modules/Telemetry/Sensor/IndicatorSensor.cpp @@ -35,8 +35,8 @@ enum sensor_pkt_type { static int cmd_send(uint8_t cmd, const char *p_data, uint8_t len) { - uint8_t buf[32] = {0}; - uint8_t data[32] = {0}; + uint8_t send_buf[32] = {0}; + uint8_t send_data[32] = {0}; if (len > 31) { return -1; @@ -44,18 +44,18 @@ static int cmd_send(uint8_t cmd, const char *p_data, uint8_t len) uint8_t index = 1; - data[0] = cmd; + send_data[0] = cmd; if (len > 0 && p_data != NULL) { - memcpy(&data[1], p_data, len); + memcpy(&send_data[1], p_data, len); index += len; } - cobs_encode_result ret = cobs_encode(buf, sizeof(buf), data, index); + cobs_encode_result ret = cobs_encode(send_buf, sizeof(send_buf), send_data, index); // LOG_DEBUG("cobs TX status:%d, len:%d, type 0x%x", ret.status, ret.out_len, cmd); if (ret.status == COBS_ENCODE_OK) { - return uart_write_bytes(SENSOR_PORT_NUM, buf, ret.out_len + 1); + return uart_write_bytes(SENSOR_PORT_NUM, send_buf, ret.out_len + 1); } return -1; @@ -96,7 +96,6 @@ bool IndicatorSensor::getMetrics(meshtastic_Telemetry *measurement) int len = uart_read_bytes(SENSOR_PORT_NUM, buf, (SENSOR_BUF_SIZE - 1), 100 / portTICK_PERIOD_MS); float value = 0.0; - uint8_t pkt_type = 0; uint8_t *p_buf_start = buf; uint8_t *p_buf_end = buf; if (len > 0) { @@ -117,7 +116,7 @@ bool IndicatorSensor::getMetrics(meshtastic_Telemetry *measurement) if (ret.out_len > 1 && ret.status == COBS_DECODE_OK) { value = 0.0; - pkt_type = data[0]; + uint8_t pkt_type = data[0]; switch (pkt_type) { case PKT_TYPE_SENSOR_SCD41_CO2: { memcpy(&value, &data[1], sizeof(value)); diff --git a/src/platform/portduino/USBHal.h b/src/platform/portduino/USBHal.h index 2b0302ced..064f7ae36 100644 --- a/src/platform/portduino/USBHal.h +++ b/src/platform/portduino/USBHal.h @@ -26,7 +26,7 @@ class Ch341Hal : public RadioLibHal { public: // default constructor - initializes the base HAL and any needed private members - Ch341Hal(uint8_t spiChannel, uint32_t spiSpeed = 2000000, uint8_t spiDevice = 0, uint8_t gpioDevice = 0) + explicit Ch341Hal(uint8_t spiChannel, uint32_t spiSpeed = 2000000, uint8_t spiDevice = 0, uint8_t gpioDevice = 0) : RadioLibHal(PI_INPUT, PI_OUTPUT, PI_LOW, PI_HIGH, PI_RISING, PI_FALLING) { } diff --git a/src/serialization/MeshPacketSerializer.cpp b/src/serialization/MeshPacketSerializer.cpp index b4603186b..2f0d881f2 100644 --- a/src/serialization/MeshPacketSerializer.cpp +++ b/src/serialization/MeshPacketSerializer.cpp @@ -13,6 +13,8 @@ #include "mesh/generated/meshtastic/remote_hardware.pb.h" #include +static const char *errStr = "Error decoding proto for %s message!"; + std::string MeshPacketSerializer::JsonSerialize(const meshtastic_MeshPacket *mp, bool shouldLog) { // the created jsonObj is immutable after creation, so diff --git a/src/serialization/MeshPacketSerializer.h b/src/serialization/MeshPacketSerializer.h index 12efccb43..03860ab35 100644 --- a/src/serialization/MeshPacketSerializer.h +++ b/src/serialization/MeshPacketSerializer.h @@ -2,7 +2,6 @@ #include static const char hexChars[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; -static const char *errStr = "Error decoding proto for %s message!"; class MeshPacketSerializer { diff --git a/src/serialization/cobs.cpp b/src/serialization/cobs.cpp index 39ea019fd..afb868f50 100644 --- a/src/serialization/cobs.cpp +++ b/src/serialization/cobs.cpp @@ -5,21 +5,22 @@ cobs_encode_result cobs_encode(uint8_t *dst_buf_ptr, size_t dst_buf_len, const uint8_t *src_ptr, size_t src_len) { + cobs_encode_result result = {0, COBS_ENCODE_OK}; + + if (!dst_buf_ptr || !src_ptr) { + result.status = COBS_ENCODE_NULL_POINTER; + return result; + } + const uint8_t *src_read_ptr = src_ptr; const uint8_t *src_end_ptr = src_read_ptr + src_len; uint8_t *dst_buf_start_ptr = dst_buf_ptr; uint8_t *dst_buf_end_ptr = dst_buf_start_ptr + dst_buf_len; uint8_t *dst_code_write_ptr = dst_buf_ptr; uint8_t *dst_write_ptr = dst_code_write_ptr + 1; - uint8_t src_byte = 0; uint8_t search_len = 1; - if ((dst_buf_ptr == NULL) || (src_ptr == NULL)) { - result.status = COBS_ENCODE_NULL_POINTER; - return result; - } - if (src_len != 0) { for (;;) { if (dst_write_ptr >= dst_buf_end_ptr) { @@ -27,7 +28,7 @@ cobs_encode_result cobs_encode(uint8_t *dst_buf_ptr, size_t dst_buf_len, const u break; } - src_byte = *src_read_ptr++; + uint8_t src_byte = *src_read_ptr++; if (src_byte == 0) { *dst_code_write_ptr = search_len; dst_code_write_ptr = dst_write_ptr++; @@ -65,31 +66,28 @@ cobs_encode_result cobs_encode(uint8_t *dst_buf_ptr, size_t dst_buf_len, const u cobs_decode_result cobs_decode(uint8_t *dst_buf_ptr, size_t dst_buf_len, const uint8_t *src_ptr, size_t src_len) { cobs_decode_result result = {0, COBS_DECODE_OK}; - const uint8_t *src_read_ptr = src_ptr; - const uint8_t *src_end_ptr = src_read_ptr + src_len; - uint8_t *dst_buf_start_ptr = dst_buf_ptr; - uint8_t *dst_buf_end_ptr = dst_buf_start_ptr + dst_buf_len; - uint8_t *dst_write_ptr = dst_buf_ptr; - size_t remaining_bytes; - uint8_t src_byte; - uint8_t i; - uint8_t len_code; - if ((dst_buf_ptr == NULL) || (src_ptr == NULL)) { + if (!dst_buf_ptr || !src_ptr) { result.status = COBS_DECODE_NULL_POINTER; return result; } + const uint8_t *src_read_ptr = src_ptr; + const uint8_t *src_end_ptr = src_read_ptr + src_len; + uint8_t *dst_buf_start_ptr = dst_buf_ptr; + const uint8_t *dst_buf_end_ptr = dst_buf_start_ptr + dst_buf_len; + uint8_t *dst_write_ptr = dst_buf_ptr; + if (src_len != 0) { for (;;) { - len_code = *src_read_ptr++; + uint8_t len_code = *src_read_ptr++; if (len_code == 0) { result.status = (cobs_decode_status)(result.status | (cobs_decode_status)COBS_DECODE_ZERO_BYTE_IN_INPUT); break; } len_code--; - remaining_bytes = src_end_ptr - src_read_ptr; + size_t remaining_bytes = src_end_ptr - src_read_ptr; if (len_code > remaining_bytes) { result.status = (cobs_decode_status)(result.status | (cobs_decode_status)COBS_DECODE_INPUT_TOO_SHORT); len_code = remaining_bytes; @@ -101,8 +99,8 @@ cobs_decode_result cobs_decode(uint8_t *dst_buf_ptr, size_t dst_buf_len, const u len_code = remaining_bytes; } - for (i = len_code; i != 0; i--) { - src_byte = *src_read_ptr++; + for (uint8_t i = len_code; i != 0; i--) { + uint8_t src_byte = *src_read_ptr++; if (src_byte == 0) { result.status = (cobs_decode_status)(result.status | (cobs_decode_status)COBS_DECODE_ZERO_BYTE_IN_INPUT); } diff --git a/src/sleep.cpp b/src/sleep.cpp index 69eb0349a..5f1909a77 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -271,6 +271,12 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false, bool skipSaveN gpio_hold_en((gpio_num_t)BUTTON_PIN); } #endif +#ifdef SENSECAP_INDICATOR + // Portexpander definition does not pass GPIO_IS_VALID_OUTPUT_GPIO + pinMode(LORA_CS, OUTPUT); + digitalWrite(LORA_CS, HIGH); + gpio_hold_en((gpio_num_t)LORA_CS); +#else if (GPIO_IS_VALID_OUTPUT_GPIO(LORA_CS)) { // LoRa CS (RADIO_NSS) needs to stay HIGH, even during deep sleep pinMode(LORA_CS, OUTPUT); @@ -278,6 +284,7 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false, bool skipSaveN gpio_hold_en((gpio_num_t)LORA_CS); } #endif +#endif #ifdef HAS_PMU if (pmu_found && PMU) { From fdcc0e12aa17673d7f2838c22ee8faab0a530f31 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Wed, 1 Jan 2025 03:15:01 +1100 Subject: [PATCH 008/381] Minor TFT branch synch (#5706) --- src/graphics/Screen.cpp | 4 ++-- src/modules/CannedMessageModule.cpp | 2 ++ src/sleep.cpp | 5 ++++- variants/seeed-sensecap-indicator/platformio.ini | 4 ++-- variants/seeed-sensecap-indicator/variant.h | 3 +-- variants/t-deck/platformio.ini | 4 ++-- variants/t-deck/variant.h | 6 ++++-- 7 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 31647c92d..198dcc235 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1506,7 +1506,7 @@ Screen::Screen(ScanI2C::DeviceAddress address, meshtastic_Config_DisplayConfig_O #elif defined(USE_ST7567) dispdev = new ST7567Wire(address.address, -1, -1, geometry, (address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE); -#elif ARCH_PORTDUINO +#elif ARCH_PORTDUINO && !HAS_TFT if (settingsMap[displayPanel] != no_screen) { LOG_DEBUG("Make TFTDisplay!"); dispdev = new TFTDisplay(address.address, -1, -1, geometry, @@ -2756,4 +2756,4 @@ int Screen::handleAdminMessage(const meshtastic_AdminMessage *arg) } // namespace graphics #else graphics::Screen::Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY) {} -#endif // HAS_SCREEN \ No newline at end of file +#endif // HAS_SCREEN diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index a96fcc080..c20b7b56e 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -982,6 +982,7 @@ bool CannedMessageModule::interceptingKeyboardInput() } } +#if !HAS_TFT void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) { char buffer[50]; @@ -1140,6 +1141,7 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st } } } +#endif //! HAS_TFT ProcessMessage CannedMessageModule::handleReceived(const meshtastic_MeshPacket &mp) { diff --git a/src/sleep.cpp b/src/sleep.cpp index 5f1909a77..161b6e107 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -58,7 +58,7 @@ RTC_DATA_ATTR int bootCount = 0; */ void setCPUFast(bool on) { -#if defined(ARCH_ESP32) && HAS_WIFI +#if defined(ARCH_ESP32) && HAS_WIFI && !HAS_TFT if (isWifiAvailable()) { /* @@ -391,6 +391,9 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r gpio_wakeup_enable(pin, GPIO_INTR_LOW_LEVEL); esp_sleep_enable_gpio_wakeup(); #endif +#ifdef INPUTDRIVER_ENCODER_BTN + gpio_wakeup_enable((gpio_num_t)INPUTDRIVER_ENCODER_BTN, GPIO_INTR_LOW_LEVEL); +#endif #ifdef T_WATCH_S3 gpio_wakeup_enable((gpio_num_t)SCREEN_TOUCH_INT, GPIO_INTR_LOW_LEVEL); #endif diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 86d6d0412..1b64ed6e1 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -24,5 +24,5 @@ build_flags = ${esp32_base.build_flags} lib_deps = ${esp32s3_base.lib_deps} https://github.com/mverch67/LovyanGFX#develop - earlephilhower/ESP8266Audio@^1.9.7 - earlephilhower/ESP8266SAM@^1.0.1 \ No newline at end of file + earlephilhower/ESP8266Audio@^1.9.9 + earlephilhower/ESP8266SAM@^1.0.1 diff --git a/variants/seeed-sensecap-indicator/variant.h b/variants/seeed-sensecap-indicator/variant.h index 289fea55b..29d547be3 100644 --- a/variants/seeed-sensecap-indicator/variant.h +++ b/variants/seeed-sensecap-indicator/variant.h @@ -25,8 +25,7 @@ #define ST7701_BL 45 #define ST7701_SPI_HOST SPI2_HOST #define ST7701_BACKLIGHT_EN 45 -#define SPI_FREQUENCY 20000000 -#define SPI_READ_FREQUENCY 16000000 +#define SPI_FREQUENCY 12000000 #define TFT_HEIGHT 480 #define TFT_WIDTH 480 #define TFT_OFFSET_X 0 diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 16769e2f2..d2f09f50b 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -6,7 +6,7 @@ board_check = true upload_protocol = esptool #upload_port = COM29 -build_flags = ${esp32_base.build_flags} +build_flags = ${esp32s3_base.build_flags} -DT_DECK -DBOARD_HAS_PSRAM -DMAX_THREADS=40 @@ -16,4 +16,4 @@ build_flags = ${esp32_base.build_flags} lib_deps = ${esp32s3_base.lib_deps} lovyan03/LovyanGFX@^1.1.9 earlephilhower/ESP8266Audio@^1.9.9 - earlephilhower/ESP8266SAM@^1.0.1 \ No newline at end of file + earlephilhower/ESP8266SAM@^1.0.1 diff --git a/variants/t-deck/variant.h b/variants/t-deck/variant.h index 91c12ab3d..4aeeb7ca8 100644 --- a/variants/t-deck/variant.h +++ b/variants/t-deck/variant.h @@ -27,8 +27,10 @@ #define SLEEP_TIME 120 +#ifndef HAS_TFT #define BUTTON_PIN 0 // #define BUTTON_NEED_PULLUP +#endif #define GPS_DEFAULT_NOT_PRESENT 1 #define GPS_RX_PIN 44 #define GPS_TX_PIN 43 @@ -60,7 +62,7 @@ #define TB_DOWN 15 #define TB_LEFT 1 #define TB_RIGHT 2 -#define TB_PRESS BUTTON_PIN +#define TB_PRESS 0 // BUTTON_PIN // microphone #define ES7210_SCK 47 @@ -98,4 +100,4 @@ #define SX126X_DIO2_AS_RF_SWITCH #define SX126X_DIO3_TCXO_VOLTAGE 1.8 // Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface -// code) \ No newline at end of file +// code) From 9abd07bb0535d67ad807800aba854f11aaf61395 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Tue, 31 Dec 2024 16:06:38 -0600 Subject: [PATCH 009/381] Set ch341 MAD Address via sprintf formatting (#5713) --- src/platform/portduino/PortduinoGlue.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index b020f5991..b042510f5 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include @@ -232,9 +231,9 @@ void portduinoSetup() dmac[3] = hash[3]; dmac[4] = hash[4]; dmac[5] = hash[5]; - std::stringstream mactmp; - mactmp << std::hex << +dmac[0] << +dmac[1] << +dmac[2] << +dmac[3] << +dmac[4] << +dmac[5]; - settingsStrings[mac_address] = mactmp.str(); + char macBuf[13] = {0}; + sprintf(macBuf, "%02X%02X%02X%02X%02X%02X", dmac[0], dmac[1], dmac[2], dmac[3], dmac[4], dmac[5]); + settingsStrings[mac_address] = macBuf; } } @@ -244,7 +243,7 @@ void portduinoSetup() std::cout << "Please set a MAC Address in config.yaml using either MACAddress or MACAddressSource." << std::endl; exit(EXIT_FAILURE); } - std::cout << "MAC Address: " << std::hex << +dmac[0] << +dmac[1] << +dmac[2] << +dmac[3] << +dmac[4] << +dmac[5] << std::endl; + printf("MAC ADDRESS: %02X:%02X:%02X:%02X:%02X:%02X\n", dmac[0], dmac[1], dmac[2], dmac[3], dmac[4], dmac[5]); // Rather important to set this, if not running simulated. randomSeed(time(NULL)); From c2c06ed0adb3f779d88ab6f812a380d848c72c75 Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Wed, 1 Jan 2025 16:40:14 -0800 Subject: [PATCH 010/381] Move DecodedServiceEnvelope into its own file (#5715) --- src/mqtt/MQTT.cpp | 19 +------------------ src/mqtt/ServiceEnvelope.cpp | 23 +++++++++++++++++++++++ src/mqtt/ServiceEnvelope.h | 13 +++++++++++++ 3 files changed, 37 insertions(+), 18 deletions(-) create mode 100644 src/mqtt/ServiceEnvelope.cpp create mode 100644 src/mqtt/ServiceEnvelope.h diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 4260ae201..5141af560 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -2,6 +2,7 @@ #include "MeshService.h" #include "NodeDB.h" #include "PowerFSM.h" +#include "ServiceEnvelope.h" #include "configuration.h" #include "main.h" #include "mesh/Channels.h" @@ -25,7 +26,6 @@ #endif #include #include -#include #include #include @@ -47,23 +47,6 @@ static uint8_t bytes[meshtastic_MqttClientProxyMessage_size + 30]; // 12 for cha static bool isMqttServerAddressPrivate = false; -// meshtastic_ServiceEnvelope that automatically releases dynamically allocated memory when it goes out of scope. -struct DecodedServiceEnvelope : public meshtastic_ServiceEnvelope { - DecodedServiceEnvelope() = delete; - DecodedServiceEnvelope(const uint8_t *payload, size_t length) - : meshtastic_ServiceEnvelope(meshtastic_ServiceEnvelope_init_default), - validDecode(pb_decode_from_bytes(payload, length, &meshtastic_ServiceEnvelope_msg, this)) - { - } - ~DecodedServiceEnvelope() - { - if (validDecode) - pb_release(&meshtastic_ServiceEnvelope_msg, this); - } - // Clients must check that this is true before using. - const bool validDecode; -}; - inline void onReceiveProto(char *topic, byte *payload, size_t length) { const DecodedServiceEnvelope e(payload, length); diff --git a/src/mqtt/ServiceEnvelope.cpp b/src/mqtt/ServiceEnvelope.cpp new file mode 100644 index 000000000..ee55f22f6 --- /dev/null +++ b/src/mqtt/ServiceEnvelope.cpp @@ -0,0 +1,23 @@ +#include "ServiceEnvelope.h" +#include "mesh-pb-constants.h" +#include + +DecodedServiceEnvelope::DecodedServiceEnvelope(const uint8_t *payload, size_t length) + : meshtastic_ServiceEnvelope(meshtastic_ServiceEnvelope_init_default), + validDecode(pb_decode_from_bytes(payload, length, &meshtastic_ServiceEnvelope_msg, this)) +{ +} + +DecodedServiceEnvelope::DecodedServiceEnvelope(DecodedServiceEnvelope &&other) + : meshtastic_ServiceEnvelope(meshtastic_ServiceEnvelope_init_zero), validDecode(other.validDecode) +{ + std::swap(packet, other.packet); + std::swap(channel_id, other.channel_id); + std::swap(gateway_id, other.gateway_id); +} + +DecodedServiceEnvelope::~DecodedServiceEnvelope() +{ + if (validDecode) + pb_release(&meshtastic_ServiceEnvelope_msg, this); +} \ No newline at end of file diff --git a/src/mqtt/ServiceEnvelope.h b/src/mqtt/ServiceEnvelope.h new file mode 100644 index 000000000..6ab0695db --- /dev/null +++ b/src/mqtt/ServiceEnvelope.h @@ -0,0 +1,13 @@ +#pragma once + +#include "mesh/generated/meshtastic/mqtt.pb.h" + +// meshtastic_ServiceEnvelope that automatically releases dynamically allocated memory when it goes out of scope. +struct DecodedServiceEnvelope : public meshtastic_ServiceEnvelope { + DecodedServiceEnvelope(const uint8_t *payload, size_t length); + DecodedServiceEnvelope(DecodedServiceEnvelope &) = delete; + DecodedServiceEnvelope(DecodedServiceEnvelope &&); + ~DecodedServiceEnvelope(); + // Clients must check that this is true before using. + const bool validDecode; +}; \ No newline at end of file From 9f32995d7fcf96384dc01b5b953772327a600e97 Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Wed, 1 Jan 2025 17:25:01 -0800 Subject: [PATCH 011/381] Implement MeshModule destructor (#5714) --- src/mesh/MeshModule.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mesh/MeshModule.cpp b/src/mesh/MeshModule.cpp index 9de54ade5..2f2863fa5 100644 --- a/src/mesh/MeshModule.cpp +++ b/src/mesh/MeshModule.cpp @@ -4,6 +4,7 @@ #include "NodeDB.h" #include "configuration.h" #include "modules/RoutingModule.h" +#include #include std::vector *MeshModule::modules; @@ -29,7 +30,9 @@ void MeshModule::setup() {} MeshModule::~MeshModule() { - assert(0); // FIXME - remove from list of modules once someone needs this feature + auto it = std::find(modules->begin(), modules->end(), this); + assert(it != modules->end()); + modules->erase(it); } meshtastic_MeshPacket *MeshModule::allocAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, From 183f68ba0005e9bfeb4423681693b225d28a5f6d Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Wed, 1 Jan 2025 17:26:12 -0800 Subject: [PATCH 012/381] Run tests as part of the main CI (#5712) * Create an shared action to install native dependecies * Create a workflow for running native tests * Artifact names contain version * Add test-native to main_matrix.yml * No permission are required for test_native.yml * Add permissions for dorny/test-reporter * No permissions when running tests * s/Generate Reports/Generate Test Reports/ --- .github/actions/setup-native/action.yml | 14 +++ .github/workflows/build_native.yml | 20 +--- .github/workflows/main_matrix.yml | 3 + .github/workflows/test_native.yml | 153 ++++++++++++++++++++++++ .github/workflows/tests.yml | 75 +----------- 5 files changed, 175 insertions(+), 90 deletions(-) create mode 100644 .github/actions/setup-native/action.yml create mode 100644 .github/workflows/test_native.yml diff --git a/.github/actions/setup-native/action.yml b/.github/actions/setup-native/action.yml new file mode 100644 index 000000000..36c95d943 --- /dev/null +++ b/.github/actions/setup-native/action.yml @@ -0,0 +1,14 @@ +name: Setup native build +description: Install libraries needed for building the Native/Portduino build + +runs: + using: composite + steps: + - name: Setup base + id: base + uses: ./.github/actions/setup-base + + - name: Install libs needed for native build + shell: bash + run: | + sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev libusb-1.0-0-dev libi2c-dev diff --git a/.github/workflows/build_native.yml b/.github/workflows/build_native.yml index 74bc074aa..11ba09ad7 100644 --- a/.github/workflows/build_native.yml +++ b/.github/workflows/build_native.yml @@ -10,12 +10,6 @@ jobs: build-native: runs-on: ubuntu-latest steps: - - name: Install libs needed for native build - shell: bash - run: | - sudo apt-get update --fix-missing - sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev libusb-1.0-0-dev libi2c-dev - - name: Checkout code uses: actions/checkout@v4 with: @@ -23,17 +17,9 @@ jobs: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - name: Upgrade python tools - shell: bash - run: | - python -m pip install --upgrade pip - pip install -U platformio adafruit-nrfutil - pip install -U meshtastic --pre - - - name: Upgrade platformio - shell: bash - run: | - pio upgrade + - name: Setup native build + id: base + uses: ./.github/actions/setup-native - name: Build Native run: bin/build-native.sh diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 0109bef1a..a437411b5 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -137,6 +137,9 @@ jobs: package-native: uses: ./.github/workflows/package_amd64.yml + test-native: + uses: ./.github/workflows/test_native.yml + build-docker: if: ${{ github.event_name == 'workflow_dispatch' }} uses: ./.github/workflows/build_docker.yml diff --git a/.github/workflows/test_native.yml b/.github/workflows/test_native.yml new file mode 100644 index 000000000..8fe4e1c03 --- /dev/null +++ b/.github/workflows/test_native.yml @@ -0,0 +1,153 @@ +name: Run Tests on Native platform + +on: + workflow_call: + workflow_dispatch: + +permissions: {} + +env: + LCOV_CAPTURE_FLAGS: --quiet --capture --include "${PWD}/src/*" --exclude '*/src/mesh/generated/*' --directory .pio/build/coverage/src --base-directory "${PWD}" + +jobs: + simulator-tests: + name: Native Simulator Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Setup native build + id: base + uses: ./.github/actions/setup-native + + - name: Install simulator dependencies + run: pip install -U dotmap + + # We now run integration test before other build steps (to quickly see runtime failures) + - name: Build for native/coverage + run: platformio run -e coverage + + - name: Capture initial coverage information + shell: bash + run: | + sudo apt-get install -y lcov + lcov ${{ env.LCOV_CAPTURE_FLAGS }} --initial --output-file coverage_base.info + + - name: Integration test + run: | + .pio/build/coverage/program & + PID=$! + timeout 20 bash -c "until ls -al /proc/$PID/fd | grep socket; do sleep 1; done" + echo "Simulator started, launching python test..." + python3 -c 'from meshtastic.test import testSimulator; testSimulator()' + wait + + - name: Capture coverage information + if: always() # run this step even if previous step failed + run: lcov ${{ env.LCOV_CAPTURE_FLAGS }} --test-name integration --output-file coverage_integration.info + + - name: Get release version string + if: always() # run this step even if previous step failed + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + + - name: Save coverage information + uses: actions/upload-artifact@v4 + if: always() # run this step even if previous step failed + with: + name: lcov-coverage-info-native-simulator-test-${{ steps.version.outputs.version }}.zip + overwrite: true + path: ./coverage_*.info + + platformio-tests: + name: Native PlatformIO Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Setup native build + id: base + uses: ./.github/actions/setup-native + + - name: Get release version string + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + + - name: PlatformIO Tests + run: platformio test -e coverage --junit-output-path testreport.xml + + - name: Save test results + if: always() # run this step even if previous step failed + uses: actions/upload-artifact@v4 + with: + name: platformio-test-report-${{ steps.version.outputs.version }}.zip + overwrite: true + path: ./testreport.xml + + - name: Capture coverage information + if: always() # run this step even if previous step failed + run: | + sudo apt-get install -y lcov + lcov ${{ env.LCOV_CAPTURE_FLAGS }} --test-name tests --output-file coverage_tests.info + + - name: Save coverage information + uses: actions/upload-artifact@v4 + if: always() # run this step even if previous step failed + with: + name: lcov-coverage-info-native-platformio-tests-${{ steps.version.outputs.version }}.zip + overwrite: true + path: ./coverage_*.info + + generate-reports: + name: Generate Test Reports + runs-on: ubuntu-latest + permissions: # Needed for dorny/test-reporter. + contents: read + actions: read + checks: write + needs: + - simulator-tests + - platformio-tests + if: always() + steps: + - uses: actions/checkout@v4 + + - name: Get release version string + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + + - name: Download test artifacts + uses: actions/download-artifact@v4 + with: + name: platformio-test-report-${{ steps.version.outputs.version }}.zip + merge-multiple: true + + - name: Test Report + uses: dorny/test-reporter@v1.9.1 + with: + name: PlatformIO Tests + path: testreport.xml + reporter: java-junit + + - name: Download coverage artifacts + uses: actions/download-artifact@v4 + with: + pattern: lcov-coverage-info-native-*-${{ steps.version.outputs.version }}.zip + path: code-coverage-report + merge-multiple: true + + - name: Generate Code Coverage Report + run: | + sudo apt-get install -y lcov + lcov --quiet --add-tracefile code-coverage-report/coverage_base.info --add-tracefile code-coverage-report/coverage_integration.info --add-tracefile code-coverage-report/coverage_tests.info --output-file code-coverage-report/coverage_src.info + genhtml --quiet --legend --prefix "${PWD}" code-coverage-report/coverage_src.info --output-directory code-coverage-report + + - name: Save Code Coverage Report + uses: actions/upload-artifact@v4 + with: + name: code-coverage-report-${{ steps.version.outputs.version }}.zip + path: code-coverage-report diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ae9f82543..c9489db1a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,79 +6,8 @@ on: workflow_dispatch: {} jobs: - test-simulator: - runs-on: ubuntu-latest - env: - LCOV_CAPTURE_FLAGS: --quiet --capture --include "${PWD}/src/*" --exclude '*/src/mesh/generated/*' --directory .pio/build/coverage/src --base-directory "${PWD}" - steps: - - name: Install libs needed for native build - shell: bash - run: | - sudo apt-get update --fix-missing - sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev libusb-1.0-0-dev libi2c-dev - sudo apt-get install -y lcov - - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Upgrade python tools - shell: bash - run: | - python -m pip install --upgrade pip - pip install -U platformio adafruit-nrfutil dotmap - pip install -U meshtastic --pre - - - name: Upgrade platformio - shell: bash - run: | - pio upgrade - - - name: Build Native - run: bin/build-native.sh - - # We now run integration test before other build steps (to quickly see runtime failures) - - name: Build for native/coverage - run: | - platformio run -e coverage - lcov ${{ env.LCOV_CAPTURE_FLAGS }} --initial --output-file coverage_base.info - - - name: Integration test - run: | - .pio/build/coverage/program & - PID=$! - timeout 20 bash -c "until ls -al /proc/$PID/fd | grep socket; do sleep 1; done" - echo "Simulator started, launching python test..." - python3 -c 'from meshtastic.test import testSimulator; testSimulator()' - wait - lcov ${{ env.LCOV_CAPTURE_FLAGS }} --test-name integration --output-file coverage_integration.info - - - name: PlatformIO Tests - run: | - platformio test -e coverage --junit-output-path testreport.xml - lcov ${{ env.LCOV_CAPTURE_FLAGS }} --test-name tests --output-file coverage_tests.info - - - name: Test Report - uses: dorny/test-reporter@v1.9.1 - if: success() || failure() # run this step even if previous step failed - with: - name: PlatformIO Tests - path: testreport.xml - reporter: java-junit - - - name: Generate Code Coverage Report - run: | - lcov --quiet --add-tracefile coverage_base.info --add-tracefile coverage_integration.info --add-tracefile coverage_tests.info --output-file coverage_src.info - mkdir code-coverage-report - genhtml --quiet --legend --prefix "${PWD}" coverage_src.info --output-directory code-coverage-report - mv coverage_*.info code-coverage-report - - - name: Save Code Coverage Report - uses: actions/upload-artifact@v4 - with: - name: code-coverage-report - path: code-coverage-report + native-tests: + uses: ./.github/workflows/test_native.yml hardware-tests: runs-on: test-runner From 88d8ab53c8fba2830a71c9c0131b990d0f0f4e64 Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Wed, 1 Jan 2025 19:37:11 -0800 Subject: [PATCH 013/381] Disable coverage generation (#5719) * Disable coverage generation * Comment a bit more of the report generation --- .github/workflows/test_native.yml | 54 +++++++++++++++---------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/test_native.yml b/.github/workflows/test_native.yml index 8fe4e1c03..9de3b34a6 100644 --- a/.github/workflows/test_native.yml +++ b/.github/workflows/test_native.yml @@ -120,34 +120,34 @@ jobs: run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - - name: Download test artifacts - uses: actions/download-artifact@v4 - with: - name: platformio-test-report-${{ steps.version.outputs.version }}.zip - merge-multiple: true + # - name: Download test artifacts + # uses: actions/download-artifact@v4 + # with: + # name: platformio-test-report-${{ steps.version.outputs.version }}.zip + # merge-multiple: true - - name: Test Report - uses: dorny/test-reporter@v1.9.1 - with: - name: PlatformIO Tests - path: testreport.xml - reporter: java-junit + # - name: Test Report + # uses: dorny/test-reporter@v1.9.1 + # with: + # name: PlatformIO Tests + # path: testreport.xml + # reporter: java-junit - - name: Download coverage artifacts - uses: actions/download-artifact@v4 - with: - pattern: lcov-coverage-info-native-*-${{ steps.version.outputs.version }}.zip - path: code-coverage-report - merge-multiple: true + # - name: Download coverage artifacts + # uses: actions/download-artifact@v4 + # with: + # pattern: lcov-coverage-info-native-*-${{ steps.version.outputs.version }}.zip + # path: code-coverage-report + # merge-multiple: true - - name: Generate Code Coverage Report - run: | - sudo apt-get install -y lcov - lcov --quiet --add-tracefile code-coverage-report/coverage_base.info --add-tracefile code-coverage-report/coverage_integration.info --add-tracefile code-coverage-report/coverage_tests.info --output-file code-coverage-report/coverage_src.info - genhtml --quiet --legend --prefix "${PWD}" code-coverage-report/coverage_src.info --output-directory code-coverage-report + # - name: Generate Code Coverage Report + # run: | + # sudo apt-get install -y lcov + # lcov --quiet --add-tracefile code-coverage-report/coverage_base.info --add-tracefile code-coverage-report/coverage_integration.info --add-tracefile code-coverage-report/coverage_tests.info --output-file code-coverage-report/coverage_src.info + # genhtml --quiet --legend --prefix "${PWD}" code-coverage-report/coverage_src.info --output-directory code-coverage-report - - name: Save Code Coverage Report - uses: actions/upload-artifact@v4 - with: - name: code-coverage-report-${{ steps.version.outputs.version }}.zip - path: code-coverage-report + # - name: Save Code Coverage Report + # uses: actions/upload-artifact@v4 + # with: + # name: code-coverage-report-${{ steps.version.outputs.version }}.zip + # path: code-coverage-report From 7a1c32b89aa348871ff2e97ebf7a618f8274309e Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Wed, 1 Jan 2025 20:41:13 -0800 Subject: [PATCH 014/381] test_native.yaml checks out code for the PR. (#5720) --- .github/workflows/test_native.yml | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test_native.yml b/.github/workflows/test_native.yml index 9de3b34a6..1cc1f7c40 100644 --- a/.github/workflows/test_native.yml +++ b/.github/workflows/test_native.yml @@ -16,6 +16,8 @@ jobs: steps: - uses: actions/checkout@v4 with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} submodules: recursive - name: Setup native build @@ -67,6 +69,8 @@ jobs: steps: - uses: actions/checkout@v4 with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} submodules: recursive - name: Setup native build @@ -115,23 +119,26 @@ jobs: if: always() steps: - uses: actions/checkout@v4 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} - name: Get release version string run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - # - name: Download test artifacts - # uses: actions/download-artifact@v4 - # with: - # name: platformio-test-report-${{ steps.version.outputs.version }}.zip - # merge-multiple: true + - name: Download test artifacts + uses: actions/download-artifact@v4 + with: + name: platformio-test-report-${{ steps.version.outputs.version }}.zip + merge-multiple: true - # - name: Test Report - # uses: dorny/test-reporter@v1.9.1 - # with: - # name: PlatformIO Tests - # path: testreport.xml - # reporter: java-junit + - name: Test Report + uses: dorny/test-reporter@v1.9.1 + with: + name: PlatformIO Tests + path: testreport.xml + reporter: java-junit # - name: Download coverage artifacts # uses: actions/download-artifact@v4 From 93e2bc7058ba0d0b7b3936590b5c185bc418fba9 Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Wed, 1 Jan 2025 22:53:07 -0800 Subject: [PATCH 015/381] Use relative paths in coverage info files (#5721) --- .github/workflows/test_native.yml | 38 +++++++++++++++++-------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test_native.yml b/.github/workflows/test_native.yml index 1cc1f7c40..8c1527279 100644 --- a/.github/workflows/test_native.yml +++ b/.github/workflows/test_native.yml @@ -36,6 +36,7 @@ jobs: run: | sudo apt-get install -y lcov lcov ${{ env.LCOV_CAPTURE_FLAGS }} --initial --output-file coverage_base.info + sed -i -e "s#${PWD}#.#" coverage_base.info # Make paths relative. - name: Integration test run: | @@ -48,7 +49,9 @@ jobs: - name: Capture coverage information if: always() # run this step even if previous step failed - run: lcov ${{ env.LCOV_CAPTURE_FLAGS }} --test-name integration --output-file coverage_integration.info + run: | + lcov ${{ env.LCOV_CAPTURE_FLAGS }} --test-name integration --output-file coverage_integration.info + sed -i -e "s#${PWD}#.#" coverage_integration.info # Make paths relative. - name: Get release version string if: always() # run this step even if previous step failed @@ -97,6 +100,7 @@ jobs: run: | sudo apt-get install -y lcov lcov ${{ env.LCOV_CAPTURE_FLAGS }} --test-name tests --output-file coverage_tests.info + sed -i -e "s#${PWD}#.#" coverage_tests.info # Make paths relative. - name: Save coverage information uses: actions/upload-artifact@v4 @@ -140,21 +144,21 @@ jobs: path: testreport.xml reporter: java-junit - # - name: Download coverage artifacts - # uses: actions/download-artifact@v4 - # with: - # pattern: lcov-coverage-info-native-*-${{ steps.version.outputs.version }}.zip - # path: code-coverage-report - # merge-multiple: true + - name: Download coverage artifacts + uses: actions/download-artifact@v4 + with: + pattern: lcov-coverage-info-native-*-${{ steps.version.outputs.version }}.zip + path: code-coverage-report + merge-multiple: true - # - name: Generate Code Coverage Report - # run: | - # sudo apt-get install -y lcov - # lcov --quiet --add-tracefile code-coverage-report/coverage_base.info --add-tracefile code-coverage-report/coverage_integration.info --add-tracefile code-coverage-report/coverage_tests.info --output-file code-coverage-report/coverage_src.info - # genhtml --quiet --legend --prefix "${PWD}" code-coverage-report/coverage_src.info --output-directory code-coverage-report + - name: Generate Code Coverage Report + run: | + sudo apt-get install -y lcov + lcov --quiet --add-tracefile code-coverage-report/coverage_base.info --add-tracefile code-coverage-report/coverage_integration.info --add-tracefile code-coverage-report/coverage_tests.info --output-file code-coverage-report/coverage_src.info + genhtml --quiet --legend --prefix "${PWD}" code-coverage-report/coverage_src.info --output-directory code-coverage-report - # - name: Save Code Coverage Report - # uses: actions/upload-artifact@v4 - # with: - # name: code-coverage-report-${{ steps.version.outputs.version }}.zip - # path: code-coverage-report + - name: Save Code Coverage Report + uses: actions/upload-artifact@v4 + with: + name: code-coverage-report-${{ steps.version.outputs.version }}.zip + path: code-coverage-report From 9f7cbf1b4fe61979c5e98f9affb1d801af7147c8 Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Thu, 2 Jan 2025 03:32:39 -0800 Subject: [PATCH 016/381] MQTT unit test can inject WiFiClient (#5716) --- src/mqtt/MQTT.cpp | 12 +++++++----- src/mqtt/MQTT.h | 40 +++++++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 5141af560..46fb607b5 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -282,7 +282,9 @@ void mqttInit() } #if HAS_NETWORKING -MQTT::MQTT() : concurrency::OSThread("mqtt"), pubSub(mqttClient), mqttQueue(MAX_MQTT_QUEUE) +MQTT::MQTT() : MQTT(std::unique_ptr(new MQTTClient())) {} +MQTT::MQTT(std::unique_ptr _mqttClient) + : concurrency::OSThread("mqtt"), mqttQueue(MAX_MQTT_QUEUE), mqttClient(std::move(_mqttClient)), pubSub(*mqttClient) #else MQTT::MQTT() : concurrency::OSThread("mqtt"), mqttQueue(MAX_MQTT_QUEUE) #endif @@ -420,13 +422,13 @@ void MQTT::reconnect() } } else { LOG_INFO("Use non-TLS-encrypted session"); - pubSub.setClient(mqttClient); + pubSub.setClient(*mqttClient); } #else - pubSub.setClient(mqttClient); + pubSub.setClient(*mqttClient); #endif #elif HAS_NETWORKING - pubSub.setClient(mqttClient); + pubSub.setClient(*mqttClient); #endif std::pair hostAndPort = parseHostAndPort(serverAddr, serverPort); @@ -444,7 +446,7 @@ void MQTT::reconnect() enabled = true; // Start running background process again runASAP = true; reconnectCount = 0; - isMqttServerAddressPrivate = isPrivateIpAddress(mqttClient.remoteIP()); + isMqttServerAddressPrivate = isPrivateIpAddress(mqttClient->remoteIP()); publishNodeInfo(); sendSubscriptions(); diff --git a/src/mqtt/MQTT.h b/src/mqtt/MQTT.h index cb1fffcc9..cf52ad877 100644 --- a/src/mqtt/MQTT.h +++ b/src/mqtt/MQTT.h @@ -22,6 +22,7 @@ #if HAS_NETWORKING #include +#include #endif #define MAX_MQTT_QUEUE 16 @@ -32,24 +33,7 @@ */ class MQTT : private concurrency::OSThread { - // supposedly the current version is busted: - // http://www.iotsharing.com/2017/08/how-to-use-esp32-mqtts-with-mqtts-mosquitto-broker-tls-ssl.html -#if HAS_WIFI - WiFiClient mqttClient; -#if !defined(ARCH_PORTDUINO) -#if (defined(ESP_ARDUINO_VERSION_MAJOR) && ESP_ARDUINO_VERSION_MAJOR < 3) || defined(RPI_PICO) - WiFiClientSecure wifiSecureClient; -#endif -#endif -#endif -#if HAS_ETHERNET - EthernetClient mqttClient; -#endif - public: -#if HAS_NETWORKING - PubSubClient pubSub; -#endif MQTT(); /** @@ -93,7 +77,29 @@ class MQTT : private concurrency::OSThread virtual int32_t runOnce() override; +#ifndef PIO_UNIT_TESTING private: +#endif + // supposedly the current version is busted: + // http://www.iotsharing.com/2017/08/how-to-use-esp32-mqtts-with-mqtts-mosquitto-broker-tls-ssl.html +#if HAS_WIFI + using MQTTClient = WiFiClient; +#if !defined(ARCH_PORTDUINO) +#if (defined(ESP_ARDUINO_VERSION_MAJOR) && ESP_ARDUINO_VERSION_MAJOR < 3) || defined(RPI_PICO) + WiFiClientSecure wifiSecureClient; +#endif +#endif +#endif +#if HAS_ETHERNET + using MQTTClient = EthernetClient; +#endif + +#if HAS_NETWORKING + std::unique_ptr mqttClient; + PubSubClient pubSub; + explicit MQTT(std::unique_ptr mqttClient); +#endif + std::string cryptTopic = "/2/e/"; // msh/2/e/CHANNELID/NODEID std::string jsonTopic = "/2/json/"; // msh/2/json/CHANNELID/NODEID std::string mapTopic = "/2/map/"; // For protobuf-encoded MapReport messages From 9bda080e3d0be0f025f88d36bb4a9aa605954fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 2 Jan 2025 16:05:12 +0100 Subject: [PATCH 017/381] evaluate GPS_THREAD_INTERVAL after variant file (#5722) --- src/configuration.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/configuration.h b/src/configuration.h index 994f1e72e..2c77b55e3 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -178,13 +178,6 @@ along with this program. If not, see . #define TCA9535_ADDR 0x20 #define TCA9555_ADDR 0x26 -// ----------------------------------------------------------------------------- -// GPS -// ----------------------------------------------------------------------------- -#ifndef GPS_THREAD_INTERVAL -#define GPS_THREAD_INTERVAL 200 -#endif - // ----------------------------------------------------------------------------- // Touchscreen // ----------------------------------------------------------------------------- @@ -206,6 +199,10 @@ along with this program. If not, see . #define VEXT_ON_VALUE LOW #endif +// ----------------------------------------------------------------------------- +// GPS +// ----------------------------------------------------------------------------- + #ifndef GPS_BAUDRATE #define GPS_BAUDRATE 9600 #define GPS_BAUDRATE_FIXED 0 @@ -213,6 +210,10 @@ along with this program. If not, see . #define GPS_BAUDRATE_FIXED 1 #endif +#ifndef GPS_THREAD_INTERVAL +#define GPS_THREAD_INTERVAL 200 +#endif + /* Step #2: follow with defines common to the architecture; also enable HAS_ option not specifically disabled by variant.h */ #include "architecture.h" From b41efc17ba60a0f4b93cf85fe0c1b08070aeb67e Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Thu, 2 Jan 2025 08:32:38 -0800 Subject: [PATCH 018/381] Disable BUILD_EPOCH for unit tests (#5723) --- .github/workflows/test_native.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test_native.yml b/.github/workflows/test_native.yml index 8c1527279..d016635ef 100644 --- a/.github/workflows/test_native.yml +++ b/.github/workflows/test_native.yml @@ -84,6 +84,11 @@ jobs: run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version + # Disable (comment-out) BUILD_EPOCH. It causes a full rebuild between tests and resets the + # coverage information each time. + - name: Disable BUILD_EPOCH + run: sed -i 's/-DBUILD_EPOCH=$UNIX_TIME/#-DBUILD_EPOCH=$UNIX_TIME/' platformio.ini + - name: PlatformIO Tests run: platformio test -e coverage --junit-output-path testreport.xml From 9d710041c43af266dc0e32703e39775bb1f4929e Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Fri, 3 Jan 2025 09:01:10 +0800 Subject: [PATCH 019/381] Add MESHTASTIC_EXCLUDE_SOCKETAPI (#5729) MESHTASTIC_EXCLUDE_SOCKETAPI disables the API Server when set. Co-authored-by: mverch67 Co-authored-by: GUVWAF --- src/mesh/eth/ethClient.cpp | 3 ++- src/mesh/wifi/WiFiAPClient.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mesh/eth/ethClient.cpp b/src/mesh/eth/ethClient.cpp index 08ecb7ce8..24c4f0db1 100644 --- a/src/mesh/eth/ethClient.cpp +++ b/src/mesh/eth/ethClient.cpp @@ -66,8 +66,9 @@ static int32_t reconnectETH() syslog.enable(); } - // initWebServer(); +#if !MESHTASTIC_EXCLUDE_SOCKETAPI initApiServer(); +#endif ethStartupComplete = true; } diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index 38aa2e2a2..2f8138921 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -106,7 +106,9 @@ static void onNetworkConnected() #if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_WEBSERVER initWebServer(); #endif +#if !MESHTASTIC_EXCLUDE_SOCKETAPI initApiServer(); +#endif APStartupComplete = true; } From e1aaafb77a9f6e0bc159242de24b9b3cbb9e1782 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Fri, 3 Jan 2025 10:05:26 +0800 Subject: [PATCH 020/381] Cherrypick "add more locking for shared SPI devices (#5595) " (#5728) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add more locking for shared SPI devices (#5595) * add more locking for shared SPI devices * call initSPI before the lock is used * remove old one * don't double lock * Add missing unlock * More missing unlocks * Add locks to SafeFile, remove from `readcb`, introduce some LockGuards * fix lock in setupSDCard() * pull radiolib trunk with SPI-CS fixes * change ContentHandler to Constructor type locks, where applicable --------- Co-authored-by: mverch67 Co-authored-by: GUVWAF Co-authored-by: Manuel <71137295+mverch67@users.noreply.github.com> * mesh-tab: lower I2C touch frequency --------- Co-authored-by: Thomas Göttgens Co-authored-by: mverch67 Co-authored-by: GUVWAF Co-authored-by: Manuel <71137295+mverch67@users.noreply.github.com> --- platformio.ini | 3 ++- src/FSCommon.cpp | 21 ++++++++++++++-- src/SafeFile.cpp | 15 ++++++++---- src/SafeFile.h | 1 + src/main.cpp | 4 ++-- src/mesh/NodeDB.cpp | 22 +++++++++++++---- src/mesh/PhoneAPI.cpp | 3 +++ src/mesh/http/ContentHandler.cpp | 15 ++++++++++++ src/mesh/mesh-pb-constants.cpp | 8 +++++-- src/modules/AdminModule.cpp | 4 ++++ src/modules/CannedMessageModule.cpp | 7 ++++-- src/modules/RangeTestModule.cpp | 2 ++ src/modules/Telemetry/Sensor/BME680Sensor.cpp | 5 ++++ .../Telemetry/Sensor/NAU7802Sensor.cpp | 7 +++++- src/xmodem.cpp | 24 +++++++++++++++++++ variants/mesh-tab/platformio.ini | 6 ++--- 16 files changed, 125 insertions(+), 22 deletions(-) diff --git a/platformio.ini b/platformio.ini index 3129decaa..cd32ed179 100644 --- a/platformio.ini +++ b/platformio.ini @@ -124,7 +124,8 @@ lib_deps = [radiolib_base] lib_deps = - jgromes/RadioLib@7.1.0 + ; jgromes/RadioLib@7.1.0 + https://github.com/jgromes/RadioLib.git#92b687821ff4e6c358d866f84566f66672ab02b8 ; Common libs for environmental measurements in telemetry module ; (not included in native / portduino) diff --git a/src/FSCommon.cpp b/src/FSCommon.cpp index df46c1941..6d8ff835c 100644 --- a/src/FSCommon.cpp +++ b/src/FSCommon.cpp @@ -9,6 +9,7 @@ * */ #include "FSCommon.h" +#include "SPILock.h" #include "configuration.h" #ifdef HAS_SDCARD @@ -102,6 +103,8 @@ bool copyFile(const char *from, const char *to) return true; #elif defined(FSCom) + // take SPI Lock + concurrency::LockGuard g(spiLock); unsigned char cbuffer[16]; File f1 = FSCom.open(from, FILE_O_READ); @@ -145,16 +148,23 @@ bool renameFile(const char *pathFrom, const char *pathTo) return false; } #elif defined(FSCom) + #ifdef ARCH_ESP32 + // take SPI Lock + spiLock->lock(); // rename was fixed for ESP32 IDF LittleFS in April - return FSCom.rename(pathFrom, pathTo); + bool result = FSCom.rename(pathFrom, pathTo); + spiLock->unlock(); + return result; #else + // copyFile does its own locking. if (copyFile(pathFrom, pathTo) && FSCom.remove(pathFrom)) { return true; } else { return false; } #endif + #endif } @@ -164,6 +174,7 @@ bool renameFile(const char *pathFrom, const char *pathTo) * @brief Get the list of files in a directory. * * This function returns a list of files in a directory. The list includes the full path of each file. + * We can't use SPILOCK here because of recursion. Callers of this function should use SPILOCK. * * @param dirname The name of the directory. * @param levels The number of levels of subdirectories to list. @@ -212,6 +223,7 @@ std::vector getFiles(const char *dirname, uint8_t levels) /** * Lists the contents of a directory. + * We can't use SPILOCK here because of recursion. Callers of this function should use SPILOCK. * * @param dirname The name of the directory to list. * @param levels The number of levels of subdirectories to list. @@ -325,18 +337,21 @@ void listDir(const char *dirname, uint8_t levels, bool del) void rmDir(const char *dirname) { #ifdef FSCom + #if (defined(ARCH_ESP32) || defined(ARCH_RP2040) || defined(ARCH_PORTDUINO)) listDir(dirname, 10, true); #elif defined(ARCH_NRF52) // nRF52 implementation of LittleFS has a recursive delete function FSCom.rmdir_r(dirname); #endif + #endif } void fsInit() { #ifdef FSCom + spiLock->lock(); if (!FSBegin()) { LOG_ERROR("Filesystem mount failed"); // assert(0); This auto-formats the partition, so no need to fail here. @@ -347,6 +362,7 @@ void fsInit() LOG_DEBUG("Filesystem files:"); #endif listDir("/", 10); + spiLock->unlock(); #endif } @@ -356,6 +372,7 @@ void fsInit() void setupSDCard() { #ifdef HAS_SDCARD + concurrency::LockGuard g(spiLock); SDHandler.begin(SPI_SCK, SPI_MISO, SPI_MOSI); if (!SD.begin(SDCARD_CS, SDHandler)) { @@ -383,4 +400,4 @@ void setupSDCard() LOG_DEBUG("Total space: %lu MB", (uint32_t)(SD.totalBytes() / (1024 * 1024))); LOG_DEBUG("Used space: %lu MB", (uint32_t)(SD.usedBytes() / (1024 * 1024))); #endif -} \ No newline at end of file +} diff --git a/src/SafeFile.cpp b/src/SafeFile.cpp index c76ff8054..c5d7b335e 100644 --- a/src/SafeFile.cpp +++ b/src/SafeFile.cpp @@ -5,6 +5,7 @@ // Only way to work on both esp32 and nrf52 static File openFile(const char *filename, bool fullAtomic) { + concurrency::LockGuard g(spiLock); if (!fullAtomic) FSCom.remove(filename); // Nuke the old file to make space (ignore if it !exists) @@ -53,14 +54,19 @@ bool SafeFile::close() if (!f) return false; + spiLock->lock(); f.close(); + spiLock->unlock(); if (!testReadback()) return false; - // brief window of risk here ;-) - if (fullAtomic && FSCom.exists(filename.c_str()) && !FSCom.remove(filename.c_str())) { - LOG_ERROR("Can't remove old pref file"); - return false; + { // Scope for lock + concurrency::LockGuard g(spiLock); + // brief window of risk here ;-) + if (fullAtomic && FSCom.exists(filename.c_str()) && !FSCom.remove(filename.c_str())) { + LOG_ERROR("Can't remove old pref file"); + return false; + } } String filenameTmp = filename; @@ -76,6 +82,7 @@ bool SafeFile::close() /// Read our (closed) tempfile back in and compare the hash bool SafeFile::testReadback() { + concurrency::LockGuard g(spiLock); bool lfs_failed = lfs_assert_failed; lfs_assert_failed = false; diff --git a/src/SafeFile.h b/src/SafeFile.h index 61361d312..3d0f81cad 100644 --- a/src/SafeFile.h +++ b/src/SafeFile.h @@ -1,6 +1,7 @@ #pragma once #include "FSCommon.h" +#include "SPILock.h" #include "configuration.h" #ifdef FSCom diff --git a/src/main.cpp b/src/main.cpp index 5982e709d..c2b20b1c1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -364,6 +364,8 @@ void setup() #endif #endif + initSPI(); + OSThread::setup(); ledPeriodic = new Periodic("Blink", ledBlinker); @@ -640,8 +642,6 @@ void setup() rp2040Setup(); #endif - initSPI(); // needed here before reading from littleFS - // We do this as early as possible because this loads preferences from flash // but we need to do this after main cpu init (esp32setup), because we need the random seed set nodeDB = new NodeDB; diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index bbc9eb1ea..8e084c99d 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -13,6 +13,7 @@ #include "PowerFSM.h" #include "RTC.h" #include "Router.h" +#include "SPILock.h" #include "SafeFile.h" #include "TypeConversions.h" #include "error.h" @@ -423,12 +424,15 @@ bool NodeDB::factoryReset(bool eraseBleBonds) { LOG_INFO("Perform factory reset!"); // first, remove the "/prefs" (this removes most prefs) - rmDir("/prefs"); + spiLock->lock(); + rmDir("/prefs"); // this uses spilock internally... + #ifdef FSCom if (FSCom.exists("/static/rangetest.csv") && !FSCom.remove("/static/rangetest.csv")) { LOG_ERROR("Could not remove rangetest.csv file"); } #endif + spiLock->unlock(); // second, install default state (this will deal with the duplicate mac address issue) installDefaultDeviceState(); installDefaultConfig(!eraseBleBonds); // Also preserve the private key if we're not erasing BLE bonds @@ -913,6 +917,7 @@ LoadFileResult NodeDB::loadProto(const char *filename, size_t protoSize, size_t { LoadFileResult state = LoadFileResult::OTHER_FAILURE; #ifdef FSCom + concurrency::LockGuard g(spiLock); auto f = FSCom.open(filename, FILE_O_READ); @@ -946,8 +951,10 @@ void NodeDB::loadFromDisk() // disk we will still factoryReset to restore things. #ifdef ARCH_ESP32 + spiLock->lock(); if (FSCom.exists("/static/static")) rmDir("/static/static"); // Remove bad static web files bundle from initial 2.5.13 release + spiLock->unlock(); #endif // static DeviceState scratch; We no longer read into a tempbuf because this structure is 15KB of valuable RAM @@ -1097,9 +1104,6 @@ void NodeDB::loadFromDisk() bool NodeDB::saveProto(const char *filename, size_t protoSize, const pb_msgdesc_t *fields, const void *dest_struct, bool fullAtomic) { -#ifdef ARCH_ESP32 - concurrency::LockGuard g(spiLock); -#endif bool okay = false; #ifdef FSCom auto f = SafeFile(filename, fullAtomic); @@ -1127,7 +1131,9 @@ bool NodeDB::saveProto(const char *filename, size_t protoSize, const pb_msgdesc_ bool NodeDB::saveChannelsToDisk() { #ifdef FSCom + spiLock->lock(); FSCom.mkdir("/prefs"); + spiLock->unlock(); #endif return saveProto(channelFileName, meshtastic_ChannelFile_size, &meshtastic_ChannelFile_msg, &channelFile); } @@ -1135,7 +1141,9 @@ bool NodeDB::saveChannelsToDisk() bool NodeDB::saveDeviceStateToDisk() { #ifdef FSCom + spiLock->lock(); FSCom.mkdir("/prefs"); + spiLock->unlock(); #endif // Note: if MAX_NUM_NODES=100 and meshtastic_NodeInfoLite_size=166, so will be approximately 17KB // Because so huge we _must_ not use fullAtomic, because the filesystem is probably too small to hold two copies of this @@ -1148,7 +1156,9 @@ bool NodeDB::saveToDiskNoRetry(int saveWhat) bool success = true; #ifdef FSCom + spiLock->lock(); FSCom.mkdir("/prefs"); + spiLock->unlock(); #endif if (saveWhat & SEGMENT_CONFIG) { config.has_device = true; @@ -1199,7 +1209,9 @@ bool NodeDB::saveToDisk(int saveWhat) if (!success) { LOG_ERROR("Failed to save to disk, retrying"); #ifdef ARCH_NRF52 // @geeksville is not ready yet to say we should do this on other platforms. See bug #4184 discussion + spiLock->lock(); FSCom.format(); + spiLock->unlock(); #endif success = saveToDiskNoRetry(saveWhat); @@ -1518,4 +1530,4 @@ void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, co LOG_ERROR("A critical failure occurred, portduino is exiting"); exit(2); #endif -} +} \ No newline at end of file diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 8c1ba74c7..6789acbb3 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -12,6 +12,7 @@ #include "PhoneAPI.h" #include "PowerFSM.h" #include "RadioInterface.h" +#include "SPILock.h" #include "TypeConversions.h" #include "main.h" #include "xmodem.h" @@ -54,7 +55,9 @@ void PhoneAPI::handleStartConfig() // even if we were already connected - restart our state machine state = STATE_SEND_MY_INFO; pauseBluetoothLogging = true; + spiLock->lock(); filesManifest = getFiles("/", 10); + spiLock->unlock(); LOG_DEBUG("Got %d files in manifest", filesManifest.size()); LOG_INFO("Start API client config"); diff --git a/src/mesh/http/ContentHandler.cpp b/src/mesh/http/ContentHandler.cpp index aa8a68f91..5841fe478 100644 --- a/src/mesh/http/ContentHandler.cpp +++ b/src/mesh/http/ContentHandler.cpp @@ -10,6 +10,7 @@ #include "mesh/wifi/WiFiAPClient.h" #endif #include "Led.h" +#include "SPILock.h" #include "power.h" #include "serialization/JSON.h" #include @@ -236,6 +237,7 @@ void handleAPIv1ToRadio(HTTPRequest *req, HTTPResponse *res) void htmlDeleteDir(const char *dirname) { + File root = FSCom.open(dirname); if (!root) { return; @@ -318,6 +320,7 @@ void handleFsBrowseStatic(HTTPRequest *req, HTTPResponse *res) res->setHeader("Access-Control-Allow-Origin", "*"); res->setHeader("Access-Control-Allow-Methods", "GET"); + concurrency::LockGuard g(spiLock); auto fileList = htmlListDir("/static", 10); // create json output structure @@ -349,9 +352,12 @@ void handleFsDeleteStatic(HTTPRequest *req, HTTPResponse *res) res->setHeader("Content-Type", "application/json"); res->setHeader("Access-Control-Allow-Origin", "*"); res->setHeader("Access-Control-Allow-Methods", "DELETE"); + if (params->getQueryParameter("delete", paramValDelete)) { std::string pathDelete = "/" + paramValDelete; + concurrency::LockGuard g(spiLock); if (FSCom.remove(pathDelete.c_str())) { + LOG_INFO("%s", pathDelete.c_str()); JSONObject jsonObjOuter; jsonObjOuter["status"] = new JSONValue("ok"); @@ -360,6 +366,7 @@ void handleFsDeleteStatic(HTTPRequest *req, HTTPResponse *res) delete value; return; } else { + LOG_INFO("%s", pathDelete.c_str()); JSONObject jsonObjOuter; jsonObjOuter["status"] = new JSONValue("Error"); @@ -393,6 +400,8 @@ void handleStatic(HTTPRequest *req, HTTPResponse *res) filenameGzip = "/static/index.html.gz"; } + concurrency::LockGuard g(spiLock); + if (FSCom.exists(filename.c_str())) { file = FSCom.open(filename.c_str()); if (!file.available()) { @@ -410,6 +419,7 @@ void handleStatic(HTTPRequest *req, HTTPResponse *res) file = FSCom.open(filenameGzip.c_str()); res->setHeader("Content-Type", "text/html"); if (!file.available()) { + LOG_WARN("File not available - %s", filenameGzip.c_str()); res->println("Web server is running.

The content you are looking for can't be found. Please see: FAQ.

printf("

Saved %d bytes to %s

", (int)fileLength, pathname.c_str()); } if (!didwrite) { @@ -642,9 +654,11 @@ void handleReport(HTTPRequest *req, HTTPResponse *res) jsonObjMemory["heap_free"] = new JSONValue((int)memGet.getFreeHeap()); jsonObjMemory["psram_total"] = new JSONValue((int)memGet.getPsramSize()); jsonObjMemory["psram_free"] = new JSONValue((int)memGet.getFreePsram()); + spiLock->lock(); jsonObjMemory["fs_total"] = new JSONValue((int)FSCom.totalBytes()); jsonObjMemory["fs_used"] = new JSONValue((int)FSCom.usedBytes()); jsonObjMemory["fs_free"] = new JSONValue(int(FSCom.totalBytes() - FSCom.usedBytes())); + spiLock->unlock(); // data->power JSONObject jsonObjPower; @@ -786,6 +800,7 @@ void handleDeleteFsContent(HTTPRequest *req, HTTPResponse *res) LOG_INFO("Delete files from /static/* : "); + concurrency::LockGuard g(spiLock); htmlDeleteDir("/static"); res->println("


Back to admin"); diff --git a/src/mesh/mesh-pb-constants.cpp b/src/mesh/mesh-pb-constants.cpp index deb93d0a6..a8f4fd6d8 100644 --- a/src/mesh/mesh-pb-constants.cpp +++ b/src/mesh/mesh-pb-constants.cpp @@ -1,6 +1,7 @@ #include "configuration.h" #include "FSCommon.h" +#include "SPILock.h" #include "mesh-pb-constants.h" #include #include @@ -55,9 +56,12 @@ bool readcb(pb_istream_t *stream, uint8_t *buf, size_t count) /// Write to an arduino file bool writecb(pb_ostream_t *stream, const uint8_t *buf, size_t count) { + spiLock->lock(); auto file = (Print *)stream->state; // LOG_DEBUG("writing %d bytes to protobuf file", count); - return file->write(buf, count) == count; + bool status = file->write(buf, count) == count; + spiLock->unlock(); + return status; } #endif @@ -68,4 +72,4 @@ bool is_in_helper(uint32_t n, const uint32_t *array, pb_size_t count) return true; return false; -} +} \ No newline at end of file diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index fc3b914e5..7906b410b 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -4,6 +4,7 @@ #include "NodeDB.h" #include "PowerFSM.h" #include "RTC.h" +#include "SPILock.h" #include "meshUtils.h" #include #if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_BLUETOOTH @@ -358,12 +359,15 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta } case meshtastic_AdminMessage_delete_file_request_tag: { LOG_DEBUG("Client requesting to delete file: %s", r->delete_file_request); + #ifdef FSCom + spiLock->lock(); if (FSCom.remove(r->delete_file_request)) { LOG_DEBUG("Successfully deleted file"); } else { LOG_DEBUG("Failed to delete file"); } + spiLock->unlock(); #endif break; } diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index c20b7b56e..5fb32fff5 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -9,6 +9,7 @@ #include "MeshService.h" #include "NodeDB.h" #include "PowerFSM.h" // needed for button bypass +#include "SPILock.h" #include "detect/ScanI2C.h" #include "input/ScanAndSelect.h" #include "mesh/generated/meshtastic/cannedmessages.pb.h" @@ -1184,8 +1185,10 @@ bool CannedMessageModule::saveProtoForModule() { bool okay = true; -#ifdef FS - FS.mkdir("/prefs"); +#ifdef FSCom + spiLock->lock(); + FSCom.mkdir("/prefs"); + spiLock->unlock(); #endif okay &= nodeDB->saveProto(cannedMessagesConfigFile, meshtastic_CannedMessageModuleConfig_size, diff --git a/src/modules/RangeTestModule.cpp b/src/modules/RangeTestModule.cpp index c42839d97..cad1d51f1 100644 --- a/src/modules/RangeTestModule.cpp +++ b/src/modules/RangeTestModule.cpp @@ -15,6 +15,7 @@ #include "PowerFSM.h" #include "RTC.h" #include "Router.h" +#include "SPILock.h" #include "airtime.h" #include "configuration.h" #include "gps/GeoCoord.h" @@ -205,6 +206,7 @@ bool RangeTestModuleRadio::appendFile(const meshtastic_MeshPacket &mp) LOG_DEBUG("gpsStatus->getDOP() %d", gpsStatus->getDOP()); LOG_DEBUG("-----------------------------------------"); */ + concurrency::LockGuard g(spiLock); if (!FSBegin()) { LOG_DEBUG("An Error has occurred while mounting the filesystem"); return 0; diff --git a/src/modules/Telemetry/Sensor/BME680Sensor.cpp b/src/modules/Telemetry/Sensor/BME680Sensor.cpp index 18515d0a8..9237cf0c9 100644 --- a/src/modules/Telemetry/Sensor/BME680Sensor.cpp +++ b/src/modules/Telemetry/Sensor/BME680Sensor.cpp @@ -5,6 +5,7 @@ #include "../mesh/generated/meshtastic/telemetry.pb.h" #include "BME680Sensor.h" #include "FSCommon.h" +#include "SPILock.h" #include "TelemetrySensor.h" BME680Sensor::BME680Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_BME680, "BME680") {} @@ -75,6 +76,7 @@ bool BME680Sensor::getMetrics(meshtastic_Telemetry *measurement) void BME680Sensor::loadState() { #ifdef FSCom + spiLock->lock(); auto file = FSCom.open(bsecConfigFileName, FILE_O_READ); if (file) { file.read((uint8_t *)&bsecState, BSEC_MAX_STATE_BLOB_SIZE); @@ -84,6 +86,7 @@ void BME680Sensor::loadState() } else { LOG_INFO("No %s state found (File: %s)", sensorName, bsecConfigFileName); } + spiLock->unlock(); #else LOG_ERROR("ERROR: Filesystem not implemented"); #endif @@ -92,6 +95,7 @@ void BME680Sensor::loadState() void BME680Sensor::updateState() { #ifdef FSCom + spiLock->lock(); bool update = false; if (stateUpdateCounter == 0) { /* First state update when IAQ accuracy is >= 3 */ @@ -127,6 +131,7 @@ void BME680Sensor::updateState() LOG_INFO("Can't write %s state (File: %s)", sensorName, bsecConfigFileName); } } + spiLock->unlock(); #else LOG_ERROR("ERROR: Filesystem not implemented"); #endif diff --git a/src/modules/Telemetry/Sensor/NAU7802Sensor.cpp b/src/modules/Telemetry/Sensor/NAU7802Sensor.cpp index 65f616686..1329c8d90 100644 --- a/src/modules/Telemetry/Sensor/NAU7802Sensor.cpp +++ b/src/modules/Telemetry/Sensor/NAU7802Sensor.cpp @@ -5,6 +5,7 @@ #include "../mesh/generated/meshtastic/telemetry.pb.h" #include "FSCommon.h" #include "NAU7802Sensor.h" +#include "SPILock.h" #include "SafeFile.h" #include "TelemetrySensor.h" #include @@ -111,13 +112,16 @@ bool NAU7802Sensor::saveCalibrationData() } else { okay = true; } + spiLock->lock(); okay &= file.close(); + spiLock->unlock(); return okay; } bool NAU7802Sensor::loadCalibrationData() { + spiLock->lock(); auto file = FSCom.open(nau7802ConfigFileName, FILE_O_READ); bool okay = false; if (file) { @@ -134,7 +138,8 @@ bool NAU7802Sensor::loadCalibrationData() } else { LOG_INFO("No %s state found (File: %s)", sensorName, nau7802ConfigFileName); } + spiLock->unlock(); return okay; } -#endif +#endif \ No newline at end of file diff --git a/src/xmodem.cpp b/src/xmodem.cpp index bf25e2da7..1d8c77760 100644 --- a/src/xmodem.cpp +++ b/src/xmodem.cpp @@ -49,6 +49,7 @@ **********************************************************************************************************************/ #include "xmodem.h" +#include "SPILock.h" #ifdef FSCom @@ -119,8 +120,11 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket) if ((xmodemPacket.seq == 0) && !isReceiving && !isTransmitting) { // NULL packet has the destination filename memcpy(filename, &xmodemPacket.buffer.bytes, xmodemPacket.buffer.size); + if (xmodemPacket.control == meshtastic_XModem_Control_SOH) { // Receive this file and put to Flash + spiLock->lock(); file = FSCom.open(filename, FILE_O_WRITE); + spiLock->unlock(); if (file) { sendControl(meshtastic_XModem_Control_ACK); isReceiving = true; @@ -132,14 +136,18 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket) break; } else { // Transmit this file from Flash LOG_INFO("XModem: Transmit file %s", filename); + spiLock->lock(); file = FSCom.open(filename, FILE_O_READ); + spiLock->unlock(); if (file) { packetno = 1; isTransmitting = true; xmodemStore = meshtastic_XModem_init_zero; xmodemStore.control = meshtastic_XModem_Control_SOH; xmodemStore.seq = packetno; + spiLock->lock(); xmodemStore.buffer.size = file.read(xmodemStore.buffer.bytes, sizeof(meshtastic_XModem_buffer_t::bytes)); + spiLock->unlock(); xmodemStore.crc16 = crc16_ccitt(xmodemStore.buffer.bytes, xmodemStore.buffer.size); LOG_DEBUG("XModem: STX Notify Send packet %d, %d Bytes", packetno, xmodemStore.buffer.size); if (xmodemStore.buffer.size < sizeof(meshtastic_XModem_buffer_t::bytes)) { @@ -159,7 +167,9 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket) if ((xmodemPacket.seq == packetno) && check(xmodemPacket.buffer.bytes, xmodemPacket.buffer.size, xmodemPacket.crc16)) { // valid packet + spiLock->lock(); file.write(xmodemPacket.buffer.bytes, xmodemPacket.buffer.size); + spiLock->unlock(); sendControl(meshtastic_XModem_Control_ACK); packetno++; break; @@ -178,16 +188,21 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket) case meshtastic_XModem_Control_EOT: // End of transmission sendControl(meshtastic_XModem_Control_ACK); + spiLock->lock(); file.flush(); file.close(); + spiLock->unlock(); isReceiving = false; break; case meshtastic_XModem_Control_CAN: // Cancel transmission and remove file sendControl(meshtastic_XModem_Control_ACK); + spiLock->lock(); file.flush(); file.close(); + FSCom.remove(filename); + spiLock->unlock(); isReceiving = false; break; case meshtastic_XModem_Control_ACK: @@ -195,7 +210,9 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket) if (isTransmitting) { if (isEOT) { sendControl(meshtastic_XModem_Control_EOT); + spiLock->lock(); file.close(); + spiLock->unlock(); LOG_INFO("XModem: Finished send file %s", filename); isTransmitting = false; isEOT = false; @@ -206,7 +223,9 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket) xmodemStore = meshtastic_XModem_init_zero; xmodemStore.control = meshtastic_XModem_Control_SOH; xmodemStore.seq = packetno; + spiLock->lock(); xmodemStore.buffer.size = file.read(xmodemStore.buffer.bytes, sizeof(meshtastic_XModem_buffer_t::bytes)); + spiLock->unlock(); xmodemStore.crc16 = crc16_ccitt(xmodemStore.buffer.bytes, xmodemStore.buffer.size); LOG_DEBUG("XModem: ACK Notify Send packet %d, %d Bytes", packetno, xmodemStore.buffer.size); if (xmodemStore.buffer.size < sizeof(meshtastic_XModem_buffer_t::bytes)) { @@ -224,7 +243,9 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket) if (isTransmitting) { if (--retrans <= 0) { sendControl(meshtastic_XModem_Control_CAN); + spiLock->lock(); file.close(); + spiLock->unlock(); LOG_INFO("XModem: Retransmit timeout, cancel file %s", filename); isTransmitting = false; break; @@ -232,8 +253,11 @@ void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket) xmodemStore = meshtastic_XModem_init_zero; xmodemStore.control = meshtastic_XModem_Control_SOH; xmodemStore.seq = packetno; + spiLock->lock(); file.seek((packetno - 1) * sizeof(meshtastic_XModem_buffer_t::bytes)); + xmodemStore.buffer.size = file.read(xmodemStore.buffer.bytes, sizeof(meshtastic_XModem_buffer_t::bytes)); + spiLock->unlock(); xmodemStore.crc16 = crc16_ccitt(xmodemStore.buffer.bytes, xmodemStore.buffer.size); LOG_DEBUG("XModem: NAK Notify Send packet %d, %d Bytes", packetno, xmodemStore.buffer.size); if (xmodemStore.buffer.size < sizeof(meshtastic_XModem_buffer_t::bytes)) { diff --git a/variants/mesh-tab/platformio.ini b/variants/mesh-tab/platformio.ini index 26b072cde..a1007a7f4 100644 --- a/variants/mesh-tab/platformio.ini +++ b/variants/mesh-tab/platformio.ini @@ -178,7 +178,7 @@ build_flags = ${mesh_tab_base.build_flags} -D LGFX_TOUCH_Y_MIN=0 -D LGFX_TOUCH_Y_MAX=479 -D LGFX_TOUCH_ROTATION=0 - -D LGFX_TOUCH_I2C_FREQ=1000000 + -D LGFX_TOUCH_I2C_FREQ=400000 ; 3.5" IPS TFT ILI9488 / FT6236: https://vi.aliexpress.com/item/1005006893699919.html [env:mesh-tab-3-5-IPS-capacitive] @@ -204,7 +204,7 @@ build_flags = ${mesh_tab_base.build_flags} -D LGFX_TOUCH_Y_MIN=0 -D LGFX_TOUCH_Y_MAX=479 -D LGFX_TOUCH_ROTATION=1 - -D LGFX_TOUCH_I2C_FREQ=1000000 + -D LGFX_TOUCH_I2C_FREQ=400000 ; 4.0" IPS TFT ILI9488 / FT6236: https://vi.aliexpress.com/item/1005007082906950.html [env:mesh-tab-4-0-IPS-capacitive] @@ -230,4 +230,4 @@ build_flags = ${mesh_tab_base.build_flags} -D LGFX_TOUCH_Y_MIN=0 -D LGFX_TOUCH_Y_MAX=479 -D LGFX_TOUCH_ROTATION=1 - -D LGFX_TOUCH_I2C_FREQ=1000000 \ No newline at end of file + -D LGFX_TOUCH_I2C_FREQ=400000 \ No newline at end of file From 66a961cb750afc340d86f98521825b833ea2b5a9 Mon Sep 17 00:00:00 2001 From: isseysandei Date: Fri, 3 Jan 2025 18:35:34 +0100 Subject: [PATCH 021/381] increased buffer size to 1024 (#5733) --- src/mqtt/MQTT.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 46fb607b5..3db3c37bb 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -435,7 +435,7 @@ void MQTT::reconnect() serverAddr = hostAndPort.first.c_str(); serverPort = hostAndPort.second; pubSub.setServer(serverAddr, serverPort); - pubSub.setBufferSize(512); + pubSub.setBufferSize(1024); LOG_INFO("Connect directly to MQTT server %s, port: %d, username: %s, password: %s", serverAddr, serverPort, mqttUsername, mqttPassword); From 9afadde2f4ef8c59c80c7926d1c77153f6f9ca33 Mon Sep 17 00:00:00 2001 From: Alex Markley Date: Fri, 3 Jan 2025 18:00:39 -0500 Subject: [PATCH 022/381] Add support for LS20031 GPS module. (#5718) Hardware documentation referenced: - https://cdn.sparkfun.com/datasheets/GPS/LS20030~3_datasheet_v1.3.pdf - https://cdn-shop.adafruit.com/datasheets/PMTK%20command%20packet-Complete-C39-A01.pdf --- src/gps/GPS.cpp | 4 +++- src/gps/GPS.h | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index dcece305a..e88e774bd 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -1190,6 +1190,8 @@ GnssModel_t GPS::probe(int serialSpeed) PROBE_SIMPLE("L76B", "$PMTK605*31", "Quectel-L76B", GNSS_MODEL_MTK_L76B, 500); PROBE_SIMPLE("PA1616S", "$PMTK605*31", "1616S", GNSS_MODEL_MTK_PA1616S, 500); + PROBE_SIMPLE("LS20031", "$PMTK605*31", "MC-1513", GNSS_MODEL_LS20031, 500); + uint8_t cfg_rate[] = {0xB5, 0x62, 0x06, 0x08, 0x00, 0x00, 0x00, 0x00}; UBXChecksum(cfg_rate, sizeof(cfg_rate)); clearBuffer(); @@ -1750,4 +1752,4 @@ void GPS::toggleGpsMode() enable(); } } -#endif // Exclude GPS \ No newline at end of file +#endif // Exclude GPS diff --git a/src/gps/GPS.h b/src/gps/GPS.h index 15fc50fe7..df85b7cbf 100644 --- a/src/gps/GPS.h +++ b/src/gps/GPS.h @@ -29,7 +29,8 @@ typedef enum { GNSS_MODEL_MTK_L76B, GNSS_MODEL_MTK_PA1616S, GNSS_MODEL_AG3335, - GNSS_MODEL_AG3352 + GNSS_MODEL_AG3352, + GNSS_MODEL_LS20031 } GnssModel_t; typedef enum { @@ -239,4 +240,4 @@ class GPS : private concurrency::OSThread }; extern GPS *gps; -#endif // Exclude GPS \ No newline at end of file +#endif // Exclude GPS From 2c654454cffabdd165311ac7bac3770ba975b53b Mon Sep 17 00:00:00 2001 From: Austin Date: Sat, 4 Jan 2025 14:39:37 -0500 Subject: [PATCH 023/381] meshtasticd debian source package (#5741) --- bin/.gitignore | 1 + debian/.gitignore | 6 ++++++ debian/changelog | 5 +++++ debian/control | 25 +++++++++++++++++++++++++ debian/meshtasticd.dirs | 3 +++ debian/meshtasticd.install | 6 ++++++ debian/rules | 15 +++++++++++++++ debian/source/format | 1 + debian/update_changelog.sh | 5 +++++ 9 files changed, 67 insertions(+) create mode 100644 bin/.gitignore create mode 100644 debian/.gitignore create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/meshtasticd.dirs create mode 100644 debian/meshtasticd.install create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/update_changelog.sh diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 000000000..5b6b0720c --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1 @@ +config.yaml diff --git a/debian/.gitignore b/debian/.gitignore new file mode 100644 index 000000000..b36ab39fc --- /dev/null +++ b/debian/.gitignore @@ -0,0 +1,6 @@ +.debhelper +debhelper-build-stamp +meshtasticd +files +meshtasticd.substvars +meshtasticd.postrm.debhelper diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 000000000..5dd6fb1c0 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +meshtasticd (2.5.19) unstable; urgency=medium + + * Initial packaging + + -- Austin Lane Thu, 02 Jan 2025 12:00:00 +0000 \ No newline at end of file diff --git a/debian/control b/debian/control new file mode 100644 index 000000000..b00c6d78e --- /dev/null +++ b/debian/control @@ -0,0 +1,25 @@ +Source: meshtasticd +Section: misc +Priority: optional +Maintainer: Austin Lane +Build-Depends: debhelper-compat (= 13), + python3-pip, + python3-venv, + git, + g++, + pkg-config, + libyaml-cpp-dev, + libgpiod-dev, + libbluetooth-dev, + libusb-1.0-0-dev, + libi2c-dev +Standards-Version: 4.6.2 +Homepage: https://github.com/meshtastic/firmware +Rules-Requires-Root: no + +Package: meshtasticd +Architecture: any +Depends: ${misc:Depends}, ${shlibs:Depends} +Description: Meshtastic daemon for communicating with Meshtastic devices + Meshtastic is an off-grid text communication platform that uses inexpensive + LoRa radios. diff --git a/debian/meshtasticd.dirs b/debian/meshtasticd.dirs new file mode 100644 index 000000000..cf1ba7a37 --- /dev/null +++ b/debian/meshtasticd.dirs @@ -0,0 +1,3 @@ +etc/meshtasticd +etc/meshtasticd/config.d +etc/meshtasticd/available.d diff --git a/debian/meshtasticd.install b/debian/meshtasticd.install new file mode 100644 index 000000000..04bf34daf --- /dev/null +++ b/debian/meshtasticd.install @@ -0,0 +1,6 @@ +.pio/build/native/meshtasticd usr/sbin + +bin/config.yaml etc/meshtasticd +bin/config.d/* etc/meshtasticd/available.d + +bin/meshtasticd.service lib/systemd/system diff --git a/debian/rules b/debian/rules new file mode 100755 index 000000000..5486611a6 --- /dev/null +++ b/debian/rules @@ -0,0 +1,15 @@ +#!/usr/bin/make -f + +# Use the "dh" sequencer +%: + dh $@ + +override_dh_auto_build: + # Terrible hack to use modern platformio to build the native version + python3 -m venv venv + venv/bin/pip install platformio + venv/bin/platformio run -e native + rm -rf venv + # Move the binary and default config to the correct name + mv .pio/build/native/program .pio/build/native/meshtasticd + cp bin/config-dist.yaml bin/config.yaml diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 000000000..9f6742789 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) \ No newline at end of file diff --git a/debian/update_changelog.sh b/debian/update_changelog.sh new file mode 100644 index 000000000..60af34511 --- /dev/null +++ b/debian/update_changelog.sh @@ -0,0 +1,5 @@ +#!/usr/bin/bash +export DEBEMAIL="github-actions[bot]@users.noreply.github.com" +dch --newversion "$(python3 bin/buildinfo.py short)-1" \ + --distribution unstable \ + "GitHub Actions Automatic version bump" From 7c21d7761cf8f63e8acdfe09be7ede63a3a9c379 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sat, 4 Jan 2025 14:12:54 -0600 Subject: [PATCH 024/381] Move the RFM9x to config.available (#5742) --- bin/config-dist.yaml | 6 ------ bin/config.d/lora-Adafruit-RFM9x | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-) create mode 100644 bin/config.d/lora-Adafruit-RFM9x diff --git a/bin/config-dist.yaml b/bin/config-dist.yaml index 49de1675b..e68b01ba3 100644 --- a/bin/config-dist.yaml +++ b/bin/config-dist.yaml @@ -12,12 +12,6 @@ Lora: # IRQ: 17 # Reset: 22 -# Module: RF95 # Adafruit RFM9x -# Reset: 25 -# CS: 7 -# IRQ: 22 -# Busy: 23 - # Module: RF95 # Elecrow Lora RFM95 IOT https://www.elecrow.com/lora-rfm95-iot-board-for-rpi.html # Reset: 22 # CS: 7 diff --git a/bin/config.d/lora-Adafruit-RFM9x b/bin/config.d/lora-Adafruit-RFM9x new file mode 100644 index 000000000..2d64f1f91 --- /dev/null +++ b/bin/config.d/lora-Adafruit-RFM9x @@ -0,0 +1,5 @@ +# Module: RF95 # Adafruit RFM9x +# Reset: 25 +# CS: 7 +# IRQ: 22 +# Busy: 23 \ No newline at end of file From 7480378aed611dad0acf5ea0b2e288f67ba13348 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sat, 4 Jan 2025 14:37:13 -0600 Subject: [PATCH 025/381] Update debian build rules --- debian/rules | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/debian/rules b/debian/rules index 5486611a6..ee8e74c32 100755 --- a/debian/rules +++ b/debian/rules @@ -7,8 +7,10 @@ override_dh_auto_build: # Terrible hack to use modern platformio to build the native version python3 -m venv venv - venv/bin/pip install platformio - venv/bin/platformio run -e native + source venv/bin/activate + pip install platformio + platformio run -e native + deactivate rm -rf venv # Move the binary and default config to the correct name mv .pio/build/native/program .pio/build/native/meshtasticd From eb72ee0fc19b435ff435ca2f4b31f2ba24870eea Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sat, 4 Jan 2025 14:51:36 -0600 Subject: [PATCH 026/381] don't use "source" for deb builds --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index ee8e74c32..2ea031c51 100755 --- a/debian/rules +++ b/debian/rules @@ -7,7 +7,7 @@ override_dh_auto_build: # Terrible hack to use modern platformio to build the native version python3 -m venv venv - source venv/bin/activate + . venv/bin/activate pip install platformio platformio run -e native deactivate From 6aabbedc006bd48def207d5b8337f6dfffb6447f Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sat, 4 Jan 2025 15:41:49 -0600 Subject: [PATCH 027/381] Last Ditch effort for PPA build --- debian/rules | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/debian/rules b/debian/rules index 2ea031c51..c60d611a4 100755 --- a/debian/rules +++ b/debian/rules @@ -6,12 +6,12 @@ override_dh_auto_build: # Terrible hack to use modern platformio to build the native version - python3 -m venv venv - . venv/bin/activate - pip install platformio + # python3 -m venv venv + # . venv/bin/activate + pip install platformio --break-system-packages platformio run -e native - deactivate - rm -rf venv + # deactivate + # rm -rf venv # Move the binary and default config to the correct name mv .pio/build/native/program .pio/build/native/meshtasticd cp bin/config-dist.yaml bin/config.yaml From 35814fd4bc10ba38c69d95bd7079db68fd303b2f Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 5 Jan 2025 11:22:11 -0500 Subject: [PATCH 028/381] meshtasticd debian: split libs for PPA (#5745) --- .github/workflows/build_debian_src.yml | 41 +++++++++++++ .github/workflows/main_matrix.yml | 8 +++ .github/workflows/package_ppa.yml | 58 +++++++++++++++++++ .gitignore | 1 + .../{update_changelog.sh => ci_changelog.sh} | 1 + debian/ci_pack_sdeb.sh | 9 +++ debian/control | 5 +- debian/rules | 15 ++--- debian/source/include-binaries | 2 + debian/source/options | 1 + 10 files changed, 132 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/build_debian_src.yml create mode 100644 .github/workflows/package_ppa.yml rename debian/{update_changelog.sh => ci_changelog.sh} (99%) mode change 100644 => 100755 create mode 100755 debian/ci_pack_sdeb.sh create mode 100644 debian/source/include-binaries create mode 100644 debian/source/options diff --git a/.github/workflows/build_debian_src.yml b/.github/workflows/build_debian_src.yml new file mode 100644 index 000000000..59e925838 --- /dev/null +++ b/.github/workflows/build_debian_src.yml @@ -0,0 +1,41 @@ +name: Build Debian Source Package + +on: workflow_call + +permissions: + contents: write + packages: write + +jobs: + build-debian-src: + runs-on: ubuntu-24.04 + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + + - name: Install deps + shell: bash + run: | + sudo apt-get update -y --fix-missing + sudo apt-get install -y devscripts equivs + + - name: Fetch libdeps, package debian source + run: debian/ci_pack_sdeb.sh + + - name: Get release version string + run: | + echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + echo "short=$(./bin/buildinfo.py short)" >> $GITHUB_OUTPUT + id: version + + - name: Store binaries as an artifact + uses: actions/upload-artifact@v4 + with: + name: firmware-debian-${{ steps.version.outputs.long }}-src.zip + overwrite: true + path: | + ../meshtasticd_${{ steps.version.outputs.short }}* diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index a437411b5..9685ff91f 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -128,6 +128,9 @@ jobs: with: board: ${{ matrix.board }} + package-ppa: + uses: ./.github/workflows/package_ppa.yml + package-raspbian: uses: ./.github/workflows/package_raspbian.yml @@ -332,12 +335,17 @@ jobs: run: >- bin/bump_version.py + - name: Update debian changelog + run: >- + debian/ci_changelog.sh + - name: Create version.properties pull request uses: peter-evans/create-pull-request@v7 with: title: Bump version.properties add-paths: | version.properties + debian/changelog release-firmware: strategy: diff --git a/.github/workflows/package_ppa.yml b/.github/workflows/package_ppa.yml new file mode 100644 index 000000000..284048466 --- /dev/null +++ b/.github/workflows/package_ppa.yml @@ -0,0 +1,58 @@ +name: Package Launchpad PPA + +on: + workflow_call: + workflow_dispatch: + +permissions: + contents: write + packages: write + +jobs: + build-debian-src: + uses: ./.github/workflows/build_debian_src.yml + + package-ppa: + runs-on: ubuntu-24.04 + needs: build-debian-src + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + + - name: Get release version string + run: | + echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + echo "short=$(./bin/buildinfo.py short)" >> $GITHUB_OUTPUT + id: version + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: firmware-debian-${{ steps.version.outputs.long }}-src.zip + merge-multiple: true + + # - name: Install deps + # shell: bash + # run: | + # sudo apt-get update -y --fix-missing + # sudo apt-get install -y dput + + - name: Display structure of downloaded files + run: ls -R + + - name: Publish PPA + if: ${{ github.event_name != 'pull_request_target' && github.event_name != 'pull_request' }} + uses: yuezk/publish-ppa-package@v2 + with: + # See https://launchpad.net/~meshtastic/+archive/ubuntu/meshtastic-daily + repository: "meshtastic/meshtastic-daily" + gpg_private_key: ${{ secrets.PPA_GPG_PRIVATE_KEY }} + tarball: "meshtasticd_${{ steps.version.outputs.short }}.tar.xz" + # Supported Ubuntu versions + series: "plucky oracular noble jammy" + deb_email: "github-actions[bot]@users.noreply.github.com" + deb_fullname: "github-actions[bot]" diff --git a/.gitignore b/.gitignore index 28f9a24cc..8998b60d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .pio +pio # ignore vscode IDE settings files .vscode/* diff --git a/debian/update_changelog.sh b/debian/ci_changelog.sh old mode 100644 new mode 100755 similarity index 99% rename from debian/update_changelog.sh rename to debian/ci_changelog.sh index 60af34511..56688f99b --- a/debian/update_changelog.sh +++ b/debian/ci_changelog.sh @@ -1,5 +1,6 @@ #!/usr/bin/bash export DEBEMAIL="github-actions[bot]@users.noreply.github.com" + dch --newversion "$(python3 bin/buildinfo.py short)-1" \ --distribution unstable \ "GitHub Actions Automatic version bump" diff --git a/debian/ci_pack_sdeb.sh b/debian/ci_pack_sdeb.sh new file mode 100755 index 000000000..97f102209 --- /dev/null +++ b/debian/ci_pack_sdeb.sh @@ -0,0 +1,9 @@ +#!/usr/bin/bash +export PLATFORMIO_LIBDEPS_DIR=pio/libdeps +export PLATFORMIO_PACKAGES_DIR=pio/packages + +# Download libraries to `libdeps` +platformio pkg install -e native + +# Build the source deb +debuild -S diff --git a/debian/control b/debian/control index b00c6d78e..9814933e3 100644 --- a/debian/control +++ b/debian/control @@ -3,8 +3,9 @@ Section: misc Priority: optional Maintainer: Austin Lane Build-Depends: debhelper-compat (= 13), - python3-pip, - python3-venv, + platformio, + python3-protobuf, + python3-grpcio, git, g++, pkg-config, diff --git a/debian/rules b/debian/rules index c60d611a4..f535ad6eb 100755 --- a/debian/rules +++ b/debian/rules @@ -1,17 +1,18 @@ #!/usr/bin/make -f +# export DH_VERBOSE = 1 # Use the "dh" sequencer %: dh $@ +# https://docs.platformio.org/en/latest/envvars.html +PIO_ENV:=\ + PLATFORMIO_LIBDEPS_DIR=pio/libdeps \ + PLATFORMIO_PACKAGES_DIR=pio/packages + override_dh_auto_build: - # Terrible hack to use modern platformio to build the native version - # python3 -m venv venv - # . venv/bin/activate - pip install platformio --break-system-packages - platformio run -e native - # deactivate - # rm -rf venv + # Build with platformio + $(PIO_ENV) platformio run -e native # Move the binary and default config to the correct name mv .pio/build/native/program .pio/build/native/meshtasticd cp bin/config-dist.yaml bin/config.yaml diff --git a/debian/source/include-binaries b/debian/source/include-binaries new file mode 100644 index 000000000..1632328ca --- /dev/null +++ b/debian/source/include-binaries @@ -0,0 +1,2 @@ +pio/libdeps +pio/packages \ No newline at end of file diff --git a/debian/source/options b/debian/source/options new file mode 100644 index 000000000..0553b485d --- /dev/null +++ b/debian/source/options @@ -0,0 +1 @@ +extend-diff-ignore = "\.pio" \ No newline at end of file From 15019e8663741d12321173c5a2dcdab0d2dc2f7b Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 5 Jan 2025 11:37:38 -0500 Subject: [PATCH 029/381] meshtasticd: deps for debian_build_src (#5748) --- .github/workflows/build_debian_src.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_debian_src.yml b/.github/workflows/build_debian_src.yml index 59e925838..6b1c014c2 100644 --- a/.github/workflows/build_debian_src.yml +++ b/.github/workflows/build_debian_src.yml @@ -21,7 +21,11 @@ jobs: shell: bash run: | sudo apt-get update -y --fix-missing - sudo apt-get install -y devscripts equivs + sudo apt-get install -y software-properties-common + sudo add-apt-repository ppa:meshtastic/meshtastic-daily -y + sudo apt-get install -y build-essential devscripts equivs \ + platformio python3-protobuf python3-grpcio \ + libyaml-cpp-dev libgpiod-dev libbluetooth-dev libusb-1.0-0-dev libi2c-dev - name: Fetch libdeps, package debian source run: debian/ci_pack_sdeb.sh From b2a89b8136fe27689805e07a84ef78efb191d919 Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 5 Jan 2025 12:06:00 -0500 Subject: [PATCH 030/381] meshtasticd: gpg tomfoolery (#5750) --- .github/workflows/build_debian_src.yml | 8 ++++++++ debian/ci_pack_sdeb.sh | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_debian_src.yml b/.github/workflows/build_debian_src.yml index 6b1c014c2..bae3e442d 100644 --- a/.github/workflows/build_debian_src.yml +++ b/.github/workflows/build_debian_src.yml @@ -27,8 +27,16 @@ jobs: platformio python3-protobuf python3-grpcio \ libyaml-cpp-dev libgpiod-dev libbluetooth-dev libusb-1.0-0-dev libi2c-dev + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ secrets.PPA_GPG_PRIVATE_KEY }} + id: gpg + - name: Fetch libdeps, package debian source run: debian/ci_pack_sdeb.sh + env: + GPG_KEY_ID: ${{ steps.gpg.outputs.keyid }} - name: Get release version string run: | diff --git a/debian/ci_pack_sdeb.sh b/debian/ci_pack_sdeb.sh index 97f102209..79b484a35 100755 --- a/debian/ci_pack_sdeb.sh +++ b/debian/ci_pack_sdeb.sh @@ -6,4 +6,4 @@ export PLATFORMIO_PACKAGES_DIR=pio/packages platformio pkg install -e native # Build the source deb -debuild -S +debuild -S -k$GPG_KEY_ID From 02a5a91da0813858c5fd0c27282f3a01271968cd Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 5 Jan 2025 12:30:43 -0500 Subject: [PATCH 031/381] meshtasticd debian: secrets perms (#5751) --- .github/workflows/build_debian_src.yml | 6 +++++- .github/workflows/main_matrix.yml | 1 + .github/workflows/package_ppa.yml | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_debian_src.yml b/.github/workflows/build_debian_src.yml index bae3e442d..cc93b5748 100644 --- a/.github/workflows/build_debian_src.yml +++ b/.github/workflows/build_debian_src.yml @@ -1,6 +1,10 @@ name: Build Debian Source Package -on: workflow_call +on: + workflow_call: + secrets: + PPA_GPG_PRIVATE_KEY: + required: true permissions: contents: write diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 9685ff91f..f4c5de228 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -130,6 +130,7 @@ jobs: package-ppa: uses: ./.github/workflows/package_ppa.yml + secrets: inherit package-raspbian: uses: ./.github/workflows/package_raspbian.yml diff --git a/.github/workflows/package_ppa.yml b/.github/workflows/package_ppa.yml index 284048466..1fcc96e11 100644 --- a/.github/workflows/package_ppa.yml +++ b/.github/workflows/package_ppa.yml @@ -2,6 +2,9 @@ name: Package Launchpad PPA on: workflow_call: + secrets: + PPA_GPG_PRIVATE_KEY: + required: true workflow_dispatch: permissions: @@ -11,6 +14,7 @@ permissions: jobs: build-debian-src: uses: ./.github/workflows/build_debian_src.yml + secrets: inherit package-ppa: runs-on: ubuntu-24.04 From 5196ee39cb8d8122f794fe0b100e4757887028ea Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 5 Jan 2025 12:44:05 -0500 Subject: [PATCH 032/381] meshtasticd: debian checkout to subdir (#5752) --- .github/workflows/build_debian_src.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_debian_src.yml b/.github/workflows/build_debian_src.yml index cc93b5748..72e4adf3e 100644 --- a/.github/workflows/build_debian_src.yml +++ b/.github/workflows/build_debian_src.yml @@ -18,6 +18,7 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive + path: meshtasticd ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} @@ -38,11 +39,13 @@ jobs: id: gpg - name: Fetch libdeps, package debian source + working-directory: meshtasticd run: debian/ci_pack_sdeb.sh env: GPG_KEY_ID: ${{ steps.gpg.outputs.keyid }} - name: Get release version string + working-directory: meshtasticd run: | echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT echo "short=$(./bin/buildinfo.py short)" >> $GITHUB_OUTPUT @@ -54,4 +57,4 @@ jobs: name: firmware-debian-${{ steps.version.outputs.long }}-src.zip overwrite: true path: | - ../meshtasticd_${{ steps.version.outputs.short }}* + meshtasticd_${{ steps.version.outputs.short }}* From 7c10caa78b927e31cdd69f550ac3aaafc50c7be1 Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 5 Jan 2025 13:31:01 -0500 Subject: [PATCH 033/381] meshtastic-debian: publish with dput (#5753) --- .github/workflows/build_debian_src.yml | 8 ++--- .github/workflows/package_ppa.yml | 50 ++++++++++++++++---------- 2 files changed, 36 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build_debian_src.yml b/.github/workflows/build_debian_src.yml index 72e4adf3e..dfd8b66fb 100644 --- a/.github/workflows/build_debian_src.yml +++ b/.github/workflows/build_debian_src.yml @@ -24,13 +24,13 @@ jobs: - name: Install deps shell: bash + working-directory: meshtasticd run: | sudo apt-get update -y --fix-missing sudo apt-get install -y software-properties-common sudo add-apt-repository ppa:meshtastic/meshtastic-daily -y - sudo apt-get install -y build-essential devscripts equivs \ - platformio python3-protobuf python3-grpcio \ - libyaml-cpp-dev libgpiod-dev libbluetooth-dev libusb-1.0-0-dev libi2c-dev + sudo apt-get install -y build-essential devscripts equivs + sudo mk-build-deps --install --remove --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control - name: Import GPG key uses: crazy-max/ghaction-import-gpg@v6 @@ -54,7 +54,7 @@ jobs: - name: Store binaries as an artifact uses: actions/upload-artifact@v4 with: - name: firmware-debian-${{ steps.version.outputs.long }}-src.zip + name: firmware-debian-${{ steps.version.outputs.long }}-src overwrite: true path: | meshtasticd_${{ steps.version.outputs.short }}* diff --git a/.github/workflows/package_ppa.yml b/.github/workflows/package_ppa.yml index 1fcc96e11..9d59df472 100644 --- a/.github/workflows/package_ppa.yml +++ b/.github/workflows/package_ppa.yml @@ -24,10 +24,24 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive + path: meshtasticd ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} + - name: Install deps + shell: bash + run: | + sudo apt-get update -y --fix-missing + sudo apt-get install -y dput + + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ secrets.PPA_GPG_PRIVATE_KEY }} + id: gpg + - name: Get release version string + working-directory: meshtasticd run: | echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT echo "short=$(./bin/buildinfo.py short)" >> $GITHUB_OUTPUT @@ -36,27 +50,27 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v4 with: - name: firmware-debian-${{ steps.version.outputs.long }}-src.zip + name: firmware-debian-${{ steps.version.outputs.long }}-src merge-multiple: true - # - name: Install deps - # shell: bash - # run: | - # sudo apt-get update -y --fix-missing - # sudo apt-get install -y dput - - name: Display structure of downloaded files run: ls -R - - name: Publish PPA + - name: Publish with dput if: ${{ github.event_name != 'pull_request_target' && github.event_name != 'pull_request' }} - uses: yuezk/publish-ppa-package@v2 - with: - # See https://launchpad.net/~meshtastic/+archive/ubuntu/meshtastic-daily - repository: "meshtastic/meshtastic-daily" - gpg_private_key: ${{ secrets.PPA_GPG_PRIVATE_KEY }} - tarball: "meshtasticd_${{ steps.version.outputs.short }}.tar.xz" - # Supported Ubuntu versions - series: "plucky oracular noble jammy" - deb_email: "github-actions[bot]@users.noreply.github.com" - deb_fullname: "github-actions[bot]" + run: | + dput ppa:meshtastic/meshtastic-daily meshtasticd_${{ steps.version.outputs.short }}_source.changes + + # - name: Publish PPA + # if: ${{ github.event_name != 'pull_request_target' && github.event_name != 'pull_request' }} + # uses: yuezk/publish-ppa-package@v2 + # with: + # # See https://launchpad.net/~meshtastic/+archive/ubuntu/meshtastic-daily + # repository: "meshtastic/meshtastic-daily" + # gpg_private_key: ${{ secrets.PPA_GPG_PRIVATE_KEY }} + # gpg_passphrase: "" + # tarball: "meshtasticd_${{ steps.version.outputs.short }}.tar.xz" + # deb_email: "github-actions[bot]@users.noreply.github.com" + # deb_fullname: "github-actions[bot]" + # # Supported Ubuntu versions + # series: "plucky oracular noble jammy" From 031aecac665c4e4ebf28026a9a3196b16037d9e2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 5 Jan 2025 13:14:56 -0600 Subject: [PATCH 034/381] [create-pull-request] automated change (#5755) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/config.pb.cpp | 2 ++ src/mesh/generated/meshtastic/config.pb.h | 26 ++++++++++++++++---- src/mesh/generated/meshtastic/device_ui.pb.h | 16 ++++++++---- src/mesh/generated/meshtastic/localonly.pb.h | 2 +- 5 files changed, 36 insertions(+), 12 deletions(-) diff --git a/protobufs b/protobufs index c55f120a9..76f806e1b 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit c55f120a9c1ce90c85e4826907a0b9bcb2d5f5a2 +Subproject commit 76f806e1bb1e2a7b157a14fadd095775f63db5e4 diff --git a/src/mesh/generated/meshtastic/config.pb.cpp b/src/mesh/generated/meshtastic/config.pb.cpp index 6fd2161ae..5512584a7 100644 --- a/src/mesh/generated/meshtastic/config.pb.cpp +++ b/src/mesh/generated/meshtastic/config.pb.cpp @@ -63,6 +63,8 @@ PB_BIND(meshtastic_Config_SessionkeyConfig, meshtastic_Config_SessionkeyConfig, + + diff --git a/src/mesh/generated/meshtastic/config.pb.h b/src/mesh/generated/meshtastic/config.pb.h index 5e105ab17..14aed9dfe 100644 --- a/src/mesh/generated/meshtastic/config.pb.h +++ b/src/mesh/generated/meshtastic/config.pb.h @@ -139,6 +139,14 @@ typedef enum _meshtastic_Config_NetworkConfig_AddressMode { meshtastic_Config_NetworkConfig_AddressMode_STATIC = 1 } meshtastic_Config_NetworkConfig_AddressMode; +/* Available flags auxiliary network protocols */ +typedef enum _meshtastic_Config_NetworkConfig_ProtocolFlags { + /* Do not broadcast packets over any network protocol */ + meshtastic_Config_NetworkConfig_ProtocolFlags_NO_BROADCAST = 0, + /* Enable broadcasting packets via UDP over the local network */ + meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST = 1 +} meshtastic_Config_NetworkConfig_ProtocolFlags; + /* How the GPS coordinates are displayed on the OLED screen. */ typedef enum _meshtastic_Config_DisplayConfig_GpsCoordinateFormat { /* GPS coordinates are displayed in the normal decimal degrees format: @@ -429,6 +437,8 @@ typedef struct _meshtastic_Config_NetworkConfig { meshtastic_Config_NetworkConfig_IpV4Config ipv4_config; /* rsyslog Server and Port */ char rsyslog_server[33]; + /* Flags for enabling/disabling network protocols */ + uint32_t enabled_protocols; } meshtastic_Config_NetworkConfig; /* Display Config */ @@ -613,6 +623,10 @@ extern "C" { #define _meshtastic_Config_NetworkConfig_AddressMode_MAX meshtastic_Config_NetworkConfig_AddressMode_STATIC #define _meshtastic_Config_NetworkConfig_AddressMode_ARRAYSIZE ((meshtastic_Config_NetworkConfig_AddressMode)(meshtastic_Config_NetworkConfig_AddressMode_STATIC+1)) +#define _meshtastic_Config_NetworkConfig_ProtocolFlags_MIN meshtastic_Config_NetworkConfig_ProtocolFlags_NO_BROADCAST +#define _meshtastic_Config_NetworkConfig_ProtocolFlags_MAX meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST +#define _meshtastic_Config_NetworkConfig_ProtocolFlags_ARRAYSIZE ((meshtastic_Config_NetworkConfig_ProtocolFlags)(meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST+1)) + #define _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN meshtastic_Config_DisplayConfig_GpsCoordinateFormat_DEC #define _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MAX meshtastic_Config_DisplayConfig_GpsCoordinateFormat_OSGR #define _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_ARRAYSIZE ((meshtastic_Config_DisplayConfig_GpsCoordinateFormat)(meshtastic_Config_DisplayConfig_GpsCoordinateFormat_OSGR+1)) @@ -674,7 +688,7 @@ extern "C" { #define meshtastic_Config_DeviceConfig_init_default {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0} #define meshtastic_Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _meshtastic_Config_PositionConfig_GpsMode_MIN} #define meshtastic_Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0} -#define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, ""} +#define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, "", 0} #define meshtastic_Config_NetworkConfig_IpV4Config_init_default {0, 0, 0, 0} #define meshtastic_Config_DisplayConfig_init_default {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN} #define meshtastic_Config_LoRaConfig_init_default {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0} @@ -685,7 +699,7 @@ extern "C" { #define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0} #define meshtastic_Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _meshtastic_Config_PositionConfig_GpsMode_MIN} #define meshtastic_Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0} -#define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, ""} +#define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, "", 0} #define meshtastic_Config_NetworkConfig_IpV4Config_init_zero {0, 0, 0, 0} #define meshtastic_Config_DisplayConfig_init_zero {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN} #define meshtastic_Config_LoRaConfig_init_zero {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0} @@ -739,6 +753,7 @@ extern "C" { #define meshtastic_Config_NetworkConfig_address_mode_tag 7 #define meshtastic_Config_NetworkConfig_ipv4_config_tag 8 #define meshtastic_Config_NetworkConfig_rsyslog_server_tag 9 +#define meshtastic_Config_NetworkConfig_enabled_protocols_tag 10 #define meshtastic_Config_DisplayConfig_screen_on_secs_tag 1 #define meshtastic_Config_DisplayConfig_gps_format_tag 2 #define meshtastic_Config_DisplayConfig_auto_screen_carousel_secs_tag 3 @@ -867,7 +882,8 @@ X(a, STATIC, SINGULAR, STRING, ntp_server, 5) \ X(a, STATIC, SINGULAR, BOOL, eth_enabled, 6) \ X(a, STATIC, SINGULAR, UENUM, address_mode, 7) \ X(a, STATIC, OPTIONAL, MESSAGE, ipv4_config, 8) \ -X(a, STATIC, SINGULAR, STRING, rsyslog_server, 9) +X(a, STATIC, SINGULAR, STRING, rsyslog_server, 9) \ +X(a, STATIC, SINGULAR, UINT32, enabled_protocols, 10) #define meshtastic_Config_NetworkConfig_CALLBACK NULL #define meshtastic_Config_NetworkConfig_DEFAULT NULL #define meshtastic_Config_NetworkConfig_ipv4_config_MSGTYPE meshtastic_Config_NetworkConfig_IpV4Config @@ -972,12 +988,12 @@ extern const pb_msgdesc_t meshtastic_Config_SessionkeyConfig_msg; #define meshtastic_Config_DisplayConfig_size 30 #define meshtastic_Config_LoRaConfig_size 85 #define meshtastic_Config_NetworkConfig_IpV4Config_size 20 -#define meshtastic_Config_NetworkConfig_size 196 +#define meshtastic_Config_NetworkConfig_size 202 #define meshtastic_Config_PositionConfig_size 62 #define meshtastic_Config_PowerConfig_size 52 #define meshtastic_Config_SecurityConfig_size 178 #define meshtastic_Config_SessionkeyConfig_size 0 -#define meshtastic_Config_size 199 +#define meshtastic_Config_size 205 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/device_ui.pb.h b/src/mesh/generated/meshtastic/device_ui.pb.h index 0c4f5384e..f090b5b4f 100644 --- a/src/mesh/generated/meshtastic/device_ui.pb.h +++ b/src/mesh/generated/meshtastic/device_ui.pb.h @@ -51,6 +51,8 @@ typedef enum _meshtastic_Language { meshtastic_Language_GREEK = 13, /* Norwegian */ meshtastic_Language_NORWEGIAN = 14, + /* Slovenian */ + meshtastic_Language_SLOVENIAN = 15, /* Simplified Chinese (experimental) */ meshtastic_Language_SIMPLIFIED_CHINESE = 30, /* Traditional Chinese (experimental) */ @@ -71,6 +73,8 @@ typedef struct _meshtastic_NodeFilter { bool position_switch; /* Filter nodes by matching name string */ char node_name[16]; + /* Filter based on channel */ + int8_t channel; } meshtastic_NodeFilter; typedef struct _meshtastic_NodeHighlight { @@ -138,10 +142,10 @@ extern "C" { /* Initializer values for message structs */ #define meshtastic_DeviceUIConfig_init_default {0, 0, 0, 0, 0, 0, _meshtastic_Theme_MIN, 0, 0, 0, _meshtastic_Language_MIN, false, meshtastic_NodeFilter_init_default, false, meshtastic_NodeHighlight_init_default, {0, {0}}} -#define meshtastic_NodeFilter_init_default {0, 0, 0, 0, 0, ""} +#define meshtastic_NodeFilter_init_default {0, 0, 0, 0, 0, "", 0} #define meshtastic_NodeHighlight_init_default {0, 0, 0, 0, ""} #define meshtastic_DeviceUIConfig_init_zero {0, 0, 0, 0, 0, 0, _meshtastic_Theme_MIN, 0, 0, 0, _meshtastic_Language_MIN, false, meshtastic_NodeFilter_init_zero, false, meshtastic_NodeHighlight_init_zero, {0, {0}}} -#define meshtastic_NodeFilter_init_zero {0, 0, 0, 0, 0, ""} +#define meshtastic_NodeFilter_init_zero {0, 0, 0, 0, 0, "", 0} #define meshtastic_NodeHighlight_init_zero {0, 0, 0, 0, ""} /* Field tags (for use in manual encoding/decoding) */ @@ -151,6 +155,7 @@ extern "C" { #define meshtastic_NodeFilter_hops_away_tag 4 #define meshtastic_NodeFilter_position_switch_tag 5 #define meshtastic_NodeFilter_node_name_tag 6 +#define meshtastic_NodeFilter_channel_tag 7 #define meshtastic_NodeHighlight_chat_switch_tag 1 #define meshtastic_NodeHighlight_position_switch_tag 2 #define meshtastic_NodeHighlight_telemetry_switch_tag 3 @@ -198,7 +203,8 @@ X(a, STATIC, SINGULAR, BOOL, offline_switch, 2) \ X(a, STATIC, SINGULAR, BOOL, public_key_switch, 3) \ X(a, STATIC, SINGULAR, INT32, hops_away, 4) \ X(a, STATIC, SINGULAR, BOOL, position_switch, 5) \ -X(a, STATIC, SINGULAR, STRING, node_name, 6) +X(a, STATIC, SINGULAR, STRING, node_name, 6) \ +X(a, STATIC, SINGULAR, INT32, channel, 7) #define meshtastic_NodeFilter_CALLBACK NULL #define meshtastic_NodeFilter_DEFAULT NULL @@ -222,8 +228,8 @@ extern const pb_msgdesc_t meshtastic_NodeHighlight_msg; /* Maximum encoded size of messages (where known) */ #define MESHTASTIC_MESHTASTIC_DEVICE_UI_PB_H_MAX_SIZE meshtastic_DeviceUIConfig_size -#define meshtastic_DeviceUIConfig_size 117 -#define meshtastic_NodeFilter_size 36 +#define meshtastic_DeviceUIConfig_size 128 +#define meshtastic_NodeFilter_size 47 #define meshtastic_NodeHighlight_size 25 #ifdef __cplusplus diff --git a/src/mesh/generated/meshtastic/localonly.pb.h b/src/mesh/generated/meshtastic/localonly.pb.h index 30f70ed90..dc0f507c9 100644 --- a/src/mesh/generated/meshtastic/localonly.pb.h +++ b/src/mesh/generated/meshtastic/localonly.pb.h @@ -187,7 +187,7 @@ extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg; /* Maximum encoded size of messages (where known) */ #define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalConfig_size -#define meshtastic_LocalConfig_size 735 +#define meshtastic_LocalConfig_size 741 #define meshtastic_LocalModuleConfig_size 699 #ifdef __cplusplus From d21d6c1301d2a3fd06faf17f0ca411e8d6d83d0f Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 5 Jan 2025 14:24:05 -0500 Subject: [PATCH 035/381] meshtasticd-debian: Build multiple series (#5756) --- .github/workflows/build_debian_src.yml | 9 ++++++++- .github/workflows/main_matrix.yml | 6 ++++++ .github/workflows/package_ppa.yml | 11 +++++++++-- debian/ci_pack_sdeb.sh | 7 +++++++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_debian_src.yml b/.github/workflows/build_debian_src.yml index dfd8b66fb..1424774b0 100644 --- a/.github/workflows/build_debian_src.yml +++ b/.github/workflows/build_debian_src.yml @@ -5,6 +5,11 @@ on: secrets: PPA_GPG_PRIVATE_KEY: required: true + inputs: + series: + description: 'Ubuntu series to target' + required: true + type: string permissions: contents: write @@ -42,7 +47,9 @@ jobs: working-directory: meshtasticd run: debian/ci_pack_sdeb.sh env: + SERIES: ${{ inputs.series }} GPG_KEY_ID: ${{ steps.gpg.outputs.keyid }} + REVISION: ${{ github.sha }} - name: Get release version string working-directory: meshtasticd @@ -54,7 +61,7 @@ jobs: - name: Store binaries as an artifact uses: actions/upload-artifact@v4 with: - name: firmware-debian-${{ steps.version.outputs.long }}-src + name: firmware-debian-${{ steps.version.outputs.long }}-${{ inputs.series }}-src overwrite: true path: | meshtasticd_${{ steps.version.outputs.short }}* diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index f4c5de228..be8cddaf3 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -129,7 +129,13 @@ jobs: board: ${{ matrix.board }} package-ppa: + strategy: + fail-fast: false + matrix: + series: [plucky, oracular, noble, jammy] uses: ./.github/workflows/package_ppa.yml + with: + series: ${{ matrix.series }} secrets: inherit package-raspbian: diff --git a/.github/workflows/package_ppa.yml b/.github/workflows/package_ppa.yml index 9d59df472..d630e8092 100644 --- a/.github/workflows/package_ppa.yml +++ b/.github/workflows/package_ppa.yml @@ -5,6 +5,11 @@ on: secrets: PPA_GPG_PRIVATE_KEY: required: true + inputs: + series: + description: 'Ubuntu series to target' + required: true + type: string workflow_dispatch: permissions: @@ -15,6 +20,8 @@ jobs: build-debian-src: uses: ./.github/workflows/build_debian_src.yml secrets: inherit + with: + series: ${{ inputs.series }} package-ppa: runs-on: ubuntu-24.04 @@ -50,11 +57,11 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v4 with: - name: firmware-debian-${{ steps.version.outputs.long }}-src + name: firmware-debian-${{ steps.version.outputs.long }}-${{ inputs.series }}-src merge-multiple: true - name: Display structure of downloaded files - run: ls -R + run: ls -lah - name: Publish with dput if: ${{ github.event_name != 'pull_request_target' && github.event_name != 'pull_request' }} diff --git a/debian/ci_pack_sdeb.sh b/debian/ci_pack_sdeb.sh index 79b484a35..acab2683f 100755 --- a/debian/ci_pack_sdeb.sh +++ b/debian/ci_pack_sdeb.sh @@ -1,9 +1,16 @@ #!/usr/bin/bash +export DEBEMAIL="github-actions[bot]@users.noreply.github.com" export PLATFORMIO_LIBDEPS_DIR=pio/libdeps export PLATFORMIO_PACKAGES_DIR=pio/packages # Download libraries to `libdeps` platformio pkg install -e native +package=$(dpkg-parsechangelog --show-field Source) +pkg_version=$(dpkg-parsechangelog --show-field Version | cut -d- -f1) + +dch --create --distribution $SERIES --package $package --newversion $pkg_version-ppa${REVISION::7}~$SERIES \ + "GitHub Actions Automatic packaging for $SERIES" + # Build the source deb debuild -S -k$GPG_KEY_ID From 892e0922ff32eb50211e460079d011cc41c269cc Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 5 Jan 2025 14:37:15 -0500 Subject: [PATCH 036/381] meshtastic-debian: --create requires missing changelog (#5757) --- debian/ci_pack_sdeb.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/ci_pack_sdeb.sh b/debian/ci_pack_sdeb.sh index acab2683f..23490f1bd 100755 --- a/debian/ci_pack_sdeb.sh +++ b/debian/ci_pack_sdeb.sh @@ -9,6 +9,7 @@ platformio pkg install -e native package=$(dpkg-parsechangelog --show-field Source) pkg_version=$(dpkg-parsechangelog --show-field Version | cut -d- -f1) +rm -rf debian/changelog dch --create --distribution $SERIES --package $package --newversion $pkg_version-ppa${REVISION::7}~$SERIES \ "GitHub Actions Automatic packaging for $SERIES" From 2f552d15e5b272ac2a0a572fd0b414f7ca47a6b0 Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 5 Jan 2025 15:14:47 -0500 Subject: [PATCH 037/381] meshtasticd-debian: Cleanup debian versioning (#5758) --- .github/workflows/build_debian_src.yml | 19 +++++++++---------- .github/workflows/package_ppa.yml | 21 +++------------------ bin/readprops.py | 7 ++++--- debian/ci_pack_sdeb.sh | 5 ++--- 4 files changed, 18 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build_debian_src.yml b/.github/workflows/build_debian_src.yml index 1424774b0..9bb7dfb9c 100644 --- a/.github/workflows/build_debian_src.yml +++ b/.github/workflows/build_debian_src.yml @@ -43,25 +43,24 @@ jobs: gpg_private_key: ${{ secrets.PPA_GPG_PRIVATE_KEY }} id: gpg + - name: Get release version string + working-directory: meshtasticd + run: | + echo "deb=$(./bin/buildinfo.py deb)" >> $GITHUB_OUTPUT + id: version + - name: Fetch libdeps, package debian source working-directory: meshtasticd run: debian/ci_pack_sdeb.sh env: SERIES: ${{ inputs.series }} GPG_KEY_ID: ${{ steps.gpg.outputs.keyid }} - REVISION: ${{ github.sha }} - - - name: Get release version string - working-directory: meshtasticd - run: | - echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - echo "short=$(./bin/buildinfo.py short)" >> $GITHUB_OUTPUT - id: version + PKG_VERSION: ${{ steps.version.outputs.deb }} - name: Store binaries as an artifact uses: actions/upload-artifact@v4 with: - name: firmware-debian-${{ steps.version.outputs.long }}-${{ inputs.series }}-src + name: firmware-debian-${{ steps.version.outputs.deb }}~${{ inputs.series }}-src overwrite: true path: | - meshtasticd_${{ steps.version.outputs.short }}* + meshtasticd_${{ steps.version.outputs.deb }}* diff --git a/.github/workflows/package_ppa.yml b/.github/workflows/package_ppa.yml index d630e8092..f716fdff4 100644 --- a/.github/workflows/package_ppa.yml +++ b/.github/workflows/package_ppa.yml @@ -50,14 +50,13 @@ jobs: - name: Get release version string working-directory: meshtasticd run: | - echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - echo "short=$(./bin/buildinfo.py short)" >> $GITHUB_OUTPUT + echo "deb=$(./bin/buildinfo.py deb)" >> $GITHUB_OUTPUT id: version - name: Download artifacts uses: actions/download-artifact@v4 with: - name: firmware-debian-${{ steps.version.outputs.long }}-${{ inputs.series }}-src + name: firmware-debian-${{ steps.version.outputs.deb }}~${{ inputs.series }}-src merge-multiple: true - name: Display structure of downloaded files @@ -66,18 +65,4 @@ jobs: - name: Publish with dput if: ${{ github.event_name != 'pull_request_target' && github.event_name != 'pull_request' }} run: | - dput ppa:meshtastic/meshtastic-daily meshtasticd_${{ steps.version.outputs.short }}_source.changes - - # - name: Publish PPA - # if: ${{ github.event_name != 'pull_request_target' && github.event_name != 'pull_request' }} - # uses: yuezk/publish-ppa-package@v2 - # with: - # # See https://launchpad.net/~meshtastic/+archive/ubuntu/meshtastic-daily - # repository: "meshtastic/meshtastic-daily" - # gpg_private_key: ${{ secrets.PPA_GPG_PRIVATE_KEY }} - # gpg_passphrase: "" - # tarball: "meshtasticd_${{ steps.version.outputs.short }}.tar.xz" - # deb_email: "github-actions[bot]@users.noreply.github.com" - # deb_fullname: "github-actions[bot]" - # # Supported Ubuntu versions - # series: "plucky oracular noble jammy" + dput ppa:meshtastic/meshtastic-daily meshtasticd_${{ steps.version.outputs.deb }}~${{ inputs.series }}_source.changes diff --git a/bin/readprops.py b/bin/readprops.py index 4b730658a..68516b74c 100644 --- a/bin/readprops.py +++ b/bin/readprops.py @@ -10,6 +10,7 @@ def readProps(prefsLoc): version = dict(config.items("VERSION")) verObj = dict( short="{}.{}.{}".format(version["major"], version["minor"], version["build"]), + deb="unset", long="unset", ) @@ -27,13 +28,13 @@ def readProps(prefsLoc): # if isDirty: # # short for 'dirty', we want to keep our verstrings source for protobuf reasons # suffix = sha + "-d" - verObj["long"] = "{}.{}.{}.{}".format( - version["major"], version["minor"], version["build"], suffix - ) + verObj["long"] = "{}.{}".format(verObj["short"], suffix) + verObj["deb"] = "{}-ppa{}".format(verObj["short"], sha) except: # print("Unexpected error:", sys.exc_info()[0]) # traceback.print_exc() verObj["long"] = verObj["short"] + verObj["deb"] = "{}-ppa".format(verObj["short"]) # print("firmware version " + verStr) return verObj diff --git a/debian/ci_pack_sdeb.sh b/debian/ci_pack_sdeb.sh index 23490f1bd..b8c40decb 100755 --- a/debian/ci_pack_sdeb.sh +++ b/debian/ci_pack_sdeb.sh @@ -7,11 +7,10 @@ export PLATFORMIO_PACKAGES_DIR=pio/packages platformio pkg install -e native package=$(dpkg-parsechangelog --show-field Source) -pkg_version=$(dpkg-parsechangelog --show-field Version | cut -d- -f1) rm -rf debian/changelog -dch --create --distribution $SERIES --package $package --newversion $pkg_version-ppa${REVISION::7}~$SERIES \ - "GitHub Actions Automatic packaging for $SERIES" +dch --create --distribution $SERIES --package $package --newversion $PKG_VERSION~$SERIES \ + "GitHub Actions Automatic packaging for $PKG_VERSION~$SERIES" # Build the source deb debuild -S -k$GPG_KEY_ID From 29a7866fc11411f015698f2ef7326572bfbf0a80 Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 5 Jan 2025 15:26:56 -0500 Subject: [PATCH 038/381] Use jbennett for gpg email (#5759) --- debian/ci_pack_sdeb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/ci_pack_sdeb.sh b/debian/ci_pack_sdeb.sh index b8c40decb..72d3a9399 100755 --- a/debian/ci_pack_sdeb.sh +++ b/debian/ci_pack_sdeb.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -export DEBEMAIL="github-actions[bot]@users.noreply.github.com" +export DEBEMAIL="jbennett@incomsystems.biz" export PLATFORMIO_LIBDEPS_DIR=pio/libdeps export PLATFORMIO_PACKAGES_DIR=pio/packages From fb74e1d182f13d660c0c1ca597b471871ee7eebf Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 5 Jan 2025 16:00:01 -0500 Subject: [PATCH 039/381] meshtasticd-debian: set PLATFORMIO_CORE_DIR (#5760) --- .gitignore | 1 + debian/ci_pack_sdeb.sh | 1 + debian/rules | 1 + debian/source/options | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8998b60d6..d44374919 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .pio +.pio_core pio # ignore vscode IDE settings files diff --git a/debian/ci_pack_sdeb.sh b/debian/ci_pack_sdeb.sh index 72d3a9399..f78738b65 100755 --- a/debian/ci_pack_sdeb.sh +++ b/debian/ci_pack_sdeb.sh @@ -2,6 +2,7 @@ export DEBEMAIL="jbennett@incomsystems.biz" export PLATFORMIO_LIBDEPS_DIR=pio/libdeps export PLATFORMIO_PACKAGES_DIR=pio/packages +export PLATFORMIO_CORE_DIR=.pio_core # Download libraries to `libdeps` platformio pkg install -e native diff --git a/debian/rules b/debian/rules index f535ad6eb..ccff53eb3 100755 --- a/debian/rules +++ b/debian/rules @@ -7,6 +7,7 @@ # https://docs.platformio.org/en/latest/envvars.html PIO_ENV:=\ + PLATFORMIO_CORE_DIR=.pio_core \ PLATFORMIO_LIBDEPS_DIR=pio/libdeps \ PLATFORMIO_PACKAGES_DIR=pio/packages diff --git a/debian/source/options b/debian/source/options index 0553b485d..94358cb74 100644 --- a/debian/source/options +++ b/debian/source/options @@ -1 +1 @@ -extend-diff-ignore = "\.pio" \ No newline at end of file +extend-diff-ignore = "\.pio\w*?$" \ No newline at end of file From b0087fd32827df20e6910d2a8e030a0863bc6dd1 Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 5 Jan 2025 16:26:31 -0500 Subject: [PATCH 040/381] meshtasticd-debian: Include core_dir in sdeb (#5761) --- debian/ci_pack_sdeb.sh | 2 +- debian/rules | 2 +- debian/source/include-binaries | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/debian/ci_pack_sdeb.sh b/debian/ci_pack_sdeb.sh index f78738b65..9ce334859 100755 --- a/debian/ci_pack_sdeb.sh +++ b/debian/ci_pack_sdeb.sh @@ -2,7 +2,7 @@ export DEBEMAIL="jbennett@incomsystems.biz" export PLATFORMIO_LIBDEPS_DIR=pio/libdeps export PLATFORMIO_PACKAGES_DIR=pio/packages -export PLATFORMIO_CORE_DIR=.pio_core +export PLATFORMIO_CORE_DIR=pio/core # Download libraries to `libdeps` platformio pkg install -e native diff --git a/debian/rules b/debian/rules index ccff53eb3..8098c4edb 100755 --- a/debian/rules +++ b/debian/rules @@ -7,7 +7,7 @@ # https://docs.platformio.org/en/latest/envvars.html PIO_ENV:=\ - PLATFORMIO_CORE_DIR=.pio_core \ + PLATFORMIO_CORE_DIR=pio/core \ PLATFORMIO_LIBDEPS_DIR=pio/libdeps \ PLATFORMIO_PACKAGES_DIR=pio/packages diff --git a/debian/source/include-binaries b/debian/source/include-binaries index 1632328ca..aef4a7027 100644 --- a/debian/source/include-binaries +++ b/debian/source/include-binaries @@ -1,2 +1,3 @@ pio/libdeps -pio/packages \ No newline at end of file +pio/packages +pio/core \ No newline at end of file From 403fa15a3f182e1db336f8759352f69ec4801dcd Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 5 Jan 2025 16:55:04 -0500 Subject: [PATCH 041/381] meshtasticd-debian: Include run in version (#5762) --- bin/readprops.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/readprops.py b/bin/readprops.py index 68516b74c..8a1d3dc47 100644 --- a/bin/readprops.py +++ b/bin/readprops.py @@ -1,6 +1,7 @@ import configparser import subprocess - +import os +run_number = os.getenv('GITHUB_RUN_NUMBER', '0') def readProps(prefsLoc): """Read the version of our project as a string""" @@ -29,12 +30,12 @@ def readProps(prefsLoc): # # short for 'dirty', we want to keep our verstrings source for protobuf reasons # suffix = sha + "-d" verObj["long"] = "{}.{}".format(verObj["short"], suffix) - verObj["deb"] = "{}-ppa{}".format(verObj["short"], sha) + verObj["deb"] = "{}-{}~ppa{}".format(verObj["short"], run_number, sha) except: # print("Unexpected error:", sys.exc_info()[0]) # traceback.print_exc() verObj["long"] = verObj["short"] - verObj["deb"] = "{}-ppa".format(verObj["short"]) + verObj["deb"] = "{}-{}~ppa".format(verObj["short"], run_number) # print("firmware version " + verStr) return verObj From 9cc79b1d1ed65ad280acb7d12e51863d700d5752 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Mon, 6 Jan 2025 01:55:20 +0100 Subject: [PATCH 042/381] Explicitly set CAD symbols, improve slot time calculation and adjust CW size accordingly (#5749) Co-authored-by: Ben Meadors --- src/mesh/LR11x0Interface.cpp | 9 ++++++++- src/mesh/RadioInterface.cpp | 25 ++++++++++++++++++++++--- src/mesh/RadioInterface.h | 16 +++++++--------- src/mesh/SX126xInterface.cpp | 9 ++++++++- src/mesh/SX128xInterface.cpp | 9 ++++++++- 5 files changed, 53 insertions(+), 15 deletions(-) diff --git a/src/mesh/LR11x0Interface.cpp b/src/mesh/LR11x0Interface.cpp index ce4f912ba..6a4e7404e 100644 --- a/src/mesh/LR11x0Interface.cpp +++ b/src/mesh/LR11x0Interface.cpp @@ -256,10 +256,17 @@ template void LR11x0Interface::startReceive() template bool LR11x0Interface::isChannelActive() { // check if we can detect a LoRa preamble on the current channel + ChannelScanConfig_t cfg = {.cad = {.symNum = NUM_SYM_CAD, + .detPeak = RADIOLIB_LR11X0_CAD_PARAM_DEFAULT, + .detMin = RADIOLIB_LR11X0_CAD_PARAM_DEFAULT, + .exitMode = RADIOLIB_LR11X0_CAD_PARAM_DEFAULT, + .timeout = 0, + .irqFlags = RADIOLIB_IRQ_CAD_DEFAULT_FLAGS, + .irqMask = RADIOLIB_IRQ_CAD_DEFAULT_MASK}}; int16_t result; setStandby(); - result = lora.scanChannel(); + result = lora.scanChannel(cfg); if (result == RADIOLIB_LORA_DETECTED) return true; diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index b1403f3b6..c51ad8144 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -261,7 +261,7 @@ uint8_t RadioInterface::getCWsize(float snr) const uint32_t SNR_MIN = -20; // The maximum value for a LoRa SNR - const uint32_t SNR_MAX = 15; + const uint32_t SNR_MAX = 10; return map(snr, SNR_MIN, SNR_MAX, CWmin, CWmax); } @@ -566,7 +566,7 @@ void RadioInterface::applyModemConfig() saveChannelNum(channel_num); saveFreq(freq + loraConfig.frequency_offset); - slotTimeMsec = computeSlotTimeMsec(bw, sf); + slotTimeMsec = computeSlotTimeMsec(); preambleTimeMsec = getPacketTime((uint32_t)0); maxPacketTimeMsec = getPacketTime(meshtastic_Constants_DATA_PAYLOAD_LEN + sizeof(PacketHeader)); @@ -581,6 +581,25 @@ void RadioInterface::applyModemConfig() LOG_INFO("Slot time: %u msec", slotTimeMsec); } +/** Slottime is the time to detect a transmission has started, consisting of: + - CAD duration; + - roundtrip air propagation time (assuming max. 30km between nodes); + - Tx/Rx turnaround time (maximum of SX126x and SX127x); + - MAC processing time (measured on T-beam) */ +uint32_t RadioInterface::computeSlotTimeMsec() +{ + float sumPropagationTurnaroundMACTime = 0.2 + 0.4 + 7; // in milliseconds + float symbolTime = pow(2, sf) / bw; // in milliseconds + + if (myRegion->wideLora) { + // CAD duration derived from AN1200.22 of SX1280 + return (NUM_SYM_CAD_24GHZ + (2 * sf + 3) / 32) * symbolTime + sumPropagationTurnaroundMACTime; + } else { + // CAD duration for SX127x is max. 2.25 symbols, for SX126x it is number of symbols + 0.5 symbol + return max(2.25, NUM_SYM_CAD + 0.5) * symbolTime + sumPropagationTurnaroundMACTime; + } +} + /** * Some regulatory regions limit xmit power. * This function should be called by subclasses after setting their desired power. It might lower it @@ -637,4 +656,4 @@ size_t RadioInterface::beginSending(meshtastic_MeshPacket *p) sendingPacket = p; return p->encrypted.size + sizeof(PacketHeader); -} +} \ No newline at end of file diff --git a/src/mesh/RadioInterface.h b/src/mesh/RadioInterface.h index 652b2269c..41ab0393d 100644 --- a/src/mesh/RadioInterface.h +++ b/src/mesh/RadioInterface.h @@ -83,24 +83,22 @@ class RadioInterface float bw = 125; uint8_t sf = 9; uint8_t cr = 5; - /** Slottime is the minimum time to wait, consisting of: - - CAD duration (maximum of SX126x and SX127x); - - roundtrip air propagation time (assuming max. 30km between nodes); - - Tx/Rx turnaround time (maximum of SX126x and SX127x); - - MAC processing time (measured on T-beam) */ - uint32_t slotTimeMsec = computeSlotTimeMsec(bw, sf); + + const uint8_t NUM_SYM_CAD = 2; // Number of symbols used for CAD, 2 is the default since RadioLib 6.3.0 as per AN1200.48 + const uint8_t NUM_SYM_CAD_24GHZ = 4; // Number of symbols used for CAD in 2.4 GHz, 4 is recommended in AN1200.22 of SX1280 + uint32_t slotTimeMsec = computeSlotTimeMsec(); uint16_t preambleLength = 16; // 8 is default, but we use longer to increase the amount of sleep time when receiving uint32_t preambleTimeMsec = 165; // calculated on startup, this is the default for LongFast uint32_t maxPacketTimeMsec = 3246; // calculated on startup, this is the default for LongFast const uint32_t PROCESSING_TIME_MSEC = 4500; // time to construct, process and construct a packet again (empirically determined) - const uint8_t CWmin = 2; // minimum CWsize - const uint8_t CWmax = 7; // maximum CWsize + const uint8_t CWmin = 3; // minimum CWsize + const uint8_t CWmax = 8; // maximum CWsize meshtastic_MeshPacket *sendingPacket = NULL; // The packet we are currently sending uint32_t lastTxStart = 0L; - uint32_t computeSlotTimeMsec(float bw, float sf) { return 8.5 * pow(2, sf) / bw + 0.2 + 0.4 + 7; } + uint32_t computeSlotTimeMsec(); /** * A temporary buffer used for sending/receiving packets, sized to hold the biggest buffer we might need diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index ed0267c5b..59ba139bf 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -299,10 +299,17 @@ template void SX126xInterface::startReceive() template bool SX126xInterface::isChannelActive() { // check if we can detect a LoRa preamble on the current channel + ChannelScanConfig_t cfg = {.cad = {.symNum = NUM_SYM_CAD, + .detPeak = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, + .detMin = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, + .exitMode = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, + .timeout = 0, + .irqFlags = RADIOLIB_IRQ_CAD_DEFAULT_FLAGS, + .irqMask = RADIOLIB_IRQ_CAD_DEFAULT_MASK}}; int16_t result; setStandby(); - result = lora.scanChannel(); + result = lora.scanChannel(cfg); if (result == RADIOLIB_LORA_DETECTED) return true; if (result != RADIOLIB_CHANNEL_FREE) diff --git a/src/mesh/SX128xInterface.cpp b/src/mesh/SX128xInterface.cpp index 013164bca..1ae26db91 100644 --- a/src/mesh/SX128xInterface.cpp +++ b/src/mesh/SX128xInterface.cpp @@ -275,10 +275,17 @@ template void SX128xInterface::startReceive() template bool SX128xInterface::isChannelActive() { // check if we can detect a LoRa preamble on the current channel + ChannelScanConfig_t cfg = {.cad = {.symNum = NUM_SYM_CAD_24GHZ, + .detPeak = 0, + .detMin = 0, + .exitMode = 0, + .timeout = 0, + .irqFlags = RADIOLIB_IRQ_CAD_DEFAULT_FLAGS, + .irqMask = RADIOLIB_IRQ_CAD_DEFAULT_MASK}}; int16_t result; setStandby(); - result = lora.scanChannel(); + result = lora.scanChannel(cfg); if (result == RADIOLIB_LORA_DETECTED) return true; if (result != RADIOLIB_CHANNEL_FREE) From 4fcf7fe0277aeb02a83b99b20b2e58aaa25de91a Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 5 Jan 2025 18:55:55 -0600 Subject: [PATCH 043/381] =?UTF-8?q?Revert=20"Explicitly=20set=20CAD=20symb?= =?UTF-8?q?ols,=20improve=20slot=20time=20calculation=20and=20adjust=20?= =?UTF-8?q?=E2=80=A6"=20(#5765)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 9cc79b1d1ed65ad280acb7d12e51863d700d5752. --- src/mesh/LR11x0Interface.cpp | 9 +-------- src/mesh/RadioInterface.cpp | 25 +++---------------------- src/mesh/RadioInterface.h | 16 +++++++++------- src/mesh/SX126xInterface.cpp | 9 +-------- src/mesh/SX128xInterface.cpp | 9 +-------- 5 files changed, 15 insertions(+), 53 deletions(-) diff --git a/src/mesh/LR11x0Interface.cpp b/src/mesh/LR11x0Interface.cpp index 6a4e7404e..ce4f912ba 100644 --- a/src/mesh/LR11x0Interface.cpp +++ b/src/mesh/LR11x0Interface.cpp @@ -256,17 +256,10 @@ template void LR11x0Interface::startReceive() template bool LR11x0Interface::isChannelActive() { // check if we can detect a LoRa preamble on the current channel - ChannelScanConfig_t cfg = {.cad = {.symNum = NUM_SYM_CAD, - .detPeak = RADIOLIB_LR11X0_CAD_PARAM_DEFAULT, - .detMin = RADIOLIB_LR11X0_CAD_PARAM_DEFAULT, - .exitMode = RADIOLIB_LR11X0_CAD_PARAM_DEFAULT, - .timeout = 0, - .irqFlags = RADIOLIB_IRQ_CAD_DEFAULT_FLAGS, - .irqMask = RADIOLIB_IRQ_CAD_DEFAULT_MASK}}; int16_t result; setStandby(); - result = lora.scanChannel(cfg); + result = lora.scanChannel(); if (result == RADIOLIB_LORA_DETECTED) return true; diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index c51ad8144..b1403f3b6 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -261,7 +261,7 @@ uint8_t RadioInterface::getCWsize(float snr) const uint32_t SNR_MIN = -20; // The maximum value for a LoRa SNR - const uint32_t SNR_MAX = 10; + const uint32_t SNR_MAX = 15; return map(snr, SNR_MIN, SNR_MAX, CWmin, CWmax); } @@ -566,7 +566,7 @@ void RadioInterface::applyModemConfig() saveChannelNum(channel_num); saveFreq(freq + loraConfig.frequency_offset); - slotTimeMsec = computeSlotTimeMsec(); + slotTimeMsec = computeSlotTimeMsec(bw, sf); preambleTimeMsec = getPacketTime((uint32_t)0); maxPacketTimeMsec = getPacketTime(meshtastic_Constants_DATA_PAYLOAD_LEN + sizeof(PacketHeader)); @@ -581,25 +581,6 @@ void RadioInterface::applyModemConfig() LOG_INFO("Slot time: %u msec", slotTimeMsec); } -/** Slottime is the time to detect a transmission has started, consisting of: - - CAD duration; - - roundtrip air propagation time (assuming max. 30km between nodes); - - Tx/Rx turnaround time (maximum of SX126x and SX127x); - - MAC processing time (measured on T-beam) */ -uint32_t RadioInterface::computeSlotTimeMsec() -{ - float sumPropagationTurnaroundMACTime = 0.2 + 0.4 + 7; // in milliseconds - float symbolTime = pow(2, sf) / bw; // in milliseconds - - if (myRegion->wideLora) { - // CAD duration derived from AN1200.22 of SX1280 - return (NUM_SYM_CAD_24GHZ + (2 * sf + 3) / 32) * symbolTime + sumPropagationTurnaroundMACTime; - } else { - // CAD duration for SX127x is max. 2.25 symbols, for SX126x it is number of symbols + 0.5 symbol - return max(2.25, NUM_SYM_CAD + 0.5) * symbolTime + sumPropagationTurnaroundMACTime; - } -} - /** * Some regulatory regions limit xmit power. * This function should be called by subclasses after setting their desired power. It might lower it @@ -656,4 +637,4 @@ size_t RadioInterface::beginSending(meshtastic_MeshPacket *p) sendingPacket = p; return p->encrypted.size + sizeof(PacketHeader); -} \ No newline at end of file +} diff --git a/src/mesh/RadioInterface.h b/src/mesh/RadioInterface.h index 41ab0393d..652b2269c 100644 --- a/src/mesh/RadioInterface.h +++ b/src/mesh/RadioInterface.h @@ -83,22 +83,24 @@ class RadioInterface float bw = 125; uint8_t sf = 9; uint8_t cr = 5; - - const uint8_t NUM_SYM_CAD = 2; // Number of symbols used for CAD, 2 is the default since RadioLib 6.3.0 as per AN1200.48 - const uint8_t NUM_SYM_CAD_24GHZ = 4; // Number of symbols used for CAD in 2.4 GHz, 4 is recommended in AN1200.22 of SX1280 - uint32_t slotTimeMsec = computeSlotTimeMsec(); + /** Slottime is the minimum time to wait, consisting of: + - CAD duration (maximum of SX126x and SX127x); + - roundtrip air propagation time (assuming max. 30km between nodes); + - Tx/Rx turnaround time (maximum of SX126x and SX127x); + - MAC processing time (measured on T-beam) */ + uint32_t slotTimeMsec = computeSlotTimeMsec(bw, sf); uint16_t preambleLength = 16; // 8 is default, but we use longer to increase the amount of sleep time when receiving uint32_t preambleTimeMsec = 165; // calculated on startup, this is the default for LongFast uint32_t maxPacketTimeMsec = 3246; // calculated on startup, this is the default for LongFast const uint32_t PROCESSING_TIME_MSEC = 4500; // time to construct, process and construct a packet again (empirically determined) - const uint8_t CWmin = 3; // minimum CWsize - const uint8_t CWmax = 8; // maximum CWsize + const uint8_t CWmin = 2; // minimum CWsize + const uint8_t CWmax = 7; // maximum CWsize meshtastic_MeshPacket *sendingPacket = NULL; // The packet we are currently sending uint32_t lastTxStart = 0L; - uint32_t computeSlotTimeMsec(); + uint32_t computeSlotTimeMsec(float bw, float sf) { return 8.5 * pow(2, sf) / bw + 0.2 + 0.4 + 7; } /** * A temporary buffer used for sending/receiving packets, sized to hold the biggest buffer we might need diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index 59ba139bf..ed0267c5b 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -299,17 +299,10 @@ template void SX126xInterface::startReceive() template bool SX126xInterface::isChannelActive() { // check if we can detect a LoRa preamble on the current channel - ChannelScanConfig_t cfg = {.cad = {.symNum = NUM_SYM_CAD, - .detPeak = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, - .detMin = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, - .exitMode = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, - .timeout = 0, - .irqFlags = RADIOLIB_IRQ_CAD_DEFAULT_FLAGS, - .irqMask = RADIOLIB_IRQ_CAD_DEFAULT_MASK}}; int16_t result; setStandby(); - result = lora.scanChannel(cfg); + result = lora.scanChannel(); if (result == RADIOLIB_LORA_DETECTED) return true; if (result != RADIOLIB_CHANNEL_FREE) diff --git a/src/mesh/SX128xInterface.cpp b/src/mesh/SX128xInterface.cpp index 1ae26db91..013164bca 100644 --- a/src/mesh/SX128xInterface.cpp +++ b/src/mesh/SX128xInterface.cpp @@ -275,17 +275,10 @@ template void SX128xInterface::startReceive() template bool SX128xInterface::isChannelActive() { // check if we can detect a LoRa preamble on the current channel - ChannelScanConfig_t cfg = {.cad = {.symNum = NUM_SYM_CAD_24GHZ, - .detPeak = 0, - .detMin = 0, - .exitMode = 0, - .timeout = 0, - .irqFlags = RADIOLIB_IRQ_CAD_DEFAULT_FLAGS, - .irqMask = RADIOLIB_IRQ_CAD_DEFAULT_MASK}}; int16_t result; setStandby(); - result = lora.scanChannel(cfg); + result = lora.scanChannel(); if (result == RADIOLIB_LORA_DETECTED) return true; if (result != RADIOLIB_CHANNEL_FREE) From c003ab0eeef1d55a5f267e113c3aa18ed8254947 Mon Sep 17 00:00:00 2001 From: isseysandei Date: Mon, 6 Jan 2025 01:58:10 +0100 Subject: [PATCH 044/381] Improved readability of Power Telemetry page (#5746) * increased buffer size to 1024 * better readability --- src/modules/Telemetry/PowerTelemetry.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/modules/Telemetry/PowerTelemetry.cpp b/src/modules/Telemetry/PowerTelemetry.cpp index 10133fca5..f1df2d361 100644 --- a/src/modules/Telemetry/PowerTelemetry.cpp +++ b/src/modules/Telemetry/PowerTelemetry.cpp @@ -99,11 +99,11 @@ bool PowerTelemetryModule::wantUIFrame() void PowerTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) { display->setTextAlignment(TEXT_ALIGN_LEFT); - display->setFont(FONT_MEDIUM); + display->setFont(FONT_SMALL); display->drawString(x, y, "Power Telemetry"); if (lastMeasurementPacket == nullptr) { display->setFont(FONT_SMALL); - display->drawString(x, y += _fontHeight(FONT_MEDIUM), "No measurement"); + display->drawString(x, y += _fontHeight(FONT_SMALL), "No measurement"); return; } @@ -122,21 +122,21 @@ void PowerTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *s // Display current and voltage based on ...power_metrics.has_[channel/voltage/current]... flags display->setFont(FONT_SMALL); - display->drawString(x, y += _fontHeight(FONT_MEDIUM) - 2, "From: " + String(lastSender) + "(" + String(agoSecs) + "s)"); + display->drawString(x, y += _fontHeight(FONT_SMALL) - 2, "From: " + String(lastSender) + "(" + String(agoSecs) + "s)"); if (lastMeasurement.variant.power_metrics.has_ch1_voltage || lastMeasurement.variant.power_metrics.has_ch1_current) { display->drawString(x, y += _fontHeight(FONT_SMALL), - "Ch1 Volt: " + String(lastMeasurement.variant.power_metrics.ch1_voltage, 2) + - "V / Curr: " + String(lastMeasurement.variant.power_metrics.ch1_current, 0) + "mA"); + "Ch1: " + String(lastMeasurement.variant.power_metrics.ch1_voltage, 2) + + "V " + String(lastMeasurement.variant.power_metrics.ch1_current, 0) + "mA"); } if (lastMeasurement.variant.power_metrics.has_ch2_voltage || lastMeasurement.variant.power_metrics.has_ch2_current) { display->drawString(x, y += _fontHeight(FONT_SMALL), - "Ch2 Volt: " + String(lastMeasurement.variant.power_metrics.ch2_voltage, 2) + - "V / Curr: " + String(lastMeasurement.variant.power_metrics.ch2_current, 0) + "mA"); + "Ch2: " + String(lastMeasurement.variant.power_metrics.ch2_voltage, 2) + + "V " + String(lastMeasurement.variant.power_metrics.ch2_current, 0) + "mA"); } if (lastMeasurement.variant.power_metrics.has_ch3_voltage || lastMeasurement.variant.power_metrics.has_ch3_current) { display->drawString(x, y += _fontHeight(FONT_SMALL), - "Ch3 Volt: " + String(lastMeasurement.variant.power_metrics.ch3_voltage, 2) + - "V / Curr: " + String(lastMeasurement.variant.power_metrics.ch3_current, 0) + "mA"); + "Ch3: " + String(lastMeasurement.variant.power_metrics.ch3_voltage, 2) + + "V " + String(lastMeasurement.variant.power_metrics.ch3_current, 0) + "mA"); } } From d3cbbfd3455876e4f8b63392fe23b4c5e4821e3a Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 5 Jan 2025 18:59:14 -0600 Subject: [PATCH 045/381] Try adding tar-ignore to preserve .git directories --- debian/source/options | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/source/options b/debian/source/options index 94358cb74..2f3670cba 100644 --- a/debian/source/options +++ b/debian/source/options @@ -1 +1,2 @@ -extend-diff-ignore = "\.pio\w*?$" \ No newline at end of file +extend-diff-ignore = "\.pio\w*?$" +tar-ignore = "" From 2396aa77ca625bb2e749419c41465b008aba3ed8 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 5 Jan 2025 19:03:44 -0600 Subject: [PATCH 046/381] don't run the clean step --- debian/ci_pack_sdeb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/ci_pack_sdeb.sh b/debian/ci_pack_sdeb.sh index 9ce334859..2b56a8578 100755 --- a/debian/ci_pack_sdeb.sh +++ b/debian/ci_pack_sdeb.sh @@ -14,4 +14,4 @@ dch --create --distribution $SERIES --package $package --newversion $PKG_VERSION "GitHub Actions Automatic packaging for $PKG_VERSION~$SERIES" # Build the source deb -debuild -S -k$GPG_KEY_ID +debuild -S -nc -k$GPG_KEY_ID From 7f280dd55609e7ce6fc2bba41956d2191ca7563d Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 5 Jan 2025 19:38:08 -0600 Subject: [PATCH 047/381] Hide pio folder in a tarball to preserve .git folders --- debian/ci_pack_sdeb.sh | 1 + debian/rules | 1 + 2 files changed, 2 insertions(+) diff --git a/debian/ci_pack_sdeb.sh b/debian/ci_pack_sdeb.sh index 2b56a8578..6204855cf 100755 --- a/debian/ci_pack_sdeb.sh +++ b/debian/ci_pack_sdeb.sh @@ -6,6 +6,7 @@ export PLATFORMIO_CORE_DIR=pio/core # Download libraries to `libdeps` platformio pkg install -e native +tar -cf pio.tar pio/ package=$(dpkg-parsechangelog --show-field Source) diff --git a/debian/rules b/debian/rules index 8098c4edb..f67622c5c 100755 --- a/debian/rules +++ b/debian/rules @@ -13,6 +13,7 @@ PIO_ENV:=\ override_dh_auto_build: # Build with platformio + tar -xf pio.tar $(PIO_ENV) platformio run -e native # Move the binary and default config to the correct name mv .pio/build/native/program .pio/build/native/meshtasticd From 6edf74e8f14aa1c580809a34bc6f871590b7d196 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 5 Jan 2025 19:58:34 -0600 Subject: [PATCH 048/381] Tab not spaces --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index f67622c5c..28961fd10 100755 --- a/debian/rules +++ b/debian/rules @@ -13,7 +13,7 @@ PIO_ENV:=\ override_dh_auto_build: # Build with platformio - tar -xf pio.tar + tar -xf pio.tar $(PIO_ENV) platformio run -e native # Move the binary and default config to the correct name mv .pio/build/native/program .pio/build/native/meshtasticd From 16bc89ea573a87ad40ead100dab6b150f71ddbdc Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 5 Jan 2025 22:23:01 -0600 Subject: [PATCH 049/381] Explicitly install tools-scons --- debian/ci_pack_sdeb.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/ci_pack_sdeb.sh b/debian/ci_pack_sdeb.sh index 6204855cf..605ddd288 100755 --- a/debian/ci_pack_sdeb.sh +++ b/debian/ci_pack_sdeb.sh @@ -6,7 +6,9 @@ export PLATFORMIO_CORE_DIR=pio/core # Download libraries to `libdeps` platformio pkg install -e native +platformio pkg install -t tool-scons -e native tar -cf pio.tar pio/ +rm -rf pio package=$(dpkg-parsechangelog --show-field Source) From f1a890028813ea8bdcbe6d0fb15d2b284db90e8e Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 5 Jan 2025 23:50:32 -0600 Subject: [PATCH 050/381] Don't push to PPA for every commit --- .github/workflows/main_matrix.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index be8cddaf3..267e34a94 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -128,16 +128,6 @@ jobs: with: board: ${{ matrix.board }} - package-ppa: - strategy: - fail-fast: false - matrix: - series: [plucky, oracular, noble, jammy] - uses: ./.github/workflows/package_ppa.yml - with: - series: ${{ matrix.series }} - secrets: inherit - package-raspbian: uses: ./.github/workflows/package_raspbian.yml From 70076a4b27193276ad22cd132c2c1e5f178d4920 Mon Sep 17 00:00:00 2001 From: isseysandei Date: Mon, 6 Jan 2025 16:14:52 +0100 Subject: [PATCH 051/381] Improved Power Telemetry page readability even more (#5770) * increased buffer size to 1024 * better readability * better readability 2 --------- Co-authored-by: BuildTools --- src/modules/Telemetry/PowerTelemetry.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/modules/Telemetry/PowerTelemetry.cpp b/src/modules/Telemetry/PowerTelemetry.cpp index f1df2d361..9c794e31e 100644 --- a/src/modules/Telemetry/PowerTelemetry.cpp +++ b/src/modules/Telemetry/PowerTelemetry.cpp @@ -100,29 +100,30 @@ void PowerTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *s { display->setTextAlignment(TEXT_ALIGN_LEFT); display->setFont(FONT_SMALL); - display->drawString(x, y, "Power Telemetry"); + if (lastMeasurementPacket == nullptr) { - display->setFont(FONT_SMALL); + // In case of no valid packet, display "Power Telemetry", "No measurement" + display->drawString(x, y, "Power Telemetry"); display->drawString(x, y += _fontHeight(FONT_SMALL), "No measurement"); return; } + // Decode the last power packet meshtastic_Telemetry lastMeasurement; - uint32_t agoSecs = service->GetTimeSinceMeshPacket(lastMeasurementPacket); const char *lastSender = getSenderShortName(*lastMeasurementPacket); const meshtastic_Data &p = lastMeasurementPacket->decoded; if (!pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_Telemetry_msg, &lastMeasurement)) { - display->setFont(FONT_SMALL); - display->drawString(x, y += _fontHeight(FONT_MEDIUM), "Measurement Error"); + display->drawString(x, y, "Measurement Error"); LOG_ERROR("Unable to decode last packet"); return; } + // Display "Pow. From: ..." + display->drawString(x, y, "Pow. From: " + String(lastSender) + "(" + String(agoSecs) + "s)"); + // Display current and voltage based on ...power_metrics.has_[channel/voltage/current]... flags - display->setFont(FONT_SMALL); - display->drawString(x, y += _fontHeight(FONT_SMALL) - 2, "From: " + String(lastSender) + "(" + String(agoSecs) + "s)"); if (lastMeasurement.variant.power_metrics.has_ch1_voltage || lastMeasurement.variant.power_metrics.has_ch1_current) { display->drawString(x, y += _fontHeight(FONT_SMALL), "Ch1: " + String(lastMeasurement.variant.power_metrics.ch1_voltage, 2) + From 35cd600c54d7ad760a1b06d4c91d1dc5b35a3ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 6 Jan 2025 17:08:12 +0100 Subject: [PATCH 052/381] update to 7.1.2 and remove the obsolete default_envs. (#5771) --- platformio.ini | 41 ++--------------------------------------- 1 file changed, 2 insertions(+), 39 deletions(-) diff --git a/platformio.ini b/platformio.ini index cd32ed179..6a4466c01 100644 --- a/platformio.ini +++ b/platformio.ini @@ -3,43 +3,7 @@ [platformio] default_envs = tbeam -;default_envs = pico -;default_envs = tbeam-s3-core -;default_envs = tbeam0.7 -;default_envs = heltec-v1 -;default_envs = heltec-v2_0 -;default_envs = heltec-v2_1 -;default_envs = heltec-wireless-tracker -;default_envs = chatter2 -;default_envs = tlora-v1 -;default_envs = tlora_v1_3 -;default_envs = tlora-v2 -;default_envs = tlora-v2-1-1_6 -;default_envs = tlora-v2-1-1_6-tcxo -;default_envs = tlora-v3-3-0-tcxo -;default_envs = tlora-t3s3-v1 -;default_envs = t-echo -;default_envs = canaryone -;default_envs = native -;default_envs = nano-g1 -;default_envs = pca10059_diy_eink -;default_envs = meshtastic-diy-v1 -;default_envs = meshtastic-diy-v1_1 -;default_envs = meshtastic-dr-dev -;default_envs = m5stack-coreink -;default_envs = rak4631 -;default_envs = rak4631_eth_gw -;default_envs = rak2560 -;default_envs = rak11310 -;default_envs = rak_wismeshtap -;default_envs = wio-e5 -;default_envs = radiomaster_900_bandit_nano -;default_envs = radiomaster_900_bandit_micro -;default_envs = radiomaster_900_bandit -;default_envs = heltec_vision_master_t190 -;default_envs = heltec_vision_master_e213 -;default_envs = heltec_vision_master_e290 -;default_envs = heltec_mesh_node_t114 + extra_configs = arch/*/*.ini variants/*/platformio.ini @@ -124,8 +88,7 @@ lib_deps = [radiolib_base] lib_deps = - ; jgromes/RadioLib@7.1.0 - https://github.com/jgromes/RadioLib.git#92b687821ff4e6c358d866f84566f66672ab02b8 + jgromes/RadioLib@7.1.2 ; Common libs for environmental measurements in telemetry module ; (not included in native / portduino) From ca328898939edb22d50d0b3d62f475e352d29069 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Mon, 6 Jan 2025 12:23:08 -0600 Subject: [PATCH 053/381] Specify scons version --- debian/ci_pack_sdeb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/ci_pack_sdeb.sh b/debian/ci_pack_sdeb.sh index 605ddd288..07737ea31 100755 --- a/debian/ci_pack_sdeb.sh +++ b/debian/ci_pack_sdeb.sh @@ -6,7 +6,7 @@ export PLATFORMIO_CORE_DIR=pio/core # Download libraries to `libdeps` platformio pkg install -e native -platformio pkg install -t tool-scons -e native +platformio pkg install -t platformio/tool-scons@4.40801.0 tar -cf pio.tar pio/ rm -rf pio From 78371dfdb7a8892e9bc9a45d432eef8c799ac747 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Mon, 6 Jan 2025 12:26:17 -0600 Subject: [PATCH 054/381] Add PPA to nightly --- .github/workflows/nightly.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index e249823a7..5010707de 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -17,3 +17,12 @@ jobs: uses: trunk-io/trunk-action@782e83f803ca6e369f035d64c6ba2768174ba61b with: trunk-token: ${{ secrets.TRUNK_TOKEN }} + package-ppa: + strategy: + fail-fast: false + matrix: + series: [plucky, oracular, noble, jammy] + uses: ./.github/workflows/package_ppa.yml + with: + series: ${{ matrix.series }} + secrets: inherit From 4c3a3ca47d4ee50e2d946956fe614d6e7549df8a Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Mon, 6 Jan 2025 13:02:53 -0600 Subject: [PATCH 055/381] Specify the *correct* scons version --- debian/ci_pack_sdeb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/ci_pack_sdeb.sh b/debian/ci_pack_sdeb.sh index 07737ea31..427e9c79b 100755 --- a/debian/ci_pack_sdeb.sh +++ b/debian/ci_pack_sdeb.sh @@ -6,7 +6,7 @@ export PLATFORMIO_CORE_DIR=pio/core # Download libraries to `libdeps` platformio pkg install -e native -platformio pkg install -t platformio/tool-scons@4.40801.0 +platformio pkg install -t platformio/tool-scons@4.40502.0 tar -cf pio.tar pio/ rm -rf pio From e5dbcf5bcee1fd6fe8f4a71ea0105ce211c54d36 Mon Sep 17 00:00:00 2001 From: Austin Date: Mon, 6 Jan 2025 17:20:05 -0500 Subject: [PATCH 056/381] meshtasticd-debian: parameterize target PPA (#5776) --- .github/workflows/build_debian_src.yml | 8 ++++---- .github/workflows/nightly.yml | 1 + .github/workflows/package_ppa.yml | 8 ++++++-- debian/ci_pack_sdeb.sh | 4 ++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_debian_src.yml b/.github/workflows/build_debian_src.yml index 9bb7dfb9c..b2fcb5262 100644 --- a/.github/workflows/build_debian_src.yml +++ b/.github/workflows/build_debian_src.yml @@ -7,7 +7,7 @@ on: required: true inputs: series: - description: 'Ubuntu series to target' + description: Ubuntu series to target required: true type: string @@ -32,9 +32,9 @@ jobs: working-directory: meshtasticd run: | sudo apt-get update -y --fix-missing - sudo apt-get install -y software-properties-common - sudo add-apt-repository ppa:meshtastic/meshtastic-daily -y - sudo apt-get install -y build-essential devscripts equivs + sudo apt-get install -y software-properties-common build-essential devscripts equivs + sudo add-apt-repository ppa:meshtastic/build-tools -y + sudo apt-get update -y --fix-missing sudo mk-build-deps --install --remove --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control - name: Import GPG key diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 5010707de..b7cf4bfc6 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -24,5 +24,6 @@ jobs: series: [plucky, oracular, noble, jammy] uses: ./.github/workflows/package_ppa.yml with: + ppa_repo: daily series: ${{ matrix.series }} secrets: inherit diff --git a/.github/workflows/package_ppa.yml b/.github/workflows/package_ppa.yml index f716fdff4..5705c6d49 100644 --- a/.github/workflows/package_ppa.yml +++ b/.github/workflows/package_ppa.yml @@ -6,8 +6,12 @@ on: PPA_GPG_PRIVATE_KEY: required: true inputs: + ppa_repo: + description: Meshtastic PPA to target + required: true + type: string series: - description: 'Ubuntu series to target' + description: Ubuntu series to target required: true type: string workflow_dispatch: @@ -65,4 +69,4 @@ jobs: - name: Publish with dput if: ${{ github.event_name != 'pull_request_target' && github.event_name != 'pull_request' }} run: | - dput ppa:meshtastic/meshtastic-daily meshtasticd_${{ steps.version.outputs.deb }}~${{ inputs.series }}_source.changes + dput ppa:meshtastic/${{ inputs.ppa_repo }} meshtasticd_${{ steps.version.outputs.deb }}~${{ inputs.series }}_source.changes diff --git a/debian/ci_pack_sdeb.sh b/debian/ci_pack_sdeb.sh index 427e9c79b..3099b6569 100755 --- a/debian/ci_pack_sdeb.sh +++ b/debian/ci_pack_sdeb.sh @@ -13,8 +13,8 @@ rm -rf pio package=$(dpkg-parsechangelog --show-field Source) rm -rf debian/changelog -dch --create --distribution $SERIES --package $package --newversion $PKG_VERSION~$SERIES \ +dch --create --distribution "$SERIES" --package "$package" --newversion "$PKG_VERSION~$SERIES" \ "GitHub Actions Automatic packaging for $PKG_VERSION~$SERIES" # Build the source deb -debuild -S -nc -k$GPG_KEY_ID +debuild -S -nc -k"$GPG_KEY_ID" From 57766d47a8f9bc01c57a5e10e7fc40f7e4065e42 Mon Sep 17 00:00:00 2001 From: Austin Date: Mon, 6 Jan 2025 19:45:59 -0500 Subject: [PATCH 057/381] GitHub Actions: Trigger PPA stable builds upon release (#5777) --- .github/workflows/release_channels.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/release_channels.yml diff --git a/.github/workflows/release_channels.yml b/.github/workflows/release_channels.yml new file mode 100644 index 000000000..d572568de --- /dev/null +++ b/.github/workflows/release_channels.yml @@ -0,0 +1,20 @@ +name: Trigger release workflows upon Publish + +on: + release: + types: [published] + +permissions: read-all + +jobs: + package-ppa: + strategy: + fail-fast: false + matrix: + series: [plucky, oracular, noble, jammy] + uses: ./.github/workflows/package_ppa.yml + with: + ppa_repo: |- + ${{ contains(github.event.release.name, 'Beta') && 'beta' || contains(github.event.release.name, 'Alpha') && 'alpha' }} + series: ${{ matrix.series }} + secrets: inherit From 86170171a7a093e06423e8c78841b91a6cce2b26 Mon Sep 17 00:00:00 2001 From: Austin Date: Mon, 6 Jan 2025 20:25:05 -0500 Subject: [PATCH 058/381] meshtasticd-debian: Include web components (#5778) --- .gitignore | 6 ++++-- debian/changelog | 2 +- debian/ci_changelog.sh | 7 ++++--- debian/ci_pack_sdeb.sh | 7 +++++-- debian/control | 8 ++++++-- debian/meshtasticd.dirs | 1 + debian/meshtasticd.install | 2 ++ debian/rules | 7 +++++-- debian/source/include-binaries | 5 ++--- debian/source/options | 3 +-- 10 files changed, 31 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index d44374919..803aee139 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ .pio -.pio_core pio +pio.tar +web +web.tar # ignore vscode IDE settings files .vscode/* @@ -32,4 +34,4 @@ release/ .vscode/extensions.json /compile_commands.json src/mesh/raspihttp/certificate.pem -src/mesh/raspihttp/private_key.pem +src/mesh/raspihttp/private_key.pem \ No newline at end of file diff --git a/debian/changelog b/debian/changelog index 5dd6fb1c0..79c444aca 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -meshtasticd (2.5.19) unstable; urgency=medium +meshtasticd (2.5.19) UNRELEASED; urgency=medium * Initial packaging diff --git a/debian/ci_changelog.sh b/debian/ci_changelog.sh index 56688f99b..7925ad5eb 100755 --- a/debian/ci_changelog.sh +++ b/debian/ci_changelog.sh @@ -1,6 +1,7 @@ #!/usr/bin/bash export DEBEMAIL="github-actions[bot]@users.noreply.github.com" +PKG_VERSION=$(python3 bin/buildinfo.py short) -dch --newversion "$(python3 bin/buildinfo.py short)-1" \ - --distribution unstable \ - "GitHub Actions Automatic version bump" +dch --newversion "$PKG_VERSION-1" \ + --distribution UNRELEASED \ + "GitHub Actions Automatic version bump" diff --git a/debian/ci_pack_sdeb.sh b/debian/ci_pack_sdeb.sh index 3099b6569..d45593c50 100755 --- a/debian/ci_pack_sdeb.sh +++ b/debian/ci_pack_sdeb.sh @@ -4,11 +4,14 @@ export PLATFORMIO_LIBDEPS_DIR=pio/libdeps export PLATFORMIO_PACKAGES_DIR=pio/packages export PLATFORMIO_CORE_DIR=pio/core -# Download libraries to `libdeps` +# Download libraries to `pio` platformio pkg install -e native -platformio pkg install -t platformio/tool-scons@4.40502.0 +platformio pkg install -e native -t platformio/tool-scons@4.40502.0 +# Compress `pio` directory to prevent dh_clean from sanitizing it tar -cf pio.tar pio/ rm -rf pio +# Download the latest meshtastic/web release build.tar to `web.tar` +curl https://github.com/meshtastic/web/releases/download/latest/build.tar -o web.tar package=$(dpkg-parsechangelog --show-field Source) diff --git a/debian/control b/debian/control index 9814933e3..097f85859 100644 --- a/debian/control +++ b/debian/control @@ -13,7 +13,11 @@ Build-Depends: debhelper-compat (= 13), libgpiod-dev, libbluetooth-dev, libusb-1.0-0-dev, - libi2c-dev + libi2c-dev, + openssl, + libssl-dev, + libulfius-dev, + liborcania-dev Standards-Version: 4.6.2 Homepage: https://github.com/meshtastic/firmware Rules-Requires-Root: no @@ -23,4 +27,4 @@ Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends} Description: Meshtastic daemon for communicating with Meshtastic devices Meshtastic is an off-grid text communication platform that uses inexpensive - LoRa radios. + LoRa radios. \ No newline at end of file diff --git a/debian/meshtasticd.dirs b/debian/meshtasticd.dirs index cf1ba7a37..5f57ff7be 100644 --- a/debian/meshtasticd.dirs +++ b/debian/meshtasticd.dirs @@ -1,3 +1,4 @@ etc/meshtasticd etc/meshtasticd/config.d etc/meshtasticd/available.d +usr/share/meshtasticd/web \ No newline at end of file diff --git a/debian/meshtasticd.install b/debian/meshtasticd.install index 04bf34daf..da1b0685d 100644 --- a/debian/meshtasticd.install +++ b/debian/meshtasticd.install @@ -4,3 +4,5 @@ bin/config.yaml etc/meshtasticd bin/config.d/* etc/meshtasticd/available.d bin/meshtasticd.service lib/systemd/system + +web/* usr/share/meshtasticd/web \ No newline at end of file diff --git a/debian/rules b/debian/rules index 28961fd10..31221dd80 100755 --- a/debian/rules +++ b/debian/rules @@ -12,9 +12,12 @@ PIO_ENV:=\ PLATFORMIO_PACKAGES_DIR=pio/packages override_dh_auto_build: - # Build with platformio + # Extract tarballs within source deb tar -xf pio.tar + tar -xf web.tar web + gunzip web/ -r + # Build with platformio $(PIO_ENV) platformio run -e native # Move the binary and default config to the correct name mv .pio/build/native/program .pio/build/native/meshtasticd - cp bin/config-dist.yaml bin/config.yaml + cp bin/config-dist.yaml bin/config.yaml \ No newline at end of file diff --git a/debian/source/include-binaries b/debian/source/include-binaries index aef4a7027..0c9848b72 100644 --- a/debian/source/include-binaries +++ b/debian/source/include-binaries @@ -1,3 +1,2 @@ -pio/libdeps -pio/packages -pio/core \ No newline at end of file +pio.tar +web.tar \ No newline at end of file diff --git a/debian/source/options b/debian/source/options index 2f3670cba..0553b485d 100644 --- a/debian/source/options +++ b/debian/source/options @@ -1,2 +1 @@ -extend-diff-ignore = "\.pio\w*?$" -tar-ignore = "" +extend-diff-ignore = "\.pio" \ No newline at end of file From 395469d20a8523e6e9c16e3ac43c75a839cca2d9 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Mon, 6 Jan 2025 19:59:02 -0600 Subject: [PATCH 059/381] As Per XKCD #1168 --- debian/rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/rules b/debian/rules index 31221dd80..a1a27c2f2 100755 --- a/debian/rules +++ b/debian/rules @@ -14,10 +14,10 @@ PIO_ENV:=\ override_dh_auto_build: # Extract tarballs within source deb tar -xf pio.tar - tar -xf web.tar web + mkdir -p web && tar -xf web.tar -C web gunzip web/ -r # Build with platformio $(PIO_ENV) platformio run -e native # Move the binary and default config to the correct name mv .pio/build/native/program .pio/build/native/meshtasticd - cp bin/config-dist.yaml bin/config.yaml \ No newline at end of file + cp bin/config-dist.yaml bin/config.yaml From cdcbf4c61550e45c125e17a20aff4275e9389655 Mon Sep 17 00:00:00 2001 From: Austin Date: Mon, 6 Jan 2025 21:51:50 -0500 Subject: [PATCH 060/381] Small fix: debian, curl follow redirs (#5780) --- debian/ci_pack_sdeb.sh | 2 +- debian/control | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/ci_pack_sdeb.sh b/debian/ci_pack_sdeb.sh index d45593c50..1f311af93 100755 --- a/debian/ci_pack_sdeb.sh +++ b/debian/ci_pack_sdeb.sh @@ -11,7 +11,7 @@ platformio pkg install -e native -t platformio/tool-scons@4.40502.0 tar -cf pio.tar pio/ rm -rf pio # Download the latest meshtastic/web release build.tar to `web.tar` -curl https://github.com/meshtastic/web/releases/download/latest/build.tar -o web.tar +curl -L https://github.com/meshtastic/web/releases/download/latest/build.tar -o web.tar package=$(dpkg-parsechangelog --show-field Source) diff --git a/debian/control b/debian/control index 097f85859..bb79d1958 100644 --- a/debian/control +++ b/debian/control @@ -3,6 +3,8 @@ Section: misc Priority: optional Maintainer: Austin Lane Build-Depends: debhelper-compat (= 13), + tar, + gzip, platformio, python3-protobuf, python3-grpcio, From 353740623f3a017ecf4bdc3453452b3deb277b8c Mon Sep 17 00:00:00 2001 From: Marco Veneziano Date: Tue, 7 Jan 2025 14:09:51 +0100 Subject: [PATCH 061/381] Increase esp32c3 stability over wifi (#5774) * Increase esp32c3 stability over wifi * only apply the fix on esp32c3 based nodes --- src/mesh/wifi/WiFiAPClient.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index 2f8138921..dcfcdc047 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -143,6 +143,11 @@ static int32_t reconnectWiFi() delay(5000); if (!WiFi.isConnected()) { +#ifdef CONFIG_IDF_TARGET_ESP32C3 + WiFi.mode(WIFI_MODE_NULL); + WiFi.useStaticBuffers(true); + WiFi.mode(WIFI_STA); +#endif WiFi.begin(wifiName, wifiPsw); } isReconnecting = false; From 27fbfd03d6037b44c77cc947b283bdb6af605b64 Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Tue, 7 Jan 2025 05:10:42 -0800 Subject: [PATCH 062/381] Add unit tests for MQTT (#5724) * Add unit tests for MQTT * Test received fields --- src/mesh/MeshService.h | 2 +- src/mesh/NodeDB.h | 2 +- src/mesh/RadioLibInterface.cpp | 1 + src/mesh/Router.h | 2 +- src/modules/RoutingModule.h | 3 +- src/mqtt/MQTT.cpp | 18 +- test/test_mqtt/MQTT.cpp | 856 +++++++++++++++++++++++++++++++++ 7 files changed, 876 insertions(+), 8 deletions(-) create mode 100644 test/test_mqtt/MQTT.cpp diff --git a/src/mesh/MeshService.h b/src/mesh/MeshService.h index 268c4308f..175d8a595 100644 --- a/src/mesh/MeshService.h +++ b/src/mesh/MeshService.h @@ -142,7 +142,7 @@ class MeshService void sendToPhone(meshtastic_MeshPacket *p); /// Send an MQTT message to the phone for client proxying - void sendMqttMessageToClientProxy(meshtastic_MqttClientProxyMessage *m); + virtual void sendMqttMessageToClientProxy(meshtastic_MqttClientProxyMessage *m); /// Send a ClientNotification to the phone void sendClientNotification(meshtastic_ClientNotification *cn); diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index c8c0d3170..d244a94ba 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -145,7 +145,7 @@ class NodeDB return &meshNodes->at(x); } - meshtastic_NodeInfoLite *getMeshNode(NodeNum n); + virtual meshtastic_NodeInfoLite *getMeshNode(NodeNum n); size_t getNumMeshNodes() { return numMeshNodes; } // returns true if the maximum number of nodes is reached or we are running low on memory diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index 997b1d6fe..09266b334 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -431,6 +431,7 @@ void RadioLibInterface::handleReceiveInterrupt() // nodes. meshtastic_MeshPacket *mp = packetPool.allocZeroed(); + // Keep the assigned fields in sync with src/mqtt/MQTT.cpp:onReceiveProto mp->from = radioBuffer.header.from; mp->to = radioBuffer.header.to; mp->id = radioBuffer.header.id; diff --git a/src/mesh/Router.h b/src/mesh/Router.h index da44d67df..0fe2bc551 100644 --- a/src/mesh/Router.h +++ b/src/mesh/Router.h @@ -71,7 +71,7 @@ class Router : protected concurrency::OSThread * RadioInterface calls this to queue up packets that have been received from the radio. The router is now responsible for * freeing the packet */ - void enqueueReceivedMessage(meshtastic_MeshPacket *p); + virtual void enqueueReceivedMessage(meshtastic_MeshPacket *p); /** * Send a packet on a suitable interface. This routine will diff --git a/src/modules/RoutingModule.h b/src/modules/RoutingModule.h index 7c34c5bc9..c047f6e29 100644 --- a/src/modules/RoutingModule.h +++ b/src/modules/RoutingModule.h @@ -13,7 +13,8 @@ class RoutingModule : public ProtobufModule */ RoutingModule(); - void sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopLimit = 0); + virtual void sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, + uint8_t hopLimit = 0); // Given the hopStart and hopLimit upon reception of a request, return the hop limit to use for the response uint8_t getHopLimitForResponse(uint8_t hopStart, uint8_t hopLimit); diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 3db3c37bb..f642af231 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -76,12 +76,22 @@ inline void onReceiveProto(char *topic, byte *payload, size_t length) return; } LOG_INFO("Received MQTT topic %s, len=%u", topic, length); + if (e.packet->hop_limit > HOP_MAX || e.packet->hop_start > HOP_MAX) { + LOG_INFO("Invalid hop_limit(%u) or hop_start(%u)", e.packet->hop_limit, e.packet->hop_start); + return; + } - UniquePacketPoolPacket p = packetPool.allocUniqueCopy(*e.packet); + UniquePacketPoolPacket p = packetPool.allocUniqueZeroed(); + p->from = e.packet->from; + p->to = e.packet->to; + p->id = e.packet->id; + p->channel = e.packet->channel; + p->hop_limit = e.packet->hop_limit; + p->hop_start = e.packet->hop_start; + p->want_ack = e.packet->want_ack; p->via_mqtt = true; // Mark that the packet was received via MQTT - // Unset received SNR/RSSI which might have been added by the MQTT gateway - p->rx_snr = 0; - p->rx_rssi = 0; + p->which_payload_variant = e.packet->which_payload_variant; + memcpy(&p->decoded, &e.packet->decoded, std::max(sizeof(p->decoded), sizeof(p->encrypted))); if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) { if (moduleConfig.mqtt.encryption_enabled) { diff --git a/test/test_mqtt/MQTT.cpp b/test/test_mqtt/MQTT.cpp new file mode 100644 index 000000000..55ba479e2 --- /dev/null +++ b/test/test_mqtt/MQTT.cpp @@ -0,0 +1,856 @@ +#include "DebugConfiguration.h" +#include "TestUtil.h" +#include + +#ifdef ARCH_PORTDUINO +#include "mesh/CryptoEngine.h" +#include "mesh/Default.h" +#include "mesh/MeshService.h" +#include "mesh/NodeDB.h" +#include "mesh/Router.h" +#include "modules/RoutingModule.h" +#include "mqtt/MQTT.h" +#include "mqtt/ServiceEnvelope.h" + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace +{ +// Minimal router needed to receive messages from MQTT. +class MockRouter : public Router +{ + public: + ~MockRouter() + { + // cryptLock is created in the constructor for Router. + delete cryptLock; + cryptLock = NULL; + } + void enqueueReceivedMessage(meshtastic_MeshPacket *p) override + { + packets_.emplace_back(*p); + packetPool.release(p); + } + std::list packets_; // Packets received by the Router. +}; + +// Minimal MeshService needed to receive messages from MQTT for testing PKI channel. +class MockMeshService : public MeshService +{ + public: + void sendMqttMessageToClientProxy(meshtastic_MqttClientProxyMessage *m) override + { + messages_.emplace_back(*m); + releaseMqttClientProxyMessageToPool(m); + } + std::list messages_; // Messages received from the MeshService. +}; + +// Minimal NodeDB needed to return values from getMeshNode. +class MockNodeDB : public NodeDB +{ + public: + meshtastic_NodeInfoLite *getMeshNode(NodeNum n) override { return &emptyNode; } + meshtastic_NodeInfoLite emptyNode = {}; +}; + +// Minimal RoutingModule needed to return values from sendAckNak. +class MockRoutingModule : public RoutingModule +{ + public: + void sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, + uint8_t hopLimit = 0) override + { + ackNacks_.emplace_back(err, to, idFrom, chIndex, hopLimit); + } + std::list> + ackNacks_; // ackNacks received by the RoutingModule. +}; + +// A WiFi client used by the MQTT::PubSubClient. Implements a minimal pub/sub server. +// There isn't an easy way to mock PubSubClient due to it not having virtual methods, so we mock using +// the WiFiClinet that PubSubClient uses. +class MockPubSubServer : public WiFiClient +{ + public: + static constexpr char kTextTopic[] = "TextTopic"; + uint8_t connected() override { return connected_; } + void flush() override {} + IPAddress remoteIP() const override { return IPAddress(htonl(ipAddress_)); } + void stop() override { connected_ = false; } + + int connect(IPAddress ip, uint16_t port) override + { + if (refuseConnection_) + return 0; + connected_ = true; + return 1; + } + int connect(const char *host, uint16_t port) override + { + if (refuseConnection_) + return 0; + connected_ = true; + return 1; + } + + int available() override + { + if (buffer_.empty()) + return 0; + return buffer_.front().size(); + } + + int read() override + { + assert(available()); + std::string &front = buffer_.front(); + char ch = front[0]; + front = front.substr(1, front.size()); + if (front.empty()) + buffer_.pop_front(); + return ch; + } + + size_t write(uint8_t data) override { return write(&data, 1); } + size_t write(const uint8_t *buf, size_t size) override + { + command_ += std::string(reinterpret_cast(buf), size); + if (command_.size() < 2) + return size; + const int len = (uint8_t)command_[1] + 2; + if (command_.size() < len) + return size; + handleCommand(command_[0], command_.substr(2, len)); + command_ = command_.substr(len, command_.size()); + return size; + } + + // The pub/sub "server". + // https://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/MQTT_V3.1_Protocol_Specific.pdf + void handleCommand(uint8_t header, std::string_view message) + { + switch (header & 0xf0) { + case MQTTCONNECT: + LOG_DEBUG("MQTTCONNECT"); + buffer_.push_back(std::string("\x20\x02\x00\x00", 4)); + break; + + case MQTTSUBSCRIBE: { + LOG_DEBUG("MQTTSUBSCRIBE"); + assert(message.size() >= 5); + message.remove_prefix(2); // skip messageId + + while (message.size() >= 3) { + const uint16_t topicSize = ((uint8_t)message[0]) << 8 | (uint8_t)message[1]; + message.remove_prefix(2); + + assert(message.size() >= topicSize + 1); + std::string topic(message.data(), topicSize); + message.remove_prefix(topicSize + 1); + + LOG_DEBUG("Subscribed to topic: %s", topic.c_str()); + subscriptions_.insert(std::move(topic)); + } + break; + } + + case MQTTPINGREQ: + LOG_DEBUG("MQTTPINGREQ"); + buffer_.push_back(std::string("\xd0\x00", 2)); + break; + + case MQTTPUBLISH: { + LOG_DEBUG("MQTTPUBLISH"); + assert(message.size() >= 3); + const uint16_t topicSize = ((uint8_t)message[0]) << 8 | (uint8_t)message[1]; + message.remove_prefix(2); + + assert(message.size() >= topicSize); + std::string topic(message.data(), topicSize); + message.remove_prefix(topicSize); + + if (topic == kTextTopic) { + published_.emplace_back(std::move(topic), std::string(message.data(), message.size())); + } else { + published_.emplace_back( + std::move(topic), DecodedServiceEnvelope(reinterpret_cast(message.data()), message.size())); + } + break; + } + } + } + + bool connected_ = false; + bool refuseConnection_ = false; // Simulate a failed connection. + uint32_t ipAddress_ = 0x01010101; // IP address of the MQTT server. + std::list buffer_; // Buffer of messages for the pubSub client to receive. + std::string command_; // Current command received from the pubSub client. + std::set subscriptions_; // Topics that the pubSub client has subscribed to. + std::list>> + published_; // Messages published from the pubSub client. Each list element is a pair containing the topic name and either + // a text message (if from the kTextTopic topic) or a DecodedServiceEnvelope. +}; + +// Instances of our mocks. +class MQTTUnitTest; +MQTTUnitTest *unitTest; +MockPubSubServer *pubsub; +MockRoutingModule *mockRoutingModule; +MockMeshService *mockMeshService; +MockRouter *mockRouter; + +// Keep running the loop until either conditionMet returns true or 4 seconds elapse. +// Returns true if conditionMet returns true, returns false on timeout. +bool loopUntil(std::function conditionMet) +{ + long start = millis(); + while (start + 4000 > millis()) { + long delayMsec = concurrency::mainController.runOrDelay(); + if (conditionMet()) + return true; + concurrency::mainDelay.delay(std::min(delayMsec, 5L)); + } + return false; +} + +// Used to access protected/private members of MQTT for unit testing. +class MQTTUnitTest : public MQTT +{ + public: + MQTTUnitTest() : MQTT(std::make_unique()) + { + pubsub = reinterpret_cast(mqttClient.get()); + } + ~MQTTUnitTest() + { + // Needed because WiFiClient does not have a virtual destructor. + mqttClient.release(); + delete pubsub; + } + int queueSize() { return mqttQueue.numUsed(); } + void reportToMap(std::optional precision = std::nullopt) + { + if (precision.has_value()) + map_position_precision = precision.value(); + map_publish_interval_msecs = 0; + perhapsReportToMap(); + } + void publish(const meshtastic_MeshPacket *p, std::string gateway = "!87654321", std::string channel = "test") + { + std::stringstream topic; + topic << "msh/2/e/" << channel << "/!" << gateway; + const meshtastic_ServiceEnvelope env = {.packet = const_cast(p), + .channel_id = const_cast(channel.c_str()), + .gateway_id = const_cast(gateway.c_str())}; + uint8_t bytes[256]; + size_t numBytes = pb_encode_to_bytes(bytes, sizeof(bytes), &meshtastic_ServiceEnvelope_msg, &env); + mqttCallback(const_cast(topic.str().c_str()), bytes, numBytes); + } + static void restart() + { + if (mqtt != NULL) { + delete mqtt; + mqtt = unitTest = NULL; + } + mqtt = unitTest = new MQTTUnitTest(); + mqtt->start(); + + if (!moduleConfig.mqtt.enabled || moduleConfig.mqtt.proxy_to_client_enabled || *moduleConfig.mqtt.root) { + loopUntil([] { return true; }); // Loop once + return; + } + // Wait for MQTT to subscribe to all topics. + TEST_ASSERT_TRUE(loopUntil( + [] { return pubsub->subscriptions_.count("msh/2/e/test/+") && pubsub->subscriptions_.count("msh/2/e/PKI/+"); })); + } + PubSubClient &getPubSub() { return pubSub; } +}; + +// Packets used in unit tests. +const meshtastic_MeshPacket decoded = { + .from = 1, + .to = 2, + .which_payload_variant = meshtastic_MeshPacket_decoded_tag, + .decoded = {.portnum = meshtastic_PortNum_TEXT_MESSAGE_APP, .has_bitfield = true, .bitfield = BITFIELD_OK_TO_MQTT_MASK}, + .id = 4, +}; +const meshtastic_MeshPacket encrypted = { + .from = 1, + .to = 2, + .which_payload_variant = meshtastic_MeshPacket_encrypted_tag, + .encrypted = {.size = 0}, + .id = 3, +}; +} // namespace + +// Initialize mocks and configuration before running each test. +void setUp(void) +{ + moduleConfig.mqtt = + meshtastic_ModuleConfig_MQTTConfig{.enabled = true, .map_reporting_enabled = true, .has_map_report_settings = true}; + channelFile.channels[0] = meshtastic_Channel{ + .index = 0, + .has_settings = true, + .settings = {.name = "test", .uplink_enabled = true, .downlink_enabled = true}, + .role = meshtastic_Channel_Role_PRIMARY, + }; + channelFile.channels_count = 1; + owner = meshtastic_User{.id = "!12345678"}; + myNodeInfo = meshtastic_MyNodeInfo{.my_node_num = 10}; + localPosition = + meshtastic_Position{.has_latitude_i = true, .latitude_i = 7 * 1e7, .has_longitude_i = true, .longitude_i = 3 * 1e7}; + + router = mockRouter = new MockRouter(); + service = mockMeshService = new MockMeshService(); + routingModule = mockRoutingModule = new MockRoutingModule(); + MQTTUnitTest::restart(); +} + +// Deinitialize all objects created in setUp. +void tearDown(void) +{ + delete unitTest; + mqtt = unitTest = NULL; + delete mockRoutingModule; + routingModule = mockRoutingModule = NULL; + delete mockMeshService; + service = mockMeshService = NULL; + delete mockRouter; + router = mockRouter = NULL; +} + +// Test that the decoded MeshPacket is published when encryption_enabled = false. +void test_sendDirectlyConnectedDecoded(void) +{ + mqtt->onSend(encrypted, decoded, 0); + + TEST_ASSERT_EQUAL(1, pubsub->published_.size()); + const auto &[topic, payload] = pubsub->published_.front(); + const DecodedServiceEnvelope &env = std::get(payload); + TEST_ASSERT_EQUAL_STRING("msh/2/e/test/!12345678", topic.c_str()); + TEST_ASSERT_TRUE(env.validDecode); + TEST_ASSERT_EQUAL(decoded.id, env.packet->id); +} + +// Test that the encrypted MeshPacket is published when encryption_enabled = true. +void test_sendDirectlyConnectedEncrypted(void) +{ + moduleConfig.mqtt.encryption_enabled = true; + + mqtt->onSend(encrypted, decoded, 0); + + TEST_ASSERT_EQUAL(1, pubsub->published_.size()); + const auto &[topic, payload] = pubsub->published_.front(); + const DecodedServiceEnvelope &env = std::get(payload); + TEST_ASSERT_EQUAL_STRING("msh/2/e/test/!12345678", topic.c_str()); + TEST_ASSERT_TRUE(env.validDecode); + TEST_ASSERT_EQUAL(encrypted.id, env.packet->id); +} + +// Verify that the decoded MeshPacket is proxied through the MeshService when encryption_enabled = false. +void test_proxyToMeshServiceDecoded(void) +{ + moduleConfig.mqtt.proxy_to_client_enabled = true; + MQTTUnitTest::restart(); + + mqtt->onSend(encrypted, decoded, 0); + + TEST_ASSERT_EQUAL(1, mockMeshService->messages_.size()); + const meshtastic_MqttClientProxyMessage &message = mockMeshService->messages_.front(); + TEST_ASSERT_EQUAL_STRING("msh/2/e/test/!12345678", message.topic); + TEST_ASSERT_EQUAL(meshtastic_MqttClientProxyMessage_data_tag, message.which_payload_variant); + const DecodedServiceEnvelope env(message.payload_variant.data.bytes, message.payload_variant.data.size); + TEST_ASSERT_TRUE(env.validDecode); + TEST_ASSERT_EQUAL(decoded.id, env.packet->id); +} + +// Verify that the encrypted MeshPacket is proxied through the MeshService when encryption_enabled = true. +void test_proxyToMeshServiceEncrypted(void) +{ + moduleConfig.mqtt.proxy_to_client_enabled = true; + moduleConfig.mqtt.encryption_enabled = true; + MQTTUnitTest::restart(); + + mqtt->onSend(encrypted, decoded, 0); + + TEST_ASSERT_EQUAL(1, mockMeshService->messages_.size()); + const meshtastic_MqttClientProxyMessage &message = mockMeshService->messages_.front(); + TEST_ASSERT_EQUAL_STRING("msh/2/e/test/!12345678", message.topic); + TEST_ASSERT_EQUAL(meshtastic_MqttClientProxyMessage_data_tag, message.which_payload_variant); + const DecodedServiceEnvelope env(message.payload_variant.data.bytes, message.payload_variant.data.size); + TEST_ASSERT_TRUE(env.validDecode); + TEST_ASSERT_EQUAL(encrypted.id, env.packet->id); +} + +// A packet without the OK to MQTT bit set should not be published to a public server. +void test_dontMqttMeOnPublicServer(void) +{ + meshtastic_MeshPacket p = decoded; + p.decoded.bitfield = 0; + p.decoded.has_bitfield = 0; + + mqtt->onSend(encrypted, p, 0); + + TEST_ASSERT_TRUE(pubsub->published_.empty()); +} + +// A packet without the OK to MQTT bit set should be published to a private server. +void test_okToMqttOnPrivateServer(void) +{ + // Cause a disconnect. + pubsub->connected_ = false; + pubsub->refuseConnection_ = true; + TEST_ASSERT_TRUE(loopUntil([] { return !unitTest->getPubSub().connected(); })); + + // Use 127.0.0.1 for the server's IP. + pubsub->ipAddress_ = 0x7f000001; + + // Reconnect. + pubsub->refuseConnection_ = false; + TEST_ASSERT_TRUE(loopUntil([] { return unitTest->getPubSub().connected(); })); + + // Send the same packet as test_dontMqttMeOnPublicServer. + meshtastic_MeshPacket p = decoded; + p.decoded.bitfield = 0; + p.decoded.has_bitfield = 0; + + mqtt->onSend(encrypted, p, 0); + + TEST_ASSERT_EQUAL(1, pubsub->published_.size()); +} + +// Range tests messages are not uplinked to the default server. +void test_noRangeTestAppOnDefaultServer(void) +{ + meshtastic_MeshPacket p = decoded; + p.decoded.portnum = meshtastic_PortNum_RANGE_TEST_APP; + + mqtt->onSend(encrypted, p, 0); + + TEST_ASSERT_TRUE(pubsub->published_.empty()); +} + +// Detection sensor messages are not uplinked to the default server. +void test_noDetectionSensorAppOnDefaultServer(void) +{ + meshtastic_MeshPacket p = decoded; + p.decoded.portnum = meshtastic_PortNum_DETECTION_SENSOR_APP; + + mqtt->onSend(encrypted, p, 0); + + TEST_ASSERT_TRUE(pubsub->published_.empty()); +} + +// Test that a MeshPacket is queued while the MQTT server is disconnected. +void test_sendQueued(void) +{ + // Cause a disconnect. + pubsub->connected_ = false; + pubsub->refuseConnection_ = true; + TEST_ASSERT_TRUE(loopUntil([] { return !unitTest->getPubSub().connected(); })); + + // Send while disconnected. + mqtt->onSend(encrypted, decoded, 0); + TEST_ASSERT_EQUAL(1, unitTest->queueSize()); + TEST_ASSERT_TRUE(pubsub->published_.empty()); + TEST_ASSERT_FALSE(unitTest->getPubSub().connected()); + + // Allow reconnect to happen. Expect to see the packet published now. + pubsub->refuseConnection_ = false; + TEST_ASSERT_TRUE(loopUntil([] { return !pubsub->published_.empty(); })); + + TEST_ASSERT_EQUAL(0, unitTest->queueSize()); + const auto &[topic, payload] = pubsub->published_.front(); + const DecodedServiceEnvelope &env = std::get(payload); + TEST_ASSERT_EQUAL_STRING("msh/2/e/test/!12345678", topic.c_str()); + TEST_ASSERT_TRUE(env.validDecode); + TEST_ASSERT_EQUAL(decoded.id, env.packet->id); +} + +// Verify reconnecting with the proxy enabled does not reconnect to a MQTT server. +void test_reconnectProxyDoesNotReconnectMqtt(void) +{ + moduleConfig.mqtt.proxy_to_client_enabled = true; + MQTTUnitTest::restart(); + + mqtt->reconnect(); + + TEST_ASSERT_FALSE(pubsub->connected_); +} + +// Test receiving an empty MeshPacket on a subscribed topic. +void test_receiveEmptyMeshPacket(void) +{ + unitTest->publish(NULL); + + TEST_ASSERT_TRUE(mockRouter->packets_.empty()); + TEST_ASSERT_TRUE(mockRoutingModule->ackNacks_.empty()); +} + +// Test receiving a decoded MeshPacket on a subscribed topic. +void test_receiveDecodedProto(void) +{ + unitTest->publish(&decoded); + + TEST_ASSERT_EQUAL(1, mockRouter->packets_.size()); + const meshtastic_MeshPacket &p = mockRouter->packets_.front(); + TEST_ASSERT_EQUAL(decoded.id, p.id); + TEST_ASSERT_TRUE(p.via_mqtt); +} + +// Test receiving a decoded MeshPacket from the phone proxy. +void test_receiveDecodedProtoFromProxy(void) +{ + const meshtastic_ServiceEnvelope env = { + .packet = const_cast(&decoded), .channel_id = "test", .gateway_id = "!87654321"}; + meshtastic_MqttClientProxyMessage message = meshtastic_MqttClientProxyMessage_init_default; + strcat(message.topic, "msh/2/e/test/!87654321"); + message.which_payload_variant = meshtastic_MqttClientProxyMessage_data_tag; + message.payload_variant.data.size = pb_encode_to_bytes( + message.payload_variant.data.bytes, sizeof(message.payload_variant.data.bytes), &meshtastic_ServiceEnvelope_msg, &env); + + mqtt->onClientProxyReceive(message); + + TEST_ASSERT_EQUAL(1, mockRouter->packets_.size()); + const meshtastic_MeshPacket &p = mockRouter->packets_.front(); + TEST_ASSERT_EQUAL(decoded.id, p.id); + TEST_ASSERT_TRUE(p.via_mqtt); +} + +// Properly handles the case where the received message is empty. +void test_receiveEmptyDataFromProxy(void) +{ + meshtastic_MqttClientProxyMessage message = meshtastic_MqttClientProxyMessage_init_default; + message.which_payload_variant = meshtastic_MqttClientProxyMessage_data_tag; + + mqtt->onClientProxyReceive(message); + + TEST_ASSERT_TRUE(mockRouter->packets_.empty()); +} + +// Packets should be ignored if downlink is not enabled. +void test_receiveWithoutChannelDownlink(void) +{ + channelFile.channels[0].settings.downlink_enabled = false; + + unitTest->publish(&decoded); + + TEST_ASSERT_TRUE(mockRouter->packets_.empty()); +} + +// Test receiving an encrypted MeshPacket on the PKI topic. +void test_receiveEncryptedPKITopicToUs(void) +{ + meshtastic_MeshPacket e = encrypted; + e.to = myNodeInfo.my_node_num; + + unitTest->publish(&e, "!87654321", "PKI"); + + TEST_ASSERT_EQUAL(1, mockRouter->packets_.size()); + const meshtastic_MeshPacket &p = mockRouter->packets_.front(); + TEST_ASSERT_EQUAL(encrypted.id, p.id); + TEST_ASSERT_TRUE(p.via_mqtt); +} + +// Should ignore messages published to MQTT by this gateway. +void test_receiveIgnoresOwnPublishedMessages(void) +{ + unitTest->publish(&decoded, owner.id); + + TEST_ASSERT_TRUE(mockRouter->packets_.empty()); + TEST_ASSERT_TRUE(mockRoutingModule->ackNacks_.empty()); +} + +// Considers receiving one of our packets an acknowledgement of it being sent. +void test_receiveAcksOwnSentMessages(void) +{ + meshtastic_MeshPacket p = decoded; + p.from = myNodeInfo.my_node_num; + + unitTest->publish(&p, owner.id); + + TEST_ASSERT_TRUE(mockRouter->packets_.empty()); + TEST_ASSERT_EQUAL(1, mockRoutingModule->ackNacks_.size()); + const auto &[err, to, idFrom, chIndex, hopLimit] = mockRoutingModule->ackNacks_.front(); + TEST_ASSERT_EQUAL(meshtastic_Routing_Error_NONE, err); + TEST_ASSERT_EQUAL(myNodeInfo.my_node_num, to); + TEST_ASSERT_EQUAL(p.id, idFrom); +} + +// Should ignore our own messages from MQTT that were heard by other nodes. +void test_receiveIgnoresSentMessagesFromOthers(void) +{ + meshtastic_MeshPacket p = decoded; + p.from = myNodeInfo.my_node_num; + + unitTest->publish(&p); + + TEST_ASSERT_TRUE(mockRouter->packets_.empty()); + TEST_ASSERT_TRUE(mockRoutingModule->ackNacks_.empty()); +} + +// Decoded MQTT messages should be ignored when encryption is enabled. +void test_receiveIgnoresDecodedWhenEncryptionEnabled(void) +{ + moduleConfig.mqtt.encryption_enabled = true; + + unitTest->publish(&decoded); + + TEST_ASSERT_TRUE(mockRouter->packets_.empty()); +} + +// Non-encrypted messages for the Admin App should be ignored. +void test_receiveIgnoresDecodedAdminApp(void) +{ + meshtastic_MeshPacket p = decoded; + p.decoded.portnum = meshtastic_PortNum_ADMIN_APP; + + unitTest->publish(&p); + + TEST_ASSERT_TRUE(mockRouter->packets_.empty()); +} + +// Only the same fields that are transmitted over LoRa should be set in MQTT messages. +void test_receiveIgnoresUnexpectedFields(void) +{ + meshtastic_MeshPacket input = decoded; + input.rx_snr = 10; + input.rx_rssi = 20; + + unitTest->publish(&input); + + TEST_ASSERT_EQUAL(1, mockRouter->packets_.size()); + const meshtastic_MeshPacket &p = mockRouter->packets_.front(); + TEST_ASSERT_EQUAL(0, p.rx_snr); + TEST_ASSERT_EQUAL(0, p.rx_rssi); +} + +// Messages with an invalid hop_limit are ignored. +void test_receiveIgnoresInvalidHopLimit(void) +{ + meshtastic_MeshPacket p = decoded; + p.hop_limit = 10; + + unitTest->publish(&p); + + TEST_ASSERT_TRUE(mockRouter->packets_.empty()); +} + +// Publishing to a text channel. +void test_publishTextMessageDirect(void) +{ + TEST_ASSERT_TRUE(mqtt->publish(MockPubSubServer::kTextTopic, "payload", 0)); + + TEST_ASSERT_EQUAL(1, pubsub->published_.size()); + const auto &[topic, payload] = pubsub->published_.front(); + TEST_ASSERT_EQUAL_STRING("payload", std::get(payload).c_str()); +} + +// Publishing to a text channel via the MQTT client proxy. +void test_publishTextMessageWithProxy(void) +{ + moduleConfig.mqtt.proxy_to_client_enabled = true; + + TEST_ASSERT_TRUE(mqtt->publish(MockPubSubServer::kTextTopic, "payload", 0)); + + TEST_ASSERT_EQUAL(1, mockMeshService->messages_.size()); + const meshtastic_MqttClientProxyMessage &message = mockMeshService->messages_.front(); + TEST_ASSERT_EQUAL_STRING(MockPubSubServer::kTextTopic, message.topic); + TEST_ASSERT_EQUAL(meshtastic_MqttClientProxyMessage_text_tag, message.which_payload_variant); + TEST_ASSERT_EQUAL_STRING("payload", message.payload_variant.text); +} + +// Helper method to verify the expected latitude/longitude was received. +void verifyLatLong(const DecodedServiceEnvelope &env, uint32_t latitude, uint32_t longitude) +{ + TEST_ASSERT_TRUE(env.validDecode); + const meshtastic_MeshPacket &p = *env.packet; + TEST_ASSERT_EQUAL(NODENUM_BROADCAST, p.to); + TEST_ASSERT_EQUAL(meshtastic_MeshPacket_decoded_tag, p.which_payload_variant); + TEST_ASSERT_EQUAL(meshtastic_PortNum_MAP_REPORT_APP, p.decoded.portnum); + + meshtastic_MapReport mapReport; + TEST_ASSERT_TRUE( + pb_decode_from_bytes(p.decoded.payload.bytes, p.decoded.payload.size, &meshtastic_MapReport_msg, &mapReport)); + TEST_ASSERT_EQUAL(latitude, mapReport.latitude_i); + TEST_ASSERT_EQUAL(longitude, mapReport.longitude_i); +} + +// Map reporting defaults to an imprecise location. +void test_reportToMapDefaultImprecise(void) +{ + unitTest->reportToMap(); + + TEST_ASSERT_EQUAL(1, pubsub->published_.size()); + const auto &[topic, payload] = pubsub->published_.front(); + TEST_ASSERT_EQUAL_STRING("msh/2/map/", topic.c_str()); + verifyLatLong(std::get(payload), 70123520, 30015488); +} + +// Precise location is reported when configured. +void test_reportToMapPrecise(void) +{ + unitTest->reportToMap(/*precision=*/32); + + TEST_ASSERT_EQUAL(1, pubsub->published_.size()); + const auto &[topic, payload] = pubsub->published_.front(); + TEST_ASSERT_EQUAL_STRING("msh/2/map/", topic.c_str()); + verifyLatLong(std::get(payload), localPosition.latitude_i, localPosition.longitude_i); +} + +// Location is sent over the phone proxy. +void test_reportToMapPreciseProxied(void) +{ + moduleConfig.mqtt.proxy_to_client_enabled = true; + MQTTUnitTest::restart(); + + unitTest->reportToMap(/*precision=*/32); + + TEST_ASSERT_EQUAL(1, mockMeshService->messages_.size()); + const meshtastic_MqttClientProxyMessage &message = mockMeshService->messages_.front(); + TEST_ASSERT_EQUAL_STRING("msh/2/map/", message.topic); + TEST_ASSERT_EQUAL(meshtastic_MqttClientProxyMessage_data_tag, message.which_payload_variant); + const DecodedServiceEnvelope env(message.payload_variant.data.bytes, message.payload_variant.data.size); + verifyLatLong(env, localPosition.latitude_i, localPosition.longitude_i); +} + +// No location is reported when the precision is invalid. +void test_reportToMapInvalidPrecision(void) +{ + unitTest->reportToMap(/*precision=*/0); + + TEST_ASSERT_TRUE(pubsub->published_.empty()); +} + +// isUsingDefaultServer returns true when using the default server. +void test_usingDefaultServer(void) +{ + TEST_ASSERT_TRUE(mqtt->isUsingDefaultServer()); +} + +// isUsingDefaultServer returns true when using the default server and a port. +void test_usingDefaultServerWithPort(void) +{ + std::string server = default_mqtt_address; + server += ":1883"; + strcpy(moduleConfig.mqtt.address, server.c_str()); + MQTTUnitTest::restart(); + + TEST_ASSERT_TRUE(mqtt->isUsingDefaultServer()); +} + +// isUsingDefaultServer returns true when using the default server and invalid port. +void test_usingDefaultServerWithInvalidPort(void) +{ + std::string server = default_mqtt_address; + server += ":invalid"; + strcpy(moduleConfig.mqtt.address, server.c_str()); + MQTTUnitTest::restart(); + + TEST_ASSERT_TRUE(mqtt->isUsingDefaultServer()); +} + +// isUsingDefaultServer returns false when not using the default server. +void test_usingCustomServer(void) +{ + strcpy(moduleConfig.mqtt.address, "custom"); + MQTTUnitTest::restart(); + + TEST_ASSERT_FALSE(mqtt->isUsingDefaultServer()); +} + +// Test that isEnabled returns true the MQTT module is enabled. +void test_enabled(void) +{ + TEST_ASSERT_TRUE(mqtt->isEnabled()); +} + +// Test that isEnabled returns false the MQTT module not enabled. +void test_disabled(void) +{ + moduleConfig.mqtt.enabled = false; + MQTTUnitTest::restart(); + + TEST_ASSERT_FALSE(mqtt->isEnabled()); +} + +// Subscriptions contain the moduleConfig.mqtt.root prefix. +void test_customMqttRoot(void) +{ + strcpy(moduleConfig.mqtt.root, "custom"); + MQTTUnitTest::restart(); + + TEST_ASSERT_TRUE(loopUntil( + [] { return pubsub->subscriptions_.count("custom/2/e/test/+") && pubsub->subscriptions_.count("custom/2/e/PKI/+"); })); +} + +void setup() +{ + initializeTestEnvironment(); + const std::unique_ptr mockNodeDB(new MockNodeDB()); + nodeDB = mockNodeDB.get(); + + UNITY_BEGIN(); + RUN_TEST(test_sendDirectlyConnectedDecoded); + RUN_TEST(test_sendDirectlyConnectedEncrypted); + RUN_TEST(test_proxyToMeshServiceDecoded); + RUN_TEST(test_proxyToMeshServiceEncrypted); + RUN_TEST(test_dontMqttMeOnPublicServer); + RUN_TEST(test_okToMqttOnPrivateServer); + RUN_TEST(test_noRangeTestAppOnDefaultServer); + RUN_TEST(test_noDetectionSensorAppOnDefaultServer); + RUN_TEST(test_sendQueued); + RUN_TEST(test_reconnectProxyDoesNotReconnectMqtt); + RUN_TEST(test_receiveEmptyMeshPacket); + RUN_TEST(test_receiveDecodedProto); + RUN_TEST(test_receiveDecodedProtoFromProxy); + RUN_TEST(test_receiveEmptyDataFromProxy); + RUN_TEST(test_receiveWithoutChannelDownlink); + RUN_TEST(test_receiveEncryptedPKITopicToUs); + RUN_TEST(test_receiveIgnoresOwnPublishedMessages); + RUN_TEST(test_receiveAcksOwnSentMessages); + RUN_TEST(test_receiveIgnoresSentMessagesFromOthers); + RUN_TEST(test_receiveIgnoresDecodedWhenEncryptionEnabled); + RUN_TEST(test_receiveIgnoresDecodedAdminApp); + RUN_TEST(test_receiveIgnoresUnexpectedFields); + RUN_TEST(test_receiveIgnoresInvalidHopLimit); + RUN_TEST(test_publishTextMessageDirect); + RUN_TEST(test_publishTextMessageWithProxy); + RUN_TEST(test_reportToMapDefaultImprecise); + RUN_TEST(test_reportToMapPrecise); + RUN_TEST(test_reportToMapPreciseProxied); + RUN_TEST(test_reportToMapInvalidPrecision); + RUN_TEST(test_usingDefaultServer); + RUN_TEST(test_usingDefaultServerWithPort); + RUN_TEST(test_usingDefaultServerWithInvalidPort); + RUN_TEST(test_usingCustomServer); + RUN_TEST(test_enabled); + RUN_TEST(test_disabled); + RUN_TEST(test_customMqttRoot); + exit(UNITY_END()); +} +#else +void setup() +{ + initializeTestEnvironment(); + LOG_WARN("This test requires the ARCH_PORTDUINO variant of WiFiClient"); + UNITY_BEGIN(); + UNITY_END(); +} +#endif +void loop() {} \ No newline at end of file From 9421eba0275afdc34fd2331cacd1f363485fd86e Mon Sep 17 00:00:00 2001 From: Mictronics Date: Tue, 7 Jan 2025 16:57:42 +0100 Subject: [PATCH 063/381] Fix build for Pico2 RP2350 platform. (#5783) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix LED pinout for T-Echo board marked v1.0, date 2021-6-28 * Merge PR #420 * Fixed double and missing Default class. * Use correct format specifier and fixed typo. * Removed duplicate code. * Fix error: #if with no expression * Fix warning: extra tokens at end of #endif directive. * Fix antenna switching logic. Complementary-pin control logic is required on the rp2040-lora board. * Fix deprecated macros. * Set RP2040 in dormant mode when deep sleep is triggered. * Fix array out of bounds read. * Admin key count needs to be set otherwise the key will be zero loaded after reset. * Don't reset the admin key size when loading defaults. Preserve an existing key in config if possible. * Remove log spam when reading INA voltage sensor. * Remove static declaration for admin keys from userPrefs.h. Load hard coded admin keys in case config file has empty slots. * Removed newlines from log. * Fix issue #5665. * Fix build for Pico2 RP2350 platform. --------- Co-authored-by: Ben Meadors Co-authored-by: Thomas Göttgens Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com> --- arch/rp2xx0/rp2350.ini | 6 +++--- src/platform/rp2xx0/main-rp2xx0.cpp | 22 ++++++++++++++++------ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/arch/rp2xx0/rp2350.ini b/arch/rp2xx0/rp2350.ini index c5849ff2a..ab16e24b4 100644 --- a/arch/rp2xx0/rp2350.ini +++ b/arch/rp2xx0/rp2350.ini @@ -7,12 +7,12 @@ platform_packages = framework-arduinopico@https://github.com/earlephilhower/ardu board_build.core = earlephilhower board_build.filesystem_size = 0.5m build_flags = - ${arduino_base.build_flags} -Wno-unused-variable + ${arduino_base.build_flags} -Wno-unused-variable -Wcast-align -Isrc/platform/rp2xx0 - -D__PLAT_RP2040__ + -D__PLAT_RP2350__ # -D _POSIX_THREADS build_src_filter = - ${arduino_base.build_src_filter} - - - - - - - - - + ${arduino_base.build_src_filter} - - - - - - - - - - - lib_ignore = BluetoothOTA diff --git a/src/platform/rp2xx0/main-rp2xx0.cpp b/src/platform/rp2xx0/main-rp2xx0.cpp index a46b0face..6c73e385a 100644 --- a/src/platform/rp2xx0/main-rp2xx0.cpp +++ b/src/platform/rp2xx0/main-rp2xx0.cpp @@ -2,14 +2,11 @@ #include "hardware/xosc.h" #include #include -#include #include #include -void setBluetoothEnable(bool enable) -{ - // not needed -} +#ifdef __PLAT_RP2040__ +#include static bool awake; @@ -66,7 +63,20 @@ void cpuDeepSleep(uint32_t msecs) rp2040.reboot(); /* Set RP2040 in dormant mode. Will not wake up. */ - // xosc_dormant(); + // xosc_dormant(); +} + +#else +void cpuDeepSleep(uint32_t msecs) +{ + /* Set RP2040 in dormant mode. Will not wake up. */ + xosc_dormant(); +} +#endif + +void setBluetoothEnable(bool enable) +{ + // not needed } void updateBatteryLevel(uint8_t level) From 6cf3485d07db7fb3a97b5b90a6801e4404117f28 Mon Sep 17 00:00:00 2001 From: Austin Date: Tue, 7 Jan 2025 18:16:56 -0500 Subject: [PATCH 064/381] meshtasticd-debian: Fix versioning compliance, add OBS (#5785) --- .github/workflows/build_debian_src.yml | 8 +- .github/workflows/nightly.yml | 10 --- .github/workflows/nightly_debian.yml | 37 +++++++++ .github/workflows/package_obs.yml | 103 +++++++++++++++++++++++++ .github/workflows/package_ppa.yml | 6 +- .github/workflows/release_channels.yml | 9 ++- bin/readprops.py | 9 ++- debian/changelog | 2 +- debian/ci_changelog.sh | 2 +- 9 files changed, 166 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/nightly_debian.yml create mode 100644 .github/workflows/package_obs.yml diff --git a/.github/workflows/build_debian_src.yml b/.github/workflows/build_debian_src.yml index b2fcb5262..714542047 100644 --- a/.github/workflows/build_debian_src.yml +++ b/.github/workflows/build_debian_src.yml @@ -7,7 +7,11 @@ on: required: true inputs: series: - description: Ubuntu series to target + description: Ubuntu/Debian series to target + required: true + type: string + build_location: + description: Location where build will execute required: true type: string @@ -47,6 +51,8 @@ jobs: working-directory: meshtasticd run: | echo "deb=$(./bin/buildinfo.py deb)" >> $GITHUB_OUTPUT + env: + BUILD_LOCATION: ${{ inputs.build_location }} id: version - name: Fetch libdeps, package debian source diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index b7cf4bfc6..e249823a7 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -17,13 +17,3 @@ jobs: uses: trunk-io/trunk-action@782e83f803ca6e369f035d64c6ba2768174ba61b with: trunk-token: ${{ secrets.TRUNK_TOKEN }} - package-ppa: - strategy: - fail-fast: false - matrix: - series: [plucky, oracular, noble, jammy] - uses: ./.github/workflows/package_ppa.yml - with: - ppa_repo: daily - series: ${{ matrix.series }} - secrets: inherit diff --git a/.github/workflows/nightly_debian.yml b/.github/workflows/nightly_debian.yml new file mode 100644 index 000000000..63d977beb --- /dev/null +++ b/.github/workflows/nightly_debian.yml @@ -0,0 +1,37 @@ +name: Nightly Debian Packaging +on: + schedule: + - cron: 0 9 * * * + workflow_dispatch: + push: + branches: + - master + paths: + - debian/** + - .github/workflows/nightly_debian.yml + - .github/workflows/build_debian_src.yml + - .github/workflows/package_ppa.yml + - .github/workflows/package_obs.yml + +permissions: + contents: write + packages: write + +jobs: + package-ppa: + strategy: + fail-fast: false + matrix: + series: [plucky, oracular, noble, jammy] + uses: ./.github/workflows/package_ppa.yml + with: + ppa_repo: daily + series: ${{ matrix.series }} + secrets: inherit + + package-obs: + uses: ./.github/workflows/package_obs.yml + with: + obs_repo: meshtasticd + series: unstable + secrets: inherit diff --git a/.github/workflows/package_obs.yml b/.github/workflows/package_obs.yml new file mode 100644 index 000000000..11f2b87bf --- /dev/null +++ b/.github/workflows/package_obs.yml @@ -0,0 +1,103 @@ +name: Package for OpenSUSE Build Service + +on: + workflow_call: + secrets: + PPA_GPG_PRIVATE_KEY: + required: true + inputs: + obs_repo: + description: Meshtastic OBS repo to target + required: true + type: string + series: + description: Debian series to target + required: true + type: string + +permissions: + contents: write + packages: write + +jobs: + build-debian-src: + uses: ./.github/workflows/build_debian_src.yml + secrets: inherit + with: + series: ${{ inputs.series }} + build_location: obs + + package-obs: + runs-on: ubuntu-24.04 + needs: build-debian-src + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + path: meshtasticd + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + + - name: Install OpenSUSE Build Service deps + shell: bash + run: | + echo 'deb http://download.opensuse.org/repositories/openSUSE:/Tools/xUbuntu_24.04/ /' | sudo tee /etc/apt/sources.list.d/openSUSE:Tools.list + curl -fsSL https://download.opensuse.org/repositories/openSUSE:Tools/xUbuntu_24.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/openSUSE_Tools.gpg > /dev/null + sudo apt-get update -y --fix-missing + sudo apt-get install -y osc + + - name: Get release version string + working-directory: meshtasticd + run: | + echo "deb=$(./bin/buildinfo.py deb)" >> $GITHUB_OUTPUT + env: + BUILD_LOCATION: obs + id: version + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: firmware-debian-${{ steps.version.outputs.deb }}~${{ inputs.series }}-src + merge-multiple: true + + - name: Display structure of downloaded files + run: ls -lah + + # - name: Configure osc + # shell: bash + # env: + # OBS_USERNAME: ${{ secrets.OBS_USERNAME }} + # OBS_PASSWORD: ${{ secrets.OBS_PASSWORD }} + # run: | + # mkdir -p ~/.config/osc + # echo -e "[https://api.opensuse.org]\n" > ~/.config/osc/oscrc + # echo -e "user = $OBS_USERNAME" >> ~/.config/osc/oscrc + # echo -e "pass = $OBS_PASSWORD" >> ~/.config/osc/oscrc + # echo -e "aliases = obs" >> ~/.config/osc/oscrc + # # Authenticate to OBS + # osc meta prj -v + + # - name: Upload Package to OBS + # shell: bash + # run: | + # # Define your OBS project and repository + # OBS_PROJECT="application:meshtastic" + # OBS_REPO="${{ inputs.obs_repo }}" + + # # Create a temporary directory for osc + # mkdir -p /tmp/osc/$OBS_PROJECT/$OBS_REPO + # cd /tmp/osc/$OBS_PROJECT/$OBS_REPO + + # # Initialize the package directory + # osc checkout $OBS_PROJECT $OBS_REPO + + # # Copy package files to the osc directory + # cp $GITHUB_WORKSPACE/*.dsc . + # cp $GITHUB_WORKSPACE/*.tar.xz . + + # # Add files to osc + # osc addremove + + # # Commit and push the changes + # osc commit -m "Automated upload from GitHub Actions" diff --git a/.github/workflows/package_ppa.yml b/.github/workflows/package_ppa.yml index 5705c6d49..340087d1d 100644 --- a/.github/workflows/package_ppa.yml +++ b/.github/workflows/package_ppa.yml @@ -1,4 +1,4 @@ -name: Package Launchpad PPA +name: Package for Launchpad PPA on: workflow_call: @@ -14,7 +14,6 @@ on: description: Ubuntu series to target required: true type: string - workflow_dispatch: permissions: contents: write @@ -26,6 +25,7 @@ jobs: secrets: inherit with: series: ${{ inputs.series }} + build_location: ppa package-ppa: runs-on: ubuntu-24.04 @@ -55,6 +55,8 @@ jobs: working-directory: meshtasticd run: | echo "deb=$(./bin/buildinfo.py deb)" >> $GITHUB_OUTPUT + env: + BUILD_LOCATION: ppa id: version - name: Download artifacts diff --git a/.github/workflows/release_channels.yml b/.github/workflows/release_channels.yml index d572568de..cdde74b2e 100644 --- a/.github/workflows/release_channels.yml +++ b/.github/workflows/release_channels.yml @@ -2,7 +2,7 @@ name: Trigger release workflows upon Publish on: release: - types: [published] + types: [published, released] permissions: read-all @@ -18,3 +18,10 @@ jobs: ${{ contains(github.event.release.name, 'Beta') && 'beta' || contains(github.event.release.name, 'Alpha') && 'alpha' }} series: ${{ matrix.series }} secrets: inherit + + # package-obs: + # uses: ./.github/workflows/package_obs.yml + # with: + # obs_repo: meshtasticd + # series: ${{ contains(github.event.release.name, 'Beta') && 'beta' || contains(github.event.release.name, 'Alpha') && 'alpha' }} + # secrets: inherit diff --git a/bin/readprops.py b/bin/readprops.py index 8a1d3dc47..731a3d0d3 100644 --- a/bin/readprops.py +++ b/bin/readprops.py @@ -2,6 +2,7 @@ import configparser import subprocess import os run_number = os.getenv('GITHUB_RUN_NUMBER', '0') +build_location = os.getenv('BUILD_LOCATION', 'local') def readProps(prefsLoc): """Read the version of our project as a string""" @@ -11,8 +12,8 @@ def readProps(prefsLoc): version = dict(config.items("VERSION")) verObj = dict( short="{}.{}.{}".format(version["major"], version["minor"], version["build"]), - deb="unset", long="unset", + deb="unset", ) # Try to find current build SHA if if the workspace is clean. This could fail if git is not installed @@ -30,15 +31,15 @@ def readProps(prefsLoc): # # short for 'dirty', we want to keep our verstrings source for protobuf reasons # suffix = sha + "-d" verObj["long"] = "{}.{}".format(verObj["short"], suffix) - verObj["deb"] = "{}-{}~ppa{}".format(verObj["short"], run_number, sha) + verObj["deb"] = "{}.{}~{}{}".format(verObj["short"], run_number, build_location, sha) except: # print("Unexpected error:", sys.exc_info()[0]) # traceback.print_exc() verObj["long"] = verObj["short"] - verObj["deb"] = "{}-{}~ppa".format(verObj["short"], run_number) + verObj["deb"] = "{}.{}~{}".format(verObj["short"], run_number, build_location) # print("firmware version " + verStr) return verObj -# print("path is" + ','.join(sys.path)) +# print("path is" + ','.join(sys.path)) \ No newline at end of file diff --git a/debian/changelog b/debian/changelog index 79c444aca..035d5f034 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -meshtasticd (2.5.19) UNRELEASED; urgency=medium +meshtasticd (2.5.19.0) UNRELEASED; urgency=medium * Initial packaging diff --git a/debian/ci_changelog.sh b/debian/ci_changelog.sh index 7925ad5eb..f7e875977 100755 --- a/debian/ci_changelog.sh +++ b/debian/ci_changelog.sh @@ -2,6 +2,6 @@ export DEBEMAIL="github-actions[bot]@users.noreply.github.com" PKG_VERSION=$(python3 bin/buildinfo.py short) -dch --newversion "$PKG_VERSION-1" \ +dch --newversion "$PKG_VERSION.0" \ --distribution UNRELEASED \ "GitHub Actions Automatic version bump" From 33e5a04508b37e2b430d84b74a38f48abb2336f5 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Tue, 7 Jan 2025 20:02:47 -0600 Subject: [PATCH 065/381] Don't update to the latest ref on non-master branches --- .github/workflows/update_protobufs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update_protobufs.yml b/.github/workflows/update_protobufs.yml index 2732ab760..e7b3c1f40 100644 --- a/.github/workflows/update_protobufs.yml +++ b/.github/workflows/update_protobufs.yml @@ -12,6 +12,7 @@ jobs: submodules: true - name: Update submodule + if: ${{ github.ref == 'refs/heads/master' }} run: | git submodule update --remote protobufs From 8aac9f2e8ec14c95c90c975c4d36aacda99aa591 Mon Sep 17 00:00:00 2001 From: Austin Date: Wed, 8 Jan 2025 21:43:24 -0500 Subject: [PATCH 066/381] GH Actions: Update `Release` action, clarify versioning (#5794) --- .github/actions/build-variant/action.yml | 4 +- .github/workflows/build_docker.yml | 4 +- .github/workflows/build_native.yml | 4 +- .github/workflows/build_raspbian.yml | 4 +- .github/workflows/build_raspbian_armv7l.yml | 4 +- .github/workflows/main_matrix.yml | 97 ++++++------------- .github/workflows/package_amd64.yml | 8 +- .github/workflows/package_raspbian.yml | 8 +- .github/workflows/package_raspbian_armv7l.yml | 8 +- .github/workflows/test_native.yml | 18 ++-- .github/workflows/trunk_format_pr.yml | 6 +- 11 files changed, 67 insertions(+), 98 deletions(-) diff --git a/.github/actions/build-variant/action.yml b/.github/actions/build-variant/action.yml index b3303d393..d003459d6 100644 --- a/.github/actions/build-variant/action.yml +++ b/.github/actions/build-variant/action.yml @@ -83,13 +83,13 @@ runs: - name: Get release version string shell: bash - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - name: Store binaries as an artifact uses: actions/upload-artifact@v4 with: - name: firmware-${{ inputs.arch }}-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip + name: firmware-${{ inputs.arch }}-${{ inputs.board }}-${{ steps.version.outputs.long }}.zip overwrite: true path: | ${{ inputs.artifact-paths }} diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml index 13817a8cf..18787f16a 100644 --- a/.github/workflows/build_docker.yml +++ b/.github/workflows/build_docker.yml @@ -18,7 +18,7 @@ jobs: repository: ${{github.event.pull_request.head.repo.full_name}} - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - name: Docker login @@ -39,7 +39,7 @@ jobs: context: . file: ./Dockerfile push: true - tags: meshtastic/meshtasticd:${{ steps.version.outputs.version }} + tags: meshtastic/meshtasticd:${{ steps.version.outputs.long }} - name: Docker build and push if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request_target' && github.event_name != 'pull_request' }} diff --git a/.github/workflows/build_native.yml b/.github/workflows/build_native.yml index 11ba09ad7..cca839328 100644 --- a/.github/workflows/build_native.yml +++ b/.github/workflows/build_native.yml @@ -25,13 +25,13 @@ jobs: run: bin/build-native.sh - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - name: Store binaries as an artifact uses: actions/upload-artifact@v4 with: - name: firmware-native-${{ steps.version.outputs.version }}.zip + name: firmware-native-${{ steps.version.outputs.long }}.zip overwrite: true path: | release/meshtasticd_linux_x86_64 diff --git a/.github/workflows/build_raspbian.yml b/.github/workflows/build_raspbian.yml index ac63dfea4..646c6c9f3 100644 --- a/.github/workflows/build_raspbian.yml +++ b/.github/workflows/build_raspbian.yml @@ -39,13 +39,13 @@ jobs: run: bin/build-native.sh - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - name: Store binaries as an artifact uses: actions/upload-artifact@v4 with: - name: firmware-raspbian-${{ steps.version.outputs.version }}.zip + name: firmware-raspbian-${{ steps.version.outputs.long }}.zip overwrite: true path: | release/meshtasticd_linux_aarch64 diff --git a/.github/workflows/build_raspbian_armv7l.yml b/.github/workflows/build_raspbian_armv7l.yml index 565d9a0dc..21b1aea79 100644 --- a/.github/workflows/build_raspbian_armv7l.yml +++ b/.github/workflows/build_raspbian_armv7l.yml @@ -39,13 +39,13 @@ jobs: run: bin/build-native.sh - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - name: Store binaries as an artifact uses: actions/upload-artifact@v4 with: - name: firmware-raspbian-armv7l-${{ steps.version.outputs.version }}.zip + name: firmware-raspbian-armv7l-${{ steps.version.outputs.long }}.zip overwrite: true path: | release/meshtasticd_linux_armv7l diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 267e34a94..20ffecb76 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -192,7 +192,7 @@ jobs: run: ls -R - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - name: Move files up @@ -201,7 +201,7 @@ jobs: - name: Repackage in single firmware zip uses: actions/upload-artifact@v4 with: - name: firmware-${{matrix.arch}}-${{ steps.version.outputs.version }} + name: firmware-${{matrix.arch}}-${{ steps.version.outputs.long }} overwrite: true path: | ./firmware-*.bin @@ -218,7 +218,7 @@ jobs: - uses: actions/download-artifact@v4 with: - name: firmware-${{matrix.arch}}-${{ steps.version.outputs.version }} + name: firmware-${{matrix.arch}}-${{ steps.version.outputs.long }} merge-multiple: true path: ./output @@ -232,12 +232,12 @@ jobs: chmod +x ./output/device-update.sh - name: Zip firmware - run: zip -j -9 -r ./firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip ./output + run: zip -j -9 -r ./firmware-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip ./output - name: Repackage in single elfs zip uses: actions/upload-artifact@v4 with: - name: debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip + name: debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip overwrite: true path: ./*.elf retention-days: 30 @@ -245,8 +245,8 @@ jobs: - uses: scruplelesswizard/comment-artifact@main if: ${{ github.event_name == 'pull_request' }} with: - name: firmware-${{matrix.arch}}-${{ steps.version.outputs.version }} - description: "Download firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip. This artifact will be available for 90 days from creation" + name: firmware-${{matrix.arch}}-${{ steps.version.outputs.long }} + description: "Download firmware-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip. This artifact will be available for 90 days from creation" github-token: ${{ secrets.GITHUB_TOKEN }} release-artifacts: @@ -271,26 +271,24 @@ jobs: python-version: 3.x - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - name: Create release - uses: actions/create-release@v1 + uses: softprops/action-gh-release@v2 id: create_release with: draft: true prerelease: true - release_name: Meshtastic Firmware ${{ steps.version.outputs.version }} Alpha - tag_name: v${{ steps.version.outputs.version }} + name: Meshtastic Firmware ${{ steps.version.outputs.long }} Alpha + tag_name: v${{ steps.version.outputs.long }} body: | Autogenerated by github action, developer should edit as required before publishing... - env: - GITHUB_TOKEN: ${{ github.token }} - name: Download deb files uses: actions/download-artifact@v4 with: - pattern: meshtasticd_${{ steps.version.outputs.version }}_*.deb + pattern: meshtasticd_${{ steps.version.outputs.long }}_*.deb merge-multiple: true path: ./output @@ -298,35 +296,14 @@ jobs: - name: Display structure of downloaded files run: ls -lR - - name: Add raspbian aarch64 .deb - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ github.token }} + - name: Add deb files to release + uses: softprops/action-gh-release@v2 with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./output/meshtasticd_${{ steps.version.outputs.version }}_arm64.deb - asset_name: meshtasticd_${{ steps.version.outputs.version }}_arm64.deb - asset_content_type: application/vnd.debian.binary-package - - - name: Add raspbian armv7l .deb - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./output/meshtasticd_${{ steps.version.outputs.version }}_armhf.deb - asset_name: meshtasticd_${{ steps.version.outputs.version }}_armhf.deb - asset_content_type: application/vnd.debian.binary-package - - - name: Add raspbian amd64 .deb - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./output/meshtasticd_${{ steps.version.outputs.version }}_amd64.deb - asset_name: meshtasticd_${{ steps.version.outputs.version }}_amd64.deb - asset_content_type: application/vnd.debian.binary-package + tag_name: v${{ steps.version.outputs.long }} + files: | + ./output/meshtasticd_${{ steps.version.outputs.long }}_arm64.deb + ./output/meshtasticd_${{ steps.version.outputs.long }}_armhf.deb + ./output/meshtasticd_${{ steps.version.outputs.long }}_amd64.deb - name: Bump version.properties run: >- @@ -362,12 +339,12 @@ jobs: python-version: 3.x - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - uses: actions/download-artifact@v4 with: - pattern: firmware-${{matrix.arch}}-${{ steps.version.outputs.version }} + pattern: firmware-${{matrix.arch}}-${{ steps.version.outputs.long }} merge-multiple: true path: ./output @@ -380,37 +357,25 @@ jobs: chmod +x ./output/device-update.sh - name: Zip firmware - run: zip -j -9 -r ./firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip ./output + run: zip -j -9 -r ./firmware-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip ./output - uses: actions/download-artifact@v4 with: - name: debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip + name: debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip merge-multiple: true path: ./elfs - - name: Zip firmware - run: zip -j -9 -r ./debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip ./elfs + - name: Zip debug elfs + run: zip -j -9 -r ./debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip ./elfs # For diagnostics - name: Display structure of downloaded files run: ls -lR - - name: Add bins to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ github.token }} + - name: Add bins and debug elfs to release + uses: softprops/action-gh-release@v2 with: - upload_url: ${{needs.release-artifacts.outputs.upload_url}} - asset_path: ./firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip - asset_name: firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip - asset_content_type: application/zip - - - name: Add debug elfs to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - upload_url: ${{needs.release-artifacts.outputs.upload_url}} - asset_path: ./debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip - asset_name: debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip - asset_content_type: application/zip + tag_name: v${{ steps.version.outputs.long }} + files: | + ./firmware-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip + ./debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip diff --git a/.github/workflows/package_amd64.yml b/.github/workflows/package_amd64.yml index c6e82e1be..d9f041736 100644 --- a/.github/workflows/package_amd64.yml +++ b/.github/workflows/package_amd64.yml @@ -32,13 +32,13 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - name: Download artifacts uses: actions/download-artifact@v4 with: - name: firmware-native-${{ steps.version.outputs.version }}.zip + name: firmware-native-${{ steps.version.outputs.long }}.zip merge-multiple: true - name: Display structure of downloaded files @@ -77,14 +77,14 @@ jobs: package: meshtasticd package_root: .debpkg maintainer: Jonathan Bennett - version: ${{ steps.version.outputs.version }} # refs/tags/v*.*.* + version: ${{ steps.version.outputs.long }} # refs/tags/v*.*.* arch: amd64 depends: libyaml-cpp0.7, openssl, libulfius2.7, libi2c0 desc: Native Linux Meshtastic binary. - uses: actions/upload-artifact@v4 with: - name: meshtasticd_${{ steps.version.outputs.version }}_amd64.deb + name: meshtasticd_${{ steps.version.outputs.long }}_amd64.deb overwrite: true path: | ./*.deb diff --git a/.github/workflows/package_raspbian.yml b/.github/workflows/package_raspbian.yml index a4cd49573..62613f85f 100644 --- a/.github/workflows/package_raspbian.yml +++ b/.github/workflows/package_raspbian.yml @@ -32,13 +32,13 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - name: Download artifacts uses: actions/download-artifact@v4 with: - name: firmware-raspbian-${{ steps.version.outputs.version }}.zip + name: firmware-raspbian-${{ steps.version.outputs.long }}.zip merge-multiple: true - name: Display structure of downloaded files @@ -77,14 +77,14 @@ jobs: package: meshtasticd package_root: .debpkg maintainer: Jonathan Bennett - version: ${{ steps.version.outputs.version }} # refs/tags/v*.*.* + version: ${{ steps.version.outputs.long }} # refs/tags/v*.*.* arch: arm64 depends: libyaml-cpp0.7, openssl, libulfius2.7, libi2c0 desc: Native Linux Meshtastic binary. - uses: actions/upload-artifact@v4 with: - name: meshtasticd_${{ steps.version.outputs.version }}_arm64.deb + name: meshtasticd_${{ steps.version.outputs.long }}_arm64.deb overwrite: true path: | ./*.deb diff --git a/.github/workflows/package_raspbian_armv7l.yml b/.github/workflows/package_raspbian_armv7l.yml index c4cc5c673..8a9df1710 100644 --- a/.github/workflows/package_raspbian_armv7l.yml +++ b/.github/workflows/package_raspbian_armv7l.yml @@ -32,13 +32,13 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - name: Download artifacts uses: actions/download-artifact@v4 with: - name: firmware-raspbian-armv7l-${{ steps.version.outputs.version }}.zip + name: firmware-raspbian-armv7l-${{ steps.version.outputs.long }}.zip merge-multiple: true - name: Display structure of downloaded files @@ -77,14 +77,14 @@ jobs: package: meshtasticd package_root: .debpkg maintainer: Jonathan Bennett - version: ${{ steps.version.outputs.version }} # refs/tags/v*.*.* + version: ${{ steps.version.outputs.long }} # refs/tags/v*.*.* arch: armhf depends: libyaml-cpp0.7, openssl, libulfius2.7, libi2c0 desc: Native Linux Meshtastic binary. - uses: actions/upload-artifact@v4 with: - name: meshtasticd_${{ steps.version.outputs.version }}_armhf.deb + name: meshtasticd_${{ steps.version.outputs.long }}_armhf.deb overwrite: true path: | ./*.deb diff --git a/.github/workflows/test_native.yml b/.github/workflows/test_native.yml index d016635ef..8e8ff68e4 100644 --- a/.github/workflows/test_native.yml +++ b/.github/workflows/test_native.yml @@ -55,14 +55,14 @@ jobs: - name: Get release version string if: always() # run this step even if previous step failed - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - name: Save coverage information uses: actions/upload-artifact@v4 if: always() # run this step even if previous step failed with: - name: lcov-coverage-info-native-simulator-test-${{ steps.version.outputs.version }}.zip + name: lcov-coverage-info-native-simulator-test-${{ steps.version.outputs.long }}.zip overwrite: true path: ./coverage_*.info @@ -81,7 +81,7 @@ jobs: uses: ./.github/actions/setup-native - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version # Disable (comment-out) BUILD_EPOCH. It causes a full rebuild between tests and resets the @@ -96,7 +96,7 @@ jobs: if: always() # run this step even if previous step failed uses: actions/upload-artifact@v4 with: - name: platformio-test-report-${{ steps.version.outputs.version }}.zip + name: platformio-test-report-${{ steps.version.outputs.long }}.zip overwrite: true path: ./testreport.xml @@ -111,7 +111,7 @@ jobs: uses: actions/upload-artifact@v4 if: always() # run this step even if previous step failed with: - name: lcov-coverage-info-native-platformio-tests-${{ steps.version.outputs.version }}.zip + name: lcov-coverage-info-native-platformio-tests-${{ steps.version.outputs.long }}.zip overwrite: true path: ./coverage_*.info @@ -133,13 +133,13 @@ jobs: repository: ${{github.event.pull_request.head.repo.full_name}} - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - name: Download test artifacts uses: actions/download-artifact@v4 with: - name: platformio-test-report-${{ steps.version.outputs.version }}.zip + name: platformio-test-report-${{ steps.version.outputs.long }}.zip merge-multiple: true - name: Test Report @@ -152,7 +152,7 @@ jobs: - name: Download coverage artifacts uses: actions/download-artifact@v4 with: - pattern: lcov-coverage-info-native-*-${{ steps.version.outputs.version }}.zip + pattern: lcov-coverage-info-native-*-${{ steps.version.outputs.long }}.zip path: code-coverage-report merge-multiple: true @@ -165,5 +165,5 @@ jobs: - name: Save Code Coverage Report uses: actions/upload-artifact@v4 with: - name: code-coverage-report-${{ steps.version.outputs.version }}.zip + name: code-coverage-report-${{ steps.version.outputs.long }}.zip path: code-coverage-report diff --git a/.github/workflows/trunk_format_pr.yml b/.github/workflows/trunk_format_pr.yml index c5c20b465..0d6eb6041 100644 --- a/.github/workflows/trunk_format_pr.yml +++ b/.github/workflows/trunk_format_pr.yml @@ -22,12 +22,16 @@ jobs: - name: Run Trunk Fmt run: trunk fmt + - name: Get release version string + run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + - name: Commit and push changes run: | git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" git add . - git commit -m "Add firmware version ${{ steps.version.outputs.version }}" + git commit -m "Add firmware version ${{ steps.version.outputs.long }}" git push - name: Comment on PR From 1d756ae574101b2a6372fedbfe8f9bd2b6d0dcdf Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Thu, 9 Jan 2025 16:25:25 -0800 Subject: [PATCH 067/381] Fix potential memory leak in AtakPluginModule (#5803) --- src/modules/AtakPluginModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/AtakPluginModule.cpp b/src/modules/AtakPluginModule.cpp index d242e5501..a51ef54c3 100644 --- a/src/modules/AtakPluginModule.cpp +++ b/src/modules/AtakPluginModule.cpp @@ -131,7 +131,6 @@ void AtakPluginModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtast } // Decompress for Phone (EUD) - auto decompressedCopy = packetPool.allocCopy(mp); auto uncompressed = cloneTAKPacketData(t); uncompressed.is_compressed = false; if (t->has_contact) { @@ -188,6 +187,7 @@ void AtakPluginModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtast LOG_DEBUG("Decompressed chat to_callsign: %d bytes", length); } } + auto decompressedCopy = packetPool.allocCopy(mp); decompressedCopy->decoded.payload.size = pb_encode_to_bytes(decompressedCopy->decoded.payload.bytes, sizeof(decompressedCopy->decoded.payload), meshtastic_TAKPacket_fields, &uncompressed); From 2e44de262e2be2fcdb8a11044a47099dc8799ba4 Mon Sep 17 00:00:00 2001 From: Bernd Giesecke Date: Fri, 10 Jan 2025 09:20:38 +0800 Subject: [PATCH 068/381] Add GPS capability to RAK2560 (RAKwireless WisMesh Hub) (#5797) * Add GPS to RAK2560 * Add GPS to RAK2560 --- src/gps/GPS.cpp | 4 ++++ variants/rak2560/platformio.ini | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index e88e774bd..863f956cf 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -35,7 +35,11 @@ template std::size_t array_count(const T (&)[N]) } #if defined(NRF52840_XXAA) || defined(NRF52833_XXAA) || defined(ARCH_ESP32) || defined(ARCH_PORTDUINO) +#if defined(RAK2560) +HardwareSerial *GPS::_serial_gps = &Serial2; +#else HardwareSerial *GPS::_serial_gps = &Serial1; +#endif #elif defined(ARCH_RP2040) SerialUART *GPS::_serial_gps = &Serial1; #else diff --git a/variants/rak2560/platformio.ini b/variants/rak2560/platformio.ini index 93c7acf71..96c1bfa92 100644 --- a/variants/rak2560/platformio.ini +++ b/variants/rak2560/platformio.ini @@ -6,7 +6,6 @@ board_check = true build_flags = ${nrf52840_base.build_flags} -Ivariants/rak2560 -D RAK_4631 -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. - -DMESHTASTIC_EXCLUDE_GPS=1 -DHAS_RAKPROT=1 ; Define if RAk OneWireSerial is used (disables GPS) build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak2560> + + + lib_deps = From f18a92e8c5be5a483a47b97adc58886808b12fc5 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 10 Jan 2025 04:46:26 -0600 Subject: [PATCH 069/381] Don't check for node channels on broadcast address (#5804) --- src/mesh/Router.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index f55e7cc5a..bfd4c45fd 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -187,7 +187,7 @@ ErrorCode Router::sendLocal(meshtastic_MeshPacket *p, RxSource src) } // don't override if a channel was requested and no need to set it when PKI is enforced - if (!p->channel && !p->pki_encrypted) { + if (!p->channel && !p->pki_encrypted && !isBroadcast(p->to)) { meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(p->to); if (node) { p->channel = node->channel; @@ -679,4 +679,4 @@ void Router::perhapsHandleReceived(meshtastic_MeshPacket *p) // cache/learn of the existence of nodes (i.e. FloodRouter) that they should not handleReceived(p); packetPool.release(p); -} \ No newline at end of file +} From b62bdbc46a9bcdaf10b8eeb04f00a7996ed2f397 Mon Sep 17 00:00:00 2001 From: Austin Date: Fri, 10 Jan 2025 20:03:29 -0500 Subject: [PATCH 070/381] meshtasticd-debian: Auto-Publish to OBS (#5791) --- .github/workflows/main_matrix.yml | 26 ++++++++- .github/workflows/nightly_debian.yml | 4 +- .github/workflows/package_obs.yml | 73 ++++++++++++++------------ .github/workflows/package_ppa.yml | 2 +- .github/workflows/release_channels.yml | 16 +++--- 5 files changed, 77 insertions(+), 44 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 20ffecb76..b55696301 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -137,6 +137,13 @@ jobs: package-native: uses: ./.github/workflows/package_amd64.yml + build-debian-src: + uses: ./.github/workflows/build_debian_src.yml + with: + series: UNRELEASED + build_location: local + secrets: inherit + test-native: uses: ./.github/workflows/test_native.yml @@ -260,6 +267,7 @@ jobs: package-raspbian, package-raspbian-armv7l, package-native, + build-debian-src, ] steps: - name: Checkout @@ -271,8 +279,12 @@ jobs: python-version: 3.x - name: Get release version string - run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + run: | + echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + echo "deb=$(./bin/buildinfo.py deb)" >> $GITHUB_OUTPUT id: version + env: + BUILD_LOCATION: local - name: Create release uses: softprops/action-gh-release@v2 @@ -292,6 +304,17 @@ jobs: merge-multiple: true path: ./output + - name: Download source deb + uses: actions/download-artifact@v4 + with: + pattern: firmware-debian-${{ steps.version.outputs.deb }}~UNRELEASED-src + merge-multiple: true + path: ./output/debian-src + + - name: Zip source deb + working-directory: output + run: zip -j -9 -r ./meshtasticd-${{ steps.version.outputs.deb }}-src.zip ./debian-src + # For diagnostics - name: Display structure of downloaded files run: ls -lR @@ -304,6 +327,7 @@ jobs: ./output/meshtasticd_${{ steps.version.outputs.long }}_arm64.deb ./output/meshtasticd_${{ steps.version.outputs.long }}_armhf.deb ./output/meshtasticd_${{ steps.version.outputs.long }}_amd64.deb + ./output/meshtasticd-${{ steps.version.outputs.deb }}-src.zip - name: Bump version.properties run: >- diff --git a/.github/workflows/nightly_debian.yml b/.github/workflows/nightly_debian.yml index 63d977beb..aa001854e 100644 --- a/.github/workflows/nightly_debian.yml +++ b/.github/workflows/nightly_debian.yml @@ -25,13 +25,13 @@ jobs: series: [plucky, oracular, noble, jammy] uses: ./.github/workflows/package_ppa.yml with: - ppa_repo: daily + ppa_repo: ppa:meshtastic/daily series: ${{ matrix.series }} secrets: inherit package-obs: uses: ./.github/workflows/package_obs.yml with: - obs_repo: meshtasticd + obs_project: home:meshtastic:daily series: unstable secrets: inherit diff --git a/.github/workflows/package_obs.yml b/.github/workflows/package_obs.yml index 11f2b87bf..336c27f4b 100644 --- a/.github/workflows/package_obs.yml +++ b/.github/workflows/package_obs.yml @@ -3,11 +3,15 @@ name: Package for OpenSUSE Build Service on: workflow_call: secrets: + OBS_USERNAME: + required: true + OBS_PASSWORD: + required: true PPA_GPG_PRIVATE_KEY: required: true inputs: - obs_repo: - description: Meshtastic OBS repo to target + obs_project: + description: Meshtastic OBS project to target required: true type: string series: @@ -64,40 +68,43 @@ jobs: - name: Display structure of downloaded files run: ls -lah - # - name: Configure osc - # shell: bash - # env: - # OBS_USERNAME: ${{ secrets.OBS_USERNAME }} - # OBS_PASSWORD: ${{ secrets.OBS_PASSWORD }} - # run: | - # mkdir -p ~/.config/osc - # echo -e "[https://api.opensuse.org]\n" > ~/.config/osc/oscrc - # echo -e "user = $OBS_USERNAME" >> ~/.config/osc/oscrc - # echo -e "pass = $OBS_PASSWORD" >> ~/.config/osc/oscrc - # echo -e "aliases = obs" >> ~/.config/osc/oscrc - # # Authenticate to OBS - # osc meta prj -v + - name: Configure osc + run: | + # Setup OpenSUSE Build Service credentials + mkdir -p ~/.config/osc + echo "[general]" > ~/.config/osc/oscrc + echo "apiurl=https://api.opensuse.org" >> ~/.config/osc/oscrc + echo "[https://api.opensuse.org]" >> ~/.config/osc/oscrc + echo "user=${{ secrets.OBS_USERNAME }}" >> ~/.config/osc/oscrc + echo "pass=${{ secrets.OBS_PASSWORD }}" >> ~/.config/osc/oscrc + echo "credentials_mgr_class=osc.credentials.PlaintextConfigFileCredentialsManager" >> ~/.config/osc/oscrc + # Create a temporary directory for osc checkout + mkdir -p osc - # - name: Upload Package to OBS - # shell: bash - # run: | - # # Define your OBS project and repository - # OBS_PROJECT="application:meshtastic" - # OBS_REPO="${{ inputs.obs_repo }}" + # Intentionally fail if credentials are invalid + # Update secrets if this returns `401` + - name: Verify OBS authentication + run: osc token - # # Create a temporary directory for osc - # mkdir -p /tmp/osc/$OBS_PROJECT/$OBS_REPO - # cd /tmp/osc/$OBS_PROJECT/$OBS_REPO + - name: Upload package to OBS + shell: bash + working-directory: osc + env: + OBS_PROJECT: ${{ inputs.obs_project }} + OBS_PACKAGE: meshtasticd + run: | + # Initialize the package in the current directory + osc checkout --output-dir . $OBS_PROJECT $OBS_PACKAGE - # # Initialize the package directory - # osc checkout $OBS_PROJECT $OBS_REPO + # Remove the existing package files + rm -rf *.dsc *.tar.xz - # # Copy package files to the osc directory - # cp $GITHUB_WORKSPACE/*.dsc . - # cp $GITHUB_WORKSPACE/*.tar.xz . + # Copy new package files to the directory + cp $GITHUB_WORKSPACE/*.dsc . + cp $GITHUB_WORKSPACE/*.tar.xz . - # # Add files to osc - # osc addremove + # Add/Remove the files + osc addremove - # # Commit and push the changes - # osc commit -m "Automated upload from GitHub Actions" + # Commit changes and push to OpenSUSE Build Service + osc commit -m "GitHub Actions: ${{ steps.version.outputs.deb }}~${{ inputs.series }}" diff --git a/.github/workflows/package_ppa.yml b/.github/workflows/package_ppa.yml index 340087d1d..a54b0bd36 100644 --- a/.github/workflows/package_ppa.yml +++ b/.github/workflows/package_ppa.yml @@ -71,4 +71,4 @@ jobs: - name: Publish with dput if: ${{ github.event_name != 'pull_request_target' && github.event_name != 'pull_request' }} run: | - dput ppa:meshtastic/${{ inputs.ppa_repo }} meshtasticd_${{ steps.version.outputs.deb }}~${{ inputs.series }}_source.changes + dput ${{ inputs.ppa_repo }} meshtasticd_${{ steps.version.outputs.deb }}~${{ inputs.series }}_source.changes diff --git a/.github/workflows/release_channels.yml b/.github/workflows/release_channels.yml index cdde74b2e..34673f0c7 100644 --- a/.github/workflows/release_channels.yml +++ b/.github/workflows/release_channels.yml @@ -15,13 +15,15 @@ jobs: uses: ./.github/workflows/package_ppa.yml with: ppa_repo: |- - ${{ contains(github.event.release.name, 'Beta') && 'beta' || contains(github.event.release.name, 'Alpha') && 'alpha' }} + ppa:meshtastic/${{ contains(github.event.release.name, 'Beta') && 'beta' || contains(github.event.release.name, 'Alpha') && 'alpha' }} series: ${{ matrix.series }} secrets: inherit - # package-obs: - # uses: ./.github/workflows/package_obs.yml - # with: - # obs_repo: meshtasticd - # series: ${{ contains(github.event.release.name, 'Beta') && 'beta' || contains(github.event.release.name, 'Alpha') && 'alpha' }} - # secrets: inherit + package-obs: + uses: ./.github/workflows/package_obs.yml + with: + obs_project: |- + home:meshtastic:${{ contains(github.event.release.name, 'Beta') && 'beta' || contains(github.event.release.name, 'Alpha') && 'alpha' }} + series: |- + ${{ contains(github.event.release.name, 'Beta') && 'beta' || contains(github.event.release.name, 'Alpha') && 'alpha' }} + secrets: inherit From c144ee77a7de8c7462128fba0f271bf10a108199 Mon Sep 17 00:00:00 2001 From: Austin Date: Fri, 10 Jan 2025 20:46:12 -0500 Subject: [PATCH 071/381] GitHub Actions: Fix `meshtastic` display issue in logs (#5811) --- .github/workflows/package_obs.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/package_obs.yml b/.github/workflows/package_obs.yml index 336c27f4b..275ffce0e 100644 --- a/.github/workflows/package_obs.yml +++ b/.github/workflows/package_obs.yml @@ -3,8 +3,6 @@ name: Package for OpenSUSE Build Service on: workflow_call: secrets: - OBS_USERNAME: - required: true OBS_PASSWORD: required: true PPA_GPG_PRIVATE_KEY: @@ -69,13 +67,15 @@ jobs: run: ls -lah - name: Configure osc + env: + OBS_USERNAME: meshtastic run: | # Setup OpenSUSE Build Service credentials mkdir -p ~/.config/osc echo "[general]" > ~/.config/osc/oscrc echo "apiurl=https://api.opensuse.org" >> ~/.config/osc/oscrc echo "[https://api.opensuse.org]" >> ~/.config/osc/oscrc - echo "user=${{ secrets.OBS_USERNAME }}" >> ~/.config/osc/oscrc + echo "user=${{ env.OBS_USERNAME }}" >> ~/.config/osc/oscrc echo "pass=${{ secrets.OBS_PASSWORD }}" >> ~/.config/osc/oscrc echo "credentials_mgr_class=osc.credentials.PlaintextConfigFileCredentialsManager" >> ~/.config/osc/oscrc # Create a temporary directory for osc checkout From 25a5f178e197dd0dede16063a7002c7768ad9318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 11 Jan 2025 03:43:48 +0100 Subject: [PATCH 072/381] remove ethernet code from this variant, remove unused radio chip code (#5810) * remove ethernet code from this variant, remove unused radio chip code * remove ethernet lib too, pin onewire library to release hash --- variants/rak2560/platformio.ini | 10 ++++++---- variants/rak2560/variant.h | 5 ----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/variants/rak2560/platformio.ini b/variants/rak2560/platformio.ini index 96c1bfa92..cd5225a22 100644 --- a/variants/rak2560/platformio.ini +++ b/variants/rak2560/platformio.ini @@ -1,4 +1,4 @@ -; The very slick RAK wireless RAK 4631 / 4630 board - Unified firmware for 5005/19003, with or without OLED RAK 1921 +; Firmware for the WisMesh HUB RAK2560, including a onewire module to talk to the RAK 9154 solar battery. [env:rak2560] extends = nrf52840_base board = wiscore_rak4631 @@ -6,16 +6,18 @@ board_check = true build_flags = ${nrf52840_base.build_flags} -Ivariants/rak2560 -D RAK_4631 -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. + -DRADIOLIB_EXCLUDE_SX128X=1 + -DRADIOLIB_EXCLUDE_SX127X=1 + -DRADIOLIB_EXCLUDE_LR11X0=1 -DHAS_RAKPROT=1 ; Define if RAk OneWireSerial is used (disables GPS) -build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak2560> + + + +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak2560> + + lib_deps = ${nrf52840_base.lib_deps} ${networking_base.lib_deps} melopero/Melopero RV3028@^1.1.0 - https://github.com/RAKWireless/RAK13800-W5100S.git#1.0.2 rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2 beegee-tokyo/RAKwireless RAK12034@^1.0.0 - https://github.com/beegee-tokyo/RAK-OneWireSerial.git + https://github.com/beegee-tokyo/RAK-OneWireSerial.git#0.0.2 debug_tool = jlink ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) ;upload_protocol = jlink diff --git a/variants/rak2560/variant.h b/variants/rak2560/variant.h index 8e5d90553..a03fc3933 100644 --- a/variants/rak2560/variant.h +++ b/variants/rak2560/variant.h @@ -250,8 +250,6 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG #define HAS_RTC 1 -#define HAS_ETHERNET 1 - #define RAK_4631 1 #define HALF_UART_PIN PIN_SERIAL1_RX @@ -265,9 +263,6 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG #error pin 15 collision #endif -#define PIN_ETHERNET_RESET 21 -#define PIN_ETHERNET_SS PIN_EINK_CS -#define ETH_SPI_PORT SPI1 #define AQ_SET_PIN 10 #ifdef __cplusplus From 46ea39af4511e6b13fc2662e7c0a445ea966ceae Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Sat, 11 Jan 2025 17:10:04 +0800 Subject: [PATCH 073/381] Quote filename in device-install.sh (#5814) Without these quotes, a filename with spaces would be interpreted as different arguments. Thanks to @Hnikar-az for the report. fixes https://github.com/meshtastic/firmware/issues/5795 --- bin/device-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/device-install.sh b/bin/device-install.sh index e09c61ba6..4698b88e5 100755 --- a/bin/device-install.sh +++ b/bin/device-install.sh @@ -73,7 +73,7 @@ shift "$((OPTIND - 1))" if [ -f "${FILENAME}" ] && [ -n "${FILENAME##*"update"*}" ]; then echo "Trying to flash ${FILENAME}, but first erasing and writing system information" $ESPTOOL_CMD erase_flash - $ESPTOOL_CMD write_flash 0x00 ${FILENAME} + $ESPTOOL_CMD write_flash 0x00 "${FILENAME}" # Account for S3 board's different OTA partition if [ -n "${FILENAME##*"s3"*}" ] && [ -n "${FILENAME##*"-v3"*}" ] && [ -n "${FILENAME##*"t-deck"*}" ] && [ -n "${FILENAME##*"wireless-paper"*}" ] && [ -n "${FILENAME##*"wireless-tracker"*}" ] && [ -n "${FILENAME##*"station-g2"*}" ] && [ -n "${FILENAME##*"unphone"*}" ]; then if [ -n "${FILENAME##*"esp32c3"*}" ]; then From 077ee024265289449692b9430371424e4fb2b1c1 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Sat, 11 Jan 2025 19:52:28 +0800 Subject: [PATCH 074/381] Cherry-pick: Meshtab streamline and rotation fixes (#5812) * mesh-tab: streamline target definitions * mesh-tab: fix touch rotation 4.0 inch display * Mesh-Tab platformio: 4.0inch: increase SPI frequency to max * mesh-tab: fix rotation for 3.5 IPS capacitive display * mesh-tab: fix rotation for 3.2 IPS capacitive display --------- Co-authored-by: mverch67 --- variants/mesh-tab/platformio.ini | 155 ++++++++++--------------------- 1 file changed, 50 insertions(+), 105 deletions(-) diff --git a/variants/mesh-tab/platformio.ini b/variants/mesh-tab/platformio.ini index a1007a7f4..30be7dbb8 100644 --- a/variants/mesh-tab/platformio.ini +++ b/variants/mesh-tab/platformio.ini @@ -56,18 +56,10 @@ build_src_filter = ${esp32_base.build_src_filter} lib_deps = ${esp32_base.lib_deps} lovyan03/LovyanGFX@^1.1.16 -; 3.2" TN TFT ST7789 / XPT2046: https://vi.aliexpress.com/item/1005005933490544.html -[env:mesh-tab-3-2-TN-resistive] +[mesh_tab_xpt2046] extends = mesh_tab_base build_flags = ${mesh_tab_base.build_flags} - -D LGFX_SCREEN_WIDTH=240 - -D LGFX_SCREEN_HEIGHT=320 - -D LGFX_PANEL=ST7789 - -D LGFX_INVERT_COLOR=false - -D LGFX_RGB_ORDER=false - -D LGFX_ROTATION=3 -D LGFX_TOUCH=XPT2046 - -D SPI_FREQUENCY=60000000 -D LGFX_TOUCH_SPI_FREQ=2500000 -D LGFX_TOUCH_SPI_HOST=2 -D LGFX_TOUCH_CS=7 @@ -78,156 +70,109 @@ build_flags = ${mesh_tab_base.build_flags} -D LGFX_TOUCH_X_MAX=3900 -D LGFX_TOUCH_Y_MIN=400 -D LGFX_TOUCH_Y_MAX=3900 + +[mesh_tab_ft5x06] +extends = mesh_tab_base +build_flags = ${mesh_tab_base.build_flags} + -D LGFX_TOUCH=FT5x06 + -D LGFX_TOUCH_I2C_FREQ=400000 + -D LGFX_TOUCH_I2C_PORT=0 + -D LGFX_TOUCH_I2C_ADDR=0x38 + -D LGFX_TOUCH_I2C_SDA=8 + -D LGFX_TOUCH_I2C_SCL=9 + -D LGFX_TOUCH_RST=7 + +; 3.2" TN TFT ST7789 / XPT2046: https://vi.aliexpress.com/item/1005005933490544.html +[env:mesh-tab-3-2-TN-resistive] +extends = mesh_tab_base +build_flags = ${mesh_tab_xpt2046.build_flags} + -D SPI_FREQUENCY=60000000 + -D LGFX_SCREEN_WIDTH=240 + -D LGFX_SCREEN_HEIGHT=320 + -D LGFX_PANEL=ST7789 + -D LGFX_INVERT_COLOR=false + -D LGFX_ROTATION=3 -D LGFX_TOUCH_ROTATION=4 ; 3.2" IPS TFT ILI9341 / XPT2046: https://www.aliexpress.com/item/1005006258575617.html [env:mesh-tab-3-2-IPS-resistive] extends = mesh_tab_base -build_flags = ${mesh_tab_base.build_flags} +build_flags = ${mesh_tab_xpt2046.build_flags} + -D SPI_FREQUENCY=60000000 ; if image is distorted then lower to 40 MHz -D LGFX_SCREEN_WIDTH=240 -D LGFX_SCREEN_HEIGHT=320 -D LGFX_PANEL=ILI9341 - -D LGFX_INVERT_COLOR=true - -D LGFX_RGB_ORDER=false -D LGFX_ROTATION=1 - -D LGFX_TOUCH=XPT2046 - -D SPI_FREQUENCY=60000000 ; if image is distorted then lower to 40 MHz - -D LGFX_TOUCH_SPI_FREQ=2500000 - -D LGFX_TOUCH_SPI_HOST=2 - -D LGFX_TOUCH_CS=7 - -D LGFX_TOUCH_CLK=12 - -D LGFX_TOUCH_DO=11 - -D LGFX_TOUCH_DIN=13 - -D LGFX_TOUCH_X_MIN=300 - -D LGFX_TOUCH_X_MAX=3900 - -D LGFX_TOUCH_Y_MIN=400 - -D LGFX_TOUCH_Y_MAX=3900 -D LGFX_TOUCH_ROTATION=4 ; 3.5" IPS TFT ILI9488 / XPT2046: https://vi.aliexpress.com/item/1005006333922639.html [env:mesh-tab-3-5-IPS-resistive] extends = mesh_tab_base -build_flags = ${mesh_tab_base.build_flags} +build_flags = ${mesh_tab_xpt2046.build_flags} + -D SPI_FREQUENCY=60000000 ; may go higher upto 40/60/80 MHz -D DISPLAY_SET_RESOLUTION -D LGFX_SCREEN_WIDTH=320 -D LGFX_SCREEN_HEIGHT=480 -D LGFX_PANEL=ILI9488 - -D LGFX_INVERT_COLOR=true - -D LGFX_RGB_ORDER=false - -D LGFX_DLEN_16BITS=false -D LGFX_ROTATION=0 - -D LGFX_TOUCH=XPT2046 - -D SPI_FREQUENCY=40000000 ; may go higher upto 40/60/80 MHz - -D LGFX_TOUCH_SPI_FREQ=2500000 - -D LGFX_TOUCH_SPI_HOST=2 - -D LGFX_TOUCH_CS=7 - -D LGFX_TOUCH_CLK=12 - -D LGFX_TOUCH_DO=11 - -D LGFX_TOUCH_DIN=13 - -D LGFX_TOUCH_X_MIN=300 - -D LGFX_TOUCH_X_MAX=3900 - -D LGFX_TOUCH_Y_MIN=400 - -D LGFX_TOUCH_Y_MAX=3900 -D LGFX_TOUCH_ROTATION=0 ; 3.5" TN TFT ILI9488 / XPT2046: https://vi.aliexpress.com/item/32985467436.html [env:mesh-tab-3-5-TN-resistive] extends = mesh_tab_base -build_flags = ${mesh_tab_base.build_flags} +build_flags = ${mesh_tab_xpt2046.build_flags} + -D SPI_FREQUENCY=60000000 -D DISPLAY_SET_RESOLUTION -D LGFX_SCREEN_WIDTH=320 -D LGFX_SCREEN_HEIGHT=480 -D LGFX_PANEL=HX8357B - -D SPI_FREQUENCY=60000000 -D LGFX_INVERT_COLOR=false - -D LGFX_RGB_ORDER=false - -D LGFX_DLEN_16BITS=false -D LGFX_ROTATION=4 - -D LGFX_TOUCH=XPT2046 - -D LGFX_TOUCH_SPI_FREQ=2500000 - -D LGFX_TOUCH_SPI_HOST=2 - -D LGFX_TOUCH_CS=7 - -D LGFX_TOUCH_CLK=12 - -D LGFX_TOUCH_DO=11 - -D LGFX_TOUCH_DIN=13 - -D LGFX_TOUCH_X_MIN=300 - -D LGFX_TOUCH_X_MAX=3900 - -D LGFX_TOUCH_Y_MIN=400 - -D LGFX_TOUCH_Y_MAX=3900 -D LGFX_TOUCH_ROTATION=2 ; 3.2" IPS TFT ILI9341 / FT6236: https://vi.aliexpress.com/item/1005006624072350.html [env:mesh-tab-3-2-IPS-capacitive] extends = mesh_tab_base -build_flags = ${mesh_tab_base.build_flags} +build_flags = ${mesh_tab_ft5x06.build_flags} + -D SPI_FREQUENCY=75000000 ; may go higher upto 60/80 MHz -D LGFX_SCREEN_WIDTH=240 -D LGFX_SCREEN_HEIGHT=320 -D LGFX_PANEL=ILI9341 - -D LGFX_INVERT_COLOR=true - -D LGFX_RGB_ORDER=false -D LGFX_ROTATION=1 - -D LGFX_TOUCH=FT5x06 - -D SPI_FREQUENCY=40000000 ; may go higher upto 60/80 MHz - -D LGFX_TOUCH_I2C_PORT=0 - -D LGFX_TOUCH_I2C_ADDR=0x38 - -D LGFX_TOUCH_I2C_SDA=8 - -D LGFX_TOUCH_I2C_SCL=9 - -D LGFX_TOUCH_RST=7 + -D LGFX_TOUCH_X_MIN=0 + -D LGFX_TOUCH_X_MAX=239 + -D LGFX_TOUCH_Y_MIN=0 + -D LGFX_TOUCH_Y_MAX=319 + -D LGFX_TOUCH_ROTATION=2 + +; 3.5" IPS TFT ILI9488 / FT6236: https://vi.aliexpress.com/item/1005006893699919.html +[env:mesh-tab-3-5-IPS-capacitive] +extends = mesh_tab_base +build_flags = ${mesh_tab_ft5x06.build_flags} + -D SPI_FREQUENCY=75000000 ; may go higher upto 40/60/80 MHz + -D DISPLAY_SET_RESOLUTION + -D LGFX_SCREEN_WIDTH=320 + -D LGFX_SCREEN_HEIGHT=480 + -D LGFX_PANEL=ILI9488 + -D LGFX_ROTATION=2 -D LGFX_TOUCH_X_MIN=0 -D LGFX_TOUCH_X_MAX=319 -D LGFX_TOUCH_Y_MIN=0 -D LGFX_TOUCH_Y_MAX=479 -D LGFX_TOUCH_ROTATION=0 - -D LGFX_TOUCH_I2C_FREQ=400000 - -; 3.5" IPS TFT ILI9488 / FT6236: https://vi.aliexpress.com/item/1005006893699919.html -[env:mesh-tab-3-5-IPS-capacitive] -extends = mesh_tab_base -build_flags = ${mesh_tab_base.build_flags} - -D DISPLAY_SET_RESOLUTION - -D LGFX_SCREEN_WIDTH=320 - -D LGFX_SCREEN_HEIGHT=480 - -D LGFX_PANEL=ILI9488 - -D LGFX_INVERT_COLOR=true - -D LGFX_RGB_ORDER=false - -D LGFX_DLEN_16BITS=false - -D LGFX_ROTATION=1 - -D LGFX_TOUCH=FT5x06 - -D SPI_FREQUENCY=30000000 ; may go higher upto 40/60/80 MHz - -D LGFX_TOUCH_I2C_PORT=0 - -D LGFX_TOUCH_I2C_ADDR=0x38 - -D LGFX_TOUCH_I2C_SDA=8 - -D LGFX_TOUCH_I2C_SCL=9 - -D LGFX_TOUCH_RST=7 - -D LGFX_TOUCH_X_MIN=0 - -D LGFX_TOUCH_X_MAX=319 - -D LGFX_TOUCH_Y_MIN=0 - -D LGFX_TOUCH_Y_MAX=479 - -D LGFX_TOUCH_ROTATION=1 - -D LGFX_TOUCH_I2C_FREQ=400000 ; 4.0" IPS TFT ILI9488 / FT6236: https://vi.aliexpress.com/item/1005007082906950.html [env:mesh-tab-4-0-IPS-capacitive] extends = mesh_tab_base -build_flags = ${mesh_tab_base.build_flags} +build_flags = ${mesh_tab_ft5x06.build_flags} + -D SPI_FREQUENCY=75000000 -D DISPLAY_SET_RESOLUTION -D LGFX_SCREEN_WIDTH=320 -D LGFX_SCREEN_HEIGHT=480 -D LGFX_PANEL=HX8357B - -D LGFX_INVERT_COLOR=true - -D LGFX_RGB_ORDER=false - -D LGFX_DLEN_16BITS=false -D LGFX_ROTATION=4 - -D LGFX_TOUCH=FT5x06 - -D SPI_FREQUENCY=30000000 ; may go higher upto 40/60/80 MHz - -D LGFX_TOUCH_I2C_PORT=0 - -D LGFX_TOUCH_I2C_ADDR=0x38 - -D LGFX_TOUCH_I2C_SDA=8 - -D LGFX_TOUCH_I2C_SCL=9 - -D LGFX_TOUCH_RST=7 -D LGFX_TOUCH_X_MIN=0 -D LGFX_TOUCH_X_MAX=319 -D LGFX_TOUCH_Y_MIN=0 -D LGFX_TOUCH_Y_MAX=479 - -D LGFX_TOUCH_ROTATION=1 - -D LGFX_TOUCH_I2C_FREQ=400000 \ No newline at end of file + -D LGFX_TOUCH_ROTATION=6 From e7802d960fac813e58e6b0e8ed085d91801e5dd8 Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Sat, 11 Jan 2025 04:15:50 -0800 Subject: [PATCH 075/381] Manage when destructor is called for native HttpAPI (#5807) --- src/main.cpp | 4 +++- src/mesh/raspihttp/PiWebServer.cpp | 23 +++++++++---------- src/mesh/raspihttp/PiWebServer.h | 36 +++++++++++++++--------------- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index c2b20b1c1..4a642ef6d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -92,6 +92,7 @@ NRF52Bluetooth *nrf52Bluetooth = nullptr; #include "mesh/raspihttp/PiWebServer.h" #include "platform/portduino/PortduinoGlue.h" #include "platform/portduino/USBHal.h" +#include #include #include #include @@ -1159,6 +1160,7 @@ void setup() #if __has_include() if (settingsMap[webserverport] != -1) { piwebServerThread = new PiWebServerThread(); + std::atexit([] { delete piwebServerThread; }); } #endif initApiServer(TCPPort); @@ -1278,4 +1280,4 @@ void loop() mainDelay.delay(delayMsec); } } -#endif +#endif \ No newline at end of file diff --git a/src/mesh/raspihttp/PiWebServer.cpp b/src/mesh/raspihttp/PiWebServer.cpp index 846d70723..9d2625410 100644 --- a/src/mesh/raspihttp/PiWebServer.cpp +++ b/src/mesh/raspihttp/PiWebServer.cpp @@ -82,8 +82,6 @@ char contentTypes[][2][32] = {{".txt", "text/plain"}, {".html", "text/html" volatile bool isWebServerReady; volatile bool isCertReady; -HttpAPI webAPI; - PiWebServerThread *piwebServerThread; /** @@ -247,7 +245,7 @@ int handleAPIv1ToRadio(const struct _u_request *req, struct _u_response *res, vo portduinoVFS->mountpoint(configWeb.rootPath); LOG_DEBUG("Received %d bytes from PUT request", s); - webAPI.handleToRadio(buffer, s); + static_cast(user_data)->handleToRadio(buffer, s); LOG_DEBUG("end web->radio "); return U_CALLBACK_COMPLETE; } @@ -279,7 +277,7 @@ int handleAPIv1FromRadio(const struct _u_request *req, struct _u_response *res, if (valueAll == "true") { while (len) { - len = webAPI.getFromRadio(txBuf); + len = static_cast(user_data)->getFromRadio(txBuf); ulfius_set_response_properties(res, U_OPT_STATUS, 200, U_OPT_BINARY_BODY, txBuf, len); const char *tmpa = (const char *)txBuf; ulfius_set_string_body_response(res, 200, tmpa); @@ -289,7 +287,7 @@ int handleAPIv1FromRadio(const struct _u_request *req, struct _u_response *res, } // Otherwise, just return one protobuf } else { - len = webAPI.getFromRadio(txBuf); + len = static_cast(user_data)->getFromRadio(txBuf); const char *tmpa = (const char *)txBuf; ulfius_set_binary_body_response(res, 200, tmpa, len); // LOG_DEBUG("\n----webAPI response:"); @@ -497,10 +495,10 @@ PiWebServerThread::PiWebServerThread() u_map_put(instanceWeb.default_headers, "Access-Control-Allow-Origin", "*"); // Maximum body size sent by the client is 1 Kb instanceWeb.max_post_body_size = 1024; - ulfius_add_endpoint_by_val(&instanceWeb, "GET", PREFIX, "/api/v1/fromradio/*", 1, &handleAPIv1FromRadio, NULL); - ulfius_add_endpoint_by_val(&instanceWeb, "OPTIONS", PREFIX, "/api/v1/fromradio/*", 1, &handleAPIv1FromRadio, NULL); - ulfius_add_endpoint_by_val(&instanceWeb, "PUT", PREFIX, "/api/v1/toradio/*", 1, &handleAPIv1ToRadio, configWeb.rootPath); - ulfius_add_endpoint_by_val(&instanceWeb, "OPTIONS", PREFIX, "/api/v1/toradio/*", 1, &handleAPIv1ToRadio, NULL); + ulfius_add_endpoint_by_val(&instanceWeb, "GET", PREFIX, "/api/v1/fromradio/*", 1, &handleAPIv1FromRadio, &webAPI); + ulfius_add_endpoint_by_val(&instanceWeb, "OPTIONS", PREFIX, "/api/v1/fromradio/*", 1, &handleAPIv1FromRadio, &webAPI); + ulfius_add_endpoint_by_val(&instanceWeb, "PUT", PREFIX, "/api/v1/toradio/*", 1, &handleAPIv1ToRadio, &webAPI); + ulfius_add_endpoint_by_val(&instanceWeb, "OPTIONS", PREFIX, "/api/v1/toradio/*", 1, &handleAPIv1ToRadio, &webAPI); // Add callback function to all endpoints for the Web Server ulfius_add_endpoint_by_val(&instanceWeb, "GET", NULL, "/*", 2, &callback_static_file, &configWeb); @@ -525,13 +523,12 @@ PiWebServerThread::~PiWebServerThread() u_map_clean(&configWeb.mime_types); ulfius_stop_framework(&instanceWeb); - ulfius_stop_framework(&instanceWeb); + ulfius_clean_instance(&instanceWeb); free(configWeb.rootPath); - ulfius_clean_instance(&instanceService); - ulfius_clean_instance(&instanceService); + free(key_pem); free(cert_pem); LOG_INFO("End framework"); } #endif -#endif +#endif \ No newline at end of file diff --git a/src/mesh/raspihttp/PiWebServer.h b/src/mesh/raspihttp/PiWebServer.h index c4c49e919..b45348cf3 100644 --- a/src/mesh/raspihttp/PiWebServer.h +++ b/src/mesh/raspihttp/PiWebServer.h @@ -23,24 +23,6 @@ struct _file_config { char *rootPath; }; -class PiWebServerThread -{ - private: - char *key_pem = NULL; - char *cert_pem = NULL; - // struct _u_map mime_types; - std::string webrootpath; - - public: - PiWebServerThread(); - ~PiWebServerThread(); - int CreateSSLCertificate(); - int CheckSSLandLoad(); - uint32_t requestRestart = 0; - struct _u_instance instanceWeb; - struct _u_instance instanceService; -}; - class HttpAPI : public PhoneAPI { @@ -55,6 +37,24 @@ class HttpAPI : public PhoneAPI virtual bool checkIsConnected() override { return true; } // FIXME, be smarter about this }; +class PiWebServerThread +{ + private: + char *key_pem = NULL; + char *cert_pem = NULL; + // struct _u_map mime_types; + std::string webrootpath; + HttpAPI webAPI; + + public: + PiWebServerThread(); + ~PiWebServerThread(); + int CreateSSLCertificate(); + int CheckSSLandLoad(); + uint32_t requestRestart = 0; + struct _u_instance instanceWeb; +}; + extern PiWebServerThread *piwebServerThread; #endif From 812aa35f096c0102bdcf246a335810596873c558 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sat, 11 Jan 2025 14:19:17 +0100 Subject: [PATCH 076/381] Enable Tx interrupt immediately after `startTransmit()` (#5820) --- src/mesh/RadioLibInterface.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index 09266b334..0a047a660 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -501,14 +501,13 @@ bool RadioLibInterface::startSend(meshtastic_MeshPacket *txp) powerMon->clearState(meshtastic_PowerMon_State_Lora_TXOn); // Transmitter off now startReceive(); // Restart receive mode (because startTransmit failed to put us in xmit mode) } else { + // Must be done AFTER, starting transmit, because startTransmit clears (possibly stale) interrupt pending register + // bits + enableInterrupt(isrTxLevel0); lastTxStart = millis(); printPacket("Started Tx", txp); } - // Must be done AFTER, starting transmit, because startTransmit clears (possibly stale) interrupt pending register - // bits - enableInterrupt(isrTxLevel0); - return res == RADIOLIB_ERR_NONE; } } \ No newline at end of file From 6b8cf164e9a5af84c40d403c5102102c0c73db42 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sat, 11 Jan 2025 14:20:32 +0100 Subject: [PATCH 077/381] Save some flash usage on STM32WL (#5819) --- src/mesh/RadioInterface.cpp | 4 ++-- variants/rak3172/platformio.ini | 2 ++ variants/wio-e5/platformio.ini | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index b1403f3b6..d91cba116 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -297,7 +297,7 @@ uint32_t RadioInterface::getTxDelayMsecWeighted(float snr) void printPacket(const char *prefix, const meshtastic_MeshPacket *p) { -#ifdef DEBUG_PORT +#if defined(DEBUG_PORT) && !defined(DEBUG_MUTE) std::string out = DEBUG_PORT.mt_sprintf("%s (id=0x%08x fr=0x%08x to=0x%08x, WantAck=%d, HopLim=%d Ch=0x%x", prefix, p->id, p->from, p->to, p->want_ack, p->hop_limit, p->channel); if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) { @@ -637,4 +637,4 @@ size_t RadioInterface::beginSending(meshtastic_MeshPacket *p) sendingPacket = p; return p->encrypted.size + sizeof(PacketHeader); -} +} \ No newline at end of file diff --git a/variants/rak3172/platformio.ini b/variants/rak3172/platformio.ini index 9e617e01e..58ea32088 100644 --- a/variants/rak3172/platformio.ini +++ b/variants/rak3172/platformio.ini @@ -28,6 +28,8 @@ build_flags = -DHAL_TIM_MODULE_DISABLED -DHAL_WWDG_MODULE_DISABLED -DHAL_EXTI_MODULE_DISABLED + -DHAL_SAI_MODULE_DISABLED + -DHAL_ICACHE_MODULE_DISABLED -DRADIOLIB_EXCLUDE_SX128X=1 -DRADIOLIB_EXCLUDE_SX127X=1 -DRADIOLIB_EXCLUDE_LR11X0=1 diff --git a/variants/wio-e5/platformio.ini b/variants/wio-e5/platformio.ini index 29c4a0a37..e9d4ca946 100644 --- a/variants/wio-e5/platformio.ini +++ b/variants/wio-e5/platformio.ini @@ -28,6 +28,8 @@ build_flags = -DHAL_TIM_MODULE_DISABLED -DHAL_WWDG_MODULE_DISABLED -DHAL_EXTI_MODULE_DISABLED + -DHAL_SAI_MODULE_DISABLED + -DHAL_ICACHE_MODULE_DISABLED -DRADIOLIB_EXCLUDE_SX128X=1 -DRADIOLIB_EXCLUDE_SX127X=1 -DRADIOLIB_EXCLUDE_LR11X0=1 From b4a4d2db4e9a482d778ebd7232dd0fc821df95bb Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Sat, 11 Jan 2025 17:40:39 -0800 Subject: [PATCH 078/381] Cache Python & PlatformIO dependencies (#5822) --- .github/actions/build-variant/action.yml | 6 ++++++ .github/actions/setup-base/action.yml | 11 ++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/actions/build-variant/action.yml b/.github/actions/build-variant/action.yml index d003459d6..b24a5fc12 100644 --- a/.github/actions/build-variant/action.yml +++ b/.github/actions/build-variant/action.yml @@ -68,6 +68,12 @@ runs: sed -i '/DDEBUG_HEAP/d' ${INI_FILE} done + - name: PlatformIO ${{ inputs.arch }} download cache + uses: actions/cache@v4 + with: + path: ~/.platformio/.cache + key: pio-cache-${{ inputs.arch }}-${{ hashFiles('.github/actions/**', '**.ini') }} + - name: Build ${{ inputs.board }} shell: bash run: ${{ inputs.build-script-path }} ${{ inputs.board }} diff --git a/.github/actions/setup-base/action.yml b/.github/actions/setup-base/action.yml index c0f6c4e66..77c8f0e10 100644 --- a/.github/actions/setup-base/action.yml +++ b/.github/actions/setup-base/action.yml @@ -26,13 +26,10 @@ runs: uses: actions/setup-python@v5 with: python-version: 3.x - - # - name: Cache python libs - # uses: actions/cache@v4 - # id: cache-pip # needed in if test - # with: - # path: ~/.cache/pip - # key: ${{ runner.os }}-pip + cache: pip + cache-dependency-path: | + .github/actions/** + **.ini - name: Upgrade python tools shell: bash From 253ab458efaf2a60cfda7d57a6b5196ad06c6028 Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Sat, 11 Jan 2025 20:29:24 -0800 Subject: [PATCH 079/381] Add lsb-release on the github runner (#5825) --- .github/actions/setup-base/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-base/action.yml b/.github/actions/setup-base/action.yml index 77c8f0e10..7364c4ddb 100644 --- a/.github/actions/setup-base/action.yml +++ b/.github/actions/setup-base/action.yml @@ -20,7 +20,7 @@ runs: shell: bash run: | sudo apt-get -y update --fix-missing - sudo apt-get install -y cppcheck libbluetooth-dev libgpiod-dev libyaml-cpp-dev + sudo apt-get install -y cppcheck libbluetooth-dev libgpiod-dev libyaml-cpp-dev lsb-release - name: Setup Python uses: actions/setup-python@v5 From 00fdf2c9aadf5c45e77ae98e0b476ca9d9f4fd10 Mon Sep 17 00:00:00 2001 From: DarkZeros Date: Sun, 12 Jan 2025 05:17:40 +0000 Subject: [PATCH 080/381] Heltec Wireless Stick Lite V1/V2 support (#5808) * I only have the V2.1 version, not sure if the HW is same with V1, or V2. Given the few resources I could find I think it is. * ADC / Battery measure and TX/RX are working --- variants/heltec_wsl_v2.1/platformio.ini | 7 ++++++ variants/heltec_wsl_v2.1/variant.h | 29 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 variants/heltec_wsl_v2.1/platformio.ini create mode 100644 variants/heltec_wsl_v2.1/variant.h diff --git a/variants/heltec_wsl_v2.1/platformio.ini b/variants/heltec_wsl_v2.1/platformio.ini new file mode 100644 index 000000000..f4fff9698 --- /dev/null +++ b/variants/heltec_wsl_v2.1/platformio.ini @@ -0,0 +1,7 @@ +[env:heltec-wsl-v2_1] +extends = esp32_base +board = heltec_wireless_stick_lite +board_level = extra +build_flags = + ${esp32_base.build_flags} -D PRIVATE_HW -I variants/heltec_wsl_v2.1 + -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. \ No newline at end of file diff --git a/variants/heltec_wsl_v2.1/variant.h b/variants/heltec_wsl_v2.1/variant.h new file mode 100644 index 000000000..3927a89d6 --- /dev/null +++ b/variants/heltec_wsl_v2.1/variant.h @@ -0,0 +1,29 @@ +#define I2C_SCL SCL +#define I2C_SDA SDA + +#define LED_PIN LED + +// active low, powers the Battery reader, but no lora antenna boost (?) +// #define VEXT_ENABLE Vext +// #define VEXT_ON_VALUE LOW + +#define BUTTON_PIN 0 + +#define ADC_CTRL 21 +#define ADC_CTRL_ENABLED LOW +#define BATTERY_PIN 37 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage +#define ADC_CHANNEL ADC1_CHANNEL_1 +// ratio of voltage divider = 3.20 (R1=100k, R2=220k) +#define ADC_MULTIPLIER 3.2 + +#define USE_RF95 // RFM95/SX127x + +#define LORA_DIO0 26 +#define LORA_RESET 14 +#define LORA_DIO1 35 +#define LORA_DIO2 34 + +#define LORA_SCK 5 +#define LORA_MISO 19 +#define LORA_MOSI 27 +#define LORA_CS 18 From 0fe8d4ccc7687195cf93401c2914c16de7d9ab9d Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Sat, 11 Jan 2025 21:51:43 -0800 Subject: [PATCH 081/381] Run the AddressSanitizer during tests (#5815) * Run the AddressSanitizer during tests * Show details for test failures --- .github/workflows/test_native.yml | 2 +- variants/portduino/platformio.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_native.yml b/.github/workflows/test_native.yml index 8e8ff68e4..c7b0ef34c 100644 --- a/.github/workflows/test_native.yml +++ b/.github/workflows/test_native.yml @@ -90,7 +90,7 @@ jobs: run: sed -i 's/-DBUILD_EPOCH=$UNIX_TIME/#-DBUILD_EPOCH=$UNIX_TIME/' platformio.ini - name: PlatformIO Tests - run: platformio test -e coverage --junit-output-path testreport.xml + run: platformio test -e coverage -v --junit-output-path testreport.xml - name: Save test results if: always() # run this step even if previous step failed diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index cad87ea8c..2c7030b5b 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -12,4 +12,4 @@ build_src_filter = ${portduino_base.build_src_filter} [env:coverage] extends = env:native -build_flags = -lgcov --coverage -fprofile-abs-path ${env:native.build_flags} +build_flags = -lgcov --coverage -fprofile-abs-path -fsanitize=address ${env:native.build_flags} From a0a4c5bc7944764af1ba7154eb9476f80e3b956c Mon Sep 17 00:00:00 2001 From: And137 <137andrew137@gmail.com> Date: Sun, 12 Jan 2025 07:30:58 +0100 Subject: [PATCH 082/381] Support for Polish fonts on E-Ink devices, Polish fonts retouch, fixed Czech/Slovak OLED/E-Ink double space bug (#5821) * Added support for Polish fonts for E-Ink devices * Added support for Polish fonts for E-Ink devices FIX * Polilsh E-Ink/OLED font retouch, fixed Czech/Slovak font double space bug * Fixed platformio.ini uncommented flag --- platformio.ini | 2 +- src/graphics/ScreenFonts.h | 14 + src/graphics/fonts/OLEDDisplayFontsCS.cpp | 6 +- src/graphics/fonts/OLEDDisplayFontsPL.cpp | 1742 ++++++++++++++++----- src/graphics/fonts/OLEDDisplayFontsPL.h | 3 +- 5 files changed, 1327 insertions(+), 440 deletions(-) diff --git a/platformio.ini b/platformio.ini index 6a4466c01..e6735ec23 100644 --- a/platformio.ini +++ b/platformio.ini @@ -49,7 +49,7 @@ build_flags = -Wno-missing-field-initializers -DMESHTASTIC_EXCLUDE_HEALTH_TELEMETRY=1 -DMESHTASTIC_EXCLUDE_POWERSTRESS=1 ; exclude power stress test module from main firmware #-DBUILD_EPOCH=$UNIX_TIME - ;-D OLED_PL + #-D OLED_PL=1 monitor_speed = 115200 monitor_filters = direct diff --git a/src/graphics/ScreenFonts.h b/src/graphics/ScreenFonts.h index 81eb717cd..7881b464f 100644 --- a/src/graphics/ScreenFonts.h +++ b/src/graphics/ScreenFonts.h @@ -20,9 +20,15 @@ defined(ST7789_CS) || defined(USE_ST7789) || defined(HX8357_CS)) && \ !defined(DISPLAY_FORCE_SMALL_FONTS) // The screen is bigger so use bigger fonts +#ifdef OLED_PL +#define FONT_SMALL ArialMT_Plain_16_PL // Height: 19 +#define FONT_MEDIUM ArialMT_Plain_24_PL // Height: 28 +#define FONT_LARGE ArialMT_Plain_24_PL // Height: 28 +#else #define FONT_SMALL ArialMT_Plain_16 // Height: 19 #define FONT_MEDIUM ArialMT_Plain_24 // Height: 28 #define FONT_LARGE ArialMT_Plain_24 // Height: 28 +#endif #else #ifdef OLED_PL #define FONT_SMALL ArialMT_Plain_10_PL @@ -41,6 +47,9 @@ #endif #endif #endif +#ifdef OLED_PL +#define FONT_MEDIUM ArialMT_Plain_16_PL // Height: 19 +#else #ifdef OLED_UA #define FONT_MEDIUM ArialMT_Plain_16_UA // Height: 19 #else @@ -50,6 +59,10 @@ #define FONT_MEDIUM ArialMT_Plain_16 // Height: 19 #endif #endif +#endif +#ifdef OLED_PL +#define FONT_LARGE ArialMT_Plain_24_PL // Height: 28 +#else #ifdef OLED_UA #define FONT_LARGE ArialMT_Plain_24_UA // Height: 28 #else @@ -60,6 +73,7 @@ #endif #endif #endif +#endif #define _fontHeight(font) ((font)[1] + 1) // height is position 1 diff --git a/src/graphics/fonts/OLEDDisplayFontsCS.cpp b/src/graphics/fonts/OLEDDisplayFontsCS.cpp index 5c17e9177..67208b4d9 100644 --- a/src/graphics/fonts/OLEDDisplayFontsCS.cpp +++ b/src/graphics/fonts/OLEDDisplayFontsCS.cpp @@ -7,7 +7,7 @@ const uint8_t ArialMT_Plain_10_CS[] PROGMEM = { 0x20, // First char: 32 0xE0, // Number of chars: 224 // Jump Table: - 0xFF, 0xFF, 0x00, 0x0A, // 32 + 0xFF, 0xFF, 0x00, 0x03, // 32 0x00, 0x00, 0x04, 0x03, // 33 0x00, 0x04, 0x05, 0x04, // 34 0x00, 0x09, 0x09, 0x06, // 35 @@ -453,7 +453,7 @@ const uint8_t ArialMT_Plain_16_CS[] PROGMEM = { 0x20, // First char: 32 0xE0, // Number of chars: 224 // Jump Table: - 0xFF, 0xFF, 0x00, 0x10, // 32 + 0xFF, 0xFF, 0x00, 0x04, // 32 0x00, 0x00, 0x08, 0x04, // 33 0x00, 0x08, 0x0D, 0x06, // 34 0x00, 0x15, 0x1A, 0x0A, // 35 @@ -1036,7 +1036,7 @@ const uint8_t ArialMT_Plain_24_CS[] PROGMEM = { 0x20, // First char: 32 0xE0, // Number of chars: 224 // Jump Table: - 0xFF, 0xFF, 0x00, 0x18, // 32 + 0xFF, 0xFF, 0x00, 0x06, // 32 0x00, 0x00, 0x13, 0x06, // 33 0x00, 0x13, 0x1A, 0x08, // 34 0x00, 0x2D, 0x33, 0x0E, // 35 diff --git a/src/graphics/fonts/OLEDDisplayFontsPL.cpp b/src/graphics/fonts/OLEDDisplayFontsPL.cpp index 03fdab5fa..1f43967aa 100644 --- a/src/graphics/fonts/OLEDDisplayFontsPL.cpp +++ b/src/graphics/fonts/OLEDDisplayFontsPL.cpp @@ -1,440 +1,1312 @@ #include "OLEDDisplayFontsPL.h" -// Font generated or edited with the glyphEditor const uint8_t ArialMT_Plain_10_PL[] PROGMEM = { - 0x0A, // Width: 10 - 0x0D, // Height: 13 - 0x20, // First char: 32 - 0xE0, // Number of chars: 224 +0x0A, // Width: 10 +0x0D, // Height: 13 +0x20, // First char: 32 +0xE0, // Number of chars: 224 +// Jump Table: +0xFF, 0xFF, 0x00, 0x03, // 32 +0x00, 0x00, 0x04, 0x03, // 33 +0x00, 0x04, 0x05, 0x04, // 34 +0x00, 0x09, 0x09, 0x06, // 35 +0x00, 0x12, 0x0A, 0x06, // 36 +0x00, 0x1C, 0x10, 0x09, // 37 +0x00, 0x2C, 0x0E, 0x08, // 38 +0x00, 0x3A, 0x01, 0x02, // 39 +0x00, 0x3B, 0x06, 0x04, // 40 +0x00, 0x41, 0x06, 0x04, // 41 +0x00, 0x47, 0x05, 0x04, // 42 +0x00, 0x4C, 0x09, 0x06, // 43 +0x00, 0x55, 0x04, 0x03, // 44 +0x00, 0x59, 0x03, 0x03, // 45 +0x00, 0x5C, 0x04, 0x03, // 46 +0x00, 0x60, 0x05, 0x04, // 47 +0x00, 0x65, 0x0A, 0x06, // 48 +0x00, 0x6F, 0x08, 0x05, // 49 +0x00, 0x77, 0x0A, 0x06, // 50 +0x00, 0x81, 0x0A, 0x06, // 51 +0x00, 0x8B, 0x0B, 0x07, // 52 +0x00, 0x96, 0x0A, 0x06, // 53 +0x00, 0xA0, 0x0A, 0x06, // 54 +0x00, 0xAA, 0x09, 0x06, // 55 +0x00, 0xB3, 0x0A, 0x06, // 56 +0x00, 0xBD, 0x0A, 0x06, // 57 +0x00, 0xC7, 0x04, 0x03, // 58 +0x00, 0xCB, 0x04, 0x03, // 59 +0x00, 0xCF, 0x0A, 0x06, // 60 +0x00, 0xD9, 0x09, 0x06, // 61 +0x00, 0xE2, 0x09, 0x06, // 62 +0x00, 0xEB, 0x0B, 0x07, // 63 +0x00, 0xF6, 0x14, 0x0B, // 64 +0x01, 0x0A, 0x0E, 0x08, // 65 +0x01, 0x18, 0x0C, 0x07, // 66 +0x01, 0x24, 0x0C, 0x07, // 67 +0x01, 0x30, 0x0B, 0x07, // 68 +0x01, 0x3B, 0x0C, 0x07, // 69 +0x01, 0x47, 0x09, 0x06, // 70 +0x01, 0x50, 0x0D, 0x08, // 71 +0x01, 0x5D, 0x0C, 0x07, // 72 +0x01, 0x69, 0x04, 0x03, // 73 +0x01, 0x6D, 0x08, 0x05, // 74 +0x01, 0x75, 0x0E, 0x08, // 75 +0x01, 0x83, 0x0C, 0x07, // 76 +0x01, 0x8F, 0x10, 0x09, // 77 +0x01, 0x9F, 0x0C, 0x07, // 78 +0x01, 0xAB, 0x0E, 0x08, // 79 +0x01, 0xB9, 0x0B, 0x07, // 80 +0x01, 0xC4, 0x0E, 0x08, // 81 +0x01, 0xD2, 0x0C, 0x07, // 82 +0x01, 0xDE, 0x0C, 0x07, // 83 +0x01, 0xEA, 0x0B, 0x07, // 84 +0x01, 0xF5, 0x0C, 0x07, // 85 +0x02, 0x01, 0x0D, 0x08, // 86 +0x02, 0x0E, 0x11, 0x0A, // 87 +0x02, 0x1F, 0x0E, 0x08, // 88 +0x02, 0x2D, 0x0D, 0x08, // 89 +0x02, 0x3A, 0x0C, 0x07, // 90 +0x02, 0x46, 0x06, 0x04, // 91 +0x02, 0x4C, 0x06, 0x04, // 92 +0x02, 0x52, 0x04, 0x03, // 93 +0x02, 0x56, 0x09, 0x06, // 94 +0x02, 0x5F, 0x0C, 0x07, // 95 +0x02, 0x6B, 0x03, 0x03, // 96 +0x02, 0x6E, 0x0A, 0x06, // 97 +0x02, 0x78, 0x0A, 0x06, // 98 +0x02, 0x82, 0x0A, 0x06, // 99 +0x02, 0x8C, 0x0A, 0x06, // 100 +0x02, 0x96, 0x0A, 0x06, // 101 +0x02, 0xA0, 0x05, 0x04, // 102 +0x02, 0xA5, 0x0A, 0x06, // 103 +0x02, 0xAF, 0x0A, 0x06, // 104 +0x02, 0xB9, 0x04, 0x03, // 105 +0x02, 0xBD, 0x04, 0x03, // 106 +0x02, 0xC1, 0x08, 0x05, // 107 +0x02, 0xC9, 0x04, 0x03, // 108 +0x02, 0xCD, 0x10, 0x09, // 109 +0x02, 0xDD, 0x0A, 0x06, // 110 +0x02, 0xE7, 0x0A, 0x06, // 111 +0x02, 0xF1, 0x0A, 0x06, // 112 +0x02, 0xFB, 0x0A, 0x06, // 113 +0x03, 0x05, 0x05, 0x04, // 114 +0x03, 0x0A, 0x08, 0x05, // 115 +0x03, 0x12, 0x06, 0x04, // 116 +0x03, 0x18, 0x0A, 0x06, // 117 +0x03, 0x22, 0x09, 0x06, // 118 +0x03, 0x2B, 0x0E, 0x08, // 119 +0x03, 0x39, 0x0A, 0x06, // 120 +0x03, 0x43, 0x09, 0x06, // 121 +0x03, 0x4C, 0x0A, 0x06, // 122 +0x03, 0x56, 0x06, 0x04, // 123 +0x03, 0x5C, 0x04, 0x03, // 124 +0x03, 0x60, 0x05, 0x04, // 125 +0x03, 0x65, 0x09, 0x06, // 126 +0xFF, 0xFF, 0x00, 0x0A, // 127 +0xFF, 0xFF, 0x00, 0x0A, // 128 +0x03, 0x6E, 0x0C, 0x07, // 129 +0x03, 0x7A, 0x05, 0x04, // 130 +0x03, 0x7F, 0x0C, 0x07, // 131 +0x03, 0x8B, 0x0E, 0x08, // 132 +0x03, 0x99, 0x0A, 0x06, // 133 +0x03, 0xA3, 0x0C, 0x07, // 134 +0x03, 0xAF, 0x0A, 0x06, // 135 +0x03, 0xB9, 0x0A, 0x06, // 136 +0x03, 0xC3, 0x0A, 0x06, // 137 +0xFF, 0xFF, 0x00, 0x0A, // 138 +0xFF, 0xFF, 0x00, 0x0A, // 139 +0xFF, 0xFF, 0x00, 0x0A, // 140 +0xFF, 0xFF, 0x00, 0x0A, // 141 +0xFF, 0xFF, 0x00, 0x0A, // 142 +0xFF, 0xFF, 0x00, 0x0A, // 143 +0xFF, 0xFF, 0x00, 0x0A, // 144 +0xFF, 0xFF, 0x00, 0x0A, // 145 +0xFF, 0xFF, 0x00, 0x0A, // 146 +0x03, 0xCD, 0x0E, 0x08, // 147 +0x03, 0xDB, 0x0A, 0x06, // 148 +0xFF, 0xFF, 0x00, 0x0A, // 149 +0xFF, 0xFF, 0x00, 0x0A, // 150 +0xFF, 0xFF, 0x00, 0x0A, // 151 +0x03, 0xE5, 0x0C, 0x07, // 152 +0x03, 0xF1, 0x0A, 0x06, // 153 +0x03, 0xFB, 0x0C, 0x07, // 154 +0x04, 0x07, 0x08, 0x05, // 155 +0xFF, 0xFF, 0x00, 0x0A, // 156 +0xFF, 0xFF, 0x00, 0x0A, // 157 +0xFF, 0xFF, 0x00, 0x0A, // 158 +0xFF, 0xFF, 0x00, 0x0A, // 159 +0xFF, 0xFF, 0x00, 0x0A, // 160 +0x04, 0x0F, 0x04, 0x03, // 161 +0x04, 0x13, 0x0A, 0x06, // 162 +0x04, 0x1D, 0x0C, 0x07, // 163 +0x04, 0x29, 0x0A, 0x06, // 164 +0x04, 0x33, 0x0A, 0x06, // 165 +0x04, 0x3D, 0x04, 0x03, // 166 +0x04, 0x41, 0x0A, 0x06, // 167 +0x04, 0x4B, 0x05, 0x04, // 168 +0x04, 0x50, 0x0D, 0x08, // 169 +0x04, 0x5D, 0x07, 0x05, // 170 +0x04, 0x64, 0x0A, 0x06, // 171 +0x04, 0x6E, 0x09, 0x06, // 172 +0x04, 0x77, 0x03, 0x03, // 173 +0x04, 0x7A, 0x0D, 0x08, // 174 +0x04, 0x87, 0x0B, 0x07, // 175 +0x04, 0x92, 0x07, 0x05, // 176 +0x04, 0x99, 0x0A, 0x06, // 177 +0x04, 0xA3, 0x05, 0x04, // 178 +0x04, 0xA8, 0x05, 0x04, // 179 +0x04, 0xAD, 0x05, 0x04, // 180 +0x04, 0xB2, 0x0A, 0x06, // 181 +0x04, 0xBC, 0x09, 0x06, // 182 +0x04, 0xC5, 0x03, 0x03, // 183 +0x04, 0xC8, 0x06, 0x04, // 184 +0x04, 0xCE, 0x0C, 0x07, // 185 +0x04, 0xDA, 0x07, 0x05, // 186 +0x04, 0xE1, 0x0C, 0x07, // 187 +0x04, 0xED, 0x0A, 0x06, // 188 +0x04, 0xF7, 0x10, 0x09, // 189 +0x05, 0x07, 0x10, 0x09, // 190 +0x05, 0x17, 0x0A, 0x06, // 191 +0x05, 0x21, 0x0E, 0x08, // 192 +0x05, 0x2F, 0x0E, 0x08, // 193 +0x05, 0x3D, 0x0E, 0x08, // 194 +0x05, 0x4B, 0x0E, 0x08, // 195 +0x05, 0x59, 0x0E, 0x08, // 196 +0x05, 0x67, 0x0E, 0x08, // 197 +0x05, 0x75, 0x12, 0x0A, // 198 +0x05, 0x87, 0x0C, 0x07, // 199 +0x05, 0x93, 0x0C, 0x07, // 200 +0x05, 0x9F, 0x0C, 0x07, // 201 +0x05, 0xAB, 0x0C, 0x07, // 202 +0x05, 0xB7, 0x0C, 0x07, // 203 +0x05, 0xC3, 0x05, 0x04, // 204 +0x05, 0xC8, 0x04, 0x03, // 205 +0x05, 0xCC, 0x04, 0x03, // 206 +0x05, 0xD0, 0x05, 0x04, // 207 +0x05, 0xD5, 0x0B, 0x07, // 208 +0x05, 0xE0, 0x0C, 0x07, // 209 +0x05, 0xEC, 0x0E, 0x08, // 210 +0x05, 0xFA, 0x0E, 0x08, // 211 +0x06, 0x08, 0x0E, 0x08, // 212 +0x06, 0x16, 0x0E, 0x08, // 213 +0x06, 0x24, 0x0E, 0x08, // 214 +0x06, 0x32, 0x0A, 0x06, // 215 +0x06, 0x3C, 0x0D, 0x08, // 216 +0x06, 0x49, 0x0C, 0x07, // 217 +0x06, 0x55, 0x0C, 0x07, // 218 +0x06, 0x61, 0x0C, 0x07, // 219 +0x06, 0x6D, 0x0C, 0x07, // 220 +0x06, 0x79, 0x0D, 0x08, // 221 +0x06, 0x86, 0x0B, 0x07, // 222 +0x06, 0x91, 0x0C, 0x07, // 223 +0x06, 0x9D, 0x0A, 0x06, // 224 +0x06, 0xA7, 0x0A, 0x06, // 225 +0x06, 0xB1, 0x0A, 0x06, // 226 +0x06, 0xBB, 0x0A, 0x06, // 227 +0x06, 0xC5, 0x0A, 0x06, // 228 +0x06, 0xCF, 0x0A, 0x06, // 229 +0x06, 0xD9, 0x10, 0x09, // 230 +0x06, 0xE9, 0x0A, 0x06, // 231 +0x06, 0xF3, 0x0A, 0x06, // 232 +0x06, 0xFD, 0x0A, 0x06, // 233 +0x07, 0x07, 0x0A, 0x06, // 234 +0x07, 0x11, 0x0A, 0x06, // 235 +0x07, 0x1B, 0x05, 0x04, // 236 +0x07, 0x20, 0x04, 0x03, // 237 +0x07, 0x24, 0x05, 0x04, // 238 +0x07, 0x29, 0x05, 0x04, // 239 +0x07, 0x2E, 0x0A, 0x06, // 240 +0x07, 0x38, 0x0A, 0x06, // 241 +0x07, 0x42, 0x0A, 0x06, // 242 +0x07, 0x4C, 0x0A, 0x06, // 243 +0x07, 0x56, 0x0A, 0x06, // 244 +0x07, 0x60, 0x0A, 0x06, // 245 +0x07, 0x6A, 0x0A, 0x06, // 246 +0x07, 0x74, 0x09, 0x06, // 247 +0x07, 0x7D, 0x0A, 0x06, // 248 +0x07, 0x87, 0x0A, 0x06, // 249 +0x07, 0x91, 0x0A, 0x06, // 250 +0x07, 0x9B, 0x0A, 0x06, // 251 +0x07, 0xA5, 0x0A, 0x06, // 252 +0x07, 0xAF, 0x09, 0x06, // 253 +0x07, 0xB8, 0x0A, 0x06, // 254 +0x07, 0xC2, 0x09, 0x06, // 255 +// Font Data: +0x00, 0x00, 0xF8, 0x02, // 33 +0x38, 0x00, 0x00, 0x00, 0x38, // 34 +0xA0, 0x03, 0xE0, 0x00, 0xB8, 0x03, 0xE0, 0x00, 0xB8, // 35 +0x30, 0x01, 0x28, 0x02, 0xF8, 0x07, 0x48, 0x02, 0x90, 0x01, // 36 +0x00, 0x00, 0x30, 0x00, 0x48, 0x00, 0x30, 0x03, 0xC0, 0x00, 0xB0, 0x01, 0x48, 0x02, 0x80, 0x01, // 37 +0x80, 0x01, 0x50, 0x02, 0x68, 0x02, 0xA8, 0x02, 0x18, 0x01, 0x80, 0x03, 0x80, 0x02, // 38 +0x38, // 39 +0xE0, 0x03, 0x10, 0x04, 0x08, 0x08, // 40 +0x08, 0x08, 0x10, 0x04, 0xE0, 0x03, // 41 +0x28, 0x00, 0x18, 0x00, 0x28, // 42 +0x40, 0x00, 0x40, 0x00, 0xF0, 0x01, 0x40, 0x00, 0x40, // 43 +0x00, 0x00, 0x00, 0x06, // 44 +0x80, 0x00, 0x80, // 45 +0x00, 0x00, 0x00, 0x02, // 46 +0x00, 0x03, 0xE0, 0x00, 0x18, // 47 +0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x02, 0xF0, 0x01, // 48 +0x00, 0x00, 0x20, 0x00, 0x10, 0x00, 0xF8, 0x03, // 49 +0x10, 0x02, 0x08, 0x03, 0x88, 0x02, 0x48, 0x02, 0x30, 0x02, // 50 +0x10, 0x01, 0x08, 0x02, 0x48, 0x02, 0x48, 0x02, 0xB0, 0x01, // 51 +0xC0, 0x00, 0xA0, 0x00, 0x90, 0x00, 0x88, 0x00, 0xF8, 0x03, 0x80, // 52 +0x60, 0x01, 0x38, 0x02, 0x28, 0x02, 0x28, 0x02, 0xC8, 0x01, // 53 +0xF0, 0x01, 0x28, 0x02, 0x28, 0x02, 0x28, 0x02, 0xD0, 0x01, // 54 +0x08, 0x00, 0x08, 0x03, 0xC8, 0x00, 0x38, 0x00, 0x08, // 55 +0xB0, 0x01, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, 0xB0, 0x01, // 56 +0x70, 0x01, 0x88, 0x02, 0x88, 0x02, 0x88, 0x02, 0xF0, 0x01, // 57 +0x00, 0x00, 0x20, 0x02, // 58 +0x00, 0x00, 0x20, 0x06, // 59 +0x00, 0x00, 0x40, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0x10, 0x01, // 60 +0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, // 61 +0x00, 0x00, 0x10, 0x01, 0xA0, 0x00, 0xA0, 0x00, 0x40, // 62 +0x10, 0x00, 0x08, 0x00, 0x08, 0x00, 0xC8, 0x02, 0x48, 0x00, 0x30, // 63 +0x00, 0x00, 0xC0, 0x03, 0x30, 0x04, 0xD0, 0x09, 0x28, 0x0A, 0x28, 0x0A, 0xC8, 0x0B, 0x68, 0x0A, 0x10, 0x05, 0xE0, 0x04, // 64 +0x00, 0x02, 0xC0, 0x01, 0xB0, 0x00, 0x88, 0x00, 0xB0, 0x00, 0xC0, 0x01, 0x00, 0x02, // 65 +0x00, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, 0xF0, 0x01, // 66 +0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x02, 0x10, 0x01, // 67 +0x00, 0x00, 0xF8, 0x03, 0x08, 0x02, 0x08, 0x02, 0x10, 0x01, 0xE0, // 68 +0x00, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, // 69 +0x00, 0x00, 0xF8, 0x03, 0x48, 0x00, 0x48, 0x00, 0x08, // 70 +0x00, 0x00, 0xE0, 0x00, 0x10, 0x01, 0x08, 0x02, 0x48, 0x02, 0x50, 0x01, 0xC0, // 71 +0x00, 0x00, 0xF8, 0x03, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0xF8, 0x03, // 72 +0x00, 0x00, 0xF8, 0x03, // 73 +0x00, 0x03, 0x00, 0x02, 0x00, 0x02, 0xF8, 0x01, // 74 +0x00, 0x00, 0xF8, 0x03, 0x80, 0x00, 0x60, 0x00, 0x90, 0x00, 0x08, 0x01, 0x00, 0x02, // 75 +0x00, 0x00, 0xF8, 0x03, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, // 76 +0x00, 0x00, 0xF8, 0x03, 0x30, 0x00, 0xC0, 0x01, 0x00, 0x02, 0xC0, 0x01, 0x30, 0x00, 0xF8, 0x03, // 77 +0x00, 0x00, 0xF8, 0x03, 0x30, 0x00, 0x40, 0x00, 0x80, 0x01, 0xF8, 0x03, // 78 +0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x02, 0x08, 0x02, 0xF0, 0x01, // 79 +0x00, 0x00, 0xF8, 0x03, 0x48, 0x00, 0x48, 0x00, 0x48, 0x00, 0x30, // 80 +0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x03, 0x08, 0x03, 0xF0, 0x02, // 81 +0x00, 0x00, 0xF8, 0x03, 0x48, 0x00, 0x48, 0x00, 0xC8, 0x00, 0x30, 0x03, // 82 +0x00, 0x00, 0x30, 0x01, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, 0x90, 0x01, // 83 +0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0xF8, 0x03, 0x08, 0x00, 0x08, // 84 +0x00, 0x00, 0xF8, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0xF8, 0x01, // 85 +0x08, 0x00, 0x70, 0x00, 0x80, 0x01, 0x00, 0x02, 0x80, 0x01, 0x70, 0x00, 0x08, // 86 +0x18, 0x00, 0xE0, 0x01, 0x00, 0x02, 0xF0, 0x01, 0x08, 0x00, 0xF0, 0x01, 0x00, 0x02, 0xE0, 0x01, 0x18, // 87 +0x00, 0x02, 0x08, 0x01, 0x90, 0x00, 0x60, 0x00, 0x90, 0x00, 0x08, 0x01, 0x00, 0x02, // 88 +0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0xC0, 0x03, 0x20, 0x00, 0x10, 0x00, 0x08, // 89 +0x08, 0x03, 0x88, 0x02, 0xC8, 0x02, 0x68, 0x02, 0x38, 0x02, 0x18, 0x02, // 90 +0x00, 0x00, 0xF8, 0x0F, 0x08, 0x08, // 91 +0x18, 0x00, 0xE0, 0x00, 0x00, 0x03, // 92 +0x08, 0x08, 0xF8, 0x0F, // 93 +0x40, 0x00, 0x30, 0x00, 0x08, 0x00, 0x30, 0x00, 0x40, // 94 +0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, // 95 +0x08, 0x00, 0x10, // 96 +0x00, 0x00, 0x00, 0x03, 0xA0, 0x02, 0xA0, 0x02, 0xE0, 0x03, // 97 +0x00, 0x00, 0xF8, 0x03, 0x20, 0x02, 0x20, 0x02, 0xC0, 0x01, // 98 +0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x20, 0x02, 0x40, 0x01, // 99 +0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x20, 0x02, 0xF8, 0x03, // 100 +0x00, 0x00, 0xC0, 0x01, 0xA0, 0x02, 0xA0, 0x02, 0xC0, 0x02, // 101 +0x20, 0x00, 0xF0, 0x03, 0x28, // 102 +0x00, 0x00, 0xC0, 0x05, 0x20, 0x0A, 0x20, 0x0A, 0xE0, 0x07, // 103 +0x00, 0x00, 0xF8, 0x03, 0x20, 0x00, 0x20, 0x00, 0xC0, 0x03, // 104 +0x00, 0x00, 0xE8, 0x03, // 105 +0x00, 0x08, 0xE8, 0x07, // 106 +0xF8, 0x03, 0x80, 0x00, 0xC0, 0x01, 0x20, 0x02, // 107 +0x00, 0x00, 0xF8, 0x03, // 108 +0x00, 0x00, 0xE0, 0x03, 0x20, 0x00, 0x20, 0x00, 0xE0, 0x03, 0x20, 0x00, 0x20, 0x00, 0xC0, 0x03, // 109 +0x00, 0x00, 0xE0, 0x03, 0x20, 0x00, 0x20, 0x00, 0xC0, 0x03, // 110 +0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x20, 0x02, 0xC0, 0x01, // 111 +0x00, 0x00, 0xE0, 0x0F, 0x20, 0x02, 0x20, 0x02, 0xC0, 0x01, // 112 +0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x20, 0x02, 0xE0, 0x0F, // 113 +0x00, 0x00, 0xE0, 0x03, 0x20, // 114 +0x40, 0x02, 0xA0, 0x02, 0xA0, 0x02, 0x20, 0x01, // 115 +0x20, 0x00, 0xF8, 0x03, 0x20, 0x02, // 116 +0x00, 0x00, 0xE0, 0x01, 0x00, 0x02, 0x00, 0x02, 0xE0, 0x03, // 117 +0x20, 0x00, 0xC0, 0x01, 0x00, 0x02, 0xC0, 0x01, 0x20, // 118 +0xE0, 0x01, 0x00, 0x02, 0xC0, 0x01, 0x20, 0x00, 0xC0, 0x01, 0x00, 0x02, 0xE0, 0x01, // 119 +0x20, 0x02, 0x40, 0x01, 0x80, 0x00, 0x40, 0x01, 0x20, 0x02, // 120 +0x20, 0x00, 0xC0, 0x09, 0x00, 0x06, 0xC0, 0x01, 0x20, // 121 +0x20, 0x02, 0x20, 0x03, 0xA0, 0x02, 0x60, 0x02, 0x20, 0x02, // 122 +0x80, 0x00, 0x78, 0x0F, 0x08, 0x08, // 123 +0x00, 0x00, 0xF8, 0x0F, // 124 +0x08, 0x08, 0x78, 0x0F, 0x80, // 125 +0xC0, 0x00, 0x40, 0x00, 0xC0, 0x00, 0x80, 0x00, 0xC0, // 126 +0x00, 0x00, 0xF8, 0x03, 0x40, 0x02, 0x20, 0x02, 0x00, 0x02, 0x00, 0x02, // 129 +0x40, 0x00, 0xF8, 0x03, 0x20, // 130 +0x00, 0x00, 0xF8, 0x03, 0x30, 0x00, 0x44, 0x00, 0x82, 0x01, 0xF8, 0x03, // 131 +0x00, 0x02, 0xC0, 0x01, 0xB0, 0x00, 0x88, 0x00, 0xB0, 0x00, 0xC0, 0x0D, 0x00, 0x0A, // 132 +0x00, 0x00, 0x00, 0x03, 0xA0, 0x02, 0xA0, 0x0E, 0xE0, 0x0B, // 133 +0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x0A, 0x02, 0x09, 0x02, 0x10, 0x01, // 134 +0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x28, 0x02, 0x44, 0x01, // 135 +0x00, 0x00, 0xE0, 0x03, 0x20, 0x00, 0x28, 0x00, 0xC4, 0x03, // 136 +0x20, 0x02, 0x20, 0x03, 0xA8, 0x02, 0x64, 0x02, 0x20, 0x02, // 137 +0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x0A, 0x02, 0x09, 0x02, 0xF0, 0x01, // 147 +0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x28, 0x02, 0xC4, 0x01, // 148 +0x00, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x0E, 0x48, 0x0A, 0x48, 0x02, // 152 +0x00, 0x00, 0xC0, 0x01, 0xA0, 0x02, 0xA0, 0x0E, 0xC0, 0x0A, // 153 +0x00, 0x00, 0x30, 0x01, 0x48, 0x02, 0x4A, 0x02, 0x49, 0x02, 0x90, 0x01, // 154 +0x40, 0x02, 0xA0, 0x02, 0xA8, 0x02, 0x24, 0x01, // 155 +0x00, 0x00, 0xA0, 0x0F, // 161 +0x00, 0x00, 0xC0, 0x01, 0xA0, 0x0F, 0x78, 0x02, 0x40, 0x01, // 162 +0x40, 0x02, 0x70, 0x03, 0xC8, 0x02, 0x48, 0x02, 0x08, 0x02, 0x10, 0x02, // 163 +0x00, 0x00, 0xE0, 0x01, 0x20, 0x01, 0x20, 0x01, 0xE0, 0x01, // 164 +0x48, 0x01, 0x70, 0x01, 0xC0, 0x03, 0x70, 0x01, 0x48, 0x01, // 165 +0x00, 0x00, 0x38, 0x0F, // 166 +0xD0, 0x04, 0x28, 0x09, 0x48, 0x09, 0x48, 0x0A, 0x90, 0x05, // 167 +0x08, 0x00, 0x00, 0x00, 0x08, // 168 +0xE0, 0x00, 0x10, 0x01, 0x48, 0x02, 0xA8, 0x02, 0xA8, 0x02, 0x10, 0x01, 0xE0, // 169 +0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x78, // 170 +0x00, 0x00, 0x80, 0x01, 0x40, 0x02, 0x80, 0x01, 0x40, 0x02, // 171 +0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0xE0, // 172 +0x80, 0x00, 0x80, // 173 +0xE0, 0x00, 0x10, 0x01, 0xE8, 0x02, 0x68, 0x02, 0xC8, 0x02, 0x10, 0x01, 0xE0, // 174 +0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, // 175 +0x00, 0x00, 0x38, 0x00, 0x28, 0x00, 0x38, // 176 +0x40, 0x02, 0x40, 0x02, 0xF0, 0x03, 0x40, 0x02, 0x40, 0x02, // 177 +0x48, 0x00, 0x68, 0x00, 0x58, // 178 +0x48, 0x00, 0x58, 0x00, 0x68, // 179 +0x00, 0x00, 0x10, 0x00, 0x08, // 180 +0x00, 0x00, 0xE0, 0x0F, 0x00, 0x02, 0x00, 0x02, 0xE0, 0x03, // 181 +0x70, 0x00, 0xF8, 0x0F, 0x08, 0x00, 0xF8, 0x0F, 0x08, // 182 +0x00, 0x00, 0x40, // 183 +0x00, 0x00, 0x00, 0x14, 0x00, 0x18, // 184 +0x08, 0x03, 0x88, 0x02, 0xCA, 0x02, 0x69, 0x02, 0x38, 0x02, 0x18, 0x02, // 185 +0x30, 0x00, 0x48, 0x00, 0x48, 0x00, 0x30, // 186 +0x08, 0x03, 0x88, 0x02, 0xC8, 0x02, 0x6A, 0x02, 0x38, 0x02, 0x18, 0x02, // 187 +0x20, 0x02, 0x20, 0x03, 0xA8, 0x02, 0x60, 0x02, 0x20, 0x02, // 188 +0x00, 0x00, 0x10, 0x02, 0x78, 0x01, 0x80, 0x00, 0x60, 0x00, 0x50, 0x02, 0x48, 0x03, 0xC0, 0x02, // 189 +0x48, 0x00, 0x58, 0x00, 0x68, 0x03, 0x80, 0x00, 0x60, 0x01, 0x90, 0x01, 0xC8, 0x03, 0x00, 0x01, // 190 +0x00, 0x00, 0x00, 0x06, 0x00, 0x09, 0xA0, 0x09, 0x00, 0x04, // 191 +0x00, 0x02, 0xC0, 0x01, 0xB0, 0x00, 0x89, 0x00, 0xB2, 0x00, 0xC0, 0x01, 0x00, 0x02, // 192 +0x00, 0x02, 0xC0, 0x01, 0xB0, 0x00, 0x8A, 0x00, 0xB1, 0x00, 0xC0, 0x01, 0x00, 0x02, // 193 +0x00, 0x02, 0xC0, 0x01, 0xB2, 0x00, 0x89, 0x00, 0xB2, 0x00, 0xC0, 0x01, 0x00, 0x02, // 194 +0x00, 0x02, 0xC2, 0x01, 0xB1, 0x00, 0x8A, 0x00, 0xB1, 0x00, 0xC0, 0x01, 0x00, 0x02, // 195 +0x00, 0x02, 0xC0, 0x01, 0xB2, 0x00, 0x88, 0x00, 0xB2, 0x00, 0xC0, 0x01, 0x00, 0x02, // 196 +0x00, 0x02, 0xC0, 0x01, 0xBE, 0x00, 0x8A, 0x00, 0xBE, 0x00, 0xC0, 0x01, 0x00, 0x02, // 197 +0x00, 0x03, 0xC0, 0x00, 0xE0, 0x00, 0x98, 0x00, 0x88, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, // 198 +0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x16, 0x08, 0x1A, 0x10, 0x01, // 199 +0x00, 0x00, 0xF8, 0x03, 0x49, 0x02, 0x4A, 0x02, 0x48, 0x02, 0x48, 0x02, // 200 +0x00, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x4A, 0x02, 0x49, 0x02, 0x48, 0x02, // 201 +0x00, 0x00, 0xFA, 0x03, 0x49, 0x02, 0x4A, 0x02, 0x48, 0x02, 0x48, 0x02, // 202 +0x00, 0x00, 0xF8, 0x03, 0x4A, 0x02, 0x48, 0x02, 0x4A, 0x02, 0x48, 0x02, // 203 +0x00, 0x00, 0xF9, 0x03, 0x02, // 204 +0x02, 0x00, 0xF9, 0x03, // 205 +0x01, 0x00, 0xFA, 0x03, // 206 +0x02, 0x00, 0xF8, 0x03, 0x02, // 207 +0x40, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x02, 0x10, 0x01, 0xE0, // 208 +0x00, 0x00, 0xFA, 0x03, 0x31, 0x00, 0x42, 0x00, 0x81, 0x01, 0xF8, 0x03, // 209 +0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x09, 0x02, 0x0A, 0x02, 0x08, 0x02, 0xF0, 0x01, // 210 +0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x0A, 0x02, 0x09, 0x02, 0x08, 0x02, 0xF0, 0x01, // 211 +0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x0A, 0x02, 0x09, 0x02, 0x0A, 0x02, 0xF0, 0x01, // 212 +0x00, 0x00, 0xF0, 0x01, 0x0A, 0x02, 0x09, 0x02, 0x0A, 0x02, 0x09, 0x02, 0xF0, 0x01, // 213 +0x00, 0x00, 0xF0, 0x01, 0x0A, 0x02, 0x08, 0x02, 0x0A, 0x02, 0x08, 0x02, 0xF0, 0x01, // 214 +0x10, 0x01, 0xA0, 0x00, 0xE0, 0x00, 0xA0, 0x00, 0x10, 0x01, // 215 +0x00, 0x00, 0xF0, 0x02, 0x08, 0x03, 0xC8, 0x02, 0x28, 0x02, 0x18, 0x03, 0xE8, // 216 +0x00, 0x00, 0xF8, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x02, 0xF8, 0x01, // 217 +0x00, 0x00, 0xF8, 0x01, 0x02, 0x02, 0x01, 0x02, 0x00, 0x02, 0xF8, 0x01, // 218 +0x00, 0x00, 0xF8, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x02, 0xF8, 0x01, // 219 +0x00, 0x00, 0xF8, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0xF8, 0x01, // 220 +0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0xC2, 0x03, 0x21, 0x00, 0x10, 0x00, 0x08, // 221 +0x00, 0x00, 0xF8, 0x03, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0xE0, // 222 +0x00, 0x00, 0xF0, 0x03, 0x08, 0x01, 0x48, 0x02, 0xB0, 0x02, 0x80, 0x01, // 223 +0x00, 0x00, 0x00, 0x03, 0xA4, 0x02, 0xA8, 0x02, 0xE0, 0x03, // 224 +0x00, 0x00, 0x00, 0x03, 0xA8, 0x02, 0xA4, 0x02, 0xE0, 0x03, // 225 +0x00, 0x00, 0x00, 0x03, 0xA8, 0x02, 0xA4, 0x02, 0xE8, 0x03, // 226 +0x00, 0x00, 0x08, 0x03, 0xA4, 0x02, 0xA8, 0x02, 0xE4, 0x03, // 227 +0x00, 0x00, 0x00, 0x03, 0xA8, 0x02, 0xA0, 0x02, 0xE8, 0x03, // 228 +0x00, 0x00, 0x00, 0x03, 0xAE, 0x02, 0xAA, 0x02, 0xEE, 0x03, // 229 +0x00, 0x00, 0x40, 0x03, 0xA0, 0x02, 0xA0, 0x02, 0xC0, 0x01, 0xA0, 0x02, 0xA0, 0x02, 0xC0, 0x02, // 230 +0x00, 0x00, 0xC0, 0x01, 0x20, 0x16, 0x20, 0x1A, 0x40, 0x01, // 231 +0x00, 0x00, 0xC0, 0x01, 0xA4, 0x02, 0xA8, 0x02, 0xC0, 0x02, // 232 +0x00, 0x00, 0xC0, 0x01, 0xA8, 0x02, 0xA4, 0x02, 0xC0, 0x02, // 233 +0x00, 0x00, 0xC0, 0x01, 0xA8, 0x02, 0xA4, 0x02, 0xC8, 0x02, // 234 +0x00, 0x00, 0xC0, 0x01, 0xA8, 0x02, 0xA0, 0x02, 0xC8, 0x02, // 235 +0x00, 0x00, 0xE4, 0x03, 0x08, // 236 +0x08, 0x00, 0xE4, 0x03, // 237 +0x08, 0x00, 0xE4, 0x03, 0x08, // 238 +0x08, 0x00, 0xE0, 0x03, 0x08, // 239 +0x00, 0x00, 0xC0, 0x01, 0x28, 0x02, 0x38, 0x02, 0xE0, 0x01, // 240 +0x00, 0x00, 0xE8, 0x03, 0x24, 0x00, 0x28, 0x00, 0xC4, 0x03, // 241 +0x00, 0x00, 0xC0, 0x01, 0x24, 0x02, 0x28, 0x02, 0xC0, 0x01, // 242 +0x00, 0x00, 0xC0, 0x01, 0x28, 0x02, 0x24, 0x02, 0xC0, 0x01, // 243 +0x00, 0x00, 0xC0, 0x01, 0x28, 0x02, 0x24, 0x02, 0xC8, 0x01, // 244 +0x00, 0x00, 0xC8, 0x01, 0x24, 0x02, 0x28, 0x02, 0xC4, 0x01, // 245 +0x00, 0x00, 0xC0, 0x01, 0x28, 0x02, 0x20, 0x02, 0xC8, 0x01, // 246 +0x40, 0x00, 0x40, 0x00, 0x50, 0x01, 0x40, 0x00, 0x40, // 247 +0x00, 0x00, 0xC0, 0x02, 0xA0, 0x03, 0x60, 0x02, 0xA0, 0x01, // 248 +0x00, 0x00, 0xE0, 0x01, 0x04, 0x02, 0x08, 0x02, 0xE0, 0x03, // 249 +0x00, 0x00, 0xE0, 0x01, 0x08, 0x02, 0x04, 0x02, 0xE0, 0x03, // 250 +0x00, 0x00, 0xE8, 0x01, 0x04, 0x02, 0x08, 0x02, 0xE0, 0x03, // 251 +0x00, 0x00, 0xE0, 0x01, 0x08, 0x02, 0x00, 0x02, 0xE8, 0x03, // 252 +0x20, 0x00, 0xC0, 0x09, 0x08, 0x06, 0xC4, 0x01, 0x20, // 253 +0x00, 0x00, 0xF8, 0x0F, 0x20, 0x02, 0x20, 0x02, 0xC0, 0x01, // 254 +0x20, 0x00, 0xC8, 0x09, 0x00, 0x06, 0xC8, 0x01, 0x20, // 255 +}; - // Jump Table: - 0xFF, 0xFF, 0x00, 0x03, // 32:65535 - 0x00, 0x00, 0x04, 0x03, // 33 - 0x00, 0x04, 0x05, 0x04, // 34 - 0x00, 0x09, 0x09, 0x06, // 35 - 0x00, 0x12, 0x0A, 0x06, // 36 - 0x00, 0x1C, 0x10, 0x09, // 37 - 0x00, 0x2C, 0x0E, 0x08, // 38 - 0x00, 0x3A, 0x01, 0x02, // 39 - 0x00, 0x3B, 0x06, 0x04, // 40 - 0x00, 0x41, 0x06, 0x04, // 41 - 0x00, 0x47, 0x05, 0x04, // 42 - 0x00, 0x4C, 0x09, 0x06, // 43 - 0x00, 0x55, 0x04, 0x03, // 44 - 0x00, 0x59, 0x03, 0x03, // 45 - 0x00, 0x5C, 0x04, 0x03, // 46 - 0x00, 0x60, 0x05, 0x04, // 47 - 0x00, 0x65, 0x0A, 0x06, // 48 - 0x00, 0x6F, 0x08, 0x05, // 49 - 0x00, 0x77, 0x0A, 0x06, // 50 - 0x00, 0x81, 0x0A, 0x06, // 51 - 0x00, 0x8B, 0x0B, 0x07, // 52 - 0x00, 0x96, 0x0A, 0x06, // 53 - 0x00, 0xA0, 0x0A, 0x06, // 54 - 0x00, 0xAA, 0x09, 0x06, // 55 - 0x00, 0xB3, 0x0A, 0x06, // 56 - 0x00, 0xBD, 0x0A, 0x06, // 57 - 0x00, 0xC7, 0x04, 0x03, // 58 - 0x00, 0xCB, 0x04, 0x03, // 59 - 0x00, 0xCF, 0x0A, 0x06, // 60 - 0x00, 0xD9, 0x09, 0x06, // 61 - 0x00, 0xE2, 0x09, 0x06, // 62 - 0x00, 0xEB, 0x0B, 0x07, // 63 - 0x00, 0xF6, 0x14, 0x0B, // 64 - 0x01, 0x0A, 0x0E, 0x08, // 65 - 0x01, 0x18, 0x0C, 0x07, // 66 - 0x01, 0x24, 0x0C, 0x07, // 67 - 0x01, 0x30, 0x0B, 0x07, // 68 - 0x01, 0x3B, 0x0C, 0x07, // 69 - 0x01, 0x47, 0x09, 0x06, // 70 - 0x01, 0x50, 0x0D, 0x08, // 71 - 0x01, 0x5D, 0x0C, 0x07, // 72 - 0x01, 0x69, 0x04, 0x03, // 73 - 0x01, 0x6D, 0x08, 0x05, // 74 - 0x01, 0x75, 0x0E, 0x08, // 75 - 0x01, 0x83, 0x0C, 0x07, // 76 - 0x01, 0x8F, 0x10, 0x09, // 77 - 0x01, 0x9F, 0x0C, 0x07, // 78 - 0x01, 0xAB, 0x0E, 0x08, // 79 - 0x01, 0xB9, 0x0B, 0x07, // 80 - 0x01, 0xC4, 0x0E, 0x08, // 81 - 0x01, 0xD2, 0x0C, 0x07, // 82 - 0x01, 0xDE, 0x0C, 0x07, // 83 - 0x01, 0xEA, 0x0B, 0x07, // 84 - 0x01, 0xF5, 0x0C, 0x07, // 85 - 0x02, 0x01, 0x0D, 0x08, // 86 - 0x02, 0x0E, 0x11, 0x0A, // 87 - 0x02, 0x1F, 0x0E, 0x08, // 88 - 0x02, 0x2D, 0x0D, 0x08, // 89 - 0x02, 0x3A, 0x0C, 0x07, // 90 - 0x02, 0x46, 0x06, 0x04, // 91 - 0x02, 0x4C, 0x06, 0x04, // 92 - 0x02, 0x52, 0x04, 0x03, // 93 - 0x02, 0x56, 0x09, 0x06, // 94 - 0x02, 0x5F, 0x0C, 0x07, // 95 - 0x02, 0x6B, 0x03, 0x03, // 96 - 0x02, 0x6E, 0x0A, 0x06, // 97 - 0x02, 0x78, 0x0A, 0x06, // 98 - 0x02, 0x82, 0x0A, 0x06, // 99 - 0x02, 0x8C, 0x0A, 0x06, // 100 - 0x02, 0x96, 0x0A, 0x06, // 101 - 0x02, 0xA0, 0x05, 0x04, // 102 - 0x02, 0xA5, 0x0A, 0x06, // 103 - 0x02, 0xAF, 0x0A, 0x06, // 104 - 0x02, 0xB9, 0x04, 0x03, // 105 - 0x02, 0xBD, 0x04, 0x03, // 106 - 0x02, 0xC1, 0x08, 0x05, // 107 - 0x02, 0xC9, 0x04, 0x03, // 108 - 0x02, 0xCD, 0x10, 0x09, // 109 - 0x02, 0xDD, 0x0A, 0x06, // 110 - 0x02, 0xE7, 0x0A, 0x06, // 111 - 0x02, 0xF1, 0x0A, 0x06, // 112 - 0x02, 0xFB, 0x0A, 0x06, // 113 - 0x03, 0x05, 0x05, 0x04, // 114 - 0x03, 0x0A, 0x08, 0x05, // 115 - 0x03, 0x12, 0x06, 0x04, // 116 - 0x03, 0x18, 0x0A, 0x06, // 117 - 0x03, 0x22, 0x09, 0x06, // 118 - 0x03, 0x2B, 0x0E, 0x08, // 119 - 0x03, 0x39, 0x0A, 0x06, // 120 - 0x03, 0x43, 0x09, 0x06, // 121 - 0x03, 0x4C, 0x0A, 0x06, // 122 - 0x03, 0x56, 0x06, 0x04, // 123 - 0x03, 0x5C, 0x04, 0x03, // 124 - 0x03, 0x60, 0x05, 0x04, // 125 - 0x03, 0x65, 0x09, 0x06, // 126 - 0xFF, 0xFF, 0x00, 0x0A, // 127 - 0xFF, 0xFF, 0x00, 0x0A, // 128 - 0x03, 0x6E, 0x0C, 0x07, // 129 - 0x03, 0x7A, 0x05, 0x04, // 130 - 0x03, 0x7F, 0x0C, 0x07, // 131 - 0x03, 0x8B, 0x0E, 0x08, // 132 - 0x03, 0x99, 0x0C, 0x07, // 133 - 0x03, 0xA5, 0x0C, 0x07, // 134 - 0x03, 0xB1, 0x0A, 0x06, // 135 - 0x03, 0xBB, 0x0A, 0x06, // 136 - 0x03, 0xC5, 0x0A, 0x06, // 137 - 0xFF, 0xFF, 0x00, 0x0A, // 138 - 0xFF, 0xFF, 0x00, 0x0A, // 139 - 0xFF, 0xFF, 0x00, 0x0A, // 140 - 0xFF, 0xFF, 0x00, 0x0A, // 141 - 0xFF, 0xFF, 0x00, 0x0A, // 142 - 0xFF, 0xFF, 0x00, 0x0A, // 143 - 0xFF, 0xFF, 0x00, 0x0A, // 144 - 0xFF, 0xFF, 0x00, 0x0A, // 145 - 0xFF, 0xFF, 0x00, 0x0A, // 146 - 0x03, 0xCF, 0x0E, 0x08, // 147 - 0x03, 0xDD, 0x0A, 0x06, // 148 - 0xFF, 0xFF, 0x00, 0x0A, // 149 - 0xFF, 0xFF, 0x00, 0x0A, // 150 - 0xFF, 0xFF, 0x00, 0x0A, // 151 - 0x03, 0xE7, 0x0C, 0x07, // 152 - 0x03, 0xF3, 0x0C, 0x07, // 153 - 0x03, 0xFF, 0x0C, 0x07, // 154 - 0x04, 0x0B, 0x08, 0x05, // 155 - 0xFF, 0xFF, 0x00, 0x0A, // 156 - 0xFF, 0xFF, 0x00, 0x0A, // 157 - 0xFF, 0xFF, 0x00, 0x0A, // 158 - 0xFF, 0xFF, 0x00, 0x0A, // 159 - 0xFF, 0xFF, 0x00, 0x0A, // 160 - 0x04, 0x13, 0x04, 0x03, // 161 - 0x04, 0x17, 0x0A, 0x06, // 162 - 0x04, 0x21, 0x0C, 0x07, // 163 - 0x04, 0x2D, 0x0A, 0x06, // 164 - 0x04, 0x37, 0x0A, 0x06, // 165 - 0x04, 0x41, 0x04, 0x03, // 166 - 0x04, 0x45, 0x0A, 0x06, // 167 - 0x04, 0x4F, 0x05, 0x04, // 168 - 0x04, 0x54, 0x0D, 0x08, // 169 - 0x04, 0x61, 0x07, 0x05, // 170 - 0x04, 0x68, 0x0A, 0x06, // 171 - 0x04, 0x72, 0x09, 0x06, // 172 - 0x04, 0x7B, 0x03, 0x03, // 173 - 0x04, 0x7E, 0x0D, 0x08, // 174 - 0x04, 0x8B, 0x0B, 0x07, // 175 - 0x04, 0x96, 0x07, 0x05, // 176 - 0x04, 0x9D, 0x0A, 0x06, // 177 - 0x04, 0xA7, 0x05, 0x04, // 178 - 0x04, 0xAC, 0x05, 0x04, // 179 - 0x04, 0xB1, 0x05, 0x04, // 180 - 0x04, 0xB6, 0x0A, 0x06, // 181 - 0x04, 0xC0, 0x09, 0x06, // 182 - 0x04, 0xC9, 0x03, 0x03, // 183 - 0x04, 0xCC, 0x06, 0x04, // 184 - 0x04, 0xD2, 0x0C, 0x07, // 185 - 0x04, 0xDE, 0x07, 0x05, // 186 - 0x04, 0xE5, 0x0C, 0x07, // 187 - 0x04, 0xF1, 0x0A, 0x06, // 188 - 0x04, 0xFB, 0x10, 0x09, // 189 - 0x05, 0x0B, 0x10, 0x09, // 190 - 0x05, 0x1B, 0x0A, 0x06, // 191 - 0x05, 0x25, 0x0E, 0x08, // 192 - 0x05, 0x33, 0x0E, 0x08, // 193 - 0x05, 0x41, 0x0E, 0x08, // 194 - 0x05, 0x4F, 0x0E, 0x08, // 195 - 0x05, 0x5D, 0x0E, 0x08, // 196 - 0x05, 0x6B, 0x0E, 0x08, // 197 - 0x05, 0x79, 0x12, 0x0A, // 198 - 0x05, 0x8B, 0x0C, 0x07, // 199 - 0x05, 0x97, 0x0C, 0x07, // 200 - 0x05, 0xA3, 0x0C, 0x07, // 201 - 0x05, 0xAF, 0x0C, 0x07, // 202 - 0x05, 0xBB, 0x0C, 0x07, // 203 - 0x05, 0xC7, 0x05, 0x04, // 204 - 0x05, 0xCC, 0x04, 0x03, // 205 - 0x05, 0xD0, 0x04, 0x03, // 206 - 0x05, 0xD4, 0x05, 0x04, // 207 - 0x05, 0xD9, 0x0B, 0x07, // 208 - 0x05, 0xE4, 0x0C, 0x07, // 209 - 0x05, 0xF0, 0x0E, 0x08, // 210 - 0x05, 0xFE, 0x0E, 0x08, // 211 - 0x06, 0x0C, 0x0E, 0x08, // 212 - 0x06, 0x1A, 0x0E, 0x08, // 213 - 0x06, 0x28, 0x0E, 0x08, // 214 - 0x06, 0x36, 0x0A, 0x06, // 215 - 0x06, 0x40, 0x0D, 0x08, // 216 - 0x06, 0x4D, 0x0C, 0x07, // 217 - 0x06, 0x59, 0x0C, 0x07, // 218 - 0x06, 0x65, 0x0C, 0x07, // 219 - 0x06, 0x71, 0x0C, 0x07, // 220 - 0x06, 0x7D, 0x0D, 0x08, // 221 - 0x06, 0x8A, 0x0B, 0x07, // 222 - 0x06, 0x95, 0x0C, 0x07, // 223 - 0x06, 0xA1, 0x0A, 0x06, // 224 - 0x06, 0xAB, 0x0A, 0x06, // 225 - 0x06, 0xB5, 0x0A, 0x06, // 226 - 0x06, 0xBF, 0x0A, 0x06, // 227 - 0x06, 0xC9, 0x0A, 0x06, // 228 - 0x06, 0xD3, 0x0A, 0x06, // 229 - 0x06, 0xDD, 0x10, 0x09, // 230 - 0x06, 0xED, 0x0A, 0x06, // 231 - 0x06, 0xF7, 0x0A, 0x06, // 232 - 0x07, 0x01, 0x0A, 0x06, // 233 - 0x07, 0x0B, 0x0A, 0x06, // 234 - 0x07, 0x15, 0x0A, 0x06, // 235 - 0x07, 0x1F, 0x05, 0x04, // 236 - 0x07, 0x24, 0x04, 0x03, // 237 - 0x07, 0x28, 0x05, 0x04, // 238 - 0x07, 0x2D, 0x05, 0x04, // 239 - 0x07, 0x32, 0x0A, 0x06, // 240 - 0x07, 0x3C, 0x0A, 0x06, // 241 - 0x07, 0x46, 0x0A, 0x06, // 242 - 0x07, 0x50, 0x0A, 0x06, // 243 - 0x07, 0x5A, 0x0A, 0x06, // 244 - 0x07, 0x64, 0x0A, 0x06, // 245 - 0x07, 0x6E, 0x0A, 0x06, // 246 - 0x07, 0x78, 0x09, 0x06, // 247 - 0x07, 0x81, 0x0A, 0x06, // 248 - 0x07, 0x8B, 0x0A, 0x06, // 249 - 0x07, 0x95, 0x0A, 0x06, // 250 - 0x07, 0x9F, 0x0A, 0x06, // 251 - 0x07, 0xA9, 0x0A, 0x06, // 252 - 0x07, 0xB3, 0x09, 0x06, // 253 - 0x07, 0xBC, 0x0A, 0x06, // 254 - 0x07, 0xC6, 0x09, 0x06, // 255 - // Font Data: - 0x00, 0x00, 0xF8, 0x02, // 33 - 0x38, 0x00, 0x00, 0x00, 0x38, // 34 - 0xA0, 0x03, 0xE0, 0x00, 0xB8, 0x03, 0xE0, 0x00, 0xB8, // 35 - 0x30, 0x01, 0x28, 0x02, 0xF8, 0x07, 0x48, 0x02, 0x90, 0x01, // 36 - 0x00, 0x00, 0x30, 0x00, 0x48, 0x00, 0x30, 0x03, 0xC0, 0x00, 0xB0, 0x01, 0x48, 0x02, 0x80, 0x01, // 37 - 0x80, 0x01, 0x50, 0x02, 0x68, 0x02, 0xA8, 0x02, 0x18, 0x01, 0x80, 0x03, 0x80, 0x02, // 38 - 0x38, // 39 - 0xE0, 0x03, 0x10, 0x04, 0x08, 0x08, // 40 - 0x08, 0x08, 0x10, 0x04, 0xE0, 0x03, // 41 - 0x28, 0x00, 0x18, 0x00, 0x28, // 42 - 0x40, 0x00, 0x40, 0x00, 0xF0, 0x01, 0x40, 0x00, 0x40, // 43 - 0x00, 0x00, 0x00, 0x06, // 44 - 0x80, 0x00, 0x80, // 45 - 0x00, 0x00, 0x00, 0x02, // 46 - 0x00, 0x03, 0xE0, 0x00, 0x18, // 47 - 0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x02, 0xF0, 0x01, // 48 - 0x00, 0x00, 0x20, 0x00, 0x10, 0x00, 0xF8, 0x03, // 49 - 0x10, 0x02, 0x08, 0x03, 0x88, 0x02, 0x48, 0x02, 0x30, 0x02, // 50 - 0x10, 0x01, 0x08, 0x02, 0x48, 0x02, 0x48, 0x02, 0xB0, 0x01, // 51 - 0xC0, 0x00, 0xA0, 0x00, 0x90, 0x00, 0x88, 0x00, 0xF8, 0x03, 0x80, // 52 - 0x60, 0x01, 0x38, 0x02, 0x28, 0x02, 0x28, 0x02, 0xC8, 0x01, // 53 - 0xF0, 0x01, 0x28, 0x02, 0x28, 0x02, 0x28, 0x02, 0xD0, 0x01, // 54 - 0x08, 0x00, 0x08, 0x03, 0xC8, 0x00, 0x38, 0x00, 0x08, // 55 - 0xB0, 0x01, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, 0xB0, 0x01, // 56 - 0x70, 0x01, 0x88, 0x02, 0x88, 0x02, 0x88, 0x02, 0xF0, 0x01, // 57 - 0x00, 0x00, 0x20, 0x02, // 58 - 0x00, 0x00, 0x20, 0x06, // 59 - 0x00, 0x00, 0x40, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0x10, 0x01, // 60 - 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, // 61 - 0x00, 0x00, 0x10, 0x01, 0xA0, 0x00, 0xA0, 0x00, 0x40, // 62 - 0x10, 0x00, 0x08, 0x00, 0x08, 0x00, 0xC8, 0x02, 0x48, 0x00, 0x30, // 63 - 0x00, 0x00, 0xC0, 0x03, 0x30, 0x04, 0xD0, 0x09, 0x28, 0x0A, 0x28, 0x0A, 0xC8, 0x0B, 0x68, 0x0A, 0x10, 0x05, 0xE0, 0x04, // 64 - 0x00, 0x02, 0xC0, 0x01, 0xB0, 0x00, 0x88, 0x00, 0xB0, 0x00, 0xC0, 0x01, 0x00, 0x02, // 65 - 0x00, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, 0xF0, 0x01, // 66 - 0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x02, 0x10, 0x01, // 67 - 0x00, 0x00, 0xF8, 0x03, 0x08, 0x02, 0x08, 0x02, 0x10, 0x01, 0xE0, // 68 - 0x00, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, // 69 - 0x00, 0x00, 0xF8, 0x03, 0x48, 0x00, 0x48, 0x00, 0x08, // 70 - 0x00, 0x00, 0xE0, 0x00, 0x10, 0x01, 0x08, 0x02, 0x48, 0x02, 0x50, 0x01, 0xC0, // 71 - 0x00, 0x00, 0xF8, 0x03, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0xF8, 0x03, // 72 - 0x00, 0x00, 0xF8, 0x03, // 73 - 0x00, 0x03, 0x00, 0x02, 0x00, 0x02, 0xF8, 0x01, // 74 - 0x00, 0x00, 0xF8, 0x03, 0x80, 0x00, 0x60, 0x00, 0x90, 0x00, 0x08, 0x01, 0x00, 0x02, // 75 - 0x00, 0x00, 0xF8, 0x03, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, // 76 - 0x00, 0x00, 0xF8, 0x03, 0x30, 0x00, 0xC0, 0x01, 0x00, 0x02, 0xC0, 0x01, 0x30, 0x00, 0xF8, 0x03, // 77 - 0x00, 0x00, 0xF8, 0x03, 0x30, 0x00, 0x40, 0x00, 0x80, 0x01, 0xF8, 0x03, // 78 - 0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x02, 0x08, 0x02, 0xF0, 0x01, // 79 - 0x00, 0x00, 0xF8, 0x03, 0x48, 0x00, 0x48, 0x00, 0x48, 0x00, 0x30, // 80 - 0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x03, 0x08, 0x03, 0xF0, 0x02, // 81 - 0x00, 0x00, 0xF8, 0x03, 0x48, 0x00, 0x48, 0x00, 0xC8, 0x00, 0x30, 0x03, // 82 - 0x00, 0x00, 0x30, 0x01, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, 0x90, 0x01, // 83 - 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0xF8, 0x03, 0x08, 0x00, 0x08, // 84 - 0x00, 0x00, 0xF8, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0xF8, 0x01, // 85 - 0x08, 0x00, 0x70, 0x00, 0x80, 0x01, 0x00, 0x02, 0x80, 0x01, 0x70, 0x00, 0x08, // 86 - 0x18, 0x00, 0xE0, 0x01, 0x00, 0x02, 0xF0, 0x01, 0x08, 0x00, 0xF0, 0x01, 0x00, 0x02, 0xE0, 0x01, 0x18, // 87 - 0x00, 0x02, 0x08, 0x01, 0x90, 0x00, 0x60, 0x00, 0x90, 0x00, 0x08, 0x01, 0x00, 0x02, // 88 - 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0xC0, 0x03, 0x20, 0x00, 0x10, 0x00, 0x08, // 89 - 0x08, 0x03, 0x88, 0x02, 0xC8, 0x02, 0x68, 0x02, 0x38, 0x02, 0x18, 0x02, // 90 - 0x00, 0x00, 0xF8, 0x0F, 0x08, 0x08, // 91 - 0x18, 0x00, 0xE0, 0x00, 0x00, 0x03, // 92 - 0x08, 0x08, 0xF8, 0x0F, // 93 - 0x40, 0x00, 0x30, 0x00, 0x08, 0x00, 0x30, 0x00, 0x40, // 94 - 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, // 95 - 0x08, 0x00, 0x10, // 96 - 0x00, 0x00, 0x00, 0x03, 0xA0, 0x02, 0xA0, 0x02, 0xE0, 0x03, // 97 - 0x00, 0x00, 0xF8, 0x03, 0x20, 0x02, 0x20, 0x02, 0xC0, 0x01, // 98 - 0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x20, 0x02, 0x40, 0x01, // 99 - 0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x20, 0x02, 0xF8, 0x03, // 100 - 0x00, 0x00, 0xC0, 0x01, 0xA0, 0x02, 0xA0, 0x02, 0xC0, 0x02, // 101 - 0x20, 0x00, 0xF0, 0x03, 0x28, // 102 - 0x00, 0x00, 0xC0, 0x05, 0x20, 0x0A, 0x20, 0x0A, 0xE0, 0x07, // 103 - 0x00, 0x00, 0xF8, 0x03, 0x20, 0x00, 0x20, 0x00, 0xC0, 0x03, // 104 - 0x00, 0x00, 0xE8, 0x03, // 105 - 0x00, 0x08, 0xE8, 0x07, // 106 - 0xF8, 0x03, 0x80, 0x00, 0xC0, 0x01, 0x20, 0x02, // 107 - 0x00, 0x00, 0xF8, 0x03, // 108 - 0x00, 0x00, 0xE0, 0x03, 0x20, 0x00, 0x20, 0x00, 0xE0, 0x03, 0x20, 0x00, 0x20, 0x00, 0xC0, 0x03, // 109 - 0x00, 0x00, 0xE0, 0x03, 0x20, 0x00, 0x20, 0x00, 0xC0, 0x03, // 110 - 0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x20, 0x02, 0xC0, 0x01, // 111 - 0x00, 0x00, 0xE0, 0x0F, 0x20, 0x02, 0x20, 0x02, 0xC0, 0x01, // 112 - 0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x20, 0x02, 0xE0, 0x0F, // 113 - 0x00, 0x00, 0xE0, 0x03, 0x20, // 114 - 0x40, 0x02, 0xA0, 0x02, 0xA0, 0x02, 0x20, 0x01, // 115 - 0x20, 0x00, 0xF8, 0x03, 0x20, 0x02, // 116 - 0x00, 0x00, 0xE0, 0x01, 0x00, 0x02, 0x00, 0x02, 0xE0, 0x03, // 117 - 0x20, 0x00, 0xC0, 0x01, 0x00, 0x02, 0xC0, 0x01, 0x20, // 118 - 0xE0, 0x01, 0x00, 0x02, 0xC0, 0x01, 0x20, 0x00, 0xC0, 0x01, 0x00, 0x02, 0xE0, 0x01, // 119 - 0x20, 0x02, 0x40, 0x01, 0x80, 0x00, 0x40, 0x01, 0x20, 0x02, // 120 - 0x20, 0x00, 0xC0, 0x09, 0x00, 0x06, 0xC0, 0x01, 0x20, // 121 - 0x20, 0x02, 0x20, 0x03, 0xA0, 0x02, 0x60, 0x02, 0x20, 0x02, // 122 - 0x80, 0x00, 0x78, 0x0F, 0x08, 0x08, // 123 - 0x00, 0x00, 0xF8, 0x0F, // 124 - 0x08, 0x08, 0x78, 0x0F, 0x80, // 125 - 0xC0, 0x00, 0x40, 0x00, 0xC0, 0x00, 0x80, 0x00, 0xC0, // 126 - 0x00, 0x00, 0xF8, 0x03, 0x40, 0x02, 0x20, 0x02, 0x00, 0x02, 0x00, 0x02, // 129 - 0x40, 0x00, 0xF8, 0x03, 0x20, // 130 - 0x00, 0x00, 0xF8, 0x03, 0x30, 0x00, 0x44, 0x00, 0x82, 0x01, 0xF8, 0x03, // 131 - 0x00, 0x02, 0xC0, 0x01, 0xB0, 0x00, 0x88, 0x00, 0xB0, 0x00, 0xC0, 0x05, 0x00, 0x0A, // 132 - 0x00, 0x00, 0x00, 0x03, 0xA0, 0x02, 0xA0, 0x02, 0xE0, 0x07, 0x00, 0x08, // 133 - 0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x0A, 0x02, 0x09, 0x02, 0x10, 0x01, // 134 - 0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x28, 0x02, 0x44, 0x01, // 135 - 0x00, 0x00, 0xE0, 0x03, 0x20, 0x00, 0x28, 0x00, 0xC4, 0x03, // 136 - 0x20, 0x02, 0x20, 0x03, 0xA8, 0x02, 0x64, 0x02, 0x20, 0x02, // 137 - 0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x0A, 0x02, 0x09, 0x02, 0xF0, 0x01, // 147 - 0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x28, 0x02, 0xC4, 0x01, // 148 - 0x00, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x02, 0x48, 0x06, 0x48, 0x0A, // 152 - 0x00, 0x00, 0xC0, 0x01, 0xA0, 0x02, 0xA0, 0x02, 0xC0, 0x06, 0x00, 0x08, // 153 - 0x00, 0x00, 0x30, 0x01, 0x48, 0x02, 0x4A, 0x02, 0x49, 0x02, 0x90, 0x01, // 154 - 0x40, 0x02, 0xA0, 0x02, 0xA8, 0x02, 0x24, 0x01, // 155 - 0x00, 0x00, 0xA0, 0x0F, // 161 - 0x00, 0x00, 0xC0, 0x01, 0xA0, 0x0F, 0x78, 0x02, 0x40, 0x01, // 162 - 0x40, 0x02, 0x70, 0x03, 0xC8, 0x02, 0x48, 0x02, 0x08, 0x02, 0x10, 0x02, // 163 - 0x00, 0x00, 0xE0, 0x01, 0x20, 0x01, 0x20, 0x01, 0xE0, 0x01, // 164 - 0x48, 0x01, 0x70, 0x01, 0xC0, 0x03, 0x70, 0x01, 0x48, 0x01, // 165 - 0x00, 0x00, 0x38, 0x0F, // 166 - 0xD0, 0x04, 0x28, 0x09, 0x48, 0x09, 0x48, 0x0A, 0x90, 0x05, // 167 - 0x08, 0x00, 0x00, 0x00, 0x08, // 168 - 0xE0, 0x00, 0x10, 0x01, 0x48, 0x02, 0xA8, 0x02, 0xA8, 0x02, 0x10, 0x01, 0xE0, // 169 - 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x78, // 170 - 0x00, 0x00, 0x80, 0x01, 0x40, 0x02, 0x80, 0x01, 0x40, 0x02, // 171 - 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0xE0, // 172 - 0x80, 0x00, 0x80, // 173 - 0xE0, 0x00, 0x10, 0x01, 0xE8, 0x02, 0x68, 0x02, 0xC8, 0x02, 0x10, 0x01, 0xE0, // 174 - 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, // 175 - 0x00, 0x00, 0x38, 0x00, 0x28, 0x00, 0x38, // 176 - 0x40, 0x02, 0x40, 0x02, 0xF0, 0x03, 0x40, 0x02, 0x40, 0x02, // 177 - 0x48, 0x00, 0x68, 0x00, 0x58, // 178 - 0x48, 0x00, 0x58, 0x00, 0x68, // 179 - 0x00, 0x00, 0x10, 0x00, 0x08, // 180 - 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x02, 0x00, 0x02, 0xE0, 0x03, // 181 - 0x70, 0x00, 0xF8, 0x0F, 0x08, 0x00, 0xF8, 0x0F, 0x08, // 182 - 0x00, 0x00, 0x40, // 183 - 0x00, 0x00, 0x00, 0x14, 0x00, 0x18, // 184 - 0x08, 0x03, 0x88, 0x02, 0xCA, 0x02, 0x69, 0x02, 0x38, 0x02, 0x18, 0x02, // 185 - 0x30, 0x00, 0x48, 0x00, 0x48, 0x00, 0x30, // 186 - 0x08, 0x03, 0x88, 0x02, 0xC8, 0x02, 0x6A, 0x02, 0x38, 0x02, 0x18, 0x02, // 187 - 0x20, 0x02, 0x20, 0x03, 0xA8, 0x02, 0x60, 0x02, 0x20, 0x02, // 188 - 0x00, 0x00, 0x10, 0x02, 0x78, 0x01, 0x80, 0x00, 0x60, 0x00, 0x50, 0x02, 0x48, 0x03, 0xC0, 0x02, // 189 - 0x48, 0x00, 0x58, 0x00, 0x68, 0x03, 0x80, 0x00, 0x60, 0x01, 0x90, 0x01, 0xC8, 0x03, 0x00, 0x01, // 190 - 0x00, 0x00, 0x00, 0x06, 0x00, 0x09, 0xA0, 0x09, 0x00, 0x04, // 191 - 0x00, 0x02, 0xC0, 0x01, 0xB0, 0x00, 0x89, 0x00, 0xB2, 0x00, 0xC0, 0x01, 0x00, 0x02, // 192 - 0x00, 0x02, 0xC0, 0x01, 0xB0, 0x00, 0x8A, 0x00, 0xB1, 0x00, 0xC0, 0x01, 0x00, 0x02, // 193 - 0x00, 0x02, 0xC0, 0x01, 0xB2, 0x00, 0x89, 0x00, 0xB2, 0x00, 0xC0, 0x01, 0x00, 0x02, // 194 - 0x00, 0x02, 0xC2, 0x01, 0xB1, 0x00, 0x8A, 0x00, 0xB1, 0x00, 0xC0, 0x01, 0x00, 0x02, // 195 - 0x00, 0x02, 0xC0, 0x01, 0xB2, 0x00, 0x88, 0x00, 0xB2, 0x00, 0xC0, 0x01, 0x00, 0x02, // 196 - 0x00, 0x02, 0xC0, 0x01, 0xBE, 0x00, 0x8A, 0x00, 0xBE, 0x00, 0xC0, 0x01, 0x00, 0x02, // 197 - 0x00, 0x03, 0xC0, 0x00, 0xE0, 0x00, 0x98, 0x00, 0x88, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, // 198 - 0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x16, 0x08, 0x1A, 0x10, 0x01, // 199 - 0x00, 0x00, 0xF8, 0x03, 0x49, 0x02, 0x4A, 0x02, 0x48, 0x02, 0x48, 0x02, // 200 - 0x00, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x4A, 0x02, 0x49, 0x02, 0x48, 0x02, // 201 - 0x00, 0x00, 0xFA, 0x03, 0x49, 0x02, 0x4A, 0x02, 0x48, 0x02, 0x48, 0x02, // 202 - 0x00, 0x00, 0xF8, 0x03, 0x4A, 0x02, 0x48, 0x02, 0x4A, 0x02, 0x48, 0x02, // 203 - 0x00, 0x00, 0xF9, 0x03, 0x02, // 204 - 0x02, 0x00, 0xF9, 0x03, // 205 - 0x01, 0x00, 0xFA, 0x03, // 206 - 0x02, 0x00, 0xF8, 0x03, 0x02, // 207 - 0x40, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x02, 0x10, 0x01, 0xE0, // 208 - 0x00, 0x00, 0xFA, 0x03, 0x31, 0x00, 0x42, 0x00, 0x81, 0x01, 0xF8, 0x03, // 209 - 0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x09, 0x02, 0x0A, 0x02, 0x08, 0x02, 0xF0, 0x01, // 210 - 0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x0A, 0x02, 0x09, 0x02, 0x08, 0x02, 0xF0, 0x01, // 211 - 0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x0A, 0x02, 0x09, 0x02, 0x0A, 0x02, 0xF0, 0x01, // 212 - 0x00, 0x00, 0xF0, 0x01, 0x0A, 0x02, 0x09, 0x02, 0x0A, 0x02, 0x09, 0x02, 0xF0, 0x01, // 213 - 0x00, 0x00, 0xF0, 0x01, 0x0A, 0x02, 0x08, 0x02, 0x0A, 0x02, 0x08, 0x02, 0xF0, 0x01, // 214 - 0x10, 0x01, 0xA0, 0x00, 0xE0, 0x00, 0xA0, 0x00, 0x10, 0x01, // 215 - 0x00, 0x00, 0xF0, 0x02, 0x08, 0x03, 0xC8, 0x02, 0x28, 0x02, 0x18, 0x03, 0xE8, // 216 - 0x00, 0x00, 0xF8, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x02, 0xF8, 0x01, // 217 - 0x00, 0x00, 0xF8, 0x01, 0x02, 0x02, 0x01, 0x02, 0x00, 0x02, 0xF8, 0x01, // 218 - 0x00, 0x00, 0xF8, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x02, 0xF8, 0x01, // 219 - 0x00, 0x00, 0xF8, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0xF8, 0x01, // 220 - 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0xC2, 0x03, 0x21, 0x00, 0x10, 0x00, 0x08, // 221 - 0x00, 0x00, 0xF8, 0x03, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0xE0, // 222 - 0x00, 0x00, 0xF0, 0x03, 0x08, 0x01, 0x48, 0x02, 0xB0, 0x02, 0x80, 0x01, // 223 - 0x00, 0x00, 0x00, 0x03, 0xA4, 0x02, 0xA8, 0x02, 0xE0, 0x03, // 224 - 0x00, 0x00, 0x00, 0x03, 0xA8, 0x02, 0xA4, 0x02, 0xE0, 0x03, // 225 - 0x00, 0x00, 0x00, 0x03, 0xA8, 0x02, 0xA4, 0x02, 0xE8, 0x03, // 226 - 0x00, 0x00, 0x08, 0x03, 0xA4, 0x02, 0xA8, 0x02, 0xE4, 0x03, // 227 - 0x00, 0x00, 0x00, 0x03, 0xA8, 0x02, 0xA0, 0x02, 0xE8, 0x03, // 228 - 0x00, 0x00, 0x00, 0x03, 0xAE, 0x02, 0xAA, 0x02, 0xEE, 0x03, // 229 - 0x00, 0x00, 0x40, 0x03, 0xA0, 0x02, 0xA0, 0x02, 0xC0, 0x01, 0xA0, 0x02, 0xA0, 0x02, 0xC0, 0x02, // 230 - 0x00, 0x00, 0xC0, 0x01, 0x20, 0x16, 0x20, 0x1A, 0x40, 0x01, // 231 - 0x00, 0x00, 0xC0, 0x01, 0xA4, 0x02, 0xA8, 0x02, 0xC0, 0x02, // 232 - 0x00, 0x00, 0xC0, 0x01, 0xA8, 0x02, 0xA4, 0x02, 0xC0, 0x02, // 233 - 0x00, 0x00, 0xC0, 0x01, 0xA8, 0x02, 0xA4, 0x02, 0xC8, 0x02, // 234 - 0x00, 0x00, 0xC0, 0x01, 0xA8, 0x02, 0xA0, 0x02, 0xC8, 0x02, // 235 - 0x00, 0x00, 0xE4, 0x03, 0x08, // 236 - 0x08, 0x00, 0xE4, 0x03, // 237 - 0x08, 0x00, 0xE4, 0x03, 0x08, // 238 - 0x08, 0x00, 0xE0, 0x03, 0x08, // 239 - 0x00, 0x00, 0xC0, 0x01, 0x28, 0x02, 0x38, 0x02, 0xE0, 0x01, // 240 - 0x00, 0x00, 0xE8, 0x03, 0x24, 0x00, 0x28, 0x00, 0xC4, 0x03, // 241 - 0x00, 0x00, 0xC0, 0x01, 0x24, 0x02, 0x28, 0x02, 0xC0, 0x01, // 242 - 0x00, 0x00, 0xC0, 0x01, 0x28, 0x02, 0x24, 0x02, 0xC0, 0x01, // 243 - 0x00, 0x00, 0xC0, 0x01, 0x28, 0x02, 0x24, 0x02, 0xC8, 0x01, // 244 - 0x00, 0x00, 0xC8, 0x01, 0x24, 0x02, 0x28, 0x02, 0xC4, 0x01, // 245 - 0x00, 0x00, 0xC0, 0x01, 0x28, 0x02, 0x20, 0x02, 0xC8, 0x01, // 246 - 0x40, 0x00, 0x40, 0x00, 0x50, 0x01, 0x40, 0x00, 0x40, // 247 - 0x00, 0x00, 0xC0, 0x02, 0xA0, 0x03, 0x60, 0x02, 0xA0, 0x01, // 248 - 0x00, 0x00, 0xE0, 0x01, 0x04, 0x02, 0x08, 0x02, 0xE0, 0x03, // 249 - 0x00, 0x00, 0xE0, 0x01, 0x08, 0x02, 0x04, 0x02, 0xE0, 0x03, // 250 - 0x00, 0x00, 0xE8, 0x01, 0x04, 0x02, 0x08, 0x02, 0xE0, 0x03, // 251 - 0x00, 0x00, 0xE0, 0x01, 0x08, 0x02, 0x00, 0x02, 0xE8, 0x03, // 252 - 0x20, 0x00, 0xC0, 0x09, 0x08, 0x06, 0xC4, 0x01, 0x20, // 253 - 0x00, 0x00, 0xF8, 0x0F, 0x20, 0x02, 0x20, 0x02, 0xC0, 0x01, // 254 - 0x20, 0x00, 0xC8, 0x09, 0x00, 0x06, 0xC8, 0x01, 0x20, // 255 +const uint8_t ArialMT_Plain_16_PL[] PROGMEM = { +0x10, // Width: 16 +0x13, // Height: 19 +0x20, // First char: 32 +0xE0, // Number of chars: 224 +// Jump Table: +0xFF, 0xFF, 0x00, 0x04, // 32 +0x00, 0x00, 0x08, 0x04, // 33 +0x00, 0x08, 0x0D, 0x06, // 34 +0x00, 0x15, 0x1A, 0x0A, // 35 +0x00, 0x2F, 0x17, 0x09, // 36 +0x00, 0x46, 0x26, 0x0E, // 37 +0x00, 0x6C, 0x1D, 0x0B, // 38 +0x00, 0x89, 0x04, 0x03, // 39 +0x00, 0x8D, 0x0C, 0x05, // 40 +0x00, 0x99, 0x0B, 0x05, // 41 +0x00, 0xA4, 0x0D, 0x06, // 42 +0x00, 0xB1, 0x17, 0x09, // 43 +0x00, 0xC8, 0x09, 0x04, // 44 +0x00, 0xD1, 0x0B, 0x05, // 45 +0x00, 0xDC, 0x08, 0x04, // 46 +0x00, 0xE4, 0x0A, 0x05, // 47 +0x00, 0xEE, 0x17, 0x09, // 48 +0x01, 0x05, 0x11, 0x07, // 49 +0x01, 0x16, 0x17, 0x09, // 50 +0x01, 0x2D, 0x17, 0x09, // 51 +0x01, 0x44, 0x17, 0x09, // 52 +0x01, 0x5B, 0x17, 0x09, // 53 +0x01, 0x72, 0x17, 0x09, // 54 +0x01, 0x89, 0x16, 0x09, // 55 +0x01, 0x9F, 0x17, 0x09, // 56 +0x01, 0xB6, 0x17, 0x09, // 57 +0x01, 0xCD, 0x05, 0x03, // 58 +0x01, 0xD2, 0x06, 0x03, // 59 +0x01, 0xD8, 0x17, 0x09, // 60 +0x01, 0xEF, 0x17, 0x09, // 61 +0x02, 0x06, 0x17, 0x09, // 62 +0x02, 0x1D, 0x16, 0x09, // 63 +0x02, 0x33, 0x2F, 0x11, // 64 +0x02, 0x62, 0x1D, 0x0B, // 65 +0x02, 0x7F, 0x1D, 0x0B, // 66 +0x02, 0x9C, 0x20, 0x0C, // 67 +0x02, 0xBC, 0x20, 0x0C, // 68 +0x02, 0xDC, 0x1D, 0x0B, // 69 +0x02, 0xF9, 0x19, 0x0A, // 70 +0x03, 0x12, 0x20, 0x0C, // 71 +0x03, 0x32, 0x1D, 0x0B, // 72 +0x03, 0x4F, 0x05, 0x03, // 73 +0x03, 0x54, 0x14, 0x08, // 74 +0x03, 0x68, 0x1D, 0x0B, // 75 +0x03, 0x85, 0x17, 0x09, // 76 +0x03, 0x9C, 0x23, 0x0D, // 77 +0x03, 0xBF, 0x1D, 0x0B, // 78 +0x03, 0xDC, 0x20, 0x0C, // 79 +0x03, 0xFC, 0x1C, 0x0B, // 80 +0x04, 0x18, 0x20, 0x0C, // 81 +0x04, 0x38, 0x1D, 0x0B, // 82 +0x04, 0x55, 0x1D, 0x0B, // 83 +0x04, 0x72, 0x19, 0x0A, // 84 +0x04, 0x8B, 0x1D, 0x0B, // 85 +0x04, 0xA8, 0x1C, 0x0B, // 86 +0x04, 0xC4, 0x2B, 0x10, // 87 +0x04, 0xEF, 0x20, 0x0C, // 88 +0x05, 0x0F, 0x19, 0x0A, // 89 +0x05, 0x28, 0x1A, 0x0A, // 90 +0x05, 0x42, 0x0C, 0x05, // 91 +0x05, 0x4E, 0x0B, 0x05, // 92 +0x05, 0x59, 0x09, 0x04, // 93 +0x05, 0x62, 0x14, 0x08, // 94 +0x05, 0x76, 0x1B, 0x0A, // 95 +0x05, 0x91, 0x07, 0x04, // 96 +0x05, 0x98, 0x17, 0x09, // 97 +0x05, 0xAF, 0x17, 0x09, // 98 +0x05, 0xC6, 0x14, 0x08, // 99 +0x05, 0xDA, 0x17, 0x09, // 100 +0x05, 0xF1, 0x17, 0x09, // 101 +0x06, 0x08, 0x0A, 0x05, // 102 +0x06, 0x12, 0x17, 0x09, // 103 +0x06, 0x29, 0x14, 0x08, // 104 +0x06, 0x3D, 0x05, 0x03, // 105 +0x06, 0x42, 0x06, 0x03, // 106 +0x06, 0x48, 0x17, 0x09, // 107 +0x06, 0x5F, 0x05, 0x03, // 108 +0x06, 0x64, 0x23, 0x0D, // 109 +0x06, 0x87, 0x14, 0x08, // 110 +0x06, 0x9B, 0x17, 0x09, // 111 +0x06, 0xB2, 0x17, 0x09, // 112 +0x06, 0xC9, 0x18, 0x09, // 113 +0x06, 0xE1, 0x0D, 0x06, // 114 +0x06, 0xEE, 0x14, 0x08, // 115 +0x07, 0x02, 0x0B, 0x05, // 116 +0x07, 0x0D, 0x14, 0x08, // 117 +0x07, 0x21, 0x13, 0x08, // 118 +0x07, 0x34, 0x1F, 0x0C, // 119 +0x07, 0x53, 0x14, 0x08, // 120 +0x07, 0x67, 0x13, 0x08, // 121 +0x07, 0x7A, 0x14, 0x08, // 122 +0x07, 0x8E, 0x0F, 0x06, // 123 +0x07, 0x9D, 0x06, 0x03, // 124 +0x07, 0xA3, 0x0E, 0x06, // 125 +0x07, 0xB1, 0x17, 0x09, // 126 +0xFF, 0xFF, 0x00, 0x10, // 127 +0xFF, 0xFF, 0x00, 0x10, // 128 +0x07, 0xC8, 0x17, 0x09, // 129 +0x07, 0xDF, 0x07, 0x04, // 130 +0x07, 0xE6, 0x1D, 0x0B, // 131 +0x08, 0x03, 0x1E, 0x0B, // 132 +0x08, 0x21, 0x1B, 0x0A, // 133 +0x08, 0x3C, 0x20, 0x0C, // 134 +0x08, 0x5C, 0x14, 0x08, // 135 +0x08, 0x70, 0x14, 0x08, // 136 +0x08, 0x84, 0x14, 0x08, // 137 +0xFF, 0xFF, 0x00, 0x10, // 138 +0xFF, 0xFF, 0x00, 0x10, // 139 +0xFF, 0xFF, 0x00, 0x10, // 140 +0xFF, 0xFF, 0x00, 0x10, // 141 +0xFF, 0xFF, 0x00, 0x10, // 142 +0xFF, 0xFF, 0x00, 0x10, // 143 +0xFF, 0xFF, 0x00, 0x10, // 144 +0xFF, 0xFF, 0x00, 0x10, // 145 +0xFF, 0xFF, 0x00, 0x10, // 146 +0x08, 0x98, 0x20, 0x0C, // 147 +0x08, 0xB8, 0x17, 0x09, // 148 +0xFF, 0xFF, 0x00, 0x10, // 149 +0xFF, 0xFF, 0x00, 0x10, // 150 +0xFF, 0xFF, 0x00, 0x10, // 151 +0x08, 0xCF, 0x1D, 0x0B, // 152 +0x08, 0xEC, 0x17, 0x09, // 153 +0x09, 0x03, 0x1D, 0x0B, // 154 +0x09, 0x20, 0x14, 0x08, // 155 +0xFF, 0xFF, 0x00, 0x10, // 156 +0xFF, 0xFF, 0x00, 0x10, // 157 +0xFF, 0xFF, 0x00, 0x10, // 158 +0xFF, 0xFF, 0x00, 0x10, // 159 +0xFF, 0xFF, 0x00, 0x10, // 160 +0x09, 0x34, 0x09, 0x04, // 161 +0x09, 0x3D, 0x17, 0x09, // 162 +0x09, 0x54, 0x17, 0x09, // 163 +0x09, 0x6B, 0x14, 0x08, // 164 +0x09, 0x7F, 0x1A, 0x0A, // 165 +0x09, 0x99, 0x06, 0x03, // 166 +0x09, 0x9F, 0x17, 0x09, // 167 +0x09, 0xB6, 0x07, 0x04, // 168 +0x09, 0xBD, 0x23, 0x0D, // 169 +0x09, 0xE0, 0x0E, 0x06, // 170 +0x09, 0xEE, 0x14, 0x08, // 171 +0x0A, 0x02, 0x17, 0x09, // 172 +0x0A, 0x19, 0x0B, 0x05, // 173 +0x0A, 0x24, 0x23, 0x0D, // 174 +0x0A, 0x47, 0x19, 0x0A, // 175 +0x0A, 0x60, 0x0D, 0x06, // 176 +0x0A, 0x6D, 0x17, 0x09, // 177 +0x0A, 0x84, 0x0E, 0x06, // 178 +0x0A, 0x92, 0x0D, 0x06, // 179 +0x0A, 0x9F, 0x0A, 0x05, // 180 +0x0A, 0xA9, 0x17, 0x09, // 181 +0x0A, 0xC0, 0x19, 0x0A, // 182 +0x0A, 0xD9, 0x08, 0x04, // 183 +0x0A, 0xE1, 0x0C, 0x05, // 184 +0x0A, 0xED, 0x1A, 0x0A, // 185 +0x0B, 0x07, 0x0D, 0x06, // 186 +0x0B, 0x14, 0x1A, 0x0A, // 187 +0x0B, 0x2E, 0x14, 0x08, // 188 +0x0B, 0x42, 0x26, 0x0E, // 189 +0x0B, 0x68, 0x26, 0x0E, // 190 +0x0B, 0x8E, 0x1A, 0x0A, // 191 +0x0B, 0xA8, 0x1D, 0x0B, // 192 +0x0B, 0xC5, 0x1D, 0x0B, // 193 +0x0B, 0xE2, 0x1D, 0x0B, // 194 +0x0B, 0xFF, 0x1D, 0x0B, // 195 +0x0C, 0x1C, 0x1D, 0x0B, // 196 +0x0C, 0x39, 0x1D, 0x0B, // 197 +0x0C, 0x56, 0x2C, 0x10, // 198 +0x0C, 0x82, 0x20, 0x0C, // 199 +0x0C, 0xA2, 0x1D, 0x0B, // 200 +0x0C, 0xBF, 0x1D, 0x0B, // 201 +0x0C, 0xDC, 0x1D, 0x0B, // 202 +0x0C, 0xF9, 0x1D, 0x0B, // 203 +0x0D, 0x16, 0x05, 0x03, // 204 +0x0D, 0x1B, 0x07, 0x04, // 205 +0x0D, 0x22, 0x0A, 0x05, // 206 +0x0D, 0x2C, 0x07, 0x04, // 207 +0x0D, 0x33, 0x20, 0x0C, // 208 +0x0D, 0x53, 0x1D, 0x0B, // 209 +0x0D, 0x70, 0x20, 0x0C, // 210 +0x0D, 0x90, 0x20, 0x0C, // 211 +0x0D, 0xB0, 0x20, 0x0C, // 212 +0x0D, 0xD0, 0x20, 0x0C, // 213 +0x0D, 0xF0, 0x20, 0x0C, // 214 +0x0E, 0x10, 0x17, 0x09, // 215 +0x0E, 0x27, 0x20, 0x0C, // 216 +0x0E, 0x47, 0x1D, 0x0B, // 217 +0x0E, 0x64, 0x1D, 0x0B, // 218 +0x0E, 0x81, 0x1D, 0x0B, // 219 +0x0E, 0x9E, 0x1D, 0x0B, // 220 +0x0E, 0xBB, 0x19, 0x0A, // 221 +0x0E, 0xD4, 0x1D, 0x0B, // 222 +0x0E, 0xF1, 0x17, 0x09, // 223 +0x0F, 0x08, 0x17, 0x09, // 224 +0x0F, 0x1F, 0x17, 0x09, // 225 +0x0F, 0x36, 0x17, 0x09, // 226 +0x0F, 0x4D, 0x17, 0x09, // 227 +0x0F, 0x64, 0x17, 0x09, // 228 +0x0F, 0x7B, 0x17, 0x09, // 229 +0x0F, 0x92, 0x29, 0x0F, // 230 +0x0F, 0xBB, 0x14, 0x08, // 231 +0x0F, 0xCF, 0x17, 0x09, // 232 +0x0F, 0xE6, 0x17, 0x09, // 233 +0x0F, 0xFD, 0x17, 0x09, // 234 +0x10, 0x14, 0x17, 0x09, // 235 +0x10, 0x2B, 0x05, 0x03, // 236 +0x10, 0x30, 0x07, 0x04, // 237 +0x10, 0x37, 0x0A, 0x05, // 238 +0x10, 0x41, 0x07, 0x04, // 239 +0x10, 0x48, 0x17, 0x09, // 240 +0x10, 0x5F, 0x14, 0x08, // 241 +0x10, 0x73, 0x17, 0x09, // 242 +0x10, 0x8A, 0x17, 0x09, // 243 +0x10, 0xA1, 0x17, 0x09, // 244 +0x10, 0xB8, 0x17, 0x09, // 245 +0x10, 0xCF, 0x17, 0x09, // 246 +0x10, 0xE6, 0x17, 0x09, // 247 +0x10, 0xFD, 0x17, 0x09, // 248 +0x11, 0x14, 0x14, 0x08, // 249 +0x11, 0x28, 0x14, 0x08, // 250 +0x11, 0x3C, 0x14, 0x08, // 251 +0x11, 0x50, 0x14, 0x08, // 252 +0x11, 0x64, 0x13, 0x08, // 253 +0x11, 0x77, 0x17, 0x09, // 254 +0x11, 0x8E, 0x13, 0x08, // 255 +// Font Data: +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x5F, // 33 +0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, // 34 +0x80, 0x08, 0x00, 0x80, 0x78, 0x00, 0xC0, 0x0F, 0x00, 0xB8, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x78, 0x00, 0xC0, 0x0F, 0x00, 0xB8, 0x08, 0x00, 0x80, 0x08, // 35 +0x00, 0x00, 0x00, 0xE0, 0x10, 0x00, 0x10, 0x21, 0x00, 0x08, 0x41, 0x00, 0xFC, 0xFF, 0x00, 0x08, 0x42, 0x00, 0x10, 0x22, 0x00, 0x20, 0x1C, // 36 +0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x08, 0x01, 0x00, 0x08, 0x01, 0x00, 0x08, 0x61, 0x00, 0xF0, 0x18, 0x00, 0x00, 0x06, 0x00, 0xC0, 0x01, 0x00, 0x30, 0x3C, 0x00, 0x08, 0x42, 0x00, 0x00, 0x42, 0x00, 0x00, 0x42, 0x00, 0x00, 0x3C, // 37 +0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x70, 0x22, 0x00, 0x88, 0x41, 0x00, 0x08, 0x43, 0x00, 0x88, 0x44, 0x00, 0x70, 0x28, 0x00, 0x00, 0x10, 0x00, 0x00, 0x28, 0x00, 0x00, 0x44, // 38 +0x00, 0x00, 0x00, 0x78, // 39 +0x00, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x70, 0xC0, 0x01, 0x08, 0x00, 0x02, // 40 +0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x70, 0xC0, 0x01, 0x80, 0x3F, // 41 +0x10, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x38, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x10, // 42 +0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, // 43 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, // 44 +0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, // 45 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, // 46 +0x00, 0x60, 0x00, 0x00, 0x1E, 0x00, 0xE0, 0x01, 0x00, 0x18, // 47 +0x00, 0x00, 0x00, 0xE0, 0x1F, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0xE0, 0x1F, // 48 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0x00, 0x10, 0x00, 0x00, 0xF8, 0x7F, // 49 +0x00, 0x00, 0x00, 0x20, 0x40, 0x00, 0x10, 0x60, 0x00, 0x08, 0x50, 0x00, 0x08, 0x48, 0x00, 0x08, 0x44, 0x00, 0x10, 0x43, 0x00, 0xE0, 0x40, // 50 +0x00, 0x00, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x88, 0x41, 0x00, 0xF0, 0x22, 0x00, 0x00, 0x1C, // 51 +0x00, 0x0C, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x09, 0x00, 0xC0, 0x08, 0x00, 0x20, 0x08, 0x00, 0x10, 0x08, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x08, // 52 +0x00, 0x00, 0x00, 0xC0, 0x11, 0x00, 0xB8, 0x20, 0x00, 0x88, 0x40, 0x00, 0x88, 0x40, 0x00, 0x88, 0x40, 0x00, 0x08, 0x21, 0x00, 0x08, 0x1E, // 53 +0x00, 0x00, 0x00, 0xE0, 0x1F, 0x00, 0x10, 0x21, 0x00, 0x88, 0x40, 0x00, 0x88, 0x40, 0x00, 0x88, 0x40, 0x00, 0x10, 0x21, 0x00, 0x20, 0x1E, // 54 +0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x78, 0x00, 0x08, 0x07, 0x00, 0xC8, 0x00, 0x00, 0x28, 0x00, 0x00, 0x18, // 55 +0x00, 0x00, 0x00, 0x60, 0x1C, 0x00, 0x90, 0x22, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x90, 0x22, 0x00, 0x60, 0x1C, // 56 +0x00, 0x00, 0x00, 0xE0, 0x11, 0x00, 0x10, 0x22, 0x00, 0x08, 0x44, 0x00, 0x08, 0x44, 0x00, 0x08, 0x44, 0x00, 0x10, 0x22, 0x00, 0xE0, 0x1F, // 57 +0x00, 0x00, 0x00, 0x40, 0x40, // 58 +0x00, 0x00, 0x00, 0x40, 0xC0, 0x01, // 59 +0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x05, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x40, 0x10, // 60 +0x00, 0x00, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, // 61 +0x00, 0x00, 0x00, 0x40, 0x10, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x00, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, 0x02, // 62 +0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x5C, 0x00, 0x08, 0x02, 0x00, 0x10, 0x01, 0x00, 0xE0, // 63 +0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0xC0, 0x40, 0x00, 0x20, 0x80, 0x00, 0x10, 0x1E, 0x01, 0x10, 0x21, 0x01, 0x88, 0x40, 0x02, 0x48, 0x40, 0x02, 0x48, 0x40, 0x02, 0x48, 0x20, 0x02, 0x88, 0x7C, 0x02, 0xC8, 0x43, 0x02, 0x10, 0x40, 0x02, 0x10, 0x20, 0x01, 0x60, 0x10, 0x01, 0x80, 0x8F, // 64 +0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x70, 0x04, 0x00, 0x08, 0x04, 0x00, 0x70, 0x04, 0x00, 0x80, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 65 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x90, 0x22, 0x00, 0x60, 0x1C, // 66 +0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, // 67 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 68 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x40, // 69 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, // 70 +0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x42, 0x00, 0x08, 0x42, 0x00, 0x10, 0x22, 0x00, 0x20, 0x12, 0x00, 0x00, 0x0E, // 71 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0xF8, 0x7F, // 72 +0x00, 0x00, 0x00, 0xF8, 0x7F, // 73 +0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0xF8, 0x3F, // 74 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x80, 0x03, 0x00, 0x40, 0x04, 0x00, 0x20, 0x18, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, // 75 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, // 76 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x30, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x03, 0x00, 0xC0, 0x00, 0x00, 0x30, 0x00, 0x00, 0xF8, 0x7F, // 77 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x10, 0x00, 0x00, 0x60, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x18, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x7F, // 78 +0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 79 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x10, 0x01, 0x00, 0xE0, // 80 +0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x50, 0x00, 0x08, 0x50, 0x00, 0x10, 0x20, 0x00, 0x20, 0x70, 0x00, 0xC0, 0x4F, // 81 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x06, 0x00, 0x08, 0x1A, 0x00, 0x10, 0x21, 0x00, 0xE0, 0x40, // 82 +0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x90, 0x20, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x42, 0x00, 0x08, 0x42, 0x00, 0x10, 0x22, 0x00, 0x20, 0x1C, // 83 +0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, // 84 +0x00, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x1F, // 85 +0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x18, 0x00, 0x00, 0x60, 0x00, 0x00, 0x18, 0x00, 0x00, 0x07, 0x00, 0xE0, 0x00, 0x00, 0x18, // 86 +0x18, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x03, 0x00, 0x70, 0x00, 0x00, 0x08, 0x00, 0x00, 0x70, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1E, 0x00, 0xE0, 0x01, 0x00, 0x18, // 87 +0x00, 0x40, 0x00, 0x08, 0x20, 0x00, 0x10, 0x10, 0x00, 0x60, 0x0C, 0x00, 0x80, 0x02, 0x00, 0x00, 0x01, 0x00, 0x80, 0x02, 0x00, 0x60, 0x0C, 0x00, 0x10, 0x10, 0x00, 0x08, 0x20, 0x00, 0x00, 0x40, // 88 +0x08, 0x00, 0x00, 0x30, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x7E, 0x00, 0x80, 0x01, 0x00, 0x40, 0x00, 0x00, 0x30, 0x00, 0x00, 0x08, // 89 +0x00, 0x40, 0x00, 0x08, 0x60, 0x00, 0x08, 0x58, 0x00, 0x08, 0x44, 0x00, 0x08, 0x43, 0x00, 0x88, 0x40, 0x00, 0x68, 0x40, 0x00, 0x18, 0x40, 0x00, 0x08, 0x40, // 90 +0x00, 0x00, 0x00, 0xF8, 0xFF, 0x03, 0x08, 0x00, 0x02, 0x08, 0x00, 0x02, // 91 +0x18, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x60, // 92 +0x08, 0x00, 0x02, 0x08, 0x00, 0x02, 0xF8, 0xFF, 0x03, // 93 +0x00, 0x01, 0x00, 0xC0, 0x00, 0x00, 0x30, 0x00, 0x00, 0x08, 0x00, 0x00, 0x30, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x01, // 94 +0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, // 95 +0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x10, // 96 +0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x7F, // 97 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 98 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, // 99 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0xF8, 0x7F, // 100 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x24, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x80, 0x24, 0x00, 0x00, 0x17, // 101 +0x40, 0x00, 0x00, 0xF0, 0x7F, 0x00, 0x48, 0x00, 0x00, 0x48, // 102 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x01, 0x80, 0x20, 0x02, 0x40, 0x40, 0x02, 0x40, 0x40, 0x02, 0x40, 0x40, 0x02, 0x80, 0x20, 0x01, 0xC0, 0xFF, // 103 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x7F, // 104 +0x00, 0x00, 0x00, 0xC8, 0x7F, // 105 +0x00, 0x00, 0x02, 0xC8, 0xFF, 0x01, // 106 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x19, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, // 107 +0x00, 0x00, 0x00, 0xF8, 0x7F, // 108 +0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x7F, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x7F, // 109 +0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x7F, // 110 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 111 +0x00, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 112 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0xC0, 0xFF, 0x03, // 113 +0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, // 114 +0x00, 0x00, 0x00, 0x80, 0x23, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x80, 0x38, // 115 +0x40, 0x00, 0x00, 0xF0, 0x7F, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, // 116 +0x00, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xC0, 0x7F, // 117 +0xC0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x03, 0x00, 0xC0, // 118 +0xC0, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x03, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1F, 0x00, 0xC0, // 119 +0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1B, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1B, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, // 120 +0xC0, 0x01, 0x00, 0x00, 0x06, 0x02, 0x00, 0x38, 0x02, 0x00, 0xE0, 0x01, 0x00, 0x38, 0x00, 0x00, 0x07, 0x00, 0xC0, // 121 +0x40, 0x40, 0x00, 0x40, 0x60, 0x00, 0x40, 0x58, 0x00, 0x40, 0x44, 0x00, 0x40, 0x43, 0x00, 0xC0, 0x40, 0x00, 0x40, 0x40, // 122 +0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0xF0, 0xFB, 0x01, 0x08, 0x00, 0x02, 0x08, 0x00, 0x02, // 123 +0x00, 0x00, 0x00, 0xF8, 0xFF, 0x03, // 124 +0x08, 0x00, 0x02, 0x08, 0x00, 0x02, 0xF0, 0xFB, 0x01, 0x00, 0x04, 0x00, 0x00, 0x04, // 125 +0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, // 126 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x42, 0x00, 0x00, 0x41, 0x00, 0x80, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, // 129 +0x00, 0x01, 0x00, 0xF8, 0x7F, 0x00, 0x80, // 130 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x10, 0x00, 0x00, 0x60, 0x00, 0x00, 0x80, 0x00, 0x00, 0x08, 0x03, 0x00, 0x04, 0x04, 0x00, 0x02, 0x18, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x7F, // 131 +0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x70, 0x04, 0x00, 0x08, 0x04, 0x00, 0x70, 0x04, 0x00, 0x80, 0x07, 0x00, 0x00, 0x9C, 0x01, 0x00, 0x60, 0x02, // 132 +0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x7F, 0x03, 0x00, 0x80, 0x04, // 133 +0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x09, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, // 134 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x50, 0x40, 0x00, 0x48, 0x40, 0x00, 0x80, 0x20, // 135 +0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x50, 0x00, 0x00, 0x48, 0x00, 0x00, 0x80, 0x7F, // 136 +0x40, 0x40, 0x00, 0x40, 0x60, 0x00, 0x40, 0x58, 0x00, 0x50, 0x44, 0x00, 0x48, 0x43, 0x00, 0xC0, 0x40, 0x00, 0x40, 0x40, // 137 +0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x09, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 147 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x50, 0x40, 0x00, 0x48, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 148 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0xC1, 0x01, 0x08, 0x41, 0x02, 0x08, 0x41, 0x00, 0x08, 0x40, // 152 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x24, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x03, 0x40, 0xC4, 0x04, 0x80, 0x24, 0x00, 0x00, 0x17, // 153 +0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x90, 0x20, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x09, 0x42, 0x00, 0x08, 0x42, 0x00, 0x10, 0x22, 0x00, 0x20, 0x1C, // 154 +0x00, 0x00, 0x00, 0x80, 0x23, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x50, 0x44, 0x00, 0x48, 0x44, 0x00, 0x80, 0x38, // 155 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xFF, 0x03, // 161 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x03, 0x40, 0xF0, 0x00, 0x40, 0x4E, 0x00, 0xC0, 0x41, 0x00, 0xB8, 0x20, 0x00, 0x00, 0x11, // 162 +0x00, 0x41, 0x00, 0xE0, 0x31, 0x00, 0x10, 0x2F, 0x00, 0x08, 0x21, 0x00, 0x08, 0x21, 0x00, 0x08, 0x40, 0x00, 0x10, 0x40, 0x00, 0x20, 0x20, // 163 +0x00, 0x00, 0x00, 0x40, 0x0B, 0x00, 0x80, 0x04, 0x00, 0x40, 0x08, 0x00, 0x40, 0x08, 0x00, 0x80, 0x04, 0x00, 0x40, 0x0B, // 164 +0x08, 0x0A, 0x00, 0x10, 0x0A, 0x00, 0x60, 0x0A, 0x00, 0x80, 0x0B, 0x00, 0x00, 0x7E, 0x00, 0x80, 0x0B, 0x00, 0x60, 0x0A, 0x00, 0x10, 0x0A, 0x00, 0x08, 0x0A, // 165 +0x00, 0x00, 0x00, 0xF8, 0xF1, 0x03, // 166 +0x00, 0x86, 0x00, 0x70, 0x09, 0x01, 0xC8, 0x10, 0x02, 0x88, 0x10, 0x02, 0x08, 0x21, 0x02, 0x08, 0x61, 0x02, 0x30, 0xD2, 0x01, 0x00, 0x0C, // 167 +0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, // 168 +0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0xC8, 0x47, 0x00, 0x28, 0x48, 0x00, 0x28, 0x48, 0x00, 0x28, 0x48, 0x00, 0x28, 0x48, 0x00, 0x48, 0x44, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 169 +0xD0, 0x00, 0x00, 0x48, 0x01, 0x00, 0x28, 0x01, 0x00, 0x28, 0x01, 0x00, 0xF0, 0x01, // 170 +0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1B, 0x00, 0x80, 0x20, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1B, 0x00, 0x80, 0x20, // 171 +0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x0F, // 172 +0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, // 173 +0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0xE8, 0x4F, 0x00, 0x28, 0x41, 0x00, 0x28, 0x41, 0x00, 0x28, 0x43, 0x00, 0x28, 0x45, 0x00, 0xC8, 0x48, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 174 +0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, // 175 +0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x48, 0x00, 0x00, 0x48, 0x00, 0x00, 0x30, // 176 +0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x41, 0x00, 0x00, 0x41, 0x00, 0xE0, 0x4F, 0x00, 0x00, 0x41, 0x00, 0x00, 0x41, 0x00, 0x00, 0x41, // 177 +0x10, 0x01, 0x00, 0x88, 0x01, 0x00, 0x48, 0x01, 0x00, 0x48, 0x01, 0x00, 0x30, 0x01, // 178 +0x90, 0x00, 0x00, 0x08, 0x01, 0x00, 0x08, 0x01, 0x00, 0x28, 0x01, 0x00, 0xD8, // 179 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, // 180 +0x00, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xC0, 0x7F, // 181 +0xF0, 0x00, 0x00, 0xF8, 0x00, 0x00, 0xF8, 0x01, 0x00, 0xF8, 0x01, 0x00, 0xF8, 0xFF, 0x03, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0xF8, 0xFF, 0x03, 0x08, // 182 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // 183 +0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, // 184 +0x00, 0x40, 0x00, 0x08, 0x60, 0x00, 0x08, 0x58, 0x00, 0x08, 0x44, 0x00, 0x0A, 0x43, 0x00, 0x89, 0x40, 0x00, 0x68, 0x40, 0x00, 0x18, 0x40, 0x00, 0x08, 0x40, // 185 +0xF0, 0x00, 0x00, 0x08, 0x01, 0x00, 0x08, 0x01, 0x00, 0x08, 0x01, 0x00, 0xF0, // 186 +0x00, 0x40, 0x00, 0x08, 0x60, 0x00, 0x08, 0x58, 0x00, 0x08, 0x44, 0x00, 0x0A, 0x43, 0x00, 0x88, 0x40, 0x00, 0x68, 0x40, 0x00, 0x18, 0x40, 0x00, 0x08, 0x40, // 187 +0x40, 0x40, 0x00, 0x40, 0x60, 0x00, 0x40, 0x58, 0x00, 0x50, 0x44, 0x00, 0x40, 0x43, 0x00, 0xC0, 0x40, 0x00, 0x40, 0x40, // 188 +0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x40, 0x00, 0xF8, 0x31, 0x00, 0x00, 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0x80, 0x00, 0x00, 0x60, 0x44, 0x00, 0x10, 0x62, 0x00, 0x08, 0x52, 0x00, 0x00, 0x52, 0x00, 0x00, 0x4C, // 189 +0x90, 0x00, 0x00, 0x08, 0x01, 0x00, 0x08, 0x41, 0x00, 0x28, 0x21, 0x00, 0xD8, 0x18, 0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0x80, 0x00, 0x00, 0x40, 0x30, 0x00, 0x30, 0x28, 0x00, 0x08, 0x24, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x20, // 190 +0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x10, 0x01, 0x00, 0x08, 0x02, 0x40, 0x07, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0xC0, // 191 +0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x71, 0x04, 0x00, 0x0A, 0x04, 0x00, 0x70, 0x04, 0x00, 0x80, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 192 +0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x70, 0x04, 0x00, 0x0A, 0x04, 0x00, 0x71, 0x04, 0x00, 0x80, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 193 +0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x72, 0x04, 0x00, 0x09, 0x04, 0x00, 0x71, 0x04, 0x00, 0x82, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 194 +0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x72, 0x04, 0x00, 0x09, 0x04, 0x00, 0x72, 0x04, 0x00, 0x81, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 195 +0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x72, 0x04, 0x00, 0x08, 0x04, 0x00, 0x72, 0x04, 0x00, 0x80, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 196 +0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x7E, 0x04, 0x00, 0x0A, 0x04, 0x00, 0x7E, 0x04, 0x00, 0x80, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 197 +0x00, 0x60, 0x00, 0x00, 0x18, 0x00, 0x00, 0x06, 0x00, 0x80, 0x05, 0x00, 0x60, 0x04, 0x00, 0x18, 0x04, 0x00, 0x08, 0x04, 0x00, 0x08, 0x04, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, // 198 +0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x02, 0x08, 0xC0, 0x02, 0x08, 0x40, 0x03, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, // 199 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x09, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x40, // 200 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x09, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x40, // 201 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x09, 0x41, 0x00, 0x09, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x40, // 202 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x08, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x40, // 203 +0x01, 0x00, 0x00, 0xFA, 0x7F, // 204 +0x00, 0x00, 0x00, 0xFA, 0x7F, 0x00, 0x01, // 205 +0x02, 0x00, 0x00, 0xF9, 0x7F, 0x00, 0x01, 0x00, 0x00, 0x02, // 206 +0x02, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x02, // 207 +0x00, 0x02, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x42, 0x00, 0x08, 0x42, 0x00, 0x08, 0x42, 0x00, 0x08, 0x42, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 208 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x10, 0x00, 0x00, 0x60, 0x00, 0x00, 0x82, 0x00, 0x00, 0x01, 0x03, 0x00, 0x02, 0x04, 0x00, 0x01, 0x18, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x7F, // 209 +0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x09, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 210 +0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x09, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 211 +0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x0A, 0x40, 0x00, 0x09, 0x40, 0x00, 0x09, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 212 +0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x0A, 0x40, 0x00, 0x09, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x09, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 213 +0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x08, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 214 +0x00, 0x00, 0x00, 0x40, 0x10, 0x00, 0x80, 0x08, 0x00, 0x00, 0x05, 0x00, 0x00, 0x07, 0x00, 0x00, 0x05, 0x00, 0x80, 0x08, 0x00, 0x40, 0x10, // 215 +0x00, 0x00, 0x00, 0xC0, 0x4F, 0x00, 0x20, 0x30, 0x00, 0x10, 0x30, 0x00, 0x08, 0x4C, 0x00, 0x08, 0x42, 0x00, 0x08, 0x41, 0x00, 0xC8, 0x40, 0x00, 0x30, 0x20, 0x00, 0x30, 0x10, 0x00, 0xC8, 0x0F, // 216 +0x00, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x01, 0x40, 0x00, 0x02, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x1F, // 217 +0x00, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x02, 0x40, 0x00, 0x01, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x1F, // 218 +0x00, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x02, 0x40, 0x00, 0x01, 0x40, 0x00, 0x01, 0x40, 0x00, 0x02, 0x40, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x1F, // 219 +0x00, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x02, 0x40, 0x00, 0x00, 0x40, 0x00, 0x02, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x1F, // 220 +0x08, 0x00, 0x00, 0x30, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x01, 0x00, 0x02, 0x7E, 0x00, 0x81, 0x01, 0x00, 0x40, 0x00, 0x00, 0x30, 0x00, 0x00, 0x08, // 221 +0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x20, 0x10, 0x00, 0x20, 0x10, 0x00, 0x20, 0x10, 0x00, 0x20, 0x10, 0x00, 0x20, 0x10, 0x00, 0x20, 0x10, 0x00, 0x40, 0x08, 0x00, 0x80, 0x07, // 222 +0x00, 0x00, 0x00, 0xE0, 0x7F, 0x00, 0x10, 0x00, 0x00, 0x08, 0x20, 0x00, 0x88, 0x43, 0x00, 0x70, 0x42, 0x00, 0x00, 0x44, 0x00, 0x00, 0x38, // 223 +0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x40, 0x44, 0x00, 0x48, 0x44, 0x00, 0x50, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x7F, // 224 +0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x40, 0x44, 0x00, 0x50, 0x44, 0x00, 0x48, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x7F, // 225 +0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x50, 0x44, 0x00, 0x48, 0x44, 0x00, 0x48, 0x42, 0x00, 0x50, 0x22, 0x00, 0x80, 0x7F, // 226 +0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x50, 0x44, 0x00, 0x48, 0x44, 0x00, 0x50, 0x42, 0x00, 0x48, 0x22, 0x00, 0x80, 0x7F, // 227 +0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x50, 0x44, 0x00, 0x40, 0x44, 0x00, 0x50, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x7F, // 228 +0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x5C, 0x44, 0x00, 0x54, 0x44, 0x00, 0x5C, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x7F, // 229 +0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x3F, 0x00, 0x80, 0x24, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x80, 0x24, 0x00, 0x00, 0x17, // 230 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x02, 0x40, 0xC0, 0x02, 0x40, 0x40, 0x03, 0x80, 0x20, // 231 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x24, 0x00, 0x48, 0x44, 0x00, 0x50, 0x44, 0x00, 0x40, 0x44, 0x00, 0x80, 0x24, 0x00, 0x00, 0x17, // 232 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x24, 0x00, 0x40, 0x44, 0x00, 0x50, 0x44, 0x00, 0x48, 0x44, 0x00, 0x80, 0x24, 0x00, 0x00, 0x17, // 233 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x24, 0x00, 0x50, 0x44, 0x00, 0x48, 0x44, 0x00, 0x48, 0x44, 0x00, 0x90, 0x24, 0x00, 0x00, 0x17, // 234 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x24, 0x00, 0x50, 0x44, 0x00, 0x40, 0x44, 0x00, 0x50, 0x44, 0x00, 0x80, 0x24, 0x00, 0x00, 0x17, // 235 +0x08, 0x00, 0x00, 0xD0, 0x7F, // 236 +0x00, 0x00, 0x00, 0xD0, 0x7F, 0x00, 0x08, // 237 +0x10, 0x00, 0x00, 0xC8, 0x7F, 0x00, 0x08, 0x00, 0x00, 0x10, // 238 +0x10, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x10, // 239 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0xA0, 0x20, 0x00, 0x68, 0x40, 0x00, 0x58, 0x40, 0x00, 0x70, 0x40, 0x00, 0xE8, 0x20, 0x00, 0x00, 0x1F, // 240 +0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x90, 0x00, 0x00, 0x48, 0x00, 0x00, 0x50, 0x00, 0x00, 0x48, 0x00, 0x00, 0x80, 0x7F, // 241 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x48, 0x40, 0x00, 0x50, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 242 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x50, 0x40, 0x00, 0x48, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 243 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x50, 0x40, 0x00, 0x48, 0x40, 0x00, 0x48, 0x40, 0x00, 0x90, 0x20, 0x00, 0x00, 0x1F, // 244 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x50, 0x40, 0x00, 0x48, 0x40, 0x00, 0x50, 0x40, 0x00, 0x88, 0x20, 0x00, 0x00, 0x1F, // 245 +0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x50, 0x40, 0x00, 0x40, 0x40, 0x00, 0x50, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 246 +0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x80, 0x0A, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, // 247 +0x00, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x80, 0x30, 0x00, 0x40, 0x48, 0x00, 0x40, 0x44, 0x00, 0x40, 0x42, 0x00, 0x80, 0x21, 0x00, 0x40, 0x1F, // 248 +0x00, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x40, 0x00, 0x00, 0x20, 0x00, 0xC0, 0x7F, // 249 +0x00, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x10, 0x40, 0x00, 0x08, 0x20, 0x00, 0xC0, 0x7F, // 250 +0x00, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x10, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0xC0, 0x7F, // 251 +0x00, 0x00, 0x00, 0xD0, 0x3F, 0x00, 0x00, 0x40, 0x00, 0x10, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xC0, 0x7F, // 252 +0xC0, 0x01, 0x00, 0x00, 0x06, 0x02, 0x00, 0x38, 0x02, 0x10, 0xE0, 0x01, 0x08, 0x38, 0x00, 0x00, 0x07, 0x00, 0xC0, // 253 +0x00, 0x00, 0x00, 0xF8, 0xFF, 0x03, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 254 +0xC0, 0x01, 0x00, 0x00, 0x06, 0x02, 0x10, 0x38, 0x02, 0x00, 0xE0, 0x01, 0x10, 0x38, 0x00, 0x00, 0x07, 0x00, 0xC0, // 255 +}; + +const uint8_t ArialMT_Plain_24_PL[] PROGMEM = { +0x18, // Width: 24 +0x1C, // Height: 28 +0x20, // First char: 32 +0xE0, // Number of chars: 224 +// Jump Table: +0xFF, 0xFF, 0x00, 0x06, // 32 +0x00, 0x00, 0x13, 0x06, // 33 +0x00, 0x13, 0x1A, 0x08, // 34 +0x00, 0x2D, 0x33, 0x0E, // 35 +0x00, 0x60, 0x2F, 0x0D, // 36 +0x00, 0x8F, 0x4F, 0x15, // 37 +0x00, 0xDE, 0x3B, 0x10, // 38 +0x01, 0x19, 0x0A, 0x04, // 39 +0x01, 0x23, 0x1C, 0x08, // 40 +0x01, 0x3F, 0x1B, 0x08, // 41 +0x01, 0x5A, 0x21, 0x0A, // 42 +0x01, 0x7B, 0x32, 0x0E, // 43 +0x01, 0xAD, 0x10, 0x05, // 44 +0x01, 0xBD, 0x1B, 0x08, // 45 +0x01, 0xD8, 0x0F, 0x05, // 46 +0x01, 0xE7, 0x19, 0x08, // 47 +0x02, 0x00, 0x2F, 0x0D, // 48 +0x02, 0x2F, 0x23, 0x0A, // 49 +0x02, 0x52, 0x2F, 0x0D, // 50 +0x02, 0x81, 0x2F, 0x0D, // 51 +0x02, 0xB0, 0x2F, 0x0D, // 52 +0x02, 0xDF, 0x2F, 0x0D, // 53 +0x03, 0x0E, 0x2F, 0x0D, // 54 +0x03, 0x3D, 0x2D, 0x0D, // 55 +0x03, 0x6A, 0x2F, 0x0D, // 56 +0x03, 0x99, 0x2F, 0x0D, // 57 +0x03, 0xC8, 0x0F, 0x05, // 58 +0x03, 0xD7, 0x10, 0x05, // 59 +0x03, 0xE7, 0x2F, 0x0D, // 60 +0x04, 0x16, 0x2F, 0x0D, // 61 +0x04, 0x45, 0x2E, 0x0D, // 62 +0x04, 0x73, 0x2E, 0x0D, // 63 +0x04, 0xA1, 0x5B, 0x18, // 64 +0x04, 0xFC, 0x3B, 0x10, // 65 +0x05, 0x37, 0x3B, 0x10, // 66 +0x05, 0x72, 0x3F, 0x11, // 67 +0x05, 0xB1, 0x3F, 0x11, // 68 +0x05, 0xF0, 0x3B, 0x10, // 69 +0x06, 0x2B, 0x35, 0x0F, // 70 +0x06, 0x60, 0x43, 0x12, // 71 +0x06, 0xA3, 0x3B, 0x10, // 72 +0x06, 0xDE, 0x0F, 0x05, // 73 +0x06, 0xED, 0x27, 0x0B, // 74 +0x07, 0x14, 0x3F, 0x11, // 75 +0x07, 0x53, 0x2F, 0x0D, // 76 +0x07, 0x82, 0x43, 0x12, // 77 +0x07, 0xC5, 0x3B, 0x10, // 78 +0x08, 0x00, 0x47, 0x13, // 79 +0x08, 0x47, 0x3A, 0x10, // 80 +0x08, 0x81, 0x47, 0x13, // 81 +0x08, 0xC8, 0x3F, 0x11, // 82 +0x09, 0x07, 0x3B, 0x10, // 83 +0x09, 0x42, 0x35, 0x0F, // 84 +0x09, 0x77, 0x3B, 0x10, // 85 +0x09, 0xB2, 0x39, 0x10, // 86 +0x09, 0xEB, 0x59, 0x18, // 87 +0x0A, 0x44, 0x3B, 0x10, // 88 +0x0A, 0x7F, 0x3D, 0x11, // 89 +0x0A, 0xBC, 0x37, 0x0F, // 90 +0x0A, 0xF3, 0x14, 0x06, // 91 +0x0B, 0x07, 0x1B, 0x08, // 92 +0x0B, 0x22, 0x18, 0x07, // 93 +0x0B, 0x3A, 0x2A, 0x0C, // 94 +0x0B, 0x64, 0x34, 0x0E, // 95 +0x0B, 0x98, 0x11, 0x06, // 96 +0x0B, 0xA9, 0x2F, 0x0D, // 97 +0x0B, 0xD8, 0x33, 0x0E, // 98 +0x0C, 0x0B, 0x2B, 0x0C, // 99 +0x0C, 0x36, 0x2F, 0x0D, // 100 +0x0C, 0x65, 0x2F, 0x0D, // 101 +0x0C, 0x94, 0x1A, 0x08, // 102 +0x0C, 0xAE, 0x2F, 0x0D, // 103 +0x0C, 0xDD, 0x2F, 0x0D, // 104 +0x0D, 0x0C, 0x0F, 0x05, // 105 +0x0D, 0x1B, 0x10, 0x05, // 106 +0x0D, 0x2B, 0x2F, 0x0D, // 107 +0x0D, 0x5A, 0x0F, 0x05, // 108 +0x0D, 0x69, 0x47, 0x13, // 109 +0x0D, 0xB0, 0x2F, 0x0D, // 110 +0x0D, 0xDF, 0x2F, 0x0D, // 111 +0x0E, 0x0E, 0x33, 0x0E, // 112 +0x0E, 0x41, 0x30, 0x0D, // 113 +0x0E, 0x71, 0x1E, 0x09, // 114 +0x0E, 0x8F, 0x2B, 0x0C, // 115 +0x0E, 0xBA, 0x1B, 0x08, // 116 +0x0E, 0xD5, 0x2F, 0x0D, // 117 +0x0F, 0x04, 0x2A, 0x0C, // 118 +0x0F, 0x2E, 0x42, 0x12, // 119 +0x0F, 0x70, 0x2B, 0x0C, // 120 +0x0F, 0x9B, 0x2A, 0x0C, // 121 +0x0F, 0xC5, 0x2B, 0x0C, // 122 +0x0F, 0xF0, 0x1C, 0x08, // 123 +0x10, 0x0C, 0x10, 0x05, // 124 +0x10, 0x1C, 0x1B, 0x08, // 125 +0x10, 0x37, 0x32, 0x0E, // 126 +0xFF, 0xFF, 0x00, 0x18, // 127 +0xFF, 0xFF, 0x00, 0x18, // 128 +0x10, 0x69, 0x2F, 0x0D, // 129 +0x10, 0x98, 0x16, 0x07, // 130 +0x10, 0xAE, 0x3B, 0x10, // 131 +0x10, 0xE9, 0x40, 0x11, // 132 +0x11, 0x29, 0x34, 0x0E, // 133 +0x11, 0x5D, 0x3F, 0x11, // 134 +0x11, 0x9C, 0x2B, 0x0C, // 135 +0x11, 0xC7, 0x2F, 0x0D, // 136 +0x11, 0xF6, 0x2B, 0x0C, // 137 +0xFF, 0xFF, 0x00, 0x18, // 138 +0xFF, 0xFF, 0x00, 0x18, // 139 +0xFF, 0xFF, 0x00, 0x18, // 140 +0xFF, 0xFF, 0x00, 0x18, // 141 +0xFF, 0xFF, 0x00, 0x18, // 142 +0xFF, 0xFF, 0x00, 0x18, // 143 +0xFF, 0xFF, 0x00, 0x18, // 144 +0xFF, 0xFF, 0x00, 0x18, // 145 +0xFF, 0xFF, 0x00, 0x18, // 146 +0x12, 0x21, 0x47, 0x13, // 147 +0x12, 0x68, 0x2F, 0x0D, // 148 +0xFF, 0xFF, 0x00, 0x18, // 149 +0xFF, 0xFF, 0x00, 0x18, // 150 +0xFF, 0xFF, 0x00, 0x18, // 151 +0x12, 0x97, 0x3B, 0x10, // 152 +0x12, 0xD2, 0x2F, 0x0D, // 153 +0x13, 0x01, 0x3B, 0x10, // 154 +0x13, 0x3C, 0x2B, 0x0C, // 155 +0xFF, 0xFF, 0x00, 0x18, // 156 +0xFF, 0xFF, 0x00, 0x18, // 157 +0xFF, 0xFF, 0x00, 0x18, // 158 +0xFF, 0xFF, 0x00, 0x18, // 159 +0xFF, 0xFF, 0x00, 0x18, // 160 +0x13, 0x67, 0x14, 0x06, // 161 +0x13, 0x7B, 0x2B, 0x0C, // 162 +0x13, 0xA6, 0x2F, 0x0D, // 163 +0x13, 0xD5, 0x33, 0x0E, // 164 +0x14, 0x08, 0x31, 0x0E, // 165 +0x14, 0x39, 0x10, 0x05, // 166 +0x14, 0x49, 0x2F, 0x0D, // 167 +0x14, 0x78, 0x19, 0x08, // 168 +0x14, 0x91, 0x46, 0x13, // 169 +0x14, 0xD7, 0x1A, 0x08, // 170 +0x14, 0xF1, 0x27, 0x0B, // 171 +0x15, 0x18, 0x2F, 0x0D, // 172 +0x15, 0x47, 0x1B, 0x08, // 173 +0x15, 0x62, 0x46, 0x13, // 174 +0x15, 0xA8, 0x31, 0x0E, // 175 +0x15, 0xD9, 0x1E, 0x09, // 176 +0x15, 0xF7, 0x33, 0x0E, // 177 +0x16, 0x2A, 0x1A, 0x08, // 178 +0x16, 0x44, 0x1A, 0x08, // 179 +0x16, 0x5E, 0x19, 0x08, // 180 +0x16, 0x77, 0x2F, 0x0D, // 181 +0x16, 0xA6, 0x31, 0x0E, // 182 +0x16, 0xD7, 0x12, 0x06, // 183 +0x16, 0xE9, 0x18, 0x07, // 184 +0x17, 0x01, 0x37, 0x0F, // 185 +0x17, 0x38, 0x1E, 0x09, // 186 +0x17, 0x56, 0x37, 0x0F, // 187 +0x17, 0x8D, 0x2B, 0x0C, // 188 +0x17, 0xB8, 0x4B, 0x14, // 189 +0x18, 0x03, 0x4B, 0x14, // 190 +0x18, 0x4E, 0x33, 0x0E, // 191 +0x18, 0x81, 0x3B, 0x10, // 192 +0x18, 0xBC, 0x3B, 0x10, // 193 +0x18, 0xF7, 0x3B, 0x10, // 194 +0x19, 0x32, 0x3B, 0x10, // 195 +0x19, 0x6D, 0x3B, 0x10, // 196 +0x19, 0xA8, 0x3B, 0x10, // 197 +0x19, 0xE3, 0x5B, 0x18, // 198 +0x1A, 0x3E, 0x3F, 0x11, // 199 +0x1A, 0x7D, 0x3B, 0x10, // 200 +0x1A, 0xB8, 0x3B, 0x10, // 201 +0x1A, 0xF3, 0x3B, 0x10, // 202 +0x1B, 0x2E, 0x3B, 0x10, // 203 +0x1B, 0x69, 0x11, 0x06, // 204 +0x1B, 0x7A, 0x11, 0x06, // 205 +0x1B, 0x8B, 0x15, 0x07, // 206 +0x1B, 0xA0, 0x15, 0x07, // 207 +0x1B, 0xB5, 0x3F, 0x11, // 208 +0x1B, 0xF4, 0x3B, 0x10, // 209 +0x1C, 0x2F, 0x47, 0x13, // 210 +0x1C, 0x76, 0x47, 0x13, // 211 +0x1C, 0xBD, 0x47, 0x13, // 212 +0x1D, 0x04, 0x47, 0x13, // 213 +0x1D, 0x4B, 0x47, 0x13, // 214 +0x1D, 0x92, 0x2B, 0x0C, // 215 +0x1D, 0xBD, 0x47, 0x13, // 216 +0x1E, 0x04, 0x3B, 0x10, // 217 +0x1E, 0x3F, 0x3B, 0x10, // 218 +0x1E, 0x7A, 0x3B, 0x10, // 219 +0x1E, 0xB5, 0x3B, 0x10, // 220 +0x1E, 0xF0, 0x3D, 0x11, // 221 +0x1F, 0x2D, 0x3A, 0x10, // 222 +0x1F, 0x67, 0x37, 0x0F, // 223 +0x1F, 0x9E, 0x2F, 0x0D, // 224 +0x1F, 0xCD, 0x2F, 0x0D, // 225 +0x1F, 0xFC, 0x2F, 0x0D, // 226 +0x20, 0x2B, 0x2F, 0x0D, // 227 +0x20, 0x5A, 0x2F, 0x0D, // 228 +0x20, 0x89, 0x2F, 0x0D, // 229 +0x20, 0xB8, 0x53, 0x16, // 230 +0x21, 0x0B, 0x2B, 0x0C, // 231 +0x21, 0x36, 0x2F, 0x0D, // 232 +0x21, 0x65, 0x2F, 0x0D, // 233 +0x21, 0x94, 0x2F, 0x0D, // 234 +0x21, 0xC3, 0x2F, 0x0D, // 235 +0x21, 0xF2, 0x11, 0x06, // 236 +0x22, 0x03, 0x11, 0x06, // 237 +0x22, 0x14, 0x15, 0x07, // 238 +0x22, 0x29, 0x15, 0x07, // 239 +0x22, 0x3E, 0x2F, 0x0D, // 240 +0x22, 0x6D, 0x2F, 0x0D, // 241 +0x22, 0x9C, 0x2F, 0x0D, // 242 +0x22, 0xCB, 0x2F, 0x0D, // 243 +0x22, 0xFA, 0x2F, 0x0D, // 244 +0x23, 0x29, 0x2F, 0x0D, // 245 +0x23, 0x58, 0x2F, 0x0D, // 246 +0x23, 0x87, 0x32, 0x0E, // 247 +0x23, 0xB9, 0x33, 0x0E, // 248 +0x23, 0xEC, 0x2F, 0x0D, // 249 +0x24, 0x1B, 0x2F, 0x0D, // 250 +0x24, 0x4A, 0x2F, 0x0D, // 251 +0x24, 0x79, 0x2F, 0x0D, // 252 +0x24, 0xA8, 0x2A, 0x0C, // 253 +0x24, 0xD2, 0x2F, 0x0D, // 254 +0x25, 0x01, 0x2A, 0x0C, // 255 +// Font Data: +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x33, 0x00, 0xE0, 0xFF, 0x33, // 33 +0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xE0, 0x07, // 34 +0x00, 0x0C, 0x03, 0x00, 0x00, 0x0C, 0x33, 0x00, 0x00, 0x0C, 0x3F, 0x00, 0x00, 0xFC, 0x0F, 0x00, 0x80, 0xFF, 0x03, 0x00, 0xE0, 0x0F, 0x03, 0x00, 0x60, 0x0C, 0x33, 0x00, 0x00, 0x0C, 0x3F, 0x00, 0x00, 0xFC, 0x0F, 0x00, 0x80, 0xFF, 0x03, 0x00, 0xE0, 0x0F, 0x03, 0x00, 0x60, 0x0C, 0x03, 0x00, 0x00, 0x0C, 0x03, // 35 +0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x06, 0x00, 0xC0, 0x0F, 0x1E, 0x00, 0xC0, 0x18, 0x1C, 0x00, 0x60, 0x18, 0x38, 0x00, 0x60, 0x30, 0x30, 0x00, 0xF0, 0xFF, 0xFF, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x60, 0x38, 0x00, 0xC0, 0x60, 0x18, 0x00, 0xC0, 0xC1, 0x1F, 0x00, 0x00, 0x81, 0x07, // 36 +0x00, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x20, 0x20, 0x20, 0x00, 0x60, 0x30, 0x38, 0x00, 0xC0, 0x1F, 0x1E, 0x00, 0x80, 0x8F, 0x0F, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x8F, 0x0F, 0x00, 0xC0, 0xC3, 0x1F, 0x00, 0xE0, 0x60, 0x30, 0x00, 0x20, 0x20, 0x20, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0x80, 0x0F, // 37 +0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x80, 0xE3, 0x1C, 0x00, 0xC0, 0x77, 0x38, 0x00, 0xE0, 0x3C, 0x30, 0x00, 0x60, 0x38, 0x30, 0x00, 0x60, 0x78, 0x30, 0x00, 0xE0, 0xEC, 0x38, 0x00, 0xC0, 0x8F, 0x1B, 0x00, 0x80, 0x03, 0x1F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0xC0, 0x38, 0x00, 0x00, 0x00, 0x10, // 38 +0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xE0, 0x07, // 39 +0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0xFE, 0x7F, 0x00, 0x80, 0x0F, 0xF0, 0x01, 0xC0, 0x01, 0x80, 0x03, 0x60, 0x00, 0x00, 0x06, 0x20, 0x00, 0x00, 0x04, // 40 +0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x04, 0x60, 0x00, 0x00, 0x06, 0xC0, 0x01, 0x80, 0x03, 0x80, 0x0F, 0xF0, 0x01, 0x00, 0xFE, 0x7F, 0x00, 0x00, 0xF0, 0x0F, // 41 +0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x80, // 42 +0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xFF, 0x0F, 0x00, 0x00, 0xFF, 0x0F, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, // 43 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x03, 0x00, 0x00, 0xF0, 0x01, // 44 +0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, // 45 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, // 46 +0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x80, 0x3F, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x60, // 47 +0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x80, 0xFF, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x38, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0xFF, 0x0F, 0x00, 0x00, 0xFE, 0x03, // 48 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 49 +0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x30, 0x00, 0xC0, 0x03, 0x38, 0x00, 0xC0, 0x00, 0x3C, 0x00, 0x60, 0x00, 0x36, 0x00, 0x60, 0x00, 0x33, 0x00, 0x60, 0x80, 0x31, 0x00, 0x60, 0xC0, 0x30, 0x00, 0x60, 0x60, 0x30, 0x00, 0xC0, 0x30, 0x30, 0x00, 0xC0, 0x1F, 0x30, 0x00, 0x00, 0x0F, 0x30, // 50 +0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xC0, 0x01, 0x0E, 0x00, 0xC0, 0x00, 0x1C, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0xC0, 0x38, 0x30, 0x00, 0xC0, 0x6F, 0x18, 0x00, 0x80, 0xC7, 0x0F, 0x00, 0x00, 0x80, 0x07, // 51 +0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x3C, 0x03, 0x00, 0x00, 0x0E, 0x03, 0x00, 0x80, 0x07, 0x03, 0x00, 0xC0, 0x01, 0x03, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, // 52 +0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x06, 0x00, 0x80, 0x3F, 0x0E, 0x00, 0xE0, 0x1F, 0x18, 0x00, 0x60, 0x08, 0x30, 0x00, 0x60, 0x0C, 0x30, 0x00, 0x60, 0x0C, 0x30, 0x00, 0x60, 0x0C, 0x30, 0x00, 0x60, 0x0C, 0x30, 0x00, 0x60, 0x18, 0x1C, 0x00, 0x60, 0xF0, 0x0F, 0x00, 0x00, 0xE0, 0x03, // 53 +0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x03, 0x00, 0x80, 0xFF, 0x0F, 0x00, 0xC0, 0x63, 0x1C, 0x00, 0xC0, 0x30, 0x38, 0x00, 0x60, 0x18, 0x30, 0x00, 0x60, 0x18, 0x30, 0x00, 0x60, 0x18, 0x30, 0x00, 0x60, 0x18, 0x30, 0x00, 0xE0, 0x30, 0x18, 0x00, 0xC0, 0xF1, 0x0F, 0x00, 0x80, 0xC1, 0x07, // 54 +0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x3C, 0x00, 0x60, 0x80, 0x3F, 0x00, 0x60, 0xE0, 0x03, 0x00, 0x60, 0x78, 0x00, 0x00, 0x60, 0x0E, 0x00, 0x00, 0x60, 0x03, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x60, // 55 +0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x80, 0xC7, 0x1F, 0x00, 0xC0, 0x6F, 0x18, 0x00, 0xE0, 0x38, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0xE0, 0x38, 0x30, 0x00, 0xC0, 0x6F, 0x18, 0x00, 0x80, 0xC7, 0x1F, 0x00, 0x00, 0x80, 0x07, // 56 +0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x0C, 0x00, 0x80, 0x7F, 0x1C, 0x00, 0xC0, 0x61, 0x38, 0x00, 0x60, 0xC0, 0x30, 0x00, 0x60, 0xC0, 0x30, 0x00, 0x60, 0xC0, 0x30, 0x00, 0x60, 0xC0, 0x30, 0x00, 0x60, 0x60, 0x18, 0x00, 0xC0, 0x31, 0x1E, 0x00, 0x80, 0xFF, 0x0F, 0x00, 0x00, 0xFE, 0x01, // 57 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, // 58 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x30, 0x03, 0x00, 0x06, 0xF0, 0x01, // 59 +0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0xD8, 0x00, 0x00, 0x00, 0xD8, 0x00, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x03, 0x06, // 60 +0x00, 0x00, 0x00, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, // 61 +0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0xD8, 0x00, 0x00, 0x00, 0xD8, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x20, // 62 +0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x60, 0x80, 0x33, 0x00, 0x60, 0xC0, 0x33, 0x00, 0x60, 0xE0, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0xC0, 0x38, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0x00, 0x07, // 63 +0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x1E, 0xF0, 0x00, 0x00, 0x07, 0xC0, 0x01, 0x80, 0xC3, 0x87, 0x01, 0xC0, 0xF1, 0x9F, 0x03, 0xC0, 0x38, 0x18, 0x03, 0xC0, 0x0C, 0x30, 0x03, 0x60, 0x0E, 0x30, 0x06, 0x60, 0x06, 0x30, 0x06, 0x60, 0x06, 0x18, 0x06, 0x60, 0x06, 0x0C, 0x06, 0x60, 0x0C, 0x1E, 0x06, 0x60, 0xF8, 0x3F, 0x06, 0xE0, 0xFE, 0x31, 0x06, 0xC0, 0x0E, 0x30, 0x06, 0xC0, 0x01, 0x18, 0x03, 0x80, 0x03, 0x1C, 0x03, 0x00, 0x07, 0x8F, 0x01, 0x00, 0xFE, 0x87, 0x01, 0x00, 0xF8, 0xC1, 0x00, 0x00, 0x00, 0x40, // 64 +0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x80, 0x8F, 0x01, 0x00, 0xE0, 0x83, 0x01, 0x00, 0x60, 0x80, 0x01, 0x00, 0xE0, 0x83, 0x01, 0x00, 0x80, 0x8F, 0x01, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 65 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0xC0, 0x78, 0x30, 0x00, 0xC0, 0xFF, 0x18, 0x00, 0x80, 0xC7, 0x1F, 0x00, 0x00, 0x80, 0x07, // 66 +0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x03, 0x0F, 0x00, 0x00, 0x02, 0x03, // 67 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x03, 0x0E, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 68 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 69 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, // 70 +0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x18, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x60, 0x30, 0x00, 0x60, 0x60, 0x30, 0x00, 0xE0, 0x60, 0x38, 0x00, 0xC0, 0x60, 0x18, 0x00, 0xC0, 0x61, 0x18, 0x00, 0x80, 0xE3, 0x0F, 0x00, 0x00, 0xE2, 0x0F, // 71 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 72 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 73 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0xE0, 0xFF, 0x1F, 0x00, 0xE0, 0xFF, 0x0F, // 74 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0xE7, 0x01, 0x00, 0x80, 0x83, 0x07, 0x00, 0xC0, 0x01, 0x0F, 0x00, 0xE0, 0x00, 0x1E, 0x00, 0x60, 0x00, 0x38, 0x00, 0x20, 0x00, 0x30, 0x00, 0x00, 0x00, 0x20, // 75 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, // 76 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0x01, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 77 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 78 +0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 79 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0xC0, 0x30, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0x00, 0x0F, // 80 +0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x0C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x18, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x36, 0x00, 0x60, 0x00, 0x36, 0x00, 0xE0, 0x00, 0x3C, 0x00, 0xC0, 0x00, 0x1C, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x3F, 0x00, 0x00, 0xFF, 0x77, 0x00, 0x00, 0xFC, 0x61, // 81 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x70, 0x00, 0x00, 0x60, 0xF0, 0x00, 0x00, 0x60, 0xF0, 0x03, 0x00, 0x60, 0xB0, 0x07, 0x00, 0xE0, 0x18, 0x1F, 0x00, 0xC0, 0x1F, 0x3C, 0x00, 0x80, 0x0F, 0x30, 0x00, 0x00, 0x00, 0x20, // 82 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x0F, 0x00, 0xC0, 0x1F, 0x1C, 0x00, 0xC0, 0x18, 0x18, 0x00, 0x60, 0x38, 0x38, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x70, 0x30, 0x00, 0xC0, 0x60, 0x18, 0x00, 0xC0, 0xE1, 0x18, 0x00, 0x80, 0xC3, 0x0F, 0x00, 0x00, 0x83, 0x07, // 83 +0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, // 84 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x03, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0x03, // 85 +0x20, 0x00, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0xF8, 0x01, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x3E, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x20, // 86 +0x60, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x80, 0xFF, 0x00, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x80, 0x1F, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x80, 0xFF, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x60, // 87 +0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x30, 0x00, 0x60, 0x00, 0x3C, 0x00, 0xE0, 0x01, 0x1E, 0x00, 0xC0, 0x83, 0x07, 0x00, 0x00, 0xCF, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xCF, 0x03, 0x00, 0xC0, 0x03, 0x07, 0x00, 0xE0, 0x01, 0x1E, 0x00, 0x60, 0x00, 0x3C, 0x00, 0x20, 0x00, 0x30, 0x00, 0x00, 0x00, 0x20, // 88 +0x20, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, // 89 +0x00, 0x00, 0x30, 0x00, 0x60, 0x00, 0x38, 0x00, 0x60, 0x00, 0x3C, 0x00, 0x60, 0x00, 0x37, 0x00, 0x60, 0x80, 0x33, 0x00, 0x60, 0xC0, 0x31, 0x00, 0x60, 0xE0, 0x30, 0x00, 0x60, 0x38, 0x30, 0x00, 0x60, 0x1C, 0x30, 0x00, 0x60, 0x0E, 0x30, 0x00, 0x60, 0x07, 0x30, 0x00, 0xE0, 0x01, 0x30, 0x00, 0xE0, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, // 90 +0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0x07, 0x60, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x06, // 91 +0x60, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 92 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x06, 0xE0, 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0x07, // 93 +0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0xC0, 0x07, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x20, // 94 +0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, // 95 +0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x80, // 96 +0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0x00, 0x8C, 0x39, 0x00, 0x00, 0x86, 0x31, 0x00, 0x00, 0x86, 0x31, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x18, 0x00, 0x00, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 97 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x18, 0x0C, 0x00, 0x00, 0x0C, 0x18, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xE0, 0x03, // 98 +0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x18, 0x0C, // 99 +0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0C, 0x18, 0x00, 0x00, 0x18, 0x0C, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 100 +0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xDC, 0x1C, 0x00, 0x00, 0xCE, 0x38, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xCE, 0x38, 0x00, 0x00, 0xDC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xF0, 0x04, // 101 +0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0xC0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x06, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x60, 0x06, // 102 +0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x83, 0x01, 0x00, 0xF8, 0x8F, 0x03, 0x00, 0x1C, 0x1C, 0x07, 0x00, 0x0E, 0x38, 0x06, 0x00, 0x06, 0x30, 0x06, 0x00, 0x06, 0x30, 0x06, 0x00, 0x06, 0x30, 0x06, 0x00, 0x0C, 0x18, 0x07, 0x00, 0x18, 0x8C, 0x03, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0xFE, 0xFF, // 103 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0xF8, 0x3F, // 104 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xFE, 0x3F, 0x00, 0x60, 0xFE, 0x3F, // 105 +0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x60, 0xFE, 0xFF, 0x07, 0x60, 0xFE, 0xFF, 0x03, // 106 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xF0, 0x01, 0x00, 0x00, 0x98, 0x07, 0x00, 0x00, 0x0C, 0x0E, 0x00, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x02, 0x30, 0x00, 0x00, 0x00, 0x20, // 107 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 108 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0xF8, 0x3F, // 109 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0xF8, 0x3F, // 110 +0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 111 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x07, 0x00, 0xFE, 0xFF, 0x07, 0x00, 0x18, 0x0C, 0x00, 0x00, 0x0C, 0x18, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xE0, 0x03, // 112 +0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0C, 0x18, 0x00, 0x00, 0x18, 0x0C, 0x00, 0x00, 0xFE, 0xFF, 0x07, 0x00, 0xFE, 0xFF, 0x07, // 113 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, // 114 +0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0C, 0x00, 0x00, 0x7C, 0x1C, 0x00, 0x00, 0xEE, 0x38, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x31, 0x00, 0x00, 0xC6, 0x31, 0x00, 0x00, 0x8E, 0x39, 0x00, 0x00, 0x9C, 0x1F, 0x00, 0x00, 0x18, 0x0F, // 115 +0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0xC0, 0xFF, 0x1F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, // 116 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0F, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, // 117 +0x00, 0x06, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0xC0, 0x07, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x06, // 118 +0x00, 0x0E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x0E, // 119 +0x00, 0x02, 0x20, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x1E, 0x3C, 0x00, 0x00, 0x38, 0x0E, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x38, 0x0E, 0x00, 0x00, 0x1C, 0x3C, 0x00, 0x00, 0x0E, 0x30, 0x00, 0x00, 0x02, 0x20, // 120 +0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x06, 0x00, 0xF0, 0x01, 0x06, 0x00, 0x80, 0x0F, 0x07, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0xFC, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0xF8, 0x03, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x06, // 121 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x06, 0x3E, 0x00, 0x00, 0x06, 0x37, 0x00, 0x00, 0xC6, 0x33, 0x00, 0x00, 0xE6, 0x30, 0x00, 0x00, 0x76, 0x30, 0x00, 0x00, 0x3E, 0x30, 0x00, 0x00, 0x1E, 0x30, 0x00, 0x00, 0x06, 0x30, // 122 +0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xC0, 0x03, 0x00, 0xC0, 0x7F, 0xFE, 0x03, 0xE0, 0x3F, 0xFC, 0x07, 0x60, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x06, // 123 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x0F, 0xE0, 0xFF, 0xFF, 0x0F, // 124 +0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x06, 0xE0, 0x3F, 0xFC, 0x07, 0xC0, 0x7F, 0xFF, 0x03, 0x00, 0xC0, 0x03, 0x00, 0x00, 0x80, 0x01, // 125 +0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x60, // 126 +0x00, 0x60, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x0C, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, // 129 +0x00, 0x60, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x06, // 130 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x10, 0x3C, 0x00, 0x00, 0x1C, 0x70, 0x00, 0x00, 0x0C, 0xE0, 0x01, 0x00, 0x04, 0x80, 0x03, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 131 +0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x80, 0x8F, 0x01, 0x00, 0xE0, 0x83, 0x01, 0x00, 0x60, 0x80, 0x01, 0x00, 0xE0, 0x83, 0x01, 0x00, 0x80, 0x8F, 0x01, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xB0, 0x03, 0x00, 0x00, 0x00, 0x03, // 132 +0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0x00, 0x8C, 0x39, 0x00, 0x00, 0x86, 0x31, 0x00, 0x00, 0x86, 0x31, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x18, 0x00, 0x00, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0xFF, 0x01, 0x00, 0x00, 0xA0, 0x03, 0x00, 0x00, 0x00, 0x03, // 133 +0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x68, 0x00, 0x30, 0x00, 0x6E, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0x62, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x03, 0x0F, 0x00, 0x00, 0x02, 0x03, // 134 +0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x80, 0x06, 0x30, 0x00, 0xE0, 0x06, 0x30, 0x00, 0x60, 0x06, 0x30, 0x00, 0x20, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x18, 0x0C, // 135 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, 0xE0, 0x06, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x20, 0x0E, 0x00, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0xF8, 0x3F, // 136 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x06, 0x3E, 0x00, 0x00, 0x06, 0x37, 0x00, 0x80, 0xC6, 0x33, 0x00, 0xE0, 0xE6, 0x30, 0x00, 0x60, 0x76, 0x30, 0x00, 0x20, 0x3E, 0x30, 0x00, 0x00, 0x1E, 0x30, 0x00, 0x00, 0x06, 0x30, // 137 +0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x68, 0x00, 0x30, 0x00, 0x6E, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0xE2, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 147 +0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x06, 0x30, 0x00, 0x80, 0x06, 0x30, 0x00, 0xE0, 0x06, 0x30, 0x00, 0x60, 0x0E, 0x38, 0x00, 0x20, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 148 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0xF0, 0x01, 0x60, 0x30, 0xB0, 0x03, 0x60, 0x30, 0x30, 0x03, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 152 +0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xDC, 0x1C, 0x00, 0x00, 0xCE, 0x38, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0xF0, 0x01, 0x00, 0xC6, 0xB0, 0x03, 0x00, 0xCE, 0x38, 0x03, 0x00, 0xDC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xF0, 0x04, // 153 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x0F, 0x00, 0xC0, 0x1F, 0x1C, 0x00, 0xC0, 0x18, 0x18, 0x00, 0x60, 0x38, 0x38, 0x00, 0x60, 0x30, 0x30, 0x00, 0x68, 0x30, 0x30, 0x00, 0x6E, 0x30, 0x30, 0x00, 0x66, 0x30, 0x30, 0x00, 0x62, 0x70, 0x30, 0x00, 0xC0, 0x60, 0x18, 0x00, 0xC0, 0xE1, 0x18, 0x00, 0x80, 0xC3, 0x0F, 0x00, 0x00, 0x83, 0x07, // 154 +0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0C, 0x00, 0x00, 0x7C, 0x1C, 0x00, 0x00, 0xEE, 0x38, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x80, 0xC6, 0x30, 0x00, 0xE0, 0xC6, 0x31, 0x00, 0x60, 0xC6, 0x31, 0x00, 0x20, 0x8E, 0x39, 0x00, 0x00, 0x9C, 0x1F, 0x00, 0x00, 0x18, 0x0F, // 155 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE6, 0xFF, 0x07, 0x00, 0xE6, 0xFF, 0x07, // 161 +0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x9C, 0x07, 0x00, 0x0E, 0x78, 0x00, 0x00, 0x06, 0x3F, 0x00, 0x00, 0xF6, 0x30, 0x00, 0x00, 0x0E, 0x30, 0x00, 0xE0, 0x0D, 0x1C, 0x00, 0x00, 0x1C, 0x0E, 0x00, 0x00, 0x10, 0x06, // 162 +0x00, 0x60, 0x10, 0x00, 0x00, 0x60, 0x38, 0x00, 0x00, 0x7F, 0x1C, 0x00, 0xC0, 0xFF, 0x1F, 0x00, 0xE0, 0xE0, 0x19, 0x00, 0x60, 0x60, 0x18, 0x00, 0x60, 0x60, 0x18, 0x00, 0x60, 0x60, 0x30, 0x00, 0xE0, 0x00, 0x30, 0x00, 0xC0, 0x01, 0x30, 0x00, 0x80, 0x01, 0x38, 0x00, 0x00, 0x00, 0x10, // 163 +0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0xF7, 0x0E, 0x00, 0x00, 0xFE, 0x07, 0x00, 0x00, 0x0C, 0x03, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x0C, 0x03, 0x00, 0x00, 0xFE, 0x07, 0x00, 0x00, 0xF7, 0x0E, 0x00, 0x00, 0x02, 0x04, // 164 +0xE0, 0x60, 0x06, 0x00, 0xC0, 0x61, 0x06, 0x00, 0x80, 0x67, 0x06, 0x00, 0x00, 0x7E, 0x06, 0x00, 0x00, 0x7C, 0x06, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x7C, 0x06, 0x00, 0x00, 0x7E, 0x06, 0x00, 0x80, 0x67, 0x06, 0x00, 0xC0, 0x61, 0x06, 0x00, 0xE0, 0x60, 0x06, 0x00, 0x20, // 165 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x7F, 0xF8, 0x0F, 0xE0, 0x7F, 0xF8, 0x0F, // 166 +0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x80, 0xF3, 0xC1, 0x00, 0xC0, 0x1F, 0xC3, 0x03, 0xE0, 0x0C, 0x07, 0x03, 0x60, 0x1C, 0x06, 0x06, 0x60, 0x18, 0x0C, 0x06, 0x60, 0x30, 0x1C, 0x06, 0xE0, 0x70, 0x38, 0x07, 0xC0, 0xE1, 0xF4, 0x03, 0x80, 0xC1, 0xE7, 0x01, 0x00, 0x80, 0x03, // 167 +0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, // 168 +0x00, 0xF8, 0x00, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0x07, 0x07, 0x00, 0x80, 0x01, 0x0C, 0x00, 0xC0, 0x79, 0x1C, 0x00, 0xC0, 0xFE, 0x19, 0x00, 0x60, 0x86, 0x31, 0x00, 0x60, 0x03, 0x33, 0x00, 0x60, 0x03, 0x33, 0x00, 0x60, 0x03, 0x33, 0x00, 0x60, 0x03, 0x33, 0x00, 0x60, 0x87, 0x33, 0x00, 0xC0, 0x86, 0x19, 0x00, 0xC0, 0x85, 0x1C, 0x00, 0x80, 0x01, 0x0C, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0xF8, // 169 +0x00, 0x00, 0x00, 0x00, 0xC0, 0x1C, 0x00, 0x00, 0xE0, 0x3E, 0x00, 0x00, 0x60, 0x32, 0x00, 0x00, 0x60, 0x32, 0x00, 0x00, 0xE0, 0x3F, 0x00, 0x00, 0xC0, 0x3F, // 170 +0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x78, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x84, 0x10, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x78, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x04, 0x10, // 171 +0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFC, 0x01, // 172 +0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, // 173 +0x00, 0xF8, 0x00, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0x07, 0x07, 0x00, 0x80, 0x01, 0x0C, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0xFE, 0x1B, 0x00, 0x60, 0xFE, 0x33, 0x00, 0x60, 0x66, 0x30, 0x00, 0x60, 0x66, 0x30, 0x00, 0x60, 0xE6, 0x30, 0x00, 0x60, 0xFE, 0x31, 0x00, 0x60, 0x3C, 0x33, 0x00, 0xC0, 0x00, 0x1A, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x01, 0x0C, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0xF8, // 174 +0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, // 175 +0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x80, 0x03, // 176 +0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0xFF, 0x3F, 0x00, 0x00, 0xFF, 0x3F, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, // 177 +0x40, 0x20, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x20, 0x38, 0x00, 0x00, 0x20, 0x2C, 0x00, 0x00, 0x20, 0x26, 0x00, 0x00, 0xE0, 0x23, 0x00, 0x00, 0xC0, 0x21, // 178 +0x40, 0x10, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x20, 0x22, 0x00, 0x00, 0x20, 0x22, 0x00, 0x00, 0xE0, 0x3D, 0x00, 0x00, 0xC0, 0x1D, // 179 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, // 180 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x07, 0x00, 0xFE, 0xFF, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, // 181 +0x00, 0x0F, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0xE0, 0x7F, 0x00, 0x00, 0xE0, 0x7F, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0x07, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0x07, 0x60, 0x00, 0x00, 0x00, 0x60, // 182 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, // 183 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xC0, 0x02, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x01, // 184 +0x00, 0x00, 0x30, 0x00, 0x60, 0x00, 0x38, 0x00, 0x60, 0x00, 0x3C, 0x00, 0x60, 0x00, 0x37, 0x00, 0x60, 0x80, 0x33, 0x00, 0x60, 0xC0, 0x31, 0x00, 0x68, 0xE0, 0x30, 0x00, 0x6E, 0x38, 0x30, 0x00, 0x66, 0x1C, 0x30, 0x00, 0x62, 0x0E, 0x30, 0x00, 0x60, 0x07, 0x30, 0x00, 0xE0, 0x01, 0x30, 0x00, 0xE0, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, // 185 +0x00, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0xE0, 0x38, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0xE0, 0x38, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0x80, 0x0F, // 186 +0x00, 0x00, 0x30, 0x00, 0x60, 0x00, 0x38, 0x00, 0x60, 0x00, 0x3C, 0x00, 0x60, 0x00, 0x37, 0x00, 0x60, 0x80, 0x33, 0x00, 0x60, 0xC0, 0x31, 0x00, 0x6C, 0xE0, 0x30, 0x00, 0x6C, 0x38, 0x30, 0x00, 0x60, 0x1C, 0x30, 0x00, 0x60, 0x0E, 0x30, 0x00, 0x60, 0x07, 0x30, 0x00, 0xE0, 0x01, 0x30, 0x00, 0xE0, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, // 187 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x06, 0x3E, 0x00, 0x00, 0x06, 0x37, 0x00, 0xC0, 0xC6, 0x33, 0x00, 0xC0, 0xE6, 0x30, 0x00, 0x00, 0x76, 0x30, 0x00, 0x00, 0x3E, 0x30, 0x00, 0x00, 0x1E, 0x30, 0x00, 0x00, 0x06, 0x30, // 188 +0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x20, 0x00, 0xE0, 0x3F, 0x30, 0x00, 0xE0, 0x3F, 0x1C, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x4E, 0x20, 0x00, 0x00, 0x67, 0x30, 0x00, 0xC0, 0x21, 0x38, 0x00, 0xE0, 0x20, 0x2C, 0x00, 0x60, 0x20, 0x26, 0x00, 0x00, 0xE0, 0x27, 0x00, 0x00, 0xC0, 0x21, // 189 +0x40, 0x10, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x20, 0x22, 0x20, 0x00, 0x20, 0x22, 0x30, 0x00, 0xE0, 0x3D, 0x38, 0x00, 0xC0, 0x1D, 0x0E, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x0E, 0x0C, 0x00, 0x00, 0x07, 0x0E, 0x00, 0x80, 0x83, 0x0B, 0x00, 0xE0, 0xC0, 0x08, 0x00, 0x60, 0xE0, 0x3F, 0x00, 0x20, 0xE0, 0x3F, 0x00, 0x00, 0x00, 0x08, // 190 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF8, 0x03, 0x00, 0x00, 0x1E, 0x03, 0x00, 0x00, 0x07, 0x07, 0x00, 0xE6, 0x03, 0x06, 0x00, 0xE6, 0x01, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xC0, // 191 +0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x82, 0x8F, 0x01, 0x00, 0xE6, 0x83, 0x01, 0x00, 0x6E, 0x80, 0x01, 0x00, 0xE8, 0x83, 0x01, 0x00, 0x80, 0x8F, 0x01, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 192 +0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x80, 0x8F, 0x01, 0x00, 0xE8, 0x83, 0x01, 0x00, 0x6E, 0x80, 0x01, 0x00, 0xE6, 0x83, 0x01, 0x00, 0x82, 0x8F, 0x01, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 193 +0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x88, 0x8F, 0x01, 0x00, 0xEC, 0x83, 0x01, 0x00, 0x66, 0x80, 0x01, 0x00, 0xE6, 0x83, 0x01, 0x00, 0x8C, 0x8F, 0x01, 0x00, 0x08, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 194 +0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x0C, 0xFE, 0x01, 0x00, 0x8E, 0x8F, 0x01, 0x00, 0xE6, 0x83, 0x01, 0x00, 0x66, 0x80, 0x01, 0x00, 0xEC, 0x83, 0x01, 0x00, 0x8C, 0x8F, 0x01, 0x00, 0x0E, 0xFE, 0x01, 0x00, 0x06, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 195 +0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x8C, 0x8F, 0x01, 0x00, 0xEC, 0x83, 0x01, 0x00, 0x60, 0x80, 0x01, 0x00, 0xE0, 0x83, 0x01, 0x00, 0x8C, 0x8F, 0x01, 0x00, 0x0C, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 196 +0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x9C, 0x8F, 0x01, 0x00, 0xE2, 0x83, 0x01, 0x00, 0x62, 0x80, 0x01, 0x00, 0xE2, 0x83, 0x01, 0x00, 0x9C, 0x8F, 0x01, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 197 +0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0xF0, 0x01, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00, 0x8F, 0x01, 0x00, 0xC0, 0x83, 0x01, 0x00, 0xE0, 0x80, 0x01, 0x00, 0x60, 0x80, 0x01, 0x00, 0x60, 0x80, 0x01, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 198 +0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0x60, 0x00, 0x30, 0x02, 0x60, 0x00, 0x30, 0x02, 0x60, 0x00, 0xF0, 0x02, 0x60, 0x00, 0xB0, 0x03, 0x60, 0x00, 0x30, 0x01, 0x60, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x03, 0x0F, 0x00, 0x00, 0x02, 0x03, // 199 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x62, 0x30, 0x30, 0x00, 0x66, 0x30, 0x30, 0x00, 0x6E, 0x30, 0x30, 0x00, 0x68, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 200 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x68, 0x30, 0x30, 0x00, 0x6E, 0x30, 0x30, 0x00, 0x66, 0x30, 0x30, 0x00, 0x62, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 201 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x68, 0x30, 0x30, 0x00, 0x6C, 0x30, 0x30, 0x00, 0x66, 0x30, 0x30, 0x00, 0x66, 0x30, 0x30, 0x00, 0x6C, 0x30, 0x30, 0x00, 0x68, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 202 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x6C, 0x30, 0x30, 0x00, 0x6C, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x6C, 0x30, 0x30, 0x00, 0x6C, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 203 +0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xE6, 0xFF, 0x3F, 0x00, 0xEE, 0xFF, 0x3F, 0x00, 0x08, // 204 +0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xEE, 0xFF, 0x3F, 0x00, 0xE6, 0xFF, 0x3F, 0x00, 0x02, // 205 +0x08, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0xE6, 0xFF, 0x3F, 0x00, 0xE6, 0xFF, 0x3F, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, // 206 +0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, // 207 +0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x03, 0x0E, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 208 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x8C, 0x03, 0x00, 0x00, 0x0E, 0x0E, 0x00, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x06, 0x70, 0x00, 0x00, 0x0C, 0xE0, 0x01, 0x00, 0x0C, 0x80, 0x03, 0x00, 0x0E, 0x00, 0x0F, 0x00, 0x06, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 209 +0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x62, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0x6E, 0x00, 0x30, 0x00, 0x68, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 210 +0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x60, 0x00, 0x30, 0x00, 0x68, 0x00, 0x30, 0x00, 0x6E, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0x62, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 211 +0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x68, 0x00, 0x30, 0x00, 0x6C, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0x6C, 0x00, 0x30, 0x00, 0xE8, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 212 +0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xCC, 0x00, 0x18, 0x00, 0xEE, 0x00, 0x38, 0x00, 0x66, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0x6C, 0x00, 0x30, 0x00, 0x6C, 0x00, 0x30, 0x00, 0x6E, 0x00, 0x30, 0x00, 0xE6, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 213 +0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x6C, 0x00, 0x30, 0x00, 0x6C, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x6C, 0x00, 0x30, 0x00, 0xEC, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 214 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x8E, 0x03, 0x00, 0x00, 0xDC, 0x01, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0xDC, 0x01, 0x00, 0x00, 0x8E, 0x03, 0x00, 0x00, 0x06, 0x03, // 215 +0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x21, 0x00, 0x00, 0xFF, 0x77, 0x00, 0x80, 0x07, 0x3F, 0x00, 0xC0, 0x01, 0x1E, 0x00, 0xC0, 0x00, 0x1F, 0x00, 0xE0, 0x80, 0x3B, 0x00, 0x60, 0xC0, 0x31, 0x00, 0x60, 0xE0, 0x30, 0x00, 0x60, 0x70, 0x30, 0x00, 0x60, 0x38, 0x30, 0x00, 0x60, 0x1C, 0x30, 0x00, 0xE0, 0x0E, 0x38, 0x00, 0xC0, 0x07, 0x18, 0x00, 0xC0, 0x03, 0x1C, 0x00, 0xE0, 0x07, 0x0F, 0x00, 0x70, 0xFF, 0x07, 0x00, 0x20, 0xFC, 0x01, // 216 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x03, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x02, 0x00, 0x30, 0x00, 0x06, 0x00, 0x30, 0x00, 0x0E, 0x00, 0x30, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0x03, // 217 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x03, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x08, 0x00, 0x30, 0x00, 0x0E, 0x00, 0x30, 0x00, 0x06, 0x00, 0x30, 0x00, 0x02, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0x03, // 218 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x03, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x08, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x06, 0x00, 0x30, 0x00, 0x06, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x08, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0x03, // 219 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x03, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0x03, // 220 +0x20, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x08, 0xF0, 0x3F, 0x00, 0x0E, 0xF0, 0x3F, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x02, 0x1E, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, // 221 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00, 0x86, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xF8, // 222 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x3F, 0x00, 0xC0, 0xFF, 0x3F, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x60, 0x00, 0x08, 0x00, 0x60, 0x00, 0x1C, 0x00, 0x60, 0x00, 0x38, 0x00, 0xE0, 0x78, 0x30, 0x00, 0xC0, 0x7F, 0x30, 0x00, 0x80, 0xC7, 0x30, 0x00, 0x00, 0x80, 0x39, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x0F, // 223 +0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0x00, 0x8C, 0x39, 0x00, 0x20, 0x86, 0x31, 0x00, 0x60, 0x86, 0x31, 0x00, 0xE0, 0xC6, 0x30, 0x00, 0x80, 0xC6, 0x18, 0x00, 0x00, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 224 +0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0x00, 0x8C, 0x39, 0x00, 0x00, 0x86, 0x31, 0x00, 0x80, 0x86, 0x31, 0x00, 0xE0, 0xC6, 0x30, 0x00, 0x60, 0xC6, 0x18, 0x00, 0x20, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 225 +0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0x80, 0x8C, 0x39, 0x00, 0xC0, 0x86, 0x31, 0x00, 0x60, 0x86, 0x31, 0x00, 0x60, 0xC6, 0x30, 0x00, 0xC0, 0xC6, 0x18, 0x00, 0x80, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 226 +0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0xC0, 0x1C, 0x1F, 0x00, 0xE0, 0x8C, 0x39, 0x00, 0x60, 0x86, 0x31, 0x00, 0x60, 0x86, 0x31, 0x00, 0xC0, 0xC6, 0x30, 0x00, 0xC0, 0xC6, 0x18, 0x00, 0xE0, 0xCE, 0x0C, 0x00, 0x60, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 227 +0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0xC0, 0x8C, 0x39, 0x00, 0xC0, 0x86, 0x31, 0x00, 0x00, 0x86, 0x31, 0x00, 0x00, 0xC6, 0x30, 0x00, 0xC0, 0xC6, 0x18, 0x00, 0xC0, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 228 +0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0x00, 0x8C, 0x39, 0x00, 0x70, 0x86, 0x31, 0x00, 0x88, 0x86, 0x31, 0x00, 0x88, 0xC6, 0x30, 0x00, 0x88, 0xC6, 0x18, 0x00, 0x70, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 229 +0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0F, 0x00, 0x00, 0x9C, 0x1F, 0x00, 0x00, 0xCC, 0x39, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0x66, 0x18, 0x00, 0x00, 0x6E, 0x1C, 0x00, 0x00, 0xFC, 0x0F, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xCC, 0x1C, 0x00, 0x00, 0xCE, 0x38, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xCC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xE0, 0x04, // 230 +0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x02, 0x00, 0x06, 0x30, 0x02, 0x00, 0x06, 0xF0, 0x02, 0x00, 0x06, 0xB0, 0x03, 0x00, 0x0E, 0x38, 0x01, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x18, 0x0C, // 231 +0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xDC, 0x1C, 0x00, 0x20, 0xCE, 0x38, 0x00, 0x60, 0xC6, 0x30, 0x00, 0xE0, 0xC6, 0x30, 0x00, 0x80, 0xC6, 0x30, 0x00, 0x00, 0xCE, 0x38, 0x00, 0x00, 0xDC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xF0, 0x04, // 232 +0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xDC, 0x1C, 0x00, 0x00, 0xCE, 0x38, 0x00, 0x80, 0xC6, 0x30, 0x00, 0xE0, 0xC6, 0x30, 0x00, 0x60, 0xC6, 0x30, 0x00, 0x20, 0xCE, 0x38, 0x00, 0x00, 0xDC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xF0, 0x04, // 233 +0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xDC, 0x1C, 0x00, 0x80, 0xCE, 0x38, 0x00, 0xC0, 0xC6, 0x30, 0x00, 0x60, 0xC6, 0x30, 0x00, 0x60, 0xC6, 0x30, 0x00, 0xC0, 0xCE, 0x38, 0x00, 0x80, 0xDC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xF0, 0x04, // 234 +0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xDC, 0x1C, 0x00, 0xC0, 0xCE, 0x38, 0x00, 0xC0, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0xC0, 0xCE, 0x38, 0x00, 0xC0, 0xDC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xF0, 0x04, // 235 +0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x60, 0xFE, 0x3F, 0x00, 0xE0, 0xFE, 0x3F, 0x00, 0x80, // 236 +0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xE0, 0xFE, 0x3F, 0x00, 0x60, 0xFE, 0x3F, 0x00, 0x20, // 237 +0x80, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x60, 0xFE, 0x3F, 0x00, 0x60, 0xFE, 0x3F, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x80, // 238 +0xC0, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xC0, // 239 +0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1D, 0x1C, 0x00, 0xA0, 0x0F, 0x38, 0x00, 0xA0, 0x06, 0x30, 0x00, 0xE0, 0x06, 0x30, 0x00, 0xC0, 0x06, 0x30, 0x00, 0xC0, 0x0F, 0x38, 0x00, 0x20, 0x1F, 0x1C, 0x00, 0x00, 0xFC, 0x0F, 0x00, 0x00, 0xE0, 0x07, // 240 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0xC0, 0xFE, 0x3F, 0x00, 0xE0, 0x18, 0x00, 0x00, 0x60, 0x0C, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0xC0, 0x06, 0x00, 0x00, 0xC0, 0x06, 0x00, 0x00, 0xE0, 0x0E, 0x00, 0x00, 0x60, 0xFC, 0x3F, 0x00, 0x00, 0xF8, 0x3F, // 241 +0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x20, 0x0E, 0x38, 0x00, 0x60, 0x06, 0x30, 0x00, 0xE0, 0x06, 0x30, 0x00, 0x80, 0x06, 0x30, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 242 +0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x80, 0x06, 0x30, 0x00, 0xE0, 0x06, 0x30, 0x00, 0x60, 0x06, 0x30, 0x00, 0x20, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 243 +0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x80, 0x0E, 0x38, 0x00, 0xC0, 0x06, 0x30, 0x00, 0x60, 0x06, 0x30, 0x00, 0x60, 0x06, 0x30, 0x00, 0xC0, 0x0E, 0x38, 0x00, 0x80, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 244 +0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0xC0, 0x1C, 0x1C, 0x00, 0xE0, 0x0E, 0x38, 0x00, 0x60, 0x06, 0x30, 0x00, 0x60, 0x06, 0x30, 0x00, 0xC0, 0x06, 0x30, 0x00, 0xC0, 0x0E, 0x38, 0x00, 0xE0, 0x1C, 0x1C, 0x00, 0x60, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 245 +0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0xC0, 0x0E, 0x38, 0x00, 0xC0, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0xC0, 0x0E, 0x38, 0x00, 0xC0, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 246 +0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0xB6, 0x01, 0x00, 0x00, 0xB6, 0x01, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, // 247 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x67, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x3F, 0x00, 0x00, 0x86, 0x33, 0x00, 0x00, 0xE6, 0x31, 0x00, 0x00, 0x76, 0x30, 0x00, 0x00, 0x3E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xFF, 0x0F, 0x00, 0x00, 0xF3, 0x07, // 248 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0F, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x20, 0x00, 0x38, 0x00, 0x60, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x30, 0x00, 0x80, 0x00, 0x30, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, // 249 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0F, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x80, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x30, 0x00, 0x60, 0x00, 0x18, 0x00, 0x20, 0x00, 0x0C, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, // 250 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0F, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x80, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x18, 0x00, 0x80, 0x00, 0x0C, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, // 251 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0F, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0xC0, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x00, 0x0C, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, // 252 +0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x06, 0x00, 0xF0, 0x01, 0x06, 0x00, 0x80, 0x0F, 0x07, 0x80, 0x00, 0xFE, 0x03, 0xE0, 0x00, 0xFC, 0x00, 0x60, 0xC0, 0x1F, 0x00, 0x20, 0xF8, 0x03, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x06, // 253 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0x07, 0x00, 0x1C, 0x18, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x03, // 254 +0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x06, 0xC0, 0xF0, 0x01, 0x06, 0xC0, 0x80, 0x0F, 0x07, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0xFC, 0x00, 0xC0, 0xC0, 0x1F, 0x00, 0xC0, 0xF8, 0x03, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x06, // 255 }; \ No newline at end of file diff --git a/src/graphics/fonts/OLEDDisplayFontsPL.h b/src/graphics/fonts/OLEDDisplayFontsPL.h index 59dd92c41..1e6790e07 100644 --- a/src/graphics/fonts/OLEDDisplayFontsPL.h +++ b/src/graphics/fonts/OLEDDisplayFontsPL.h @@ -6,6 +6,7 @@ #elif __MBED__ #define PROGMEM #endif - extern const uint8_t ArialMT_Plain_10_PL[] PROGMEM; +extern const uint8_t ArialMT_Plain_16_PL[] PROGMEM; +extern const uint8_t ArialMT_Plain_24_PL[] PROGMEM; #endif \ No newline at end of file From fd60c9b3be6ef285ab38866d2d6a9543d44519f7 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Sun, 12 Jan 2025 15:16:26 +0800 Subject: [PATCH 083/381] Upgrade to LovyanGFX 1.2 (#5677) * [WIP] Attempt upgrade to LovyanGFX 1.1.16 This is the version most used by the TFT branch. I wonder if this will work with our existing code? :) * Update Portduino to LovyanGFX 1.20.0 Manuel says it's good to go. * Update unPhone platformio.ini --------- Co-authored-by: Manuel <71137295+mverch67@users.noreply.github.com> --- arch/portduino/portduino.ini | 4 ++-- variants/chatter2/platformio.ini | 2 +- variants/heltec_wireless_tracker/platformio.ini | 2 +- variants/heltec_wireless_tracker_V1_0/platformio.ini | 2 +- variants/m5stack_core/platformio.ini | 2 +- variants/mesh-tab/platformio.ini | 2 +- variants/picomputer-s3/platformio.ini | 2 +- variants/t-deck/platformio.ini | 2 +- variants/t-watch-s3/platformio.ini | 2 +- variants/tracksenger/platformio.ini | 4 ++-- variants/unphone/platformio.ini | 6 +++--- variants/wiphone/platformio.ini | 4 ++-- 12 files changed, 17 insertions(+), 17 deletions(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index aa1150e9a..7ea6a77a2 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -25,7 +25,7 @@ lib_deps = ${networking_base.lib_deps} ${radiolib_base.lib_deps} rweather/Crypto@^0.4.0 - https://github.com/lovyan03/LovyanGFX.git#1401c28a47646fe00538d487adcb2eb3c72de805 + lovyan03/LovyanGFX@^1.2.0 https://github.com/pine64/libch341-spi-userspace#a9b17e3452f7fb747000d9b4ad4409155b39f6ef build_flags = @@ -40,4 +40,4 @@ build_flags = -lgpiod -lyaml-cpp -li2c - -std=c++17 \ No newline at end of file + -std=c++17 diff --git a/variants/chatter2/platformio.ini b/variants/chatter2/platformio.ini index 1f086cf07..83e00d0c4 100644 --- a/variants/chatter2/platformio.ini +++ b/variants/chatter2/platformio.ini @@ -9,4 +9,4 @@ build_flags = lib_deps = ${esp32_base.lib_deps} - lovyan03/LovyanGFX@^1.1.8 \ No newline at end of file + lovyan03/LovyanGFX@^1.2.0 diff --git a/variants/heltec_wireless_tracker/platformio.ini b/variants/heltec_wireless_tracker/platformio.ini index c7ecce8ea..4f686d289 100644 --- a/variants/heltec_wireless_tracker/platformio.ini +++ b/variants/heltec_wireless_tracker/platformio.ini @@ -11,4 +11,4 @@ build_flags = lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@^1.1.8 + lovyan03/LovyanGFX@^1.2.0 diff --git a/variants/heltec_wireless_tracker_V1_0/platformio.ini b/variants/heltec_wireless_tracker_V1_0/platformio.ini index 0e48c72f2..5f512b816 100644 --- a/variants/heltec_wireless_tracker_V1_0/platformio.ini +++ b/variants/heltec_wireless_tracker_V1_0/platformio.ini @@ -10,4 +10,4 @@ build_flags = ;-D DEBUG_DISABLED ; uncomment this line to disable DEBUG output lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@^1.1.8 \ No newline at end of file + lovyan03/LovyanGFX@^1.2.0 diff --git a/variants/m5stack_core/platformio.ini b/variants/m5stack_core/platformio.ini index 95f5aea9f..7418d9e17 100644 --- a/variants/m5stack_core/platformio.ini +++ b/variants/m5stack_core/platformio.ini @@ -25,4 +25,4 @@ lib_ignore = m5stack-core lib_deps = ${esp32_base.lib_deps} - lovyan03/LovyanGFX@^1.1.8 \ No newline at end of file + lovyan03/LovyanGFX@^1.2.0 diff --git a/variants/mesh-tab/platformio.ini b/variants/mesh-tab/platformio.ini index 30be7dbb8..d6fd1a3ac 100644 --- a/variants/mesh-tab/platformio.ini +++ b/variants/mesh-tab/platformio.ini @@ -54,7 +54,7 @@ build_src_filter = ${esp32_base.build_src_filter} +<../lib/device-ui/locale> +<../lib/device-ui/source> lib_deps = ${esp32_base.lib_deps} - lovyan03/LovyanGFX@^1.1.16 + lovyan03/LovyanGFX@^1.2.0 [mesh_tab_xpt2046] extends = mesh_tab_base diff --git a/variants/picomputer-s3/platformio.ini b/variants/picomputer-s3/platformio.ini index 202cd05e7..5a05d7b90 100644 --- a/variants/picomputer-s3/platformio.ini +++ b/variants/picomputer-s3/platformio.ini @@ -14,4 +14,4 @@ build_flags = lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@^1.1.8 + lovyan03/LovyanGFX@^1.2.0 diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index d2f09f50b..003dd184d 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -14,6 +14,6 @@ build_flags = ${esp32s3_base.build_flags} -Ivariants/t-deck lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@^1.1.9 + lovyan03/LovyanGFX@^1.2.0 earlephilhower/ESP8266Audio@^1.9.9 earlephilhower/ESP8266SAM@^1.0.1 diff --git a/variants/t-watch-s3/platformio.ini b/variants/t-watch-s3/platformio.ini index 005c4d021..8f48cf6c4 100644 --- a/variants/t-watch-s3/platformio.ini +++ b/variants/t-watch-s3/platformio.ini @@ -12,7 +12,7 @@ build_flags = ${esp32_base.build_flags} -DHAS_BMA423=1 lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@^1.1.9 + lovyan03/LovyanGFX@^1.2.0 lewisxhe/PCF8563_Library@1.0.1 adafruit/Adafruit DRV2605 Library@^1.2.2 earlephilhower/ESP8266Audio@^1.9.9 diff --git a/variants/tracksenger/platformio.ini b/variants/tracksenger/platformio.ini index d3e31264f..796a3b7d5 100644 --- a/variants/tracksenger/platformio.ini +++ b/variants/tracksenger/platformio.ini @@ -11,7 +11,7 @@ build_flags = lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@^1.1.8 + lovyan03/LovyanGFX@^1.2.0 [env:tracksenger-lcd] extends = esp32s3_base @@ -26,7 +26,7 @@ build_flags = lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@^1.1.8 + lovyan03/LovyanGFX@^1.2.0 [env:tracksenger-oled] extends = esp32s3_base diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini index 489c70f99..e21e9ed77 100644 --- a/variants/unphone/platformio.ini +++ b/variants/unphone/platformio.ini @@ -26,7 +26,7 @@ build_flags = ${esp32_base.build_flags} build_src_filter = ${esp32_base.build_src_filter} +<../variants/unphone> lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@ 1.1.12 + lovyan03/LovyanGFX@ 1.2.0 https://gitlab.com/hamishcunningham/unphonelibrary#meshtastic@9.0.0 adafruit/Adafruit NeoPixel @ ^1.12.0 @@ -72,6 +72,6 @@ build_src_filter = ${esp32_base.build_src_filter} +<../variants/unphone> +<../lib/device-ui/source> lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@^1.1.12 + lovyan03/LovyanGFX@^1.2.0 https://gitlab.com/hamishcunningham/unphonelibrary#meshtastic@9.0.0 - adafruit/Adafruit NeoPixel@1.12.0 \ No newline at end of file + adafruit/Adafruit NeoPixel@1.12.0 diff --git a/variants/wiphone/platformio.ini b/variants/wiphone/platformio.ini index 0218f8930..362102731 100644 --- a/variants/wiphone/platformio.ini +++ b/variants/wiphone/platformio.ini @@ -8,6 +8,6 @@ build_flags = ${esp32_base.build_flags} -D WIPHONE -I variants/wiphone lib_deps = ${esp32_base.lib_deps} - lovyan03/LovyanGFX@^1.1.8 + lovyan03/LovyanGFX@^1.2.0 sparkfun/SX1509 IO Expander@^3.0.5 - pololu/APA102@^3.0.0 \ No newline at end of file + pololu/APA102@^3.0.0 From 124936b6cfc848483df69d0eacd0dcfd7fb34a12 Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Sun, 12 Jan 2025 10:05:04 -0800 Subject: [PATCH 084/381] Avoid a potential NULL pointer reference in nrf52/BluetoothPhoneAPI (#5830) --- src/platform/nrf52/NRF52Bluetooth.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/platform/nrf52/NRF52Bluetooth.cpp b/src/platform/nrf52/NRF52Bluetooth.cpp index 31bbc7fa9..541e90ab2 100644 --- a/src/platform/nrf52/NRF52Bluetooth.cpp +++ b/src/platform/nrf52/NRF52Bluetooth.cpp @@ -44,11 +44,7 @@ class BluetoothPhoneAPI : public PhoneAPI } /// Check the current underlying physical link to see if the client is currently connected - virtual bool checkIsConnected() override - { - BLEConnection *connection = Bluefruit.Connection(connectionHandle); - return connection->connected(); - } + virtual bool checkIsConnected() override { return Bluefruit.connected(connectionHandle); } }; static BluetoothPhoneAPI *bluetoothPhoneAPI; From 0cf4a2951a7eccf390c52c5adf49e6196b2cae82 Mon Sep 17 00:00:00 2001 From: Erayd Date: Mon, 13 Jan 2025 07:05:51 +1300 Subject: [PATCH 085/381] Bugfix for low-priority packet replacement when TX queue is full (#5827) * Correct function comment * Enqueue the intended packet, not the pointer to what we just dropped! * Add some log output when we drop packets due to a full queue * Make it clear when a non-late packet is dropped * Remove from queue before release, not after * Erase dropped packet from queue * Declared type * Log TX queue length after every send * Fix operand order * Add worst-case cap on TX delay vs current time --- protobufs | 2 +- src/mesh/MeshPacketQueue.cpp | 22 +++++++++++++++++----- src/mesh/RadioLibInterface.cpp | 5 +++-- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/protobufs b/protobufs index 76f806e1b..c55f120a9 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 76f806e1bb1e2a7b157a14fadd095775f63db5e4 +Subproject commit c55f120a9c1ce90c85e4826907a0b9bcb2d5f5a2 diff --git a/src/mesh/MeshPacketQueue.cpp b/src/mesh/MeshPacketQueue.cpp index d7ee65800..7dd84639d 100644 --- a/src/mesh/MeshPacketQueue.cpp +++ b/src/mesh/MeshPacketQueue.cpp @@ -69,7 +69,11 @@ bool MeshPacketQueue::enqueue(meshtastic_MeshPacket *p) { // no space - try to replace a lower priority packet in the queue if (queue.size() >= maxLen) { - return replaceLowerPriorityPacket(p); + bool replaced = replaceLowerPriorityPacket(p); + if (!replaced) { + LOG_WARN("TX queue is full, and there is no lower-priority packet available to evict in favour of 0x%08x", p->id); + } + return replaced; } // Find the correct position using upper_bound to maintain a stable order @@ -113,7 +117,10 @@ meshtastic_MeshPacket *MeshPacketQueue::remove(NodeNum from, PacketId id, bool t return NULL; } -/** Attempt to find and remove a packet from this queue. Returns the packet which was removed from the queue */ +/** + * Attempt to find a lower-priority packet in the queue and replace it with the provided one. + * @return True if the replacement succeeded, false otherwise + */ bool MeshPacketQueue::replaceLowerPriorityPacket(meshtastic_MeshPacket *p) { @@ -122,11 +129,12 @@ bool MeshPacketQueue::replaceLowerPriorityPacket(meshtastic_MeshPacket *p) } // Check if the packet at the back has a lower priority than the new packet - auto &backPacket = queue.back(); + auto *backPacket = queue.back(); if (!backPacket->tx_after && backPacket->priority < p->priority) { + LOG_WARN("Dropping packet 0x%08x to make room in the TX queue for higher-priority packet 0x%08x", backPacket->id, p->id); // Remove the back packet - packetPool.release(backPacket); queue.pop_back(); + packetPool.release(backPacket); // Insert the new packet in the correct order enqueue(p); return true; @@ -139,8 +147,12 @@ bool MeshPacketQueue::replaceLowerPriorityPacket(meshtastic_MeshPacket *p) for (; refPacket->tx_after && it != queue.begin(); refPacket = *--it) ; if (!refPacket->tx_after && refPacket->priority < p->priority) { + LOG_WARN("Dropping non-late packet 0x%08x to make room in the TX queue for higher-priority packet 0x%08x", + refPacket->id, p->id); + queue.erase(it); packetPool.release(refPacket); - enqueue(refPacket); + // Insert the new packet in the correct order + enqueue(p); return true; } } diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index 0a047a660..e31f0b3e2 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -271,6 +271,7 @@ void RadioLibInterface::onNotify(uint32_t notification) uint32_t xmitMsec = getPacketTime(txp); airTime->logAirtime(TX_LOG, xmitMsec); } + LOG_DEBUG("%d packets remain in the TX queue", txQueue.getMaxLen() - txQueue.getFree()); } } } @@ -297,8 +298,8 @@ void RadioLibInterface::setTransmitDelay() if (p->tx_after) { unsigned long add_delay = p->rx_rssi ? getTxDelayMsecWeighted(p->rx_snr) : getTxDelayMsec(); unsigned long now = millis(); - p->tx_after = max(p->tx_after + add_delay, now + add_delay); - notifyLater(now - p->tx_after, TRANSMIT_DELAY_COMPLETED, false); + p->tx_after = min(max(p->tx_after + add_delay, now + add_delay), now + 2 * getTxDelayMsecWeightedWorst(p->rx_snr)); + notifyLater(p->tx_after - now, TRANSMIT_DELAY_COMPLETED, false); } else if (p->rx_snr == 0 && p->rx_rssi == 0) { /* We assume if rx_snr = 0 and rx_rssi = 0, the packet was generated locally. * This assumption is valid because of the offset generated by the radio to account for the noise From 70296b47bc9b4a026f3aceb73d8afb8448249160 Mon Sep 17 00:00:00 2001 From: Patrick Siegl <3261314+psiegl@users.noreply.github.com> Date: Sun, 12 Jan 2025 20:40:25 +0100 Subject: [PATCH 086/381] Multi gpiochip support for native environment (#5743) * For each GPIO PIN, allow to specify gpiochip and line * Added support for LLCC68 in native env. * Removed one if by employing && * Fix for log, as std::string and not const char* * Remove CH341 flag, enabling it for all LoRa chips * Provide a default example --------- Co-authored-by: Ben Meadors Co-authored-by: Jonathan Bennett --- bin/config-dist.yaml | 45 +++++- src/main.cpp | 141 ++++++------------- src/mesh/RF95Interface.cpp | 22 +-- src/mesh/SX126xInterface.cpp | 12 +- src/mesh/SX128xInterface.cpp | 42 +++--- src/platform/portduino/PortduinoGlue.cpp | 167 ++++++++++++----------- src/platform/portduino/PortduinoGlue.h | 37 +++-- 7 files changed, 237 insertions(+), 229 deletions(-) diff --git a/bin/config-dist.yaml b/bin/config-dist.yaml index e68b01ba3..c8f181308 100644 --- a/bin/config-dist.yaml +++ b/bin/config-dist.yaml @@ -23,6 +23,47 @@ Lora: # Busy: 20 # Reset: 18 +### The Radxa Zero 3E/W employs multiple gpio chips. +### Each gpio pin must be unique, but can be assigned to a specific gpio chip and line. +### In case solely a no. is given, the default gpio chip and pin == line will be employed. +### +# Module: sx1262 # Radxa Zero 3E/W + Ebyte E22-900M30S +# DIO2_AS_RF_SWITCH: true +# DIO3_TCXO_VOLTAGE: 1.8 +# CS: # NSS PIN_24 -> chip 4, line 22 +# pin: 24 +# gpiochip: 4 +# line: 22 +# SCK: # SCK PIN_23 -> chip 4, line 18 +# pin: 23 +# gpiochip: 4 +# line: 18 +# Busy: # BUSY PIN_29 -> chip 3!, line 11 +# pin: 29 +# gpiochip: 3 +# line: 11 +# MOSI: # MOSI PIN_19 -> chip 4, line 19 +# pin: 19 +# gpiochip: 4 +# line: 19 +# MISO: # MISO PIN_21 -> chip 4, line 21 +# pin: 21 +# gpiochip: 4 +# line: 21 +# Reset: # NRST PIN_27 -> chip 4, line 10 +# pin: 27 +# gpiochip: 4 +# line: 10 +# IRQ: # DIO1 PIN_28 -> chip 4, line 11 +# pin: 28 +# gpiochip: 4 +# line: 11 +# RXen: # RXEN PIN_22 -> chip 3!, line 17 +# pin: 22 +# gpiochip: 3 +# line: 17 +# TXen: RADIOLIB_NC # TXEN no PIN, no line, fallback to default gpio chip + # Module: sx1268 # SX1268-based modules, tested with Ebyte E22 400M33S # CS: 21 # IRQ: 16 @@ -39,7 +80,7 @@ Lora: # spiSpeed: 2000000 -### Set gpio chip to use in /dev/. Defaults to 0. +### Set default/fallback gpio chip to use in /dev/. Defaults to 0. ### Notably the Raspberry Pi 5 puts the GPIO header on gpiochip4 # gpiochip: 4 @@ -147,4 +188,4 @@ General: MaxMessageQueue: 100 ConfigDirectory: /etc/meshtasticd/config.d/ # MACAddress: AA:BB:CC:DD:EE:FF -# MACAddressSource: eth0 \ No newline at end of file +# MACAddressSource: eth0 diff --git a/src/main.cpp b/src/main.cpp index 4a642ef6d..338fca5c1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -826,116 +826,61 @@ void setup() #endif #ifdef ARCH_PORTDUINO - if (settingsMap[use_sx1262]) { - if (!rIf) { - LOG_DEBUG("Activate sx1262 radio on SPI port %s", settingsStrings[spidev].c_str()); + const struct { configNames cfgName; + std::string strName; + } loraModules[] = { + { use_rf95, "RF95" }, + { use_sx1262, "sx1262" }, + { use_sx1268, "sx1268" }, + { use_sx1280, "sx1280" }, + { use_lr1110, "lr1110" }, + { use_lr1120, "lr1120" }, + { use_lr1121, "lr1121" }, + { use_llcc68, "LLCC68" } + }; + // as one can't use a function pointer to the class constructor: + auto loraModuleInterface = [](configNames cfgName, LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy) { + switch (cfgName) { + case use_rf95: + return (RadioInterface*)new RF95Interface(hal, cs, irq, rst, busy); + case use_sx1262: + return (RadioInterface*)new SX1262Interface(hal, cs, irq, rst, busy); + case use_sx1268: + return (RadioInterface*)new SX1268Interface(hal, cs, irq, rst, busy); + case use_sx1280: + return (RadioInterface*)new SX1280Interface(hal, cs, irq, rst, busy); + case use_lr1110: + return (RadioInterface*)new LR1110Interface(hal, cs, irq, rst, busy); + case use_lr1120: + return (RadioInterface*)new LR1120Interface(hal, cs, irq, rst, busy); + case use_lr1121: + return (RadioInterface*)new LR1121Interface(hal, cs, irq, rst, busy); + case use_llcc68: + return (RadioInterface*)new LLCC68Interface(hal, cs, irq, rst, busy); + default: + assert(0); // shouldn't happen + return (RadioInterface*)nullptr; + } + }; + for (auto& loraModule : loraModules) { + if (settingsMap[loraModule.cfgName] && !rIf) { + LOG_DEBUG("Activate %s radio on SPI port %s", loraModule.strName.c_str(), settingsStrings[spidev].c_str()); if (settingsStrings[spidev] == "ch341") { RadioLibHAL = ch341Hal; } else { RadioLibHAL = new LockingArduinoHal(SPI, spiSettings); } - rIf = new SX1262Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset], - settingsMap[busy]); + rIf = loraModuleInterface(loraModule.cfgName, (LockingArduinoHal *)RadioLibHAL, settingsMap[cs_pin], settingsMap[irq_pin], settingsMap[reset_pin], settingsMap[busy_pin]); if (!rIf->init()) { - LOG_WARN("No SX1262 radio"); - delete rIf; - exit(EXIT_FAILURE); - } else { - LOG_INFO("SX1262 init success"); - } - } - } else if (settingsMap[use_rf95]) { - if (!rIf) { - LOG_DEBUG("Activate rf95 radio on SPI port %s", settingsStrings[spidev].c_str()); - RadioLibHAL = new LockingArduinoHal(SPI, spiSettings); - rIf = new RF95Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset], - settingsMap[busy]); - if (!rIf->init()) { - LOG_WARN("No RF95 radio"); + LOG_WARN("No %s radio", loraModule.strName.c_str()); delete rIf; rIf = NULL; exit(EXIT_FAILURE); } else { - LOG_INFO("RF95 init success"); - } - } - } else if (settingsMap[use_sx1280]) { - if (!rIf) { - LOG_DEBUG("Activate sx1280 radio on SPI port %s", settingsStrings[spidev].c_str()); - RadioLibHAL = new LockingArduinoHal(SPI, spiSettings); - rIf = new SX1280Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset], - settingsMap[busy]); - if (!rIf->init()) { - LOG_WARN("No SX1280 radio"); - delete rIf; - rIf = NULL; - exit(EXIT_FAILURE); - } else { - LOG_INFO("SX1280 init success"); - } - } - } else if (settingsMap[use_lr1110]) { - if (!rIf) { - LOG_DEBUG("Activate lr1110 radio on SPI port %s", settingsStrings[spidev].c_str()); - LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(SPI, spiSettings); - rIf = new LR1110Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset], - settingsMap[busy]); - if (!rIf->init()) { - LOG_WARN("No LR1110 radio"); - delete rIf; - rIf = NULL; - exit(EXIT_FAILURE); - } else { - LOG_INFO("LR1110 init success"); - } - } - } else if (settingsMap[use_lr1120]) { - if (!rIf) { - LOG_DEBUG("Activate lr1120 radio on SPI port %s", settingsStrings[spidev].c_str()); - LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(SPI, spiSettings); - rIf = new LR1120Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset], - settingsMap[busy]); - if (!rIf->init()) { - LOG_WARN("No LR1120 radio"); - delete rIf; - rIf = NULL; - exit(EXIT_FAILURE); - } else { - LOG_INFO("LR1120 init success"); - } - } - } else if (settingsMap[use_lr1121]) { - if (!rIf) { - LOG_DEBUG("Activate lr1121 radio on SPI port %s", settingsStrings[spidev].c_str()); - LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(SPI, spiSettings); - rIf = new LR1121Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset], - settingsMap[busy]); - if (!rIf->init()) { - LOG_WARN("No LR1121 radio"); - delete rIf; - rIf = NULL; - exit(EXIT_FAILURE); - } else { - LOG_INFO("LR1121 init success"); - } - } - } else if (settingsMap[use_sx1268]) { - if (!rIf) { - LOG_DEBUG("Activate sx1268 radio on SPI port %s", settingsStrings[spidev].c_str()); - RadioLibHAL = new LockingArduinoHal(SPI, spiSettings); - rIf = new SX1268Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset], - settingsMap[busy]); - if (!rIf->init()) { - LOG_WARN("No SX1268 radio"); - delete rIf; - rIf = NULL; - exit(EXIT_FAILURE); - } else { - LOG_INFO("SX1268 init success"); + LOG_INFO("%s init success", loraModule.strName.c_str()); } } } - #elif defined(HW_SPI1_DEVICE) LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(SPI1, spiSettings); #else // HW_SPI1_DEVICE @@ -1280,4 +1225,4 @@ void loop() mainDelay.delay(delayMsec); } } -#endif \ No newline at end of file +#endif diff --git a/src/mesh/RF95Interface.cpp b/src/mesh/RF95Interface.cpp index 9ef045099..d4d9ad23c 100644 --- a/src/mesh/RF95Interface.cpp +++ b/src/mesh/RF95Interface.cpp @@ -91,16 +91,16 @@ void RF95Interface::setTransmitEnable(bool txon) #ifdef RF95_TXEN digitalWrite(RF95_TXEN, txon ? 1 : 0); #elif ARCH_PORTDUINO - if (settingsMap[txen] != RADIOLIB_NC) { - digitalWrite(settingsMap[txen], txon ? 1 : 0); + if (settingsMap[txen_pin] != RADIOLIB_NC) { + digitalWrite(settingsMap[txen_pin], txon ? 1 : 0); } #endif #ifdef RF95_RXEN digitalWrite(RF95_RXEN, txon ? 0 : 1); #elif ARCH_PORTDUINO - if (settingsMap[rxen] != RADIOLIB_NC) { - digitalWrite(settingsMap[rxen], txon ? 0 : 1); + if (settingsMap[rxen_pin] != RADIOLIB_NC) { + digitalWrite(settingsMap[rxen_pin], txon ? 0 : 1); } #endif } @@ -164,13 +164,13 @@ bool RF95Interface::init() digitalWrite(RF95_RXEN, 1); #endif #if ARCH_PORTDUINO - if (settingsMap[txen] != RADIOLIB_NC) { - pinMode(settingsMap[txen], OUTPUT); - digitalWrite(settingsMap[txen], 0); + if (settingsMap[txen_pin] != RADIOLIB_NC) { + pinMode(settingsMap[txen_pin], OUTPUT); + digitalWrite(settingsMap[txen_pin], 0); } - if (settingsMap[rxen] != RADIOLIB_NC) { - pinMode(settingsMap[rxen], OUTPUT); - digitalWrite(settingsMap[rxen], 0); + if (settingsMap[rxen_pin] != RADIOLIB_NC) { + pinMode(settingsMap[rxen_pin], OUTPUT); + digitalWrite(settingsMap[rxen_pin], 0); } #endif setTransmitEnable(false); @@ -337,4 +337,4 @@ bool RF95Interface::sleep() return true; } -#endif \ No newline at end of file +#endif diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index ed0267c5b..b13bb6faf 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -51,9 +51,9 @@ template bool SX126xInterface::init() #if ARCH_PORTDUINO float tcxoVoltage = (float)settingsMap[dio3_tcxo_voltage] / 1000; - if (settingsMap[sx126x_ant_sw] != RADIOLIB_NC) { - digitalWrite(settingsMap[sx126x_ant_sw], HIGH); - pinMode(settingsMap[sx126x_ant_sw], OUTPUT); + if (settingsMap[sx126x_ant_sw_pin] != RADIOLIB_NC) { + digitalWrite(settingsMap[sx126x_ant_sw_pin], HIGH); + pinMode(settingsMap[sx126x_ant_sw_pin], OUTPUT); } // FIXME: correct logic to default to not using TCXO if no voltage is specified for SX126X_DIO3_TCXO_VOLTAGE #elif !defined(SX126X_DIO3_TCXO_VOLTAGE) @@ -121,8 +121,8 @@ template bool SX126xInterface::init() // no effect #if ARCH_PORTDUINO if (res == RADIOLIB_ERR_NONE) { - LOG_DEBUG("Use MCU pin %i as RXEN and pin %i as TXEN to control RF switching", settingsMap[rxen], settingsMap[txen]); - lora.setRfSwitchPins(settingsMap[rxen], settingsMap[txen]); + LOG_DEBUG("Use MCU pin %i as RXEN and pin %i as TXEN to control RF switching", settingsMap[rxen_pin], settingsMap[txen_pin]); + lora.setRfSwitchPins(settingsMap[rxen_pin], settingsMap[txen_pin]); } #else #ifndef SX126X_RXEN @@ -341,4 +341,4 @@ template bool SX126xInterface::sleep() return true; } -#endif \ No newline at end of file +#endif diff --git a/src/mesh/SX128xInterface.cpp b/src/mesh/SX128xInterface.cpp index 013164bca..ee3408456 100644 --- a/src/mesh/SX128xInterface.cpp +++ b/src/mesh/SX128xInterface.cpp @@ -38,13 +38,13 @@ template bool SX128xInterface::init() #endif #if ARCH_PORTDUINO - if (settingsMap[rxen] != RADIOLIB_NC) { - pinMode(settingsMap[rxen], OUTPUT); - digitalWrite(settingsMap[rxen], LOW); // Set low before becoming an output + if (settingsMap[rxen_pin] != RADIOLIB_NC) { + pinMode(settingsMap[rxen_pin], OUTPUT); + digitalWrite(settingsMap[rxen_pin], LOW); // Set low before becoming an output } - if (settingsMap[txen] != RADIOLIB_NC) { - pinMode(settingsMap[txen], OUTPUT); - digitalWrite(settingsMap[txen], LOW); // Set low before becoming an output + if (settingsMap[txen_pin] != RADIOLIB_NC) { + pinMode(settingsMap[txen_pin], OUTPUT); + digitalWrite(settingsMap[txen_pin], LOW); // Set low before becoming an output } #else #if defined(SX128X_RXEN) && (SX128X_RXEN != RADIOLIB_NC) // set not rx or tx mode @@ -93,8 +93,8 @@ template bool SX128xInterface::init() lora.setRfSwitchPins(SX128X_RXEN, SX128X_TXEN); } #elif ARCH_PORTDUINO - if (res == RADIOLIB_ERR_NONE && settingsMap[rxen] != RADIOLIB_NC && settingsMap[txen] != RADIOLIB_NC) { - lora.setRfSwitchPins(settingsMap[rxen], settingsMap[txen]); + if (res == RADIOLIB_ERR_NONE && settingsMap[rxen_pin] != RADIOLIB_NC && settingsMap[txen_pin] != RADIOLIB_NC) { + lora.setRfSwitchPins(settingsMap[rxen_pin], settingsMap[txen_pin]); } #endif @@ -174,11 +174,11 @@ template void SX128xInterface::setStandby() LOG_ERROR("SX128x standby %s%d", radioLibErr, err); assert(err == RADIOLIB_ERR_NONE); #if ARCH_PORTDUINO - if (settingsMap[rxen] != RADIOLIB_NC) { - digitalWrite(settingsMap[rxen], LOW); + if (settingsMap[rxen_pin] != RADIOLIB_NC) { + digitalWrite(settingsMap[rxen_pin], LOW); } - if (settingsMap[txen] != RADIOLIB_NC) { - digitalWrite(settingsMap[txen], LOW); + if (settingsMap[txen_pin] != RADIOLIB_NC) { + digitalWrite(settingsMap[txen_pin], LOW); } #else #if defined(SX128X_RXEN) && (SX128X_RXEN != RADIOLIB_NC) // we have RXEN/TXEN control - turn off RX and TX power @@ -210,11 +210,11 @@ template void SX128xInterface::addReceiveMetadata(meshtastic_Mes template void SX128xInterface::configHardwareForSend() { #if ARCH_PORTDUINO - if (settingsMap[txen] != RADIOLIB_NC) { - digitalWrite(settingsMap[txen], HIGH); + if (settingsMap[txen_pin] != RADIOLIB_NC) { + digitalWrite(settingsMap[txen_pin], HIGH); } - if (settingsMap[rxen] != RADIOLIB_NC) { - digitalWrite(settingsMap[rxen], LOW); + if (settingsMap[rxen_pin] != RADIOLIB_NC) { + digitalWrite(settingsMap[rxen_pin], LOW); } #else @@ -241,11 +241,11 @@ template void SX128xInterface::startReceive() setStandby(); #if ARCH_PORTDUINO - if (settingsMap[rxen] != RADIOLIB_NC) { - digitalWrite(settingsMap[rxen], HIGH); + if (settingsMap[rxen_pin] != RADIOLIB_NC) { + digitalWrite(settingsMap[rxen_pin], HIGH); } - if (settingsMap[txen] != RADIOLIB_NC) { - digitalWrite(settingsMap[txen], LOW); + if (settingsMap[txen_pin] != RADIOLIB_NC) { + digitalWrite(settingsMap[txen_pin], LOW); } #else @@ -315,4 +315,4 @@ template bool SX128xInterface::sleep() return true; } -#endif \ No newline at end of file +#endif diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index b042510f5..e75112235 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -134,13 +134,13 @@ void portduinoSetup() { printf("Set up Meshtastic on Portduino...\n"); int max_GPIO = 0; - const configNames GPIO_lines[] = {cs, - irq, - busy, - reset, - sx126x_ant_sw, - txen, - rxen, + const configNames GPIO_lines[] = {cs_pin, + irq_pin, + busy_pin, + reset_pin, + sx126x_ant_sw_pin, + txen_pin, + rxen_pin, displayDC, displayCS, displayBacklight, @@ -247,7 +247,7 @@ void portduinoSetup() // Rather important to set this, if not running simulated. randomSeed(time(NULL)); - gpioChipName += std::to_string(settingsMap[gpiochip]); + std::string defaultGpioChipName = gpioChipName + std::to_string(settingsMap[default_gpiochip]); for (configNames i : GPIO_lines) { if (settingsMap.count(i) && settingsMap[i] > max_GPIO) @@ -260,62 +260,46 @@ void portduinoSetup() // TODO: Can we do this in the for loop above? // TODO: If one of these fails, we should log and terminate if (settingsMap.count(user) > 0 && settingsMap[user] != RADIOLIB_NC) { - if (initGPIOPin(settingsMap[user], gpioChipName) != ERRNO_OK) { + if (initGPIOPin(settingsMap[user], defaultGpioChipName, settingsMap[user]) != ERRNO_OK) { settingsMap[user] = RADIOLIB_NC; } } if (settingsMap[displayPanel] != no_screen) { if (settingsMap[displayCS] > 0) - initGPIOPin(settingsMap[displayCS], gpioChipName); + initGPIOPin(settingsMap[displayCS], defaultGpioChipName, settingsMap[displayCS]); if (settingsMap[displayDC] > 0) - initGPIOPin(settingsMap[displayDC], gpioChipName); + initGPIOPin(settingsMap[displayDC], defaultGpioChipName, settingsMap[displayDC]); if (settingsMap[displayBacklight] > 0) - initGPIOPin(settingsMap[displayBacklight], gpioChipName); + initGPIOPin(settingsMap[displayBacklight], defaultGpioChipName, settingsMap[displayBacklight]); if (settingsMap[displayReset] > 0) - initGPIOPin(settingsMap[displayReset], gpioChipName); + initGPIOPin(settingsMap[displayReset], defaultGpioChipName, settingsMap[displayReset]); } if (settingsMap[touchscreenModule] != no_touchscreen) { if (settingsMap[touchscreenCS] > 0) - initGPIOPin(settingsMap[touchscreenCS], gpioChipName); + initGPIOPin(settingsMap[touchscreenCS], defaultGpioChipName, settingsMap[touchscreenCS]); if (settingsMap[touchscreenIRQ] > 0) - initGPIOPin(settingsMap[touchscreenIRQ], gpioChipName); + initGPIOPin(settingsMap[touchscreenIRQ], defaultGpioChipName, settingsMap[touchscreenIRQ]); } // Only initialize the radio pins when dealing with real, kernel controlled SPI hardware if (settingsStrings[spidev] != "" && settingsStrings[spidev] != "ch341") { - if (settingsMap.count(cs) > 0 && settingsMap[cs] != RADIOLIB_NC) { - if (initGPIOPin(settingsMap[cs], gpioChipName) != ERRNO_OK) { - settingsMap[cs] = RADIOLIB_NC; - } - } - if (settingsMap.count(irq) > 0 && settingsMap[irq] != RADIOLIB_NC) { - if (initGPIOPin(settingsMap[irq], gpioChipName) != ERRNO_OK) { - settingsMap[irq] = RADIOLIB_NC; - } - } - if (settingsMap.count(busy) > 0 && settingsMap[busy] != RADIOLIB_NC) { - if (initGPIOPin(settingsMap[busy], gpioChipName) != ERRNO_OK) { - settingsMap[busy] = RADIOLIB_NC; - } - } - if (settingsMap.count(reset) > 0 && settingsMap[reset] != RADIOLIB_NC) { - if (initGPIOPin(settingsMap[reset], gpioChipName) != ERRNO_OK) { - settingsMap[reset] = RADIOLIB_NC; - } - } - if (settingsMap.count(sx126x_ant_sw) > 0 && settingsMap[sx126x_ant_sw] != RADIOLIB_NC) { - if (initGPIOPin(settingsMap[sx126x_ant_sw], gpioChipName) != ERRNO_OK) { - settingsMap[sx126x_ant_sw] = RADIOLIB_NC; - } - } - if (settingsMap.count(rxen) > 0 && settingsMap[rxen] != RADIOLIB_NC) { - if (initGPIOPin(settingsMap[rxen], gpioChipName) != ERRNO_OK) { - settingsMap[rxen] = RADIOLIB_NC; - } - } - if (settingsMap.count(txen) > 0 && settingsMap[txen] != RADIOLIB_NC) { - if (initGPIOPin(settingsMap[txen], gpioChipName) != ERRNO_OK) { - settingsMap[txen] = RADIOLIB_NC; + const struct { configNames pin; configNames gpiochip; configNames line; } pinMappings[] = { + { cs_pin, cs_gpiochip, cs_line }, + { irq_pin, irq_gpiochip, irq_line }, + { busy_pin, busy_gpiochip, busy_line }, + { reset_pin, reset_gpiochip, reset_line }, + { rxen_pin, rxen_gpiochip, rxen_line }, + { txen_pin, txen_gpiochip, txen_line }, + { sx126x_ant_sw_pin, sx126x_ant_sw_gpiochip, sx126x_ant_sw_line } + }; + for (auto& pinMap : pinMappings) { + auto setMapIter = settingsMap.find(pinMap.pin); + if (setMapIter != settingsMap.end() && setMapIter->second != RADIOLIB_NC) { + if (initGPIOPin(setMapIter->second, gpioChipName + std::to_string(settingsMap[pinMap.gpiochip]), settingsMap[pinMap.line] ) != ERRNO_OK) { + settingsMap[pinMap.pin] = RADIOLIB_NC; + settingsMap[pinMap.gpiochip] = RADIOLIB_NC; + settingsMap[pinMap.line] = RADIOLIB_NC; + } } } SPI.begin(settingsStrings[spidev].c_str()); @@ -332,13 +316,13 @@ void portduinoSetup() return; } -int initGPIOPin(int pinNum, const std::string gpioChipName) +int initGPIOPin(int pinNum, const std::string gpioChipName, int line) { #ifdef PORTDUINO_LINUX_HARDWARE std::string gpio_name = "GPIO" + std::to_string(pinNum); try { GPIOPin *csPin; - csPin = new LinuxGPIOPin(pinNum, gpioChipName.c_str(), pinNum, gpio_name.c_str()); + csPin = new LinuxGPIOPin(pinNum, gpioChipName.c_str(), line, gpio_name.c_str()); csPin->setSilent(); gpioBind(csPin); return ERRNO_OK; @@ -376,42 +360,65 @@ bool loadConfig(const char *configPath) } } if (yamlConfig["Lora"]) { - settingsMap[use_sx1262] = false; - settingsMap[use_rf95] = false; - settingsMap[use_sx1280] = false; - settingsMap[use_lr1110] = false; - settingsMap[use_lr1120] = false; - settingsMap[use_lr1121] = false; - settingsMap[use_sx1268] = false; - - if (yamlConfig["Lora"]["Module"] && yamlConfig["Lora"]["Module"].as("") == "sx1262") { - settingsMap[use_sx1262] = true; - } else if (yamlConfig["Lora"]["Module"] && yamlConfig["Lora"]["Module"].as("") == "RF95") { - settingsMap[use_rf95] = true; - } else if (yamlConfig["Lora"]["Module"] && yamlConfig["Lora"]["Module"].as("") == "sx1280") { - settingsMap[use_sx1280] = true; - } else if (yamlConfig["Lora"]["Module"] && yamlConfig["Lora"]["Module"].as("") == "lr1110") { - settingsMap[use_lr1110] = true; - } else if (yamlConfig["Lora"]["Module"] && yamlConfig["Lora"]["Module"].as("") == "lr1120") { - settingsMap[use_lr1120] = true; - } else if (yamlConfig["Lora"]["Module"] && yamlConfig["Lora"]["Module"].as("") == "lr1121") { - settingsMap[use_lr1121] = true; - } else if (yamlConfig["Lora"]["Module"] && yamlConfig["Lora"]["Module"].as("") == "sx1268") { - settingsMap[use_sx1268] = true; + const struct { configNames cfgName; std::string strName; } loraModules[] = { + { use_rf95, "RF95" }, + { use_sx1262, "sx1262" }, + { use_sx1268, "sx1268" }, + { use_sx1280, "sx1280" }, + { use_lr1110, "lr1110" }, + { use_lr1120, "lr1120" }, + { use_lr1121, "lr1121" }, + { use_llcc68, "LLCC68" } + }; + for (auto& loraModule : loraModules) { + settingsMap[loraModule.cfgName] = false; } + if (yamlConfig["Lora"]["Module"]) { + for (auto& loraModule : loraModules) { + if (yamlConfig["Lora"]["Module"].as("") == loraModule.strName) { + settingsMap[loraModule.cfgName] = true; + break; + } + } + } + settingsMap[dio2_as_rf_switch] = yamlConfig["Lora"]["DIO2_AS_RF_SWITCH"].as(false); settingsMap[dio3_tcxo_voltage] = yamlConfig["Lora"]["DIO3_TCXO_VOLTAGE"].as(0) * 1000; if (settingsMap[dio3_tcxo_voltage] == 0 && yamlConfig["Lora"]["DIO3_TCXO_VOLTAGE"].as(false)) { settingsMap[dio3_tcxo_voltage] = 1800; // default millivolts for "true" } - settingsMap[cs] = yamlConfig["Lora"]["CS"].as(RADIOLIB_NC); - settingsMap[irq] = yamlConfig["Lora"]["IRQ"].as(RADIOLIB_NC); - settingsMap[busy] = yamlConfig["Lora"]["Busy"].as(RADIOLIB_NC); - settingsMap[reset] = yamlConfig["Lora"]["Reset"].as(RADIOLIB_NC); - settingsMap[txen] = yamlConfig["Lora"]["TXen"].as(RADIOLIB_NC); - settingsMap[rxen] = yamlConfig["Lora"]["RXen"].as(RADIOLIB_NC); - settingsMap[sx126x_ant_sw] = yamlConfig["Lora"]["SX126X_ANT_SW"].as(RADIOLIB_NC); - settingsMap[gpiochip] = yamlConfig["Lora"]["gpiochip"].as(0); + + // backwards API compatibility and to globally set gpiochip once + int defaultGpioChip = settingsMap[default_gpiochip] = yamlConfig["Lora"]["gpiochip"].as(0); + + const struct { configNames pin; + configNames gpiochip; + configNames line; + std::string strName; } pinMappings[] = { + { cs_pin, cs_gpiochip, cs_line, "CS" }, + { irq_pin, irq_gpiochip, irq_line, "IRQ" }, + { busy_pin, busy_gpiochip, busy_line, "Busy" }, + { reset_pin, reset_gpiochip, reset_line, "Reset" }, + { txen_pin, txen_gpiochip, txen_line, "TXen" }, + { rxen_pin, rxen_gpiochip, rxen_line, "RXen" }, + { sx126x_ant_sw_pin, sx126x_ant_sw_gpiochip, sx126x_ant_sw_line, "SX126X_ANT_SW" }, + }; + for (auto& pinMap : pinMappings) { + if (yamlConfig["Lora"][pinMap.strName].IsMap() + && (yamlConfig["Lora"][pinMap.strName]["pin"] + || yamlConfig["Lora"][pinMap.strName]["line"] + || yamlConfig["Lora"][pinMap.strName]["gpiochip"])) { + settingsMap[pinMap.pin] = yamlConfig["Lora"][pinMap.strName]["pin"].as(RADIOLIB_NC); + settingsMap[pinMap.line] = yamlConfig["Lora"][pinMap.strName]["line"].as(settingsMap[pinMap.pin]); + settingsMap[pinMap.gpiochip] = yamlConfig["Lora"][pinMap.strName]["gpiochip"].as(defaultGpioChip); + } + else { // backwards API compatibility + settingsMap[pinMap.pin] = yamlConfig["Lora"][pinMap.strName].as(RADIOLIB_NC); + settingsMap[pinMap.line] = settingsMap[pinMap.pin]; + settingsMap[pinMap.gpiochip] = defaultGpioChip; + } + } + settingsMap[spiSpeed] = yamlConfig["Lora"]["spiSpeed"].as(2000000); settingsStrings[lora_usb_serial_num] = yamlConfig["Lora"]["USB_Serialnum"].as(""); settingsMap[lora_usb_pid] = yamlConfig["Lora"]["USB_PID"].as(0x5512); diff --git a/src/platform/portduino/PortduinoGlue.h b/src/platform/portduino/PortduinoGlue.h index 5bc07df6a..d1e91956d 100644 --- a/src/platform/portduino/PortduinoGlue.h +++ b/src/platform/portduino/PortduinoGlue.h @@ -5,27 +5,42 @@ #include "platform/portduino/USBHal.h" enum configNames { - use_sx1262, - cs, - irq, - busy, - reset, - sx126x_ant_sw, - txen, - rxen, + default_gpiochip, + cs_pin, + cs_line, + cs_gpiochip, + irq_pin, + irq_line, + irq_gpiochip, + busy_pin, + busy_line, + busy_gpiochip, + reset_pin, + reset_line, + reset_gpiochip, + txen_pin, + txen_line, + txen_gpiochip, + rxen_pin, + rxen_line, + rxen_gpiochip, + sx126x_ant_sw_pin, + sx126x_ant_sw_line, + sx126x_ant_sw_gpiochip, dio2_as_rf_switch, dio3_tcxo_voltage, use_rf95, + use_sx1262, + use_sx1268, use_sx1280, use_lr1110, use_lr1120, use_lr1121, - use_sx1268, + use_llcc68, lora_usb_serial_num, lora_usb_pid, lora_usb_vid, user, - gpiochip, spidev, spiSpeed, i2cdev, @@ -75,7 +90,7 @@ extern std::map settingsMap; extern std::map settingsStrings; extern std::ofstream traceFile; extern Ch341Hal *ch341Hal; -int initGPIOPin(int pinNum, std::string gpioChipname); +int initGPIOPin(int pinNum, std::string gpioChipname, int line); bool loadConfig(const char *configPath); static bool ends_with(std::string_view str, std::string_view suffix); void getMacAddr(uint8_t *dmac); From 6b1c01ce02e57788873a9f36197e46885b8f11fc Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 12 Jan 2025 15:10:50 -0600 Subject: [PATCH 087/381] Trunk n stuff (#5833) * Trunk * Allow new gpio syntax with defaults * Exit on pin init failure --- src/main.cpp | 67 +++++++------- src/mesh/SX126xInterface.cpp | 3 +- src/platform/portduino/PortduinoGlue.cpp | 106 ++++++++++------------- 3 files changed, 78 insertions(+), 98 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 338fca5c1..fc9d24e37 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -826,43 +826,37 @@ void setup() #endif #ifdef ARCH_PORTDUINO - const struct { configNames cfgName; - std::string strName; - } loraModules[] = { - { use_rf95, "RF95" }, - { use_sx1262, "sx1262" }, - { use_sx1268, "sx1268" }, - { use_sx1280, "sx1280" }, - { use_lr1110, "lr1110" }, - { use_lr1120, "lr1120" }, - { use_lr1121, "lr1121" }, - { use_llcc68, "LLCC68" } - }; + const struct { + configNames cfgName; + std::string strName; + } loraModules[] = {{use_rf95, "RF95"}, {use_sx1262, "sx1262"}, {use_sx1268, "sx1268"}, {use_sx1280, "sx1280"}, + {use_lr1110, "lr1110"}, {use_lr1120, "lr1120"}, {use_lr1121, "lr1121"}, {use_llcc68, "LLCC68"}}; // as one can't use a function pointer to the class constructor: - auto loraModuleInterface = [](configNames cfgName, LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy) { - switch (cfgName) { - case use_rf95: - return (RadioInterface*)new RF95Interface(hal, cs, irq, rst, busy); - case use_sx1262: - return (RadioInterface*)new SX1262Interface(hal, cs, irq, rst, busy); - case use_sx1268: - return (RadioInterface*)new SX1268Interface(hal, cs, irq, rst, busy); - case use_sx1280: - return (RadioInterface*)new SX1280Interface(hal, cs, irq, rst, busy); - case use_lr1110: - return (RadioInterface*)new LR1110Interface(hal, cs, irq, rst, busy); - case use_lr1120: - return (RadioInterface*)new LR1120Interface(hal, cs, irq, rst, busy); - case use_lr1121: - return (RadioInterface*)new LR1121Interface(hal, cs, irq, rst, busy); - case use_llcc68: - return (RadioInterface*)new LLCC68Interface(hal, cs, irq, rst, busy); - default: - assert(0); // shouldn't happen - return (RadioInterface*)nullptr; - } + auto loraModuleInterface = [](configNames cfgName, LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, + RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy) { + switch (cfgName) { + case use_rf95: + return (RadioInterface *)new RF95Interface(hal, cs, irq, rst, busy); + case use_sx1262: + return (RadioInterface *)new SX1262Interface(hal, cs, irq, rst, busy); + case use_sx1268: + return (RadioInterface *)new SX1268Interface(hal, cs, irq, rst, busy); + case use_sx1280: + return (RadioInterface *)new SX1280Interface(hal, cs, irq, rst, busy); + case use_lr1110: + return (RadioInterface *)new LR1110Interface(hal, cs, irq, rst, busy); + case use_lr1120: + return (RadioInterface *)new LR1120Interface(hal, cs, irq, rst, busy); + case use_lr1121: + return (RadioInterface *)new LR1121Interface(hal, cs, irq, rst, busy); + case use_llcc68: + return (RadioInterface *)new LLCC68Interface(hal, cs, irq, rst, busy); + default: + assert(0); // shouldn't happen + return (RadioInterface *)nullptr; + } }; - for (auto& loraModule : loraModules) { + for (auto &loraModule : loraModules) { if (settingsMap[loraModule.cfgName] && !rIf) { LOG_DEBUG("Activate %s radio on SPI port %s", loraModule.strName.c_str(), settingsStrings[spidev].c_str()); if (settingsStrings[spidev] == "ch341") { @@ -870,7 +864,8 @@ void setup() } else { RadioLibHAL = new LockingArduinoHal(SPI, spiSettings); } - rIf = loraModuleInterface(loraModule.cfgName, (LockingArduinoHal *)RadioLibHAL, settingsMap[cs_pin], settingsMap[irq_pin], settingsMap[reset_pin], settingsMap[busy_pin]); + rIf = loraModuleInterface(loraModule.cfgName, (LockingArduinoHal *)RadioLibHAL, settingsMap[cs_pin], + settingsMap[irq_pin], settingsMap[reset_pin], settingsMap[busy_pin]); if (!rIf->init()) { LOG_WARN("No %s radio", loraModule.strName.c_str()); delete rIf; diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index b13bb6faf..8a7bc7670 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -121,7 +121,8 @@ template bool SX126xInterface::init() // no effect #if ARCH_PORTDUINO if (res == RADIOLIB_ERR_NONE) { - LOG_DEBUG("Use MCU pin %i as RXEN and pin %i as TXEN to control RF switching", settingsMap[rxen_pin], settingsMap[txen_pin]); + LOG_DEBUG("Use MCU pin %i as RXEN and pin %i as TXEN to control RF switching", settingsMap[rxen_pin], + settingsMap[txen_pin]); lora.setRfSwitchPins(settingsMap[rxen_pin], settingsMap[txen_pin]); } #else diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index e75112235..ce2418e86 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -134,21 +134,10 @@ void portduinoSetup() { printf("Set up Meshtastic on Portduino...\n"); int max_GPIO = 0; - const configNames GPIO_lines[] = {cs_pin, - irq_pin, - busy_pin, - reset_pin, - sx126x_ant_sw_pin, - txen_pin, - rxen_pin, - displayDC, - displayCS, - displayBacklight, - displayBacklightPWMChannel, - displayReset, - touchscreenCS, - touchscreenIRQ, - user}; + const configNames GPIO_lines[] = { + cs_pin, irq_pin, busy_pin, reset_pin, sx126x_ant_sw_pin, txen_pin, + rxen_pin, displayDC, displayCS, displayBacklight, displayBacklightPWMChannel, displayReset, + touchscreenCS, touchscreenIRQ, user}; std::string gpioChipName = "gpiochip"; settingsStrings[i2cdev] = ""; @@ -257,7 +246,6 @@ void portduinoSetup() gpioInit(max_GPIO + 1); // Done here so we can inform Portduino how many GPIOs we need. // Need to bind all the configured GPIO pins so they're not simulated - // TODO: Can we do this in the for loop above? // TODO: If one of these fails, we should log and terminate if (settingsMap.count(user) > 0 && settingsMap[user] != RADIOLIB_NC) { if (initGPIOPin(settingsMap[user], defaultGpioChipName, settingsMap[user]) != ERRNO_OK) { @@ -283,22 +271,25 @@ void portduinoSetup() // Only initialize the radio pins when dealing with real, kernel controlled SPI hardware if (settingsStrings[spidev] != "" && settingsStrings[spidev] != "ch341") { - const struct { configNames pin; configNames gpiochip; configNames line; } pinMappings[] = { - { cs_pin, cs_gpiochip, cs_line }, - { irq_pin, irq_gpiochip, irq_line }, - { busy_pin, busy_gpiochip, busy_line }, - { reset_pin, reset_gpiochip, reset_line }, - { rxen_pin, rxen_gpiochip, rxen_line }, - { txen_pin, txen_gpiochip, txen_line }, - { sx126x_ant_sw_pin, sx126x_ant_sw_gpiochip, sx126x_ant_sw_line } - }; - for (auto& pinMap : pinMappings) { + const struct { + configNames pin; + configNames gpiochip; + configNames line; + } pinMappings[] = {{cs_pin, cs_gpiochip, cs_line}, + {irq_pin, irq_gpiochip, irq_line}, + {busy_pin, busy_gpiochip, busy_line}, + {reset_pin, reset_gpiochip, reset_line}, + {rxen_pin, rxen_gpiochip, rxen_line}, + {txen_pin, txen_gpiochip, txen_line}, + {sx126x_ant_sw_pin, sx126x_ant_sw_gpiochip, sx126x_ant_sw_line}}; + for (auto &pinMap : pinMappings) { auto setMapIter = settingsMap.find(pinMap.pin); if (setMapIter != settingsMap.end() && setMapIter->second != RADIOLIB_NC) { - if (initGPIOPin(setMapIter->second, gpioChipName + std::to_string(settingsMap[pinMap.gpiochip]), settingsMap[pinMap.line] ) != ERRNO_OK) { - settingsMap[pinMap.pin] = RADIOLIB_NC; - settingsMap[pinMap.gpiochip] = RADIOLIB_NC; - settingsMap[pinMap.line] = RADIOLIB_NC; + if (initGPIOPin(setMapIter->second, gpioChipName + std::to_string(settingsMap[pinMap.gpiochip]), + settingsMap[pinMap.line]) != ERRNO_OK) { + printf("Error setting pin number %d. It may not exist, or may already be in use.\n", + settingsMap[pinMap.line]); + exit(EXIT_FAILURE); } } } @@ -360,21 +351,16 @@ bool loadConfig(const char *configPath) } } if (yamlConfig["Lora"]) { - const struct { configNames cfgName; std::string strName; } loraModules[] = { - { use_rf95, "RF95" }, - { use_sx1262, "sx1262" }, - { use_sx1268, "sx1268" }, - { use_sx1280, "sx1280" }, - { use_lr1110, "lr1110" }, - { use_lr1120, "lr1120" }, - { use_lr1121, "lr1121" }, - { use_llcc68, "LLCC68" } - }; - for (auto& loraModule : loraModules) { + const struct { + configNames cfgName; + std::string strName; + } loraModules[] = {{use_rf95, "RF95"}, {use_sx1262, "sx1262"}, {use_sx1268, "sx1268"}, {use_sx1280, "sx1280"}, + {use_lr1110, "lr1110"}, {use_lr1120, "lr1120"}, {use_lr1121, "lr1121"}, {use_llcc68, "LLCC68"}}; + for (auto &loraModule : loraModules) { settingsMap[loraModule.cfgName] = false; } if (yamlConfig["Lora"]["Module"]) { - for (auto& loraModule : loraModules) { + for (auto &loraModule : loraModules) { if (yamlConfig["Lora"]["Module"].as("") == loraModule.strName) { settingsMap[loraModule.cfgName] = true; break; @@ -391,28 +377,26 @@ bool loadConfig(const char *configPath) // backwards API compatibility and to globally set gpiochip once int defaultGpioChip = settingsMap[default_gpiochip] = yamlConfig["Lora"]["gpiochip"].as(0); - const struct { configNames pin; - configNames gpiochip; - configNames line; - std::string strName; } pinMappings[] = { - { cs_pin, cs_gpiochip, cs_line, "CS" }, - { irq_pin, irq_gpiochip, irq_line, "IRQ" }, - { busy_pin, busy_gpiochip, busy_line, "Busy" }, - { reset_pin, reset_gpiochip, reset_line, "Reset" }, - { txen_pin, txen_gpiochip, txen_line, "TXen" }, - { rxen_pin, rxen_gpiochip, rxen_line, "RXen" }, - { sx126x_ant_sw_pin, sx126x_ant_sw_gpiochip, sx126x_ant_sw_line, "SX126X_ANT_SW" }, + const struct { + configNames pin; + configNames gpiochip; + configNames line; + std::string strName; + } pinMappings[] = { + {cs_pin, cs_gpiochip, cs_line, "CS"}, + {irq_pin, irq_gpiochip, irq_line, "IRQ"}, + {busy_pin, busy_gpiochip, busy_line, "Busy"}, + {reset_pin, reset_gpiochip, reset_line, "Reset"}, + {txen_pin, txen_gpiochip, txen_line, "TXen"}, + {rxen_pin, rxen_gpiochip, rxen_line, "RXen"}, + {sx126x_ant_sw_pin, sx126x_ant_sw_gpiochip, sx126x_ant_sw_line, "SX126X_ANT_SW"}, }; - for (auto& pinMap : pinMappings) { - if (yamlConfig["Lora"][pinMap.strName].IsMap() - && (yamlConfig["Lora"][pinMap.strName]["pin"] - || yamlConfig["Lora"][pinMap.strName]["line"] - || yamlConfig["Lora"][pinMap.strName]["gpiochip"])) { + for (auto &pinMap : pinMappings) { + if (yamlConfig["Lora"][pinMap.strName].IsMap()) { settingsMap[pinMap.pin] = yamlConfig["Lora"][pinMap.strName]["pin"].as(RADIOLIB_NC); settingsMap[pinMap.line] = yamlConfig["Lora"][pinMap.strName]["line"].as(settingsMap[pinMap.pin]); settingsMap[pinMap.gpiochip] = yamlConfig["Lora"][pinMap.strName]["gpiochip"].as(defaultGpioChip); - } - else { // backwards API compatibility + } else { // backwards API compatibility settingsMap[pinMap.pin] = yamlConfig["Lora"][pinMap.strName].as(RADIOLIB_NC); settingsMap[pinMap.line] = settingsMap[pinMap.pin]; settingsMap[pinMap.gpiochip] = defaultGpioChip; @@ -584,4 +568,4 @@ bool MAC_from_string(std::string mac_str, uint8_t *dmac) } else { return false; } -} +} \ No newline at end of file From e0f97c930648e8adf71af3a279c8ee79da1f2dca Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 12 Jan 2025 23:24:05 -0500 Subject: [PATCH 088/381] rpkg Fedora packaging (#5735) --- .github/workflows/hook_copr.yml | 73 +++++++++++++++ ...ghtly_debian.yml => nightly_packaging.yml} | 12 ++- .github/workflows/release_channels.yml | 7 ++ bin/rpkg.macros | 12 +++ meshtasticd.spec.rpkg | 91 +++++++++++++++++++ rpkg.conf | 2 + 6 files changed, 195 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/hook_copr.yml rename .github/workflows/{nightly_debian.yml => nightly_packaging.yml} (75%) create mode 100644 bin/rpkg.macros create mode 100644 meshtasticd.spec.rpkg create mode 100644 rpkg.conf diff --git a/.github/workflows/hook_copr.yml b/.github/workflows/hook_copr.yml new file mode 100644 index 000000000..c7b6b8d79 --- /dev/null +++ b/.github/workflows/hook_copr.yml @@ -0,0 +1,73 @@ +name: Trigger COPR build + +on: + workflow_call: + secrets: + COPR_HOOK_DAILY: + COPR_HOOK_ALPHA: + COPR_HOOK_BETA: + inputs: + copr_project: + description: COPR project to target + required: true + type: string + +permissions: read-all + +jobs: + build-copr-hook: + runs-on: ubuntu-24.04 + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + ref: ${{ github.ref }} + repository: ${{ github.repository }} + + - name: Install Python dependencies + run: | + pip install requests + + - name: Trigger COPR build + shell: python + run: | + import requests + + project_name = "${{ inputs.copr_project }}" + if project_name == "daily": + hook_secret = "${{ secrets.COPR_HOOK_DAILY }}" + project_id = 160277 + elif project_name == "alpha": + hook_secret = "${{ secrets.COPR_HOOK_ALPHA }}" + project_id = 160278 + elif project_name == "beta": + hook_secret = "${{ secrets.COPR_HOOK_BETA }}" + project_id = 160279 + else: + raise ValueError(f"Unknown COPR project: {project_name}") + + webhook_url = f"https://copr.fedorainfracloud.org/webhooks/github/{project_id}/{hook_secret}/meshtasticd/" + copr_payload = { + "event": "push", + "payload": { + "ref": "${{ github.ref }}", + "after": "${{ github.sha }}", + "repository": { + "id": "${{ github.repository_id }}", + "full_name": "${{ github.repository }}", + "git_url": "${{ github.repositoryUrl }}", + "owner": { + "name": "${{ github.repository_owner }}" + } + }, + "pusher": { + "name": "${{ github.actor }}" + }, + "sender": { + "login": "github-actions[bot]" + } + } + } + r = requests.post(webhook_url, json=copr_payload) + r.raise_for_status() diff --git a/.github/workflows/nightly_debian.yml b/.github/workflows/nightly_packaging.yml similarity index 75% rename from .github/workflows/nightly_debian.yml rename to .github/workflows/nightly_packaging.yml index aa001854e..e477fe194 100644 --- a/.github/workflows/nightly_debian.yml +++ b/.github/workflows/nightly_packaging.yml @@ -1,4 +1,4 @@ -name: Nightly Debian Packaging +name: Nightly Packaging on: schedule: - cron: 0 9 * * * @@ -8,10 +8,12 @@ on: - master paths: - debian/** - - .github/workflows/nightly_debian.yml + - "*.rpkg" + - .github/workflows/nightly_packaging.yml - .github/workflows/build_debian_src.yml - .github/workflows/package_ppa.yml - .github/workflows/package_obs.yml + - .github/workflows/hook_copr.yml permissions: contents: write @@ -35,3 +37,9 @@ jobs: obs_project: home:meshtastic:daily series: unstable secrets: inherit + + hook-copr: + uses: ./.github/workflows/hook_copr.yml + with: + copr_project: daily + secrets: inherit diff --git a/.github/workflows/release_channels.yml b/.github/workflows/release_channels.yml index 34673f0c7..8891826d2 100644 --- a/.github/workflows/release_channels.yml +++ b/.github/workflows/release_channels.yml @@ -27,3 +27,10 @@ jobs: series: |- ${{ contains(github.event.release.name, 'Beta') && 'beta' || contains(github.event.release.name, 'Alpha') && 'alpha' }} secrets: inherit + + # hook-copr: + # uses: ./.github/workflows/hook_copr.yml + # with: + # copr_project: |- + # ${{ contains(github.event.release.name, 'Beta') && 'beta' || contains(github.event.release.name, 'Alpha') && 'alpha' }} + # secrets: inherit diff --git a/bin/rpkg.macros b/bin/rpkg.macros new file mode 100644 index 000000000..2bbb203de --- /dev/null +++ b/bin/rpkg.macros @@ -0,0 +1,12 @@ +function meshtastic_version { + meshtastic_version=$(python3 bin/buildinfo.py short) + echo -n "$meshtastic_version" +} +function git_commits_num { + total_commits=$(git rev-list --all --count) + echo -n "$total_commits" +} +function git_commit_sha { + commit_sha=$(git rev-parse --short HEAD) + echo -n "$commit_sha" +} \ No newline at end of file diff --git a/meshtasticd.spec.rpkg b/meshtasticd.spec.rpkg new file mode 100644 index 000000000..1819897b0 --- /dev/null +++ b/meshtasticd.spec.rpkg @@ -0,0 +1,91 @@ +# meshtasticd spec file for RPM-based distributions +# +# Build locally with: +# ``` +# sudo dnf install rpkg-util +# rpkg local +# ``` +# +# See: +# - https://docs.pagure.org/rpkg-util/v3/index.html +# - https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/ + +Name: meshtasticd +# Version Ex: 2.5.19 +Version: {{{ meshtastic_version }}} +# Release Ex: 9127.daily.gitd7f5f620.fc41 +Release: {{{ git_commits_num }}}%{?copr_projectname:.%{copr_projectname}}.git{{{ git_commit_sha }}}%{?dist} +VCS: {{{ git_dir_vcs }}} +Summary: Meshtastic daemon for communicating with Meshtastic devices + +License: GPL-3.0 +URL: https://github.com/meshtastic/firmware +Source0: {{{ git_dir_pack }}} +Source1: https://github.com/meshtastic/web/releases/download/latest/build.tar + +BuildRequires: systemd-rpm-macros +BuildRequires: python3-devel +BuildRequires: platformio +BuildRequires: python3dist(protobuf) +BuildRequires: python3dist(grpcio[protobuf]) +BuildRequires: python3dist(grpcio-tools) +BuildRequires: git-core +BuildRequires: gcc-c++ +BuildRequires: pkgconfig(yaml-cpp) +BuildRequires: pkgconfig(libgpiod) +BuildRequires: pkgconfig(bluez) +BuildRequires: pkgconfig(libusb-1.0) +BuildRequires: libi2c-devel +# Web components: +BuildRequires: pkgconfig(openssl) +BuildRequires: pkgconfig(liborcania) +BuildRequires: pkgconfig(libyder) +BuildRequires: pkgconfig(libulfius) + +%description +Meshtastic daemon for controlling Meshtastic devices. Meshtastic is an off-grid +text communication platform that uses inexpensive LoRa radios. + +%prep +{{{ git_dir_setup_macro }}} +# Unpack the web files +mkdir -p web +tar -xf %{SOURCE1} -C web +gzip -dr web + +%build +# Use the “native†environment from platformio to build a Linux binary +platformio run -e native + +%install +mkdir -p %{buildroot}%{_sbindir} +install -m 0755 .pio/build/native/program %{buildroot}%{_sbindir}/meshtasticd + +mkdir -p %{buildroot}%{_sysconfdir}/meshtasticd +install -m 0644 bin/config-dist.yaml %{buildroot}%{_sysconfdir}/meshtasticd/config.yaml +mkdir -p %{buildroot}%{_sysconfdir}/meshtasticd/config.d +mkdir -p %{buildroot}%{_sysconfdir}/meshtasticd/available.d +cp -r bin/config.d/* %{buildroot}%{_sysconfdir}/meshtasticd/available.d + +install -D -m 0644 bin/meshtasticd.service %{buildroot}%{_unitdir}/meshtasticd.service + +# Install the web files under /usr/share/meshtasticd/web +mkdir -p %{buildroot}%{_datadir}/meshtasticd/web +cp -r web/* %{buildroot}%{_datadir}/meshtasticd/web + +%files +%license LICENSE +%doc README.md +%{_sbindir}/meshtasticd +%dir %{_sysconfdir}/meshtasticd +%dir %{_sysconfdir}/meshtasticd/config.d +%dir %{_sysconfdir}/meshtasticd/available.d +%config(noreplace) %{_sysconfdir}/meshtasticd/config.yaml +%config %{_sysconfdir}/meshtasticd/available.d/* +%{_unitdir}/meshtasticd.service +%dir %{_datadir}/meshtasticd +%dir %{_datadir}/meshtasticd/web +%{_datadir}/meshtasticd/web/* + +%changelog +%autochangelog \ No newline at end of file diff --git a/rpkg.conf b/rpkg.conf new file mode 100644 index 000000000..f574f9a13 --- /dev/null +++ b/rpkg.conf @@ -0,0 +1,2 @@ +[rpkg] +user_macros = "${git_props:root}/bin/rpkg.macros" From 4dc8d6e4006c485fa7d5fb7b658c8e5d5f23b49d Mon Sep 17 00:00:00 2001 From: Austin Date: Mon, 13 Jan 2025 00:20:22 -0500 Subject: [PATCH 089/381] Fix daily packaging perms (#5836) --- .../workflows/{nightly_packaging.yml => daily_packaging.yml} | 2 +- .github/workflows/hook_copr.yml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) rename .github/workflows/{nightly_packaging.yml => daily_packaging.yml} (97%) diff --git a/.github/workflows/nightly_packaging.yml b/.github/workflows/daily_packaging.yml similarity index 97% rename from .github/workflows/nightly_packaging.yml rename to .github/workflows/daily_packaging.yml index e477fe194..14daae74d 100644 --- a/.github/workflows/nightly_packaging.yml +++ b/.github/workflows/daily_packaging.yml @@ -1,4 +1,4 @@ -name: Nightly Packaging +name: Daily Packaging on: schedule: - cron: 0 9 * * * diff --git a/.github/workflows/hook_copr.yml b/.github/workflows/hook_copr.yml index c7b6b8d79..94d9d095f 100644 --- a/.github/workflows/hook_copr.yml +++ b/.github/workflows/hook_copr.yml @@ -12,7 +12,9 @@ on: required: true type: string -permissions: read-all +permissions: + contents: write + packages: write jobs: build-copr-hook: From 89a9e0b99d579df9b97f87a35ba33653f496636e Mon Sep 17 00:00:00 2001 From: isseysandei Date: Mon, 13 Jan 2025 09:39:01 +0100 Subject: [PATCH 090/381] Added illuminance sensors to the node's environmental sensor page (#5832) * illuminance sensors added * added white_lux to debug --- src/modules/Telemetry/EnvironmentTelemetry.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index e72b03bd4..be5df6f63 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -253,6 +253,16 @@ void EnvironmentTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiSt display->drawString(x, y += _fontHeight(FONT_SMALL), "IAQ: " + String(lastMeasurement.variant.environment_metrics.iaq)); } + if (lastMeasurement.variant.environment_metrics.lux != 0) { + display->drawString(x, y += _fontHeight(FONT_SMALL), + "Illuminance: " + String(lastMeasurement.variant.environment_metrics.lux, 2) + "lx"); + } + + if (lastMeasurement.variant.environment_metrics.white_lux != 0) { + display->drawString(x, y += _fontHeight(FONT_SMALL), + "W_Lux: " + String(lastMeasurement.variant.environment_metrics.white_lux, 2) + "lx"); + } + if (lastMeasurement.variant.environment_metrics.distance != 0) display->drawString(x, y += _fontHeight(FONT_SMALL), "Water Level: " + String(lastMeasurement.variant.environment_metrics.distance, 0) + "mm"); @@ -277,8 +287,10 @@ bool EnvironmentTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPac sender, t->variant.environment_metrics.barometric_pressure, t->variant.environment_metrics.current, t->variant.environment_metrics.gas_resistance, t->variant.environment_metrics.relative_humidity, t->variant.environment_metrics.temperature); - LOG_INFO("(Received from %s): voltage=%f, IAQ=%d, distance=%f, lux=%f", sender, t->variant.environment_metrics.voltage, - t->variant.environment_metrics.iaq, t->variant.environment_metrics.distance, t->variant.environment_metrics.lux); + LOG_INFO("(Received from %s): voltage=%f, IAQ=%d, distance=%f, lux=%f, white_lux=%f", sender, + t->variant.environment_metrics.voltage, t->variant.environment_metrics.iaq, + t->variant.environment_metrics.distance, t->variant.environment_metrics.lux, + t->variant.environment_metrics.white_lux); LOG_INFO("(Received from %s): wind speed=%fm/s, direction=%d degrees, weight=%fkg", sender, t->variant.environment_metrics.wind_speed, t->variant.environment_metrics.wind_direction, From 1c0f43c8e2fb4cbbc285eeac319d339ab63c866f Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 13 Jan 2025 06:28:18 -0600 Subject: [PATCH 091/381] NRF52 SafeFile should not remove / rename files (#5840) --- src/SafeFile.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/SafeFile.cpp b/src/SafeFile.cpp index c5d7b335e..825ba3028 100644 --- a/src/SafeFile.cpp +++ b/src/SafeFile.cpp @@ -6,6 +6,11 @@ static File openFile(const char *filename, bool fullAtomic) { concurrency::LockGuard g(spiLock); + LOG_DEBUG("Opening %s, fullAtomic=%d", filename, fullAtomic); +#ifdef ARCH_NRF52 + lfs_assert_failed = false; + return FSCom.open(filename, FILE_O_WRITE); +#endif if (!fullAtomic) FSCom.remove(filename); // Nuke the old file to make space (ignore if it !exists) @@ -14,7 +19,6 @@ static File openFile(const char *filename, bool fullAtomic) // clear any previous LFS errors lfs_assert_failed = false; - return FSCom.open(filenameTmp.c_str(), FILE_O_WRITE); } @@ -57,6 +61,10 @@ bool SafeFile::close() spiLock->lock(); f.close(); spiLock->unlock(); + +#ifdef ARCH_NRF52 + return true; +#endif if (!testReadback()) return false; From 6366633cd402a902b496959df9784cfbbb68c7a2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 13 Jan 2025 07:05:59 -0600 Subject: [PATCH 092/381] [create-pull-request] automated change (#5841) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protobufs b/protobufs index c55f120a9..76f806e1b 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit c55f120a9c1ce90c85e4826907a0b9bcb2d5f5a2 +Subproject commit 76f806e1bb1e2a7b157a14fadd095775f63db5e4 From e2dd845051cf40003a8c4102a8d7dad90dd4d3d2 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 13 Jan 2025 08:30:20 -0600 Subject: [PATCH 093/381] Fix devicestate protobuf / filesize allocation (#5835) --- src/mesh/NodeDB.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 8e084c99d..a9e5565ef 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -958,7 +958,7 @@ void NodeDB::loadFromDisk() #endif // static DeviceState scratch; We no longer read into a tempbuf because this structure is 15KB of valuable RAM - auto state = loadProto(prefFileName, sizeof(meshtastic_DeviceState) + MAX_NUM_NODES_FS * sizeof(meshtastic_NodeInfo), + auto state = loadProto(prefFileName, sizeof(meshtastic_DeviceState) + MAX_NUM_NODES_FS * meshtastic_NodeInfoLite_size, sizeof(meshtastic_DeviceState), &meshtastic_DeviceState_msg, &devicestate); // See https://github.com/meshtastic/firmware/issues/4184#issuecomment-2269390786 @@ -1147,8 +1147,9 @@ bool NodeDB::saveDeviceStateToDisk() #endif // Note: if MAX_NUM_NODES=100 and meshtastic_NodeInfoLite_size=166, so will be approximately 17KB // Because so huge we _must_ not use fullAtomic, because the filesystem is probably too small to hold two copies of this - return saveProto(prefFileName, sizeof(devicestate) + numMeshNodes * meshtastic_NodeInfoLite_size, &meshtastic_DeviceState_msg, - &devicestate, false); + size_t deviceStateSize; + pb_get_encoded_size(&deviceStateSize, meshtastic_DeviceState_fields, &devicestate); + return saveProto(prefFileName, deviceStateSize, &meshtastic_DeviceState_msg, &devicestate, false); } bool NodeDB::saveToDiskNoRetry(int saveWhat) From de42d96adf41a36ce4aa509715fb101dc1736376 Mon Sep 17 00:00:00 2001 From: Austin Date: Mon, 13 Jan 2025 11:46:07 -0500 Subject: [PATCH 094/381] Actions: Fix issues with new Release process (#5845) --- .github/workflows/main_matrix.yml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index b55696301..66a398566 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -320,19 +320,23 @@ jobs: run: ls -lR - name: Add deb files to release - uses: softprops/action-gh-release@v2 - with: - tag_name: v${{ steps.version.outputs.long }} - files: | - ./output/meshtasticd_${{ steps.version.outputs.long }}_arm64.deb - ./output/meshtasticd_${{ steps.version.outputs.long }}_armhf.deb - ./output/meshtasticd_${{ steps.version.outputs.long }}_amd64.deb - ./output/meshtasticd-${{ steps.version.outputs.deb }}-src.zip + run: | + gh release upload v${{ steps.version.outputs.long }} ./output/meshtasticd_${{ steps.version.outputs.long }}_arm64.deb + gh release upload v${{ steps.version.outputs.long }} ./output/meshtasticd_${{ steps.version.outputs.long }}_armhf.deb + gh release upload v${{ steps.version.outputs.long }} ./output/meshtasticd_${{ steps.version.outputs.long }}_amd64.deb + gh release upload v${{ steps.version.outputs.long }} ./output/meshtasticd-${{ steps.version.outputs.deb }}-src.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Bump version.properties run: >- bin/bump_version.py + - name: Install debian tools for changelog + run: | + sudo apt-get update -y + sudo apt-get install -y devscripts + - name: Update debian changelog run: >- debian/ci_changelog.sh @@ -397,9 +401,8 @@ jobs: run: ls -lR - name: Add bins and debug elfs to release - uses: softprops/action-gh-release@v2 - with: - tag_name: v${{ steps.version.outputs.long }} - files: | - ./firmware-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip - ./debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip + run: | + gh release upload v${{ steps.version.outputs.long }} ./firmware-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip + gh release upload v${{ steps.version.outputs.long }} ./debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.long }}.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From d5cd6f87a02e63dd6ab6f5c851107912a2cf5a9f Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 13 Jan 2025 12:15:27 -0600 Subject: [PATCH 095/381] Kablammo --- .github/workflows/main_matrix.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 66a398566..0a0ea9954 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -332,11 +332,6 @@ jobs: run: >- bin/bump_version.py - - name: Install debian tools for changelog - run: | - sudo apt-get update -y - sudo apt-get install -y devscripts - - name: Update debian changelog run: >- debian/ci_changelog.sh From 038430db2336bdea1ec9093dd539943d6a56a870 Mon Sep 17 00:00:00 2001 From: isseysandei Date: Tue, 14 Jan 2025 02:00:00 +0100 Subject: [PATCH 096/381] Environmental sensors page scrolling (#5847) * env scrolling first iteration * ran trunk --- .../Telemetry/EnvironmentTelemetry.cpp | 77 +++++++++++++------ 1 file changed, 53 insertions(+), 24 deletions(-) diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index be5df6f63..2fc9bab0b 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -222,7 +222,11 @@ void EnvironmentTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiSt } // Display "Env. From: ..." on its own - display->drawString(x, y, "Env. From: " + String(lastSender) + "(" + String(agoSecs) + "s)"); + display->drawString(x, y, "Env. From: " + String(lastSender) + " (" + String(agoSecs) + "s)"); + + // Prepare sensor data strings + String sensorData[10]; + int sensorCount = 0; if (lastMeasurement.variant.environment_metrics.has_temperature || lastMeasurement.variant.environment_metrics.has_relative_humidity) { @@ -232,48 +236,73 @@ void EnvironmentTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiSt String(UnitConversions::CelsiusToFahrenheit(lastMeasurement.variant.environment_metrics.temperature), 0) + "°F"; } - // Continue with the remaining details - display->drawString(x, y += _fontHeight(FONT_SMALL), - "Temp/Hum: " + last_temp + " / " + - String(lastMeasurement.variant.environment_metrics.relative_humidity, 0) + "%"); + sensorData[sensorCount++] = + "Temp/Hum: " + last_temp + " / " + String(lastMeasurement.variant.environment_metrics.relative_humidity, 0) + "%"; } if (lastMeasurement.variant.environment_metrics.barometric_pressure != 0) { - display->drawString(x, y += _fontHeight(FONT_SMALL), - "Press: " + String(lastMeasurement.variant.environment_metrics.barometric_pressure, 0) + "hPA"); + sensorData[sensorCount++] = + "Press: " + String(lastMeasurement.variant.environment_metrics.barometric_pressure, 0) + "hPA"; } if (lastMeasurement.variant.environment_metrics.voltage != 0) { - display->drawString(x, y += _fontHeight(FONT_SMALL), - "Volt/Cur: " + String(lastMeasurement.variant.environment_metrics.voltage, 0) + "V / " + - String(lastMeasurement.variant.environment_metrics.current, 0) + "mA"); + sensorData[sensorCount++] = "Volt/Cur: " + String(lastMeasurement.variant.environment_metrics.voltage, 0) + "V / " + + String(lastMeasurement.variant.environment_metrics.current, 0) + "mA"; } if (lastMeasurement.variant.environment_metrics.iaq != 0) { - display->drawString(x, y += _fontHeight(FONT_SMALL), "IAQ: " + String(lastMeasurement.variant.environment_metrics.iaq)); + sensorData[sensorCount++] = "IAQ: " + String(lastMeasurement.variant.environment_metrics.iaq); + } + + if (lastMeasurement.variant.environment_metrics.distance != 0) { + sensorData[sensorCount++] = "Water Level: " + String(lastMeasurement.variant.environment_metrics.distance, 0) + "mm"; + } + + if (lastMeasurement.variant.environment_metrics.weight != 0) { + sensorData[sensorCount++] = "Weight: " + String(lastMeasurement.variant.environment_metrics.weight, 0) + "kg"; + } + + if (lastMeasurement.variant.environment_metrics.radiation != 0) { + sensorData[sensorCount++] = "Rad: " + String(lastMeasurement.variant.environment_metrics.radiation, 2) + "µR/h"; } if (lastMeasurement.variant.environment_metrics.lux != 0) { - display->drawString(x, y += _fontHeight(FONT_SMALL), - "Illuminance: " + String(lastMeasurement.variant.environment_metrics.lux, 2) + "lx"); + sensorData[sensorCount++] = "Illuminance: " + String(lastMeasurement.variant.environment_metrics.lux, 2) + "lx"; } if (lastMeasurement.variant.environment_metrics.white_lux != 0) { - display->drawString(x, y += _fontHeight(FONT_SMALL), - "W_Lux: " + String(lastMeasurement.variant.environment_metrics.white_lux, 2) + "lx"); + sensorData[sensorCount++] = "W_Lux: " + String(lastMeasurement.variant.environment_metrics.white_lux, 2) + "lx"; } - if (lastMeasurement.variant.environment_metrics.distance != 0) - display->drawString(x, y += _fontHeight(FONT_SMALL), - "Water Level: " + String(lastMeasurement.variant.environment_metrics.distance, 0) + "mm"); + static int scrollOffset = 0; + static bool scrollingDown = true; + static uint32_t lastScrollTime = millis(); - if (lastMeasurement.variant.environment_metrics.weight != 0) - display->drawString(x, y += _fontHeight(FONT_SMALL), - "Weight: " + String(lastMeasurement.variant.environment_metrics.weight, 0) + "kg"); + // Draw up to 3 sensor data lines + int linesToShow = min(3, sensorCount); + for (int i = 0; i < linesToShow; i++) { + int index = (scrollOffset + i) % sensorCount; + display->drawString(x, y += _fontHeight(FONT_SMALL), sensorData[index]); + } - if (lastMeasurement.variant.environment_metrics.radiation != 0) - display->drawString(x, y += _fontHeight(FONT_SMALL), - "Rad: " + String(lastMeasurement.variant.environment_metrics.radiation, 2) + "µR/h"); + // Only scroll if there are more than 3 sensor data lines + if (sensorCount > 3) { + // Update scroll offset every 5 seconds + if (millis() - lastScrollTime > 5000) { + if (scrollingDown) { + scrollOffset++; + if (scrollOffset + linesToShow >= sensorCount) { + scrollingDown = false; + } + } else { + scrollOffset--; + if (scrollOffset <= 0) { + scrollingDown = true; + } + } + lastScrollTime = millis(); + } + } } bool EnvironmentTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Telemetry *t) From 729c39fb8621e0b76f4178fee88cc1dfa2711d06 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 13 Jan 2025 19:18:34 -0600 Subject: [PATCH 097/381] [create-pull-request] automated change (#5849) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- debian/changelog | 5 +++-- version.properties | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 035d5f034..8b1799c52 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ -meshtasticd (2.5.19.0) UNRELEASED; urgency=medium +meshtasticd (2.5.20.0) UNRELEASED; urgency=medium * Initial packaging + * GitHub Actions Automatic version bump - -- Austin Lane Thu, 02 Jan 2025 12:00:00 +0000 \ No newline at end of file + -- Austin Lane Mon, 13 Jan 2025 19:24:14 +0000 diff --git a/version.properties b/version.properties index 800529e39..4312ae59a 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 5 -build = 19 +build = 20 From dd9ab7f0e1f74c2cdb33d1fe3d044cebab56cad0 Mon Sep 17 00:00:00 2001 From: Austin Date: Tue, 14 Jan 2025 02:17:54 -0500 Subject: [PATCH 098/381] Small Fix: Release_Channels permissions (#5852) --- .github/workflows/hook_copr.yml | 38 ++++++++------------------ .github/workflows/release_channels.yml | 4 ++- 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/.github/workflows/hook_copr.yml b/.github/workflows/hook_copr.yml index 94d9d095f..c30038d6b 100644 --- a/.github/workflows/hook_copr.yml +++ b/.github/workflows/hook_copr.yml @@ -38,38 +38,24 @@ jobs: project_name = "${{ inputs.copr_project }}" if project_name == "daily": - hook_secret = "${{ secrets.COPR_HOOK_DAILY }}" - project_id = 160277 + hook_secret = "${{ secrets.COPR_HOOK_DAILY }}" + project_id = 160277 elif project_name == "alpha": - hook_secret = "${{ secrets.COPR_HOOK_ALPHA }}" - project_id = 160278 + hook_secret = "${{ secrets.COPR_HOOK_ALPHA }}" + project_id = 160278 elif project_name == "beta": - hook_secret = "${{ secrets.COPR_HOOK_BETA }}" - project_id = 160279 + hook_secret = "${{ secrets.COPR_HOOK_BETA }}" + project_id = 160279 else: - raise ValueError(f"Unknown COPR project: {project_name}") + raise ValueError(f"Unknown COPR project: {project_name}") webhook_url = f"https://copr.fedorainfracloud.org/webhooks/github/{project_id}/{hook_secret}/meshtasticd/" copr_payload = { - "event": "push", - "payload": { - "ref": "${{ github.ref }}", - "after": "${{ github.sha }}", - "repository": { - "id": "${{ github.repository_id }}", - "full_name": "${{ github.repository }}", - "git_url": "${{ github.repositoryUrl }}", - "owner": { - "name": "${{ github.repository_owner }}" - } - }, - "pusher": { - "name": "${{ github.actor }}" - }, - "sender": { - "login": "github-actions[bot]" - } + "ref": "${{ github.ref }}", + "after": "${{ github.sha }}", + "repository": { + "clone_url": "${{ github.server_url }}/${{ github.repository }}.git", } } - r = requests.post(webhook_url, json=copr_payload) + r = requests.post(webhook_url, json=copr_payload, headers={"X-GitHub-Event": "push"}) r.raise_for_status() diff --git a/.github/workflows/release_channels.yml b/.github/workflows/release_channels.yml index 8891826d2..afb7319ed 100644 --- a/.github/workflows/release_channels.yml +++ b/.github/workflows/release_channels.yml @@ -4,7 +4,9 @@ on: release: types: [published, released] -permissions: read-all +permissions: + contents: write + packages: write jobs: package-ppa: From fb2c008c89cbd9930eda10193baf66c0c45fc6b4 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Tue, 14 Jan 2025 18:55:02 -0600 Subject: [PATCH 099/381] Update version.properties --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 4312ae59a..800529e39 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 5 -build = 20 +build = 19 From 85de193845bae37e1a19a87372e8c3d187f0ecb2 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 15 Jan 2025 06:46:12 -0600 Subject: [PATCH 100/381] Fix NRF52 default append write mode of files (#5858) * Fix NRF52 default append write mode of files * Inside the lock --- src/SafeFile.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/SafeFile.cpp b/src/SafeFile.cpp index 825ba3028..f874164ae 100644 --- a/src/SafeFile.cpp +++ b/src/SafeFile.cpp @@ -9,7 +9,9 @@ static File openFile(const char *filename, bool fullAtomic) LOG_DEBUG("Opening %s, fullAtomic=%d", filename, fullAtomic); #ifdef ARCH_NRF52 lfs_assert_failed = false; - return FSCom.open(filename, FILE_O_WRITE); + File file = FSCom.open(filename, FILE_O_WRITE); + file.seek(0); + return file; #endif if (!fullAtomic) FSCom.remove(filename); // Nuke the old file to make space (ignore if it !exists) @@ -59,6 +61,9 @@ bool SafeFile::close() return false; spiLock->lock(); +#ifdef ARCH_NRF52 + f.truncate(); +#endif f.close(); spiLock->unlock(); From f9876cfe9c52691b56305270e1246fdc6d72f37f Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Thu, 16 Jan 2025 02:19:51 +1300 Subject: [PATCH 101/381] Wait for disconnection (#5859) --- src/platform/nrf52/NRF52Bluetooth.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/platform/nrf52/NRF52Bluetooth.cpp b/src/platform/nrf52/NRF52Bluetooth.cpp index 541e90ab2..b98620f33 100644 --- a/src/platform/nrf52/NRF52Bluetooth.cpp +++ b/src/platform/nrf52/NRF52Bluetooth.cpp @@ -210,7 +210,10 @@ void NRF52Bluetooth::shutdown() LOG_INFO("NRF52 bluetooth disconnecting handle %d", i); Bluefruit.disconnect(i); } - delay(100); // wait for ondisconnect; + // Wait for disconnection + while (Bluefruit.connected()) + yield(); + LOG_INFO("All bluetooth connections ended"); } Bluefruit.Advertising.stop(); } From 4cd2ba54795f47b732608eab8e834c50ea8cc9c1 Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Thu, 16 Jan 2025 23:23:57 +1300 Subject: [PATCH 102/381] More lines of environmental telemetry on-screen (#5853) --- src/modules/Telemetry/EnvironmentTelemetry.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index 2fc9bab0b..fe1d0d2a9 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -278,8 +278,18 @@ void EnvironmentTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiSt static bool scrollingDown = true; static uint32_t lastScrollTime = millis(); - // Draw up to 3 sensor data lines - int linesToShow = min(3, sensorCount); + // Determine how many lines we can fit on display + // Calculated once only: display dimensions don't change during runtime. + static int maxLines = 0; + if (!maxLines) { + const int16_t paddingTop = _fontHeight(FONT_SMALL); // Heading text + const int16_t paddingBottom = 8; // Indicator dots + maxLines = (display->getHeight() - paddingTop - paddingBottom) / _fontHeight(FONT_SMALL); + assert(maxLines > 0); + } + + // Draw as many lines of data as we can fit + int linesToShow = min(maxLines, sensorCount); for (int i = 0; i < linesToShow; i++) { int index = (scrollOffset + i) % sensorCount; display->drawString(x, y += _fontHeight(FONT_SMALL), sensorData[index]); From 262f1d25a20ad68036fec402b2e5d7ca0b19adcf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2025 06:15:17 -0600 Subject: [PATCH 103/381] [create-pull-request] automated change (#5860) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- debian/changelog | 3 ++- version.properties | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 8b1799c52..a1a359cfb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,5 +2,6 @@ meshtasticd (2.5.20.0) UNRELEASED; urgency=medium * Initial packaging * GitHub Actions Automatic version bump + * GitHub Actions Automatic version bump - -- Austin Lane Mon, 13 Jan 2025 19:24:14 +0000 + -- Austin Lane Wed, 15 Jan 2025 14:08:54 +0000 diff --git a/version.properties b/version.properties index 800529e39..4312ae59a 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 5 -build = 19 +build = 20 From a48df917374019f408608e814451e9029a75d002 Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Fri, 17 Jan 2025 01:38:22 +1300 Subject: [PATCH 104/381] Canned messages: allow GPIO0 with "scan and select" input (#5838) * Allow GPIO0; check for conflict with user button * Guard for no BUTTON_PIN; handle portduino * Portduino settings: attempt two We don't really need to #include radio code here just to check if the pin is RADIOLIB_NC. We're only interested if scanAndSelect pin matches user button pin, but they won't match if user button is RADIOLIB_NC. * Portduino attempt 3: glue --- src/input/ScanAndSelect.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/input/ScanAndSelect.cpp b/src/input/ScanAndSelect.cpp index d8767fab8..1262f99b4 100644 --- a/src/input/ScanAndSelect.cpp +++ b/src/input/ScanAndSelect.cpp @@ -7,6 +7,9 @@ #include "ScanAndSelect.h" #include "modules/CannedMessageModule.h" #include +#ifdef ARCH_PORTDUINO // Only to check for pin conflict with user button +#include "platform/portduino/PortduinoGlue.h" +#endif // Config static const char name[] = "scanAndSelect"; // should match "allow input source" string @@ -30,7 +33,9 @@ bool ScanAndSelectInput::init() if (strcasecmp(moduleConfig.canned_message.allow_input_source, name) != 0) return false; - // Use any available inputbroker pin as the button + // Determine which pin to use for the single scan-and-select button + // User can specify this by setting any of the inputbroker pins + // If all values are zero, we'll assume the user *does* want GPIO0 if (moduleConfig.canned_message.inputbroker_pin_press) pin = moduleConfig.canned_message.inputbroker_pin_press; else if (moduleConfig.canned_message.inputbroker_pin_a) @@ -38,7 +43,25 @@ bool ScanAndSelectInput::init() else if (moduleConfig.canned_message.inputbroker_pin_b) pin = moduleConfig.canned_message.inputbroker_pin_b; else - return false; // Short circuit: no button found + pin = 0; // GPIO 0 then + + // Short circuit: if selected pin conficts with the user button +#if defined(ARCH_PORTDUINO) + int pinUserButton = 0; + if (settingsMap.count(user) != 0) { + pinUserButton = settingsMap[user]; + } +#elif defined(USERPREFS_BUTTON_PIN) + int pinUserButton = config.device.button_gpio ? config.device.button_gpio : USERPREFS_BUTTON_PIN; +#elif defined(BUTTON_PIN) + int pinUserButton = config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN; +#else + int pinUserButton = config.device.button_gpio; +#endif + if (pin == pinUserButton) { + LOG_ERROR("ScanAndSelect conflict with user button"); + return false; + } // Set-up the button pinMode(pin, INPUT_PULLUP); From 7ba593432e33b288db704a181eb8b910ef3afc22 Mon Sep 17 00:00:00 2001 From: Austin Date: Thu, 16 Jan 2025 16:51:18 -0500 Subject: [PATCH 105/381] COPR: Switch from hook to copr_cli (#5864) --- .github/workflows/hook_copr.yml | 41 +++++++++------------------------ 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/.github/workflows/hook_copr.yml b/.github/workflows/hook_copr.yml index c30038d6b..a72ae5cf5 100644 --- a/.github/workflows/hook_copr.yml +++ b/.github/workflows/hook_copr.yml @@ -3,9 +3,7 @@ name: Trigger COPR build on: workflow_call: secrets: - COPR_HOOK_DAILY: - COPR_HOOK_ALPHA: - COPR_HOOK_BETA: + COPR_API_CONFIG: inputs: copr_project: description: COPR project to target @@ -32,30 +30,13 @@ jobs: pip install requests - name: Trigger COPR build - shell: python - run: | - import requests - - project_name = "${{ inputs.copr_project }}" - if project_name == "daily": - hook_secret = "${{ secrets.COPR_HOOK_DAILY }}" - project_id = 160277 - elif project_name == "alpha": - hook_secret = "${{ secrets.COPR_HOOK_ALPHA }}" - project_id = 160278 - elif project_name == "beta": - hook_secret = "${{ secrets.COPR_HOOK_BETA }}" - project_id = 160279 - else: - raise ValueError(f"Unknown COPR project: {project_name}") - - webhook_url = f"https://copr.fedorainfracloud.org/webhooks/github/{project_id}/{hook_secret}/meshtasticd/" - copr_payload = { - "ref": "${{ github.ref }}", - "after": "${{ github.sha }}", - "repository": { - "clone_url": "${{ github.server_url }}/${{ github.repository }}.git", - } - } - r = requests.post(webhook_url, json=copr_payload, headers={"X-GitHub-Event": "push"}) - r.raise_for_status() + uses: akdev1l/copr-build@main + id: copr_build + env: + COPR_API_TOKEN_CONFIG: ${{ secrets.COPR_API_CONFIG }} + with: + owner: meshtastic + package-name: meshtasticd + project-name: ${{ inputs.copr_project }} + git-remote: "${{ github.server_url }}/${{ github.repository }}.git" + committish: ${{ github.sha }} From 7acd72ede145ef92b829add29beaf7d269ce636d Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 16 Jan 2025 16:00:23 -0600 Subject: [PATCH 106/381] Cleanup unique id --- src/mesh/NodeDB.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index a9e5565ef..762982287 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -197,9 +197,8 @@ NodeDB::NodeDB() uint32_t channelFileCRC = crc32Buffer(&channelFile, sizeof(channelFile)); int saveWhat = 0; - // bool hasUniqueId = false; // Get device unique id -#if defined(ARCH_ESP32) && defined(ESP_EFUSE_OPTIONAL_UNIQUE_ID) +#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) uint32_t unique_id[4]; // ESP32 factory burns a unique id in efuse for S2+ series and evidently C3+ series // This is used for HMACs in the esp-rainmaker AIOT platform and seems to be a good choice for us @@ -207,7 +206,6 @@ NodeDB::NodeDB() if (err == ESP_OK) { memcpy(myNodeInfo.device_id.bytes, unique_id, sizeof(unique_id)); myNodeInfo.device_id.size = 16; - hasUniqueId = true; } else { LOG_WARN("Failed to read unique id from efuse"); } @@ -221,12 +219,12 @@ NodeDB::NodeDB() memcpy(myNodeInfo.device_id.bytes + sizeof(device_id_start), &device_id_end, sizeof(device_id_end)); myNodeInfo.device_id.size = 16; // Uncomment below to print the device id - // hasUniqueId = true; + #else // FIXME - implement for other platforms #endif - // if (hasUniqueId) { + // if (myNodeInfo.device_id.size == 16) { // std::string deviceIdHex; // for (size_t i = 0; i < myNodeInfo.device_id.size; ++i) { // char buf[3]; From a085614aaa602ab44cb453609d3a47bb70ed0f24 Mon Sep 17 00:00:00 2001 From: danwelch3 Date: Thu, 16 Jan 2025 16:22:27 -0700 Subject: [PATCH 107/381] Initiate magnetometer based compass calibration from button presses (#5553) * Initiate magenetometer based compass calibration from button presses - only active for BMX160 accelerometers on RAK_4631 - replace automatic calibration on power on with button triggered calibration - set 5 presses to trigger 30s calibration - set 6 presses to trigger 60s calibration (useful if unit is not handheld, ie vehicle mounted) - show calibration time remaining on calibration alert screen * Fix non RAK 4631 builds - exclude changes from non RAK 4631 builds - remove calls to screen when not present * Fix build on RAK4631_eth_gw - exclude all compass heading updates on variant without screen --------- Co-authored-by: Ben Meadors --- src/ButtonThread.cpp | 14 +++++++++++++ src/graphics/Screen.h | 6 ++++++ src/motion/AccelerometerThread.h | 7 +++++++ src/motion/BMX160Sensor.cpp | 35 ++++++++++++++++++++++++++------ src/motion/BMX160Sensor.h | 1 + src/motion/MotionSensor.cpp | 8 ++++++++ src/motion/MotionSensor.h | 6 ++++++ 7 files changed, 71 insertions(+), 6 deletions(-) diff --git a/src/ButtonThread.cpp b/src/ButtonThread.cpp index 3f64b3b3e..5175a2680 100644 --- a/src/ButtonThread.cpp +++ b/src/ButtonThread.cpp @@ -190,6 +190,20 @@ int32_t ButtonThread::runOnce() case 4: digitalWrite(PIN_EINK_EN, digitalRead(PIN_EINK_EN) == LOW); break; +#endif +#if defined(RAK_4631) + // 5 clicks: start accelerometer/magenetometer calibration for 30 seconds + case 5: + if (accelerometerThread) { + accelerometerThread->calibrate(30); + } + break; + // 6 clicks: start accelerometer/magenetometer calibration for 60 seconds + case 6: + if (accelerometerThread) { + accelerometerThread->calibrate(60); + } + break; #endif // No valid multipress action default: diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index 3cb39e8ec..ce416156f 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -278,6 +278,10 @@ class Screen : public concurrency::OSThread bool hasHeading() { return hasCompass; } long getHeading() { return compassHeading; } + + void setEndCalibration(uint32_t _endCalibrationAt) { endCalibrationAt = _endCalibrationAt; } + uint32_t getEndCalibration() { return endCalibrationAt; } + // functions for display brightness void increaseBrightness(); void decreaseBrightness(); @@ -673,6 +677,8 @@ class Screen : public concurrency::OSThread bool hasCompass = false; float compassHeading; + uint32_t endCalibrationAt; + /// Holds state for debug information DebugInfo debugInfo; diff --git a/src/motion/AccelerometerThread.h b/src/motion/AccelerometerThread.h index 95f09910f..6e517d6b0 100755 --- a/src/motion/AccelerometerThread.h +++ b/src/motion/AccelerometerThread.h @@ -48,6 +48,13 @@ class AccelerometerThread : public concurrency::OSThread setIntervalFromNow(0); }; + void calibrate(uint16_t forSeconds) + { + if (sensor) { + sensor->calibrate(forSeconds); + } + } + protected: int32_t runOnce() override { diff --git a/src/motion/BMX160Sensor.cpp b/src/motion/BMX160Sensor.cpp index 6562a651c..06cea3229 100755 --- a/src/motion/BMX160Sensor.cpp +++ b/src/motion/BMX160Sensor.cpp @@ -25,19 +25,21 @@ bool BMX160Sensor::init() int32_t BMX160Sensor::runOnce() { +#if !defined(MESHTASTIC_EXCLUDE_SCREEN) sBmx160SensorData_t magAccel; sBmx160SensorData_t gAccel; /* Get a new sensor event */ sensor.getAllData(&magAccel, NULL, &gAccel); -#if !defined(MESHTASTIC_EXCLUDE_SCREEN) - // experimental calibrate routine. Limited to between 10 and 30 seconds after boot - if (millis() > 12 * 1000 && millis() < 30 * 1000) { + if (doCalibration) { + if (!showingScreen) { + powerFSM.trigger(EVENT_PRESS); // keep screen alive during calibration showingScreen = true; screen->startAlert((FrameCallback)drawFrameCalibration); } + if (magAccel.x > highestX) highestX = magAccel.x; if (magAccel.x < lowestX) @@ -50,9 +52,17 @@ int32_t BMX160Sensor::runOnce() highestZ = magAccel.z; if (magAccel.z < lowestZ) lowestZ = magAccel.z; - } else if (showingScreen && millis() >= 30 * 1000) { - showingScreen = false; - screen->endAlert(); + + uint32_t now = millis(); + if (now > endCalibrationAt) { + doCalibration = false; + endCalibrationAt = 0; + showingScreen = false; + screen->endAlert(); + } + + // LOG_DEBUG("BMX160 min_x: %.4f, max_X: %.4f, min_Y: %.4f, max_Y: %.4f, min_Z: %.4f, max_Z: %.4f", lowestX, highestX, + // lowestY, highestY, lowestZ, highestZ); } int highestRealX = highestX - (highestX + lowestX) / 2; @@ -93,12 +103,25 @@ int32_t BMX160Sensor::runOnce() heading += 270; break; } + screen->setHeading(heading); #endif return MOTION_SENSOR_CHECK_INTERVAL_MS; } +void BMX160Sensor::calibrate(uint16_t forSeconds) +{ +#if !defined(MESHTASTIC_EXCLUDE_SCREEN) + LOG_DEBUG("BMX160 calibration started for %is", forSeconds); + + doCalibration = true; + uint16_t calibrateFor = forSeconds * 1000; // calibrate for seconds provided + endCalibrationAt = millis() + calibrateFor; + screen->setEndCalibration(endCalibrationAt); +#endif +} + #endif #endif \ No newline at end of file diff --git a/src/motion/BMX160Sensor.h b/src/motion/BMX160Sensor.h index 26f477271..9031b4504 100755 --- a/src/motion/BMX160Sensor.h +++ b/src/motion/BMX160Sensor.h @@ -23,6 +23,7 @@ class BMX160Sensor : public MotionSensor explicit BMX160Sensor(ScanI2C::FoundDevice foundDevice); virtual bool init() override; virtual int32_t runOnce() override; + virtual void calibrate(uint16_t forSeconds) override; }; #else diff --git a/src/motion/MotionSensor.cpp b/src/motion/MotionSensor.cpp index 242e3709f..d87380085 100755 --- a/src/motion/MotionSensor.cpp +++ b/src/motion/MotionSensor.cpp @@ -2,6 +2,8 @@ #if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C +char timeRemainingBuffer[12]; + // screen is defined in main.cpp extern graphics::Screen *screen; @@ -37,6 +39,12 @@ void MotionSensor::drawFrameCalibration(OLEDDisplay *display, OLEDDisplayUiState display->setTextAlignment(TEXT_ALIGN_LEFT); display->setFont(FONT_MEDIUM); display->drawString(x, y, "Calibrating\nCompass"); + + uint8_t timeRemaining = (screen->getEndCalibration() - millis()) / 1000; + sprintf(timeRemainingBuffer, "( %02d )", timeRemaining); + display->setFont(FONT_SMALL); + display->drawString(x, y + 40, timeRemainingBuffer); + int16_t compassX = 0, compassY = 0; uint16_t compassDiam = graphics::Screen::getCompassDiam(display->getWidth(), display->getHeight()); diff --git a/src/motion/MotionSensor.h b/src/motion/MotionSensor.h index 78eec54ce..1f4d093bf 100755 --- a/src/motion/MotionSensor.h +++ b/src/motion/MotionSensor.h @@ -40,6 +40,8 @@ class MotionSensor // Refer to /src/concurrency/OSThread.h for more information inline virtual int32_t runOnce() { return MOTION_SENSOR_CHECK_INTERVAL_MS; }; + virtual void calibrate(uint16_t forSeconds){}; + protected: // Turn on the screen when a tap or motion is detected virtual void wakeScreen(); @@ -53,6 +55,10 @@ class MotionSensor #endif ScanI2C::FoundDevice device; + + // Do calibration if true + bool doCalibration = false; + uint32_t endCalibrationAt = 0; }; namespace MotionSensorI2C From 8179e61fdc5ed73a2deec577312cf12918efbe5c Mon Sep 17 00:00:00 2001 From: SignalMedic Date: Thu, 16 Jan 2025 18:26:02 -0500 Subject: [PATCH 108/381] changed GPS buad rate to 9600 (#5786) Co-authored-by: Huston Hedinger <1875033+hdngr@users.noreply.github.com> --- variants/canaryone/variant.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/canaryone/variant.h b/variants/canaryone/variant.h index 140b605ad..836fa74a3 100644 --- a/variants/canaryone/variant.h +++ b/variants/canaryone/variant.h @@ -123,7 +123,7 @@ static const uint8_t A0 = PIN_A0; */ #define HAS_GPS 1 #define GPS_UBLOX -#define GPS_BAUDRATE 38400 +#define GPS_BAUDRATE 9600 // #define PIN_GPS_WAKE (GPIO_PORT1 + 2) // An output to wake GPS, low means allow sleep, high means force wake // Seems to be missing on this new board From f132158c3e83fd95004be5d19b302a6d493c295d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Hol=C3=A1sek?= Date: Fri, 17 Jan 2025 01:39:39 +0100 Subject: [PATCH 109/381] Fixed localization on bigger screens (#5695) Co-authored-by: Ben Meadors --- src/graphics/ScreenFonts.h | 102 ++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 52 deletions(-) diff --git a/src/graphics/ScreenFonts.h b/src/graphics/ScreenFonts.h index 7881b464f..f6abec0f5 100644 --- a/src/graphics/ScreenFonts.h +++ b/src/graphics/ScreenFonts.h @@ -16,63 +16,61 @@ #include "graphics/fonts/OLEDDisplayFontsCS.h" #endif +#ifdef OLED_PL +#define FONT_SMALL_LOCAL ArialMT_Plain_10_PL +#else +#ifdef OLED_RU +#define FONT_SMALL_LOCAL ArialMT_Plain_10_RU +#else +#ifdef OLED_UA +#define FONT_SMALL_LOCAL ArialMT_Plain_10_UA // Height: 13 +#else +#ifdef OLED_CS +#define FONT_SMALL_LOCAL ArialMT_Plain_10_CS +#else +#define FONT_SMALL_LOCAL ArialMT_Plain_10 // Height: 13 +#endif +#endif +#endif +#endif +#ifdef OLED_PL +#define FONT_MEDIUM_LOCAL ArialMT_Plain_16_PL // Height: 19 +#else +#ifdef OLED_UA +#define FONT_MEDIUM_LOCAL ArialMT_Plain_16_UA // Height: 19 +#else +#ifdef OLED_CS +#define FONT_MEDIUM_LOCAL ArialMT_Plain_16_CS +#else +#define FONT_MEDIUM_LOCAL ArialMT_Plain_16 // Height: 19 +#endif +#endif +#endif +#ifdef OLED_PL +#define FONT_LARGE_LOCAL ArialMT_Plain_24_PL // Height: 28 +#else +#ifdef OLED_UA +#define FONT_LARGE_LOCAL ArialMT_Plain_24_UA // Height: 28 +#else +#ifdef OLED_CS +#define FONT_LARGE_LOCAL ArialMT_Plain_24_CS // Height: 28 +#else +#define FONT_LARGE_LOCAL ArialMT_Plain_24 // Height: 28 +#endif +#endif +#endif + #if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || \ defined(ST7789_CS) || defined(USE_ST7789) || defined(HX8357_CS)) && \ !defined(DISPLAY_FORCE_SMALL_FONTS) // The screen is bigger so use bigger fonts -#ifdef OLED_PL -#define FONT_SMALL ArialMT_Plain_16_PL // Height: 19 -#define FONT_MEDIUM ArialMT_Plain_24_PL // Height: 28 -#define FONT_LARGE ArialMT_Plain_24_PL // Height: 28 +#define FONT_SMALL FONT_MEDIUM_LOCAL // Height: 19 +#define FONT_MEDIUM FONT_LARGE_LOCAL // Height: 28 +#define FONT_LARGE FONT_LARGE_LOCAL // Height: 28 #else -#define FONT_SMALL ArialMT_Plain_16 // Height: 19 -#define FONT_MEDIUM ArialMT_Plain_24 // Height: 28 -#define FONT_LARGE ArialMT_Plain_24 // Height: 28 -#endif -#else -#ifdef OLED_PL -#define FONT_SMALL ArialMT_Plain_10_PL -#else -#ifdef OLED_RU -#define FONT_SMALL ArialMT_Plain_10_RU -#else -#ifdef OLED_UA -#define FONT_SMALL ArialMT_Plain_10_UA // Height: 13 -#else -#ifdef OLED_CS -#define FONT_SMALL ArialMT_Plain_10_CS -#else -#define FONT_SMALL ArialMT_Plain_10 // Height: 13 -#endif -#endif -#endif -#endif -#ifdef OLED_PL -#define FONT_MEDIUM ArialMT_Plain_16_PL // Height: 19 -#else -#ifdef OLED_UA -#define FONT_MEDIUM ArialMT_Plain_16_UA // Height: 19 -#else -#ifdef OLED_CS -#define FONT_MEDIUM ArialMT_Plain_16_CS -#else -#define FONT_MEDIUM ArialMT_Plain_16 // Height: 19 -#endif -#endif -#endif -#ifdef OLED_PL -#define FONT_LARGE ArialMT_Plain_24_PL // Height: 28 -#else -#ifdef OLED_UA -#define FONT_LARGE ArialMT_Plain_24_UA // Height: 28 -#else -#ifdef OLED_CS -#define FONT_LARGE ArialMT_Plain_24_CS // Height: 28 -#else -#define FONT_LARGE ArialMT_Plain_24 // Height: 28 -#endif -#endif -#endif +#define FONT_SMALL FONT_SMALL_LOCAL // Height: 13 +#define FONT_MEDIUM FONT_MEDIUM_LOCAL // Height: 19 +#define FONT_LARGE FONT_LARGE_LOCAL // Height: 28 #endif #define _fontHeight(font) ((font)[1] + 1) // height is position 1 From b0fe5ef8ba13af2ddc774018b9f08217859d7c3d Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Thu, 16 Jan 2025 16:42:21 -0800 Subject: [PATCH 110/381] Initial commit of a fuzzer for Meshtastic (#5790) * Initial commit of a fuzzer for Meshtastic. * Use a max of 5 for the phone queues * Only write files to the temp dir * Limitless queue + fuzzer = lots of ram :) * Use $PIO_ENV for path to program * spelling: s/is/to/ * Use loopCanSleep instead of a lock in Router * realHardware allows full use of a CPU core * Ignore checkov CKV_DOCKER_2 & CKV_DOCKER_3 * Add Atak seed * Fix lint issues in build.sh * Use exception to exit from portduino_main * Separate build & source files into $WORK & $SRC * Use an ephemeral port for the API server * Include CXXFLAGS in the link step * Read all shared libraries * Use a separate work directory for each sanitizer --------- Co-authored-by: Ben Meadors --- .clusterfuzzlite/Dockerfile | 52 +++++ .clusterfuzzlite/README.md | 59 +++++ .clusterfuzzlite/build.sh | 71 ++++++ .../platformio-clusterfuzzlite-post.py | 35 +++ .../platformio-clusterfuzzlite-pre.py | 52 +++++ .clusterfuzzlite/project.yaml | 1 + .clusterfuzzlite/router_fuzzer.cpp | 206 ++++++++++++++++++ .clusterfuzzlite/router_fuzzer.options | 2 + .clusterfuzzlite/router_fuzzer_seed_corpus.py | 168 ++++++++++++++ .dockerignore | 1 + platformio.ini | 2 +- src/FSCommon.cpp | 2 +- src/mesh/PacketHistory.h | 4 + src/mesh/TypedQueue.h | 15 +- src/platform/portduino/PortduinoGlue.cpp | 8 +- 15 files changed, 671 insertions(+), 7 deletions(-) create mode 100644 .clusterfuzzlite/Dockerfile create mode 100644 .clusterfuzzlite/README.md create mode 100644 .clusterfuzzlite/build.sh create mode 100644 .clusterfuzzlite/platformio-clusterfuzzlite-post.py create mode 100644 .clusterfuzzlite/platformio-clusterfuzzlite-pre.py create mode 100644 .clusterfuzzlite/project.yaml create mode 100644 .clusterfuzzlite/router_fuzzer.cpp create mode 100644 .clusterfuzzlite/router_fuzzer.options create mode 100644 .clusterfuzzlite/router_fuzzer_seed_corpus.py create mode 120000 .dockerignore diff --git a/.clusterfuzzlite/Dockerfile b/.clusterfuzzlite/Dockerfile new file mode 100644 index 000000000..a769a976d --- /dev/null +++ b/.clusterfuzzlite/Dockerfile @@ -0,0 +1,52 @@ +# This container is used to build Meshtastic with the libraries required by the fuzzer. +# ClusterFuzzLite starts the container, runs the build.sh script, and then exits. + +# As this is not a long running service, health-checks are not required. ClusterFuzzLite +# also only works if the user remains unchanged from the base image (it expects to run +# as root). +# trunk-ignore-all(trivy/DS026): No healthcheck is needed for this builder container +# trunk-ignore-all(checkov/CKV_DOCKER_2): No healthcheck is needed for this builder container +# trunk-ignore-all(checkov/CKV_DOCKER_3): We must run as root for this container +# trunk-ignore-all(trivy/DS002): We must run as root for this container +# trunk-ignore-all(checkov/CKV_DOCKER_8): We must run as root for this container +# trunk-ignore-all(hadolint/DL3002): We must run as root for this container + +FROM gcr.io/oss-fuzz-base/base-builder:v1 + +ENV PIP_ROOT_USER_ACTION=ignore + +# trunk-ignore(hadolint/DL3008): apt packages are not pinned. +# trunk-ignore(terrascan/AC_DOCKER_0002): apt packages are not pinned. +RUN apt-get update && apt-get install --no-install-recommends -y \ + cmake git zip libgpiod-dev libbluetooth-dev libi2c-dev \ + libunistring-dev libmicrohttpd-dev libgnutls28-dev libgcrypt20-dev \ + libusb-1.0-0-dev libssl-dev pkg-config && \ + apt-get clean && rm -rf /var/lib/apt/lists/* && \ + pip install --no-cache-dir -U \ + platformio==6.1.16 \ + grpcio-tools==1.68.1 \ + meshtastic==2.5.9 + +# Ugly hack to avoid clang detecting a conflict between the math "log" function and the "log" function in framework-portduino/cores/portduino/logging.h +RUN sed -i -e 's/__MATHCALL_VEC (log,, (_Mdouble_ __x));//' /usr/include/x86_64-linux-gnu/bits/mathcalls.h + +# A few dependencies are too old on the base-builder image. More recent versions are built from source. +WORKDIR $SRC +RUN git config --global advice.detachedHead false && \ + git clone --depth 1 --branch 0.8.0 https://github.com/jbeder/yaml-cpp.git && \ + git clone --depth 1 --branch v2.3.3 https://github.com/babelouest/orcania.git && \ + git clone --depth 1 --branch v1.4.20 https://github.com/babelouest/yder.git && \ + git clone --depth 1 --branch v2.7.15 https://github.com/babelouest/ulfius.git + +COPY ./.clusterfuzzlite/build.sh $SRC/ + +WORKDIR $SRC/firmware +COPY . $SRC/firmware/ + +# https://docs.platformio.org/en/latest/envvars.html +ENV PLATFORMIO_CORE_DIR=$SRC/pio/core \ + PLATFORMIO_LIBDEPS_DIR=$SRC/pio/libdeps \ + PLATFORMIO_PACKAGES_DIR=$SRC/pio/packages \ + PLATFORMIO_SETTING_ENABLE_CACHE=No \ + PIO_ENV=buildroot +RUN platformio pkg install --environment $PIO_ENV diff --git a/.clusterfuzzlite/README.md b/.clusterfuzzlite/README.md new file mode 100644 index 000000000..f6e4089a3 --- /dev/null +++ b/.clusterfuzzlite/README.md @@ -0,0 +1,59 @@ +# ClusterFuzzLite for Meshtastic + +This directory contains the fuzzer implementation for Meshtastic using the ClusterFuzzLite framework. +See the [ClusterFuzzLite documentation](https://google.github.io/clusterfuzzlite/) for more details. + +## Running locally + +ClusterFuzzLite uses the OSS-Fuzz toolchain. To build the fuzzer manually, first grab a copy of OSS-Fuzz. + +```shell +git clone https://github.com/google/oss-fuzz.git +cd oss-fuzz +``` + +To build the fuzzer, run: + +```shell +python3 infra/helper.py build_image --external $PATH_TO_MESHTASTIC_FIRMWARE_DIRECTORY +python3 infra/helper.py build_fuzzers --external $PATH_TO_MESHTASTIC_FIRMWARE_DIRECTORY --sanitizer address +``` + +To run the fuzzer, run: + +```shell +python3 infra/helper.py run_fuzzer --external --corpus-dir= $PATH_TO_MESHTASTIC_FIRMWARE_DIRECTORY router_fuzzer +``` + +More background on these commands can be found in the +[ClusterFuzzLite documentation](https://google.github.io/clusterfuzzlite/build-integration/#testing-locally). + +## router_fuzzer.cpp + +This fuzzer submits MeshPacket protos to the `Router::enqueueReceivedMessage` method. It takes the binary +data from the fuzzer and decodes that data to a MeshPacket using nanopb. A few fields in +the MeshPacket are modified by the fuzzer. + +- If the `to` field is 0, it will be replaced with the NodeID of the running node. +- If the `from` field is 0, it will be replaced with the NodeID of the running node. +- If the `id` field is 0, it will be replaced with an incrementing counter value. +- If the `pki_encrypted` field is true, the `public_key` field will be populated with the first admin key. + +The `router_fuzzer_seed_corpus.py` file contains a list of MeshPackets. It is run from inside build.sh and +writes the binary MeshPacket protos to files. These files are use used by the fuzzer as its initial seed data, +helping the fuzzer to start off with a few known inputs. + +### Interpreting a fuzzer crash + +If the fuzzer crashes, it'll write the input bytes used for the test case to a file and notify about the +location of that file. The contents of the file are a binary serialized MeshPacket protobuf. The following +snippet of Python code can be used to parse the file into a human readable form. + +```python +from meshtastic.protobuf import mesh_pb2 + +mesh_pb2.MeshPacket.FromString(open("crash-XXXX-file", "rb").read()) +``` + +Consider adding any such crash results to the `router_fuzzer_seed_corpus.py` file to ensure there a isn't +a future regression for that crash test case. diff --git a/.clusterfuzzlite/build.sh b/.clusterfuzzlite/build.sh new file mode 100644 index 000000000..10a2db0bd --- /dev/null +++ b/.clusterfuzzlite/build.sh @@ -0,0 +1,71 @@ +#!/bin/bash -eu + +# Build Meshtastic and a few needed dependencies using clang++ +# and the OSS-Fuzz required build flags. + +env + +cd "$SRC" +NPROC=$(nproc || echo 1) + +LDFLAGS=-lpthread cmake -S "$SRC/yaml-cpp" -B "$WORK/yaml-cpp/$SANITIZER" \ + -DBUILD_SHARED_LIBS=OFF +cmake --build "$WORK/yaml-cpp/$SANITIZER" -j "$NPROC" +cmake --install "$WORK/yaml-cpp/$SANITIZER" --prefix /usr + +cmake -S "$SRC/orcania" -B "$WORK/orcania/$SANITIZER" \ + -DBUILD_STATIC=ON +cmake --build "$WORK/orcania/$SANITIZER" -j "$NPROC" +cmake --install "$WORK/orcania/$SANITIZER" --prefix /usr + +cmake -S "$SRC/yder" -B "$WORK/yder/$SANITIZER" \ + -DBUILD_STATIC=ON -DWITH_JOURNALD=OFF +cmake --build "$WORK/yder/$SANITIZER" -j "$NPROC" +cmake --install "$WORK/yder/$SANITIZER" --prefix /usr + +cmake -S "$SRC/ulfius" -B "$WORK/ulfius/$SANITIZER" \ + -DBUILD_STATIC=ON -DWITH_JANSSON=OFF -DWITH_CURL=OFF -DWITH_WEBSOCKET=OFF +cmake --build "$WORK/ulfius/$SANITIZER" -j "$NPROC" +cmake --install "$WORK/ulfius/$SANITIZER" --prefix /usr + +cd "$SRC/firmware" + +PLATFORMIO_EXTRA_SCRIPTS=$(echo -e "pre:.clusterfuzzlite/platformio-clusterfuzzlite-pre.py\npost:.clusterfuzzlite/platformio-clusterfuzzlite-post.py") +STATIC_LIBS=$(pkg-config --libs --static libulfius openssl libgpiod yaml-cpp bluez --silence-errors) +export PLATFORMIO_EXTRA_SCRIPTS +export STATIC_LIBS +export PLATFORMIO_WORKSPACE_DIR="$WORK/pio/$SANITIZER" +export TARGET_CC=$CC +export TARGET_CXX=$CXX +export TARGET_LD=$CXX +export TARGET_AR=llvm-ar +export TARGET_AS=llvm-as +export TARGET_OBJCOPY=llvm-objcopy +export TARGET_RANLIB=llvm-ranlib + +mkdir -p "$OUT/lib" + +cp .clusterfuzzlite/*_fuzzer.options "$OUT/" + +for f in .clusterfuzzlite/*_fuzzer.cpp; do + fuzzer=$(basename "$f" .cpp) + cp -f "$f" src/fuzzer.cpp + pio run -vvv --environment "$PIO_ENV" + program="$PLATFORMIO_WORKSPACE_DIR/build/$PIO_ENV/program" + cp "$program" "$OUT/$fuzzer" + + # Copy shared libraries used by the fuzzer. + read -d '' -ra shared_libs < <(ldd "$program" | sed -n 's/[^=]\+=> \([^ ]\+\).*/\1/p') || true + cp -f "${shared_libs[@]}" "$OUT/lib/" + + # Build the initial fuzzer seed corpus. + corpus_name="${fuzzer}_seed_corpus" + corpus_generator="$PWD/.clusterfuzzlite/${corpus_name}.py" + if [[ -f $corpus_generator ]]; then + mkdir "$corpus_name" + pushd "$corpus_name" + python3 "$corpus_generator" + popd + zip -D "$OUT/${corpus_name}.zip" "$corpus_name"/* + fi +done diff --git a/.clusterfuzzlite/platformio-clusterfuzzlite-post.py b/.clusterfuzzlite/platformio-clusterfuzzlite-post.py new file mode 100644 index 000000000..f62078bb3 --- /dev/null +++ b/.clusterfuzzlite/platformio-clusterfuzzlite-post.py @@ -0,0 +1,35 @@ +"""PlatformIO build script (post: runs after other Meshtastic scripts).""" + +import os +import shlex + +from SCons.Script import DefaultEnvironment + +env = DefaultEnvironment() + +# Remove any static libraries from the LIBS environment. Static libraries are +# handled in platformio-clusterfuzzlite-pre.py. +static_libs = set(lib[2:] for lib in shlex.split(os.getenv("STATIC_LIBS"))) +env.Replace( + LIBS=[ + lib for lib in env["LIBS"] if not (isinstance(lib, str) and lib in static_libs) + ], +) + +# FrameworkArduino/portduino/main.cpp contains the "main" function the binary. +# The fuzzing framework also provides a "main" function and needs to be run +# before Meshtastic is started. We rename the "main" function for Meshtastic to +# "portduino_main" here so that it can be called inside the fuzzer. +env.AddPostAction( + "$BUILD_DIR/FrameworkArduino/portduino/main.cpp.o", + env.VerboseAction( + " ".join( + [ + "$OBJCOPY", + "--redefine-sym=main=portduino_main", + "$BUILD_DIR/FrameworkArduino/portduino/main.cpp.o", + ] + ), + "Renaming main symbol to portduino_main", + ), +) diff --git a/.clusterfuzzlite/platformio-clusterfuzzlite-pre.py b/.clusterfuzzlite/platformio-clusterfuzzlite-pre.py new file mode 100644 index 000000000..a70630cf0 --- /dev/null +++ b/.clusterfuzzlite/platformio-clusterfuzzlite-pre.py @@ -0,0 +1,52 @@ +"""PlatformIO build script (pre: runs before other Meshtastic scripts). + +ClusterFuzzLite executes in a different container from the build. During the build, +attempt to link statically to as many dependencies as possible. For dependencies that +do not have static libraries, the shared library files are copied to the output +directory by the build.sh script. +""" + +import glob +import os +import shlex + +from SCons.Script import DefaultEnvironment, Literal + +env = DefaultEnvironment() + +cxxflags = shlex.split(os.getenv("CXXFLAGS")) +sanitizer_flags = shlex.split(os.getenv("SANITIZER_FLAGS")) +lib_fuzzing_engine = shlex.split(os.getenv("LIB_FUZZING_ENGINE")) +statics = glob.glob("/usr/lib/lib*.a") + glob.glob("/usr/lib/*/lib*.a") +no_static = set(("-ldl",)) + + +def replaceStatic(lib): + """Replace -l with the static .a file for the library.""" + if not lib.startswith("-l") or lib in no_static: + return lib + static_name = f"/lib{lib[2:]}.a" + static = [s for s in statics if s.endswith(static_name)] + if len(static) == 1: + return static[0] + return lib + + +# Setup the environment for building with Clang and the OSS-Fuzz required build flags. +env.Append( + CFLAGS=os.getenv("CFLAGS"), + CXXFLAGS=cxxflags, + LIBSOURCE_DIRS=["/usr/lib/x86_64-linux-gnu"], + LINKFLAGS=cxxflags + + sanitizer_flags + + lib_fuzzing_engine + + ["-stdlib=libc++", "-std=c++17"], + _LIBFLAGS=[replaceStatic(s) for s in shlex.split(os.getenv("STATIC_LIBS"))] + + [ + "/usr/lib/x86_64-linux-gnu/libunistring.a", # Needs to be at the end. + # Find the shared libraries in a subdirectory named lib + # within the same directory as the binary. + Literal("-Wl,-rpath,$ORIGIN/lib"), + "-Wl,-z,origin", + ], +) diff --git a/.clusterfuzzlite/project.yaml b/.clusterfuzzlite/project.yaml new file mode 100644 index 000000000..b4788012b --- /dev/null +++ b/.clusterfuzzlite/project.yaml @@ -0,0 +1 @@ +language: c++ diff --git a/.clusterfuzzlite/router_fuzzer.cpp b/.clusterfuzzlite/router_fuzzer.cpp new file mode 100644 index 000000000..bc4d248db --- /dev/null +++ b/.clusterfuzzlite/router_fuzzer.cpp @@ -0,0 +1,206 @@ +// Fuzzer implementation that sends MeshPackets to Router::enqueueReceivedMessage. +#include +#include +#include +#include +#include +#include +#include + +#include "PortduinoGPIO.h" +#include "PortduinoGlue.h" +#include "PowerFSM.h" +#include "mesh/MeshTypes.h" +#include "mesh/NodeDB.h" +#include "mesh/Router.h" +#include "mesh/TypeConversions.h" +#include "mesh/mesh-pb-constants.h" + +namespace +{ +constexpr uint32_t nodeId = 0x12345678; +// Set to true when lateInitVariant finishes. Used to ensure lateInitVariant was called during startup. +bool hasBeenConfigured = false; + +// These are used to block the Arduino loop() function until a fuzzer input is ready. This is +// an optimization that prevents a sleep from happening before the loop is run. The Arduino loop +// function calls loopCanSleep() before sleeping. loopCanSleep is implemented here in the fuzzer +// and blocks until runLoopOnce() is called to signal for the loop to run. +bool fuzzerRunning = false; // Set to true once LLVMFuzzerTestOneInput has started running. +bool loopCanRun = true; // The main Arduino loop() can run when this is true. +bool loopIsWaiting = false; // The main Arduino loop() is waiting to be signaled to run. +bool loopShouldExit = false; // Indicates that the main Arduino thread should exit by throwing ShouldExitException. +std::mutex loopLock; +std::condition_variable loopCV; +std::thread meshtasticThread; + +// This exception is thrown when the portuino main thread should exit. +class ShouldExitException : public std::runtime_error +{ + public: + using std::runtime_error::runtime_error; +}; + +// Start the loop for one test case and wait till the loop has completed. This ensures fuzz +// test cases do not overlap with one another. This helps the fuzzer attribute a crash to the +// single, currently running, test case. +void runLoopOnce() +{ + realHardware = true; // Avoids delay(100) within portduino/main.cpp + std::unique_lock lck(loopLock); + fuzzerRunning = true; + loopCanRun = true; + loopCV.notify_one(); + loopCV.wait(lck, [] { return !loopCanRun && loopIsWaiting; }); +} +} // namespace + +// Called in the main Arduino loop function to determine if the loop can delay/sleep before running again. +// We use this as a way to block the loop from sleeping and to start the loop function immediately when a +// fuzzer input is ready. +bool loopCanSleep() +{ + std::unique_lock lck(loopLock); + loopIsWaiting = true; + loopCV.notify_one(); + loopCV.wait(lck, [] { return loopCanRun || loopShouldExit; }); + loopIsWaiting = false; + if (loopShouldExit) + throw ShouldExitException("exit"); + if (!fuzzerRunning) + return true; // The loop can sleep before the fuzzer starts. + loopCanRun = false; // Only run the loop once before waiting again. + return false; +} + +// Called just prior to starting Meshtastic. Allows for setting config values before startup. +void lateInitVariant() +{ + settingsMap[logoutputlevel] = level_error; + channelFile.channels[0] = meshtastic_Channel{ + .has_settings = true, + .settings = + meshtastic_ChannelSettings{ + .psk = {.size = 1, .bytes = {/*defaultpskIndex=*/1}}, + .name = "LongFast", + .uplink_enabled = true, + .has_module_settings = true, + .module_settings = {.position_precision = 16}, + }, + .role = meshtastic_Channel_Role_PRIMARY, + }; + config.security.admin_key[0] = { + .size = 32, + .bytes = {0xcd, 0xc0, 0xb4, 0x3c, 0x53, 0x24, 0xdf, 0x13, 0xca, 0x5a, 0xa6, 0x0c, 0x0d, 0xec, 0x85, 0x5a, + 0x4c, 0xf6, 0x1a, 0x96, 0x04, 0x1a, 0x3e, 0xfc, 0xbb, 0x8e, 0x33, 0x71, 0xe5, 0xfc, 0xff, 0x3c}, + }; + config.security.admin_key_count = 1; + config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_US; + moduleConfig.has_mqtt = true; + moduleConfig.mqtt = meshtastic_ModuleConfig_MQTTConfig{ + .enabled = true, + .proxy_to_client_enabled = true, + }; + moduleConfig.has_store_forward = true; + moduleConfig.store_forward = meshtastic_ModuleConfig_StoreForwardConfig{ + .enabled = true, + .history_return_max = 4, + .history_return_window = 600, + .is_server = true, + }; + meshtastic_Position fixedGPS = meshtastic_Position{ + .has_latitude_i = true, + .latitude_i = static_cast(1 * 1e7), + .has_longitude_i = true, + .longitude_i = static_cast(3 * 1e7), + .has_altitude = true, + .altitude = 64, + .location_source = meshtastic_Position_LocSource_LOC_MANUAL, + }; + nodeDB->setLocalPosition(fixedGPS); + config.has_position = true; + config.position.fixed_position = true; + meshtastic_NodeInfoLite *info = nodeDB->getMeshNode(nodeDB->getNodeNum()); + info->has_position = true; + info->position = TypeConversions::ConvertToPositionLite(fixedGPS); + hasBeenConfigured = true; +} + +extern "C" { +int portduino_main(int argc, char **argv); // Renamed "main" function from Meshtastic binary. + +// Start Meshtastic in a thread and wait till it has reached the ON state. +int LLVMFuzzerInitialize(int *argc, char ***argv) +{ + settingsMap[maxtophone] = 5; + + meshtasticThread = std::thread([program = *argv[0]]() { + char nodeIdStr[12]; + strcpy(nodeIdStr, std::to_string(nodeId).c_str()); + int argc = 7; + char *argv[] = {program, "-d", "/tmp/meshtastic", "-h", nodeIdStr, "-p", "0", nullptr}; + try { + portduino_main(argc, argv); + } catch (const ShouldExitException &) { + } + }); + std::atexit([] { + { + const std::lock_guard lck(loopLock); + loopShouldExit = true; + loopCV.notify_one(); + } + meshtasticThread.join(); + }); + + // Wait for startup. + for (int i = 1; i < 20; ++i) { + if (powerFSM.getState() == &stateON) { + assert(hasBeenConfigured); + assert(router); + assert(nodeDB); + return 0; + } + std::this_thread::sleep_for(std::chrono::seconds(1)); + } + return 1; +} + +// This is the main entrypoint for the fuzzer (the fuzz target). The fuzzer will provide an array of bytes to be +// interpreted by this method. To keep things simple, the bytes are interpreted as a binary serialized MeshPacket +// proto. Any crashes discovered by the fuzzer will be written to a file. Unserialize that file to print the MeshPacket +// that caused the failure. +// +// This guide provides best practices for writing a fuzzer target. +// https://github.com/google/fuzzing/blob/master/docs/good-fuzz-target.md +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t length) +{ + meshtastic_MeshPacket p = meshtastic_MeshPacket_init_default; + pb_istream_t stream = pb_istream_from_buffer(data, length); + // Ignore any inputs that fail to decode or have fields set that are not transmitted over LoRa. + if (!pb_decode(&stream, &meshtastic_MeshPacket_msg, &p) || p.rx_time || p.rx_snr || p.priority || p.rx_rssi || p.delayed || + p.public_key.size || p.next_hop || p.relay_node || p.tx_after) + return -1; // Reject: The input will not be added to the corpus. + if (p.which_payload_variant == meshtastic_MeshPacket_decoded_tag) { + meshtastic_Data d; + stream = pb_istream_from_buffer(p.decoded.payload.bytes, p.decoded.payload.size); + if (!pb_decode(&stream, &meshtastic_Data_msg, &d)) + return -1; // Reject: The input will not be added to the corpus. + } + + // Provide default values for a few fields so the fuzzer doesn't need to guess them. + if (p.from == 0) + p.from = nodeDB->getNodeNum(); + if (p.to == 0) + p.to = nodeDB->getNodeNum(); + static uint32_t packetId = 0; + if (p.id == 0) + p.id == ++packetId; + if (p.pki_encrypted && config.security.admin_key_count) + memcpy(&p.public_key, &config.security.admin_key[0], sizeof(p.public_key)); + + router->enqueueReceivedMessage(packetPool.allocCopy(p)); + runLoopOnce(); + return 0; // Accept: The input may be added to the corpus. +} +} \ No newline at end of file diff --git a/.clusterfuzzlite/router_fuzzer.options b/.clusterfuzzlite/router_fuzzer.options new file mode 100644 index 000000000..7cbd646dc --- /dev/null +++ b/.clusterfuzzlite/router_fuzzer.options @@ -0,0 +1,2 @@ +[libfuzzer] +max_len=256 diff --git a/.clusterfuzzlite/router_fuzzer_seed_corpus.py b/.clusterfuzzlite/router_fuzzer_seed_corpus.py new file mode 100644 index 000000000..71736c147 --- /dev/null +++ b/.clusterfuzzlite/router_fuzzer_seed_corpus.py @@ -0,0 +1,168 @@ +"""Generate an initial set of MeshPackets. + +The fuzzer uses these MeshPackets as an initial seed of test candidates. + +It's also good to add any previously discovered crash test cases to this list +to avoid future regressions. + +If left unset, the following values will be automatically set by the fuzzer. + - to: automatically set to the running node's NodeID + - from: automatically set to the running node's NodeID + - id: automatically set to the value of an incrementing counter + +Additionally, if `pki_encrypted` is populated in the packet, the first admin key +will be copied into the `public_key` field. +""" + +import base64 + +from meshtastic import BROADCAST_NUM +from meshtastic.protobuf import ( + admin_pb2, + atak_pb2, + mesh_pb2, + portnums_pb2, + telemetry_pb2, +) + + +def From(node: int = 9): + """Return a dict suitable for **kwargs for populating the 'from' field. + + 'from' is a reserved keyword in Python. It can't be used directly as an + argument to the MeshPacket constructor. Rather **From() can be used as + the final argument to provide the from node as a **kwarg. + + Defaults to 9 if no value is provided. + """ + return {"from": node} + + +packets = ( + ( + "position", + mesh_pb2.MeshPacket( + decoded=mesh_pb2.Data( + portnum=portnums_pb2.PortNum.POSITION_APP, + payload=mesh_pb2.Position( + latitude_i=int(1 * 1e7), + longitude_i=int(2 * 1e7), + altitude=5, + precision_bits=32, + ).SerializeToString(), + ), + to=BROADCAST_NUM, + **From(), + ), + ), + ( + "telemetry", + mesh_pb2.MeshPacket( + decoded=mesh_pb2.Data( + portnum=portnums_pb2.PortNum.TELEMETRY_APP, + payload=telemetry_pb2.Telemetry( + time=1736192207, + device_metrics=telemetry_pb2.DeviceMetrics( + battery_level=101, + channel_utilization=8, + air_util_tx=2, + uptime_seconds=42, + ), + ).SerializeToString(), + ), + to=BROADCAST_NUM, + **From(), + ), + ), + ( + "text", + mesh_pb2.MeshPacket( + decoded=mesh_pb2.Data( + portnum=portnums_pb2.PortNum.TEXT_MESSAGE_APP, + payload=b"Hello world", + ), + to=BROADCAST_NUM, + **From(), + ), + ), + ( + "user", + mesh_pb2.MeshPacket( + decoded=mesh_pb2.Data( + portnum=portnums_pb2.PortNum.NODEINFO_APP, + payload=mesh_pb2.User( + id="!00000009", + long_name="Node 9", + short_name="N9", + macaddr=b"\x00\x00\x00\x00\x00\x09", + hw_model=mesh_pb2.HardwareModel.RAK4631, + public_key=base64.b64decode( + "L0ih/6F41itofdE8mYyHk1SdfOJ/QRM1KQ+pO4vEEjQ=" + ), + ).SerializeToString(), + ), + **From(), + ), + ), + ( + "traceroute", + mesh_pb2.MeshPacket( + decoded=mesh_pb2.Data( + portnum=portnums_pb2.PortNum.TRACEROUTE_APP, + payload=mesh_pb2.RouteDiscovery( + route=[10], + ).SerializeToString(), + ), + **From(), + ), + ), + ( + "routing", + mesh_pb2.MeshPacket( + decoded=mesh_pb2.Data( + portnum=portnums_pb2.PortNum.ROUTING_APP, + payload=mesh_pb2.Routing( + error_reason=mesh_pb2.Routing.NO_RESPONSE, + ).SerializeToString(), + ), + **From(), + ), + ), + ( + "admin", + mesh_pb2.MeshPacket( + decoded=mesh_pb2.Data( + portnum=portnums_pb2.PortNum.ADMIN_APP, + payload=admin_pb2.AdminMessage( + get_owner_request=True, + ).SerializeToString(), + ), + pki_encrypted=True, + **From(), + ), + ), + ( + "atak", + mesh_pb2.MeshPacket( + decoded=mesh_pb2.Data( + portnum=portnums_pb2.PortNum.ATAK_PLUGIN, + payload=atak_pb2.TAKPacket( + is_compressed=True, + # Note, the strings are not valid for a compressed message, but will + # give the fuzzer a starting point. + contact=atak_pb2.Contact( + callsign="callsign", device_callsign="device_callsign" + ), + chat=atak_pb2.GeoChat( + message="message", to="to", to_callsign="to_callsign" + ), + ).SerializeToString(), + ), + **From(), + ), + ), +) + +for name, packet in packets: + with open(f"{name}.MeshPacket", "wb") as f: + f.write(packet.SerializeToString()) diff --git a/.dockerignore b/.dockerignore new file mode 120000 index 000000000..3e4e48b0b --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.gitignore \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index e6735ec23..217e75631 100644 --- a/platformio.ini +++ b/platformio.ini @@ -20,7 +20,7 @@ extra_scripts = bin/platformio-custom.py build_flags = -Wno-missing-field-initializers -Wno-format - -Isrc -Isrc/mesh -Isrc/mesh/generated -Isrc/gps -Isrc/buzz -Wl,-Map,.pio/build/output.map + -Isrc -Isrc/mesh -Isrc/mesh/generated -Isrc/gps -Isrc/buzz -Wl,-Map,${platformio.build_dir}/output.map -DUSE_THREAD_NAMES -DTINYGPS_OPTION_NO_CUSTOM_FIELDS -DPB_ENABLE_MALLOC=1 diff --git a/src/FSCommon.cpp b/src/FSCommon.cpp index 6d8ff835c..1f2994b29 100644 --- a/src/FSCommon.cpp +++ b/src/FSCommon.cpp @@ -203,7 +203,7 @@ std::vector getFiles(const char *dirname, uint8_t levels) file.close(); } } else { - meshtastic_FileInfo fileInfo = {"", file.size()}; + meshtastic_FileInfo fileInfo = {"", static_cast(file.size())}; #ifdef ARCH_ESP32 strcpy(fileInfo.file_name, file.path()); #else diff --git a/src/mesh/PacketHistory.h b/src/mesh/PacketHistory.h index 89d237a02..0417d0997 100644 --- a/src/mesh/PacketHistory.h +++ b/src/mesh/PacketHistory.h @@ -4,7 +4,11 @@ #include /// We clear our old flood record 10 minutes after we see the last of it +#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION +#define FLOOD_EXPIRE_TIME (5 * 1000L) // Don't allow too many packets to accumulate when fuzzing. +#else #define FLOOD_EXPIRE_TIME (10 * 60 * 1000L) +#endif /** * A record of a recent message broadcast diff --git a/src/mesh/TypedQueue.h b/src/mesh/TypedQueue.h index f7d016f10..47d7200a5 100644 --- a/src/mesh/TypedQueue.h +++ b/src/mesh/TypedQueue.h @@ -74,11 +74,17 @@ template class TypedQueue { std::queue q; concurrency::OSThread *reader = NULL; + int maxElements; public: - explicit TypedQueue(int maxElements) {} + explicit TypedQueue(int _maxElements) : maxElements(_maxElements) {} - int numFree() { return 1; } // Always claim 1 free, because we can grow to any size + int numFree() + { + if (maxElements <= 0) + return 1; // Always claim 1 free, because we can grow to any size + return maxElements - numUsed(); + } bool isEmpty() { return q.empty(); } @@ -86,6 +92,9 @@ template class TypedQueue bool enqueue(T x, TickType_t maxWait = portMAX_DELAY) { + if (numFree() <= 0) + return false; + if (reader) { reader->setInterval(0); concurrency::mainDelay.interrupt(); @@ -112,4 +121,4 @@ template class TypedQueue void setReader(concurrency::OSThread *t) { reader = t; } }; -#endif +#endif \ No newline at end of file diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index ce2418e86..5b1fe9c8c 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -21,6 +21,10 @@ #include #include +#ifdef PORTDUINO_LINUX_HARDWARE +#include +#endif + #include "platform/portduino/USBHal.h" std::map settingsMap; @@ -318,8 +322,8 @@ int initGPIOPin(int pinNum, const std::string gpioChipName, int line) gpioBind(csPin); return ERRNO_OK; } catch (...) { - std::exception_ptr p = std::current_exception(); - std::cout << "Warning, cannot claim pin " << gpio_name << (p ? p.__cxa_exception_type()->name() : "null") << std::endl; + const std::type_info *t = abi::__cxa_current_exception_type(); + std::cout << "Warning, cannot claim pin " << gpio_name << (t ? t->name() : "null") << std::endl; return ERRNO_DISABLED; } #else From e466bf247548b989d59d7f61d1fb716b3f6dafe4 Mon Sep 17 00:00:00 2001 From: Patrick Siegl <3261314+psiegl@users.noreply.github.com> Date: Fri, 17 Jan 2025 02:38:58 +0100 Subject: [PATCH 111/381] Slight rework of CH341 HAL (#5848) * Rework of CH341 HAL * Applied trunk fmt * revert serial reading --------- Co-authored-by: Ben Meadors Co-authored-by: Jonathan Bennett --- src/platform/portduino/PortduinoGlue.cpp | 17 ++-- src/platform/portduino/USBHal.h | 108 ++++++++--------------- 2 files changed, 45 insertions(+), 80 deletions(-) diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index 5b1fe9c8c..ab78baa1a 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -200,15 +200,12 @@ void portduinoSetup() // if we're using a usermode driver, we need to initialize it here, to get a serial number back for mac address uint8_t dmac[6] = {0}; if (settingsStrings[spidev] == "ch341") { - ch341Hal = new Ch341Hal(0); - if (settingsStrings[lora_usb_serial_num] != "") { - ch341Hal->serial = settingsStrings[lora_usb_serial_num]; - } - ch341Hal->vid = settingsMap[lora_usb_vid]; - ch341Hal->pid = settingsMap[lora_usb_pid]; - ch341Hal->init(); - if (!ch341Hal->isInit()) { - std::cout << "Could not initialize CH341 device!" << std::endl; + try { + ch341Hal = + new Ch341Hal(0, settingsStrings[lora_usb_serial_num], settingsMap[lora_usb_vid], settingsMap[lora_usb_pid]); + } catch (std::exception &e) { + std::cerr << e.what() << std::endl; + std::cerr << "Could not initialize CH341 device!" << std::endl; exit(EXIT_FAILURE); } char serial[9] = {0}; @@ -572,4 +569,4 @@ bool MAC_from_string(std::string mac_str, uint8_t *dmac) } else { return false; } -} \ No newline at end of file +} diff --git a/src/platform/portduino/USBHal.h b/src/platform/portduino/USBHal.h index 064f7ae36..0d6b361f4 100644 --- a/src/platform/portduino/USBHal.h +++ b/src/platform/portduino/USBHal.h @@ -5,6 +5,7 @@ #include "platform/portduino/PortduinoGlue.h" #include #include +#include #include #include @@ -26,30 +27,42 @@ class Ch341Hal : public RadioLibHal { public: // default constructor - initializes the base HAL and any needed private members - explicit Ch341Hal(uint8_t spiChannel, uint32_t spiSpeed = 2000000, uint8_t spiDevice = 0, uint8_t gpioDevice = 0) + explicit Ch341Hal(uint8_t spiChannel, std::string serial = "", uint32_t vid = 0x1A86, uint32_t pid = 0x5512, + uint32_t spiSpeed = 2000000, uint8_t spiDevice = 0, uint8_t gpioDevice = 0) : RadioLibHal(PI_INPUT, PI_OUTPUT, PI_LOW, PI_HIGH, PI_RISING, PI_FALLING) { + if (serial != "") { + strncpy(pinedio.serial_number, serial.c_str(), 8); + pinedio_set_option(&pinedio, PINEDIO_OPTION_SEARCH_SERIAL, 1); + } + // LOG_INFO("USB Serial: %s", pinedio.serial_number); + + // There is no vendor with 0x0 -> so check + if (vid != 0x0) { + pinedio_set_option(&pinedio, PINEDIO_OPTION_VID, vid); + pinedio_set_option(&pinedio, PINEDIO_OPTION_PID, pid); + } + int32_t ret = pinedio_init(&pinedio, NULL); + if (ret != 0) { + std::string s = "Could not open SPI: "; + throw(s + std::to_string(ret)); + } + + pinedio_set_option(&pinedio, PINEDIO_OPTION_AUTO_CS, 0); + pinedio_set_pin_mode(&pinedio, 3, true); + pinedio_set_pin_mode(&pinedio, 5, true); } + ~Ch341Hal() { pinedio_deinit(&pinedio); } + void getSerialString(char *_serial, size_t len) { - if (!pinedio_is_init) { - return; - } + len = len > 8 ? 8 : len; strncpy(_serial, pinedio.serial_number, len); } - void init() override - { - // now the SPI - spiBegin(); - } - - void term() override - { - // stop the SPI - spiEnd(); - } + void init() override {} + void term() override {} // GPIO-related methods (pinMode, digitalWrite etc.) should check // RADIOLIB_NC as an alias for non-connected pins @@ -79,7 +92,7 @@ class Ch341Hal : public RadioLibHal void attachInterrupt(uint32_t interruptNum, void (*interruptCb)(void), uint32_t mode) override { - if ((interruptNum == RADIOLIB_NC)) { + if (interruptNum == RADIOLIB_NC) { return; } // LOG_DEBUG("Attach interrupt to pin %d", interruptNum); @@ -88,23 +101,14 @@ class Ch341Hal : public RadioLibHal void detachInterrupt(uint32_t interruptNum) override { - if ((interruptNum == RADIOLIB_NC)) { + if (interruptNum == RADIOLIB_NC) { return; } // LOG_DEBUG("Detach interrupt from pin %d", interruptNum); - pinedio_deattach_interrupt(&this->pinedio, (pinedio_int_pin)interruptNum); } - void delay(unsigned long ms) override - { - if (ms == 0) { - sched_yield(); - return; - } - - usleep(ms * 1000); - } + void delay(unsigned long ms) override { delayMicroseconds(ms * 1000); } void delayMicroseconds(unsigned long us) override { @@ -133,62 +137,26 @@ class Ch341Hal : public RadioLibHal long pulseIn(uint32_t pin, uint32_t state, unsigned long timeout) override { - fprintf(stderr, "pulseIn for pin %u is not supported!\n", pin); + std::cerr << "pulseIn for pin " << pin << "is not supported!" << std::endl; return 0; } - void spiBegin() - { - if (!pinedio_is_init) { - if (serial != "") { - strncpy(pinedio.serial_number, serial.c_str(), 8); - pinedio_set_option(&pinedio, PINEDIO_OPTION_SEARCH_SERIAL, 1); - } - pinedio_set_option(&pinedio, PINEDIO_OPTION_PID, pid); - pinedio_set_option(&pinedio, PINEDIO_OPTION_VID, vid); - int32_t ret = pinedio_init(&pinedio, NULL); - if (ret != 0) { - fprintf(stderr, "Could not open SPI: %d\n", ret); - } else { - pinedio_is_init = true; - // LOG_INFO("USB Serial: %s", pinedio.serial_number); - pinedio_set_option(&pinedio, PINEDIO_OPTION_AUTO_CS, 0); - pinedio_set_pin_mode(&pinedio, 3, true); - pinedio_set_pin_mode(&pinedio, 5, true); - } - } - } - + void spiBegin() {} void spiBeginTransaction() {} void spiTransfer(uint8_t *out, size_t len, uint8_t *in) { - int32_t result = pinedio_transceive(&this->pinedio, out, in, len); - if (result < 0) { - fprintf(stderr, "Could not perform SPI transfer: %d\n", result); + int32_t ret = pinedio_transceive(&this->pinedio, out, in, len); + if (ret < 0) { + std::cerr << "Could not perform SPI transfer: " << ret << std::endl; } } void spiEndTransaction() {} - - void spiEnd() - { - if (pinedio_is_init) { - pinedio_deinit(&pinedio); - pinedio_is_init = false; - } - } - - bool isInit() { return pinedio_is_init; } - - std::string serial = ""; - uint32_t pid = 0x5512; - uint32_t vid = 0x1A86; + void spiEnd() {} private: - // the HAL can contain any additional private members pinedio_inst pinedio = {0}; - bool pinedio_is_init = false; }; -#endif \ No newline at end of file +#endif From 9566d6ffd47ca858607809951a58afc12285541c Mon Sep 17 00:00:00 2001 From: Austin Date: Thu, 16 Jan 2025 21:21:52 -0500 Subject: [PATCH 112/381] COPR: Switch to forked GitHub Action (#5871) --- .github/workflows/hook_copr.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/hook_copr.yml b/.github/workflows/hook_copr.yml index a72ae5cf5..fd2c3014b 100644 --- a/.github/workflows/hook_copr.yml +++ b/.github/workflows/hook_copr.yml @@ -25,12 +25,8 @@ jobs: ref: ${{ github.ref }} repository: ${{ github.repository }} - - name: Install Python dependencies - run: | - pip install requests - - name: Trigger COPR build - uses: akdev1l/copr-build@main + uses: vidplace7/copr-build@main id: copr_build env: COPR_API_TOKEN_CONFIG: ${{ secrets.COPR_API_CONFIG }} From 2262d77be4372e655a1fe1b10202fd008fc4977d Mon Sep 17 00:00:00 2001 From: Austin Date: Thu, 16 Jan 2025 23:27:49 -0500 Subject: [PATCH 113/381] Small fix: Reference COPR group correctly (`@`) (#5872) --- .github/workflows/hook_copr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hook_copr.yml b/.github/workflows/hook_copr.yml index fd2c3014b..94aaca49c 100644 --- a/.github/workflows/hook_copr.yml +++ b/.github/workflows/hook_copr.yml @@ -31,7 +31,7 @@ jobs: env: COPR_API_TOKEN_CONFIG: ${{ secrets.COPR_API_CONFIG }} with: - owner: meshtastic + owner: "@meshtastic" package-name: meshtasticd project-name: ${{ inputs.copr_project }} git-remote: "${{ github.server_url }}/${{ github.repository }}.git" From c4051c1a7b524051767f4aa3037cf99f570184c0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 18 Jan 2025 13:32:09 +0100 Subject: [PATCH 114/381] [create-pull-request] automated change (#5877) Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/telemetry.pb.h | 28 ++++++++++++++------ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/protobufs b/protobufs index 76f806e1b..fde27e4ef 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 76f806e1bb1e2a7b157a14fadd095775f63db5e4 +Subproject commit fde27e4ef0fcee967063ba353422ed5f9a1c4790 diff --git a/src/mesh/generated/meshtastic/telemetry.pb.h b/src/mesh/generated/meshtastic/telemetry.pb.h index 85fe4bdc1..bb612d870 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.h +++ b/src/mesh/generated/meshtastic/telemetry.pb.h @@ -81,7 +81,9 @@ typedef enum _meshtastic_TelemetrySensorType { /* ClimateGuard RadSens, radiation, Geiger-Muller Tube */ meshtastic_TelemetrySensorType_RADSENS = 33, /* High accuracy current and voltage */ - meshtastic_TelemetrySensorType_INA226 = 34 + meshtastic_TelemetrySensorType_INA226 = 34, + /* DFRobot Gravity tipping bucket rain gauge */ + meshtastic_TelemetrySensorType_DFROBOT_RAIN = 35 } meshtastic_TelemetrySensorType; /* Struct definitions */ @@ -162,6 +164,12 @@ typedef struct _meshtastic_EnvironmentMetrics { /* Radiation in µR/h */ bool has_radiation; float radiation; + /* Rainfall in the last hour in mm */ + bool has_rainfall_1h; + float rainfall_1h; + /* Rainfall in the last 24 hours in mm */ + bool has_rainfall_24h; + float rainfall_24h; } meshtastic_EnvironmentMetrics; /* Power Metrics (voltage / current / etc) */ @@ -306,8 +314,8 @@ extern "C" { /* Helper constants for enums */ #define _meshtastic_TelemetrySensorType_MIN meshtastic_TelemetrySensorType_SENSOR_UNSET -#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_INA226 -#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_INA226+1)) +#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_DFROBOT_RAIN +#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_DFROBOT_RAIN+1)) @@ -320,7 +328,7 @@ extern "C" { /* Initializer values for message structs */ #define meshtastic_DeviceMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0} -#define meshtastic_EnvironmentMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} +#define meshtastic_EnvironmentMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_PowerMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_AirQualityMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_LocalStats_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} @@ -328,7 +336,7 @@ extern "C" { #define meshtastic_Telemetry_init_default {0, 0, {meshtastic_DeviceMetrics_init_default}} #define meshtastic_Nau7802Config_init_default {0, 0} #define meshtastic_DeviceMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0} -#define meshtastic_EnvironmentMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} +#define meshtastic_EnvironmentMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_PowerMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_AirQualityMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_LocalStats_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} @@ -360,6 +368,8 @@ extern "C" { #define meshtastic_EnvironmentMetrics_wind_gust_tag 16 #define meshtastic_EnvironmentMetrics_wind_lull_tag 17 #define meshtastic_EnvironmentMetrics_radiation_tag 18 +#define meshtastic_EnvironmentMetrics_rainfall_1h_tag 19 +#define meshtastic_EnvironmentMetrics_rainfall_24h_tag 20 #define meshtastic_PowerMetrics_ch1_voltage_tag 1 #define meshtastic_PowerMetrics_ch1_current_tag 2 #define meshtastic_PowerMetrics_ch2_voltage_tag 3 @@ -431,7 +441,9 @@ X(a, STATIC, OPTIONAL, FLOAT, wind_speed, 14) \ X(a, STATIC, OPTIONAL, FLOAT, weight, 15) \ X(a, STATIC, OPTIONAL, FLOAT, wind_gust, 16) \ X(a, STATIC, OPTIONAL, FLOAT, wind_lull, 17) \ -X(a, STATIC, OPTIONAL, FLOAT, radiation, 18) +X(a, STATIC, OPTIONAL, FLOAT, radiation, 18) \ +X(a, STATIC, OPTIONAL, FLOAT, rainfall_1h, 19) \ +X(a, STATIC, OPTIONAL, FLOAT, rainfall_24h, 20) #define meshtastic_EnvironmentMetrics_CALLBACK NULL #define meshtastic_EnvironmentMetrics_DEFAULT NULL @@ -530,12 +542,12 @@ extern const pb_msgdesc_t meshtastic_Nau7802Config_msg; #define MESHTASTIC_MESHTASTIC_TELEMETRY_PB_H_MAX_SIZE meshtastic_Telemetry_size #define meshtastic_AirQualityMetrics_size 78 #define meshtastic_DeviceMetrics_size 27 -#define meshtastic_EnvironmentMetrics_size 91 +#define meshtastic_EnvironmentMetrics_size 103 #define meshtastic_HealthMetrics_size 11 #define meshtastic_LocalStats_size 60 #define meshtastic_Nau7802Config_size 16 #define meshtastic_PowerMetrics_size 30 -#define meshtastic_Telemetry_size 98 +#define meshtastic_Telemetry_size 110 #ifdef __cplusplus } /* extern "C" */ From b353bcc04acf9eeab7d2f700e7ee977a6a0d7582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 18 Jan 2025 14:10:13 +0100 Subject: [PATCH 115/381] fix detection of lark weather station and add rain sensor (#5874) * fix detection of lark weather station * fix unit tests and add support for Dfrobot rain gauge * fix name display on bootup * fix gauge init logic * trunk fmt --- platformio.ini | 1 + src/configuration.h | 1 + src/detect/ScanI2C.h | 1 + src/detect/ScanI2CTwoWire.cpp | 17 +++++-- src/detect/ScanI2CTwoWire.h | 2 +- src/main.cpp | 1 + .../Telemetry/EnvironmentTelemetry.cpp | 13 ++++++ .../Telemetry/Sensor/DFRobotGravitySensor.cpp | 44 +++++++++++++++++++ .../Telemetry/Sensor/DFRobotGravitySensor.h | 29 ++++++++++++ 9 files changed, 105 insertions(+), 4 deletions(-) create mode 100644 src/modules/Telemetry/Sensor/DFRobotGravitySensor.cpp create mode 100644 src/modules/Telemetry/Sensor/DFRobotGravitySensor.h diff --git a/platformio.ini b/platformio.ini index 217e75631..ea4de4db1 100644 --- a/platformio.ini +++ b/platformio.ini @@ -126,6 +126,7 @@ lib_deps = mprograms/QMC5883LCompass@1.2.3 dfrobot/DFRobot_RTU@1.0.3 https://github.com/meshtastic/DFRobot_LarkWeatherStation#4de3a9cadef0f6a5220a8a906cf9775b02b0040d + https://github.com/DFRobot/DFRobot_RainfallSensor#38fea5e02b40a5430be6dab39a99a6f6347d667e robtillaart/INA226@0.6.0 ; Health Sensor Libraries diff --git a/src/configuration.h b/src/configuration.h index 2c77b55e3..6f5255ec9 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -145,6 +145,7 @@ along with this program. If not, see . #define OPT3001_ADDR_ALT 0x44 #define MLX90632_ADDR 0x3A #define DFROBOT_LARK_ADDR 0x42 +#define DFROBOT_RAIN_ADDR 0x1d #define NAU7802_ADDR 0x2A #define MAX30102_ADDR 0x57 #define MLX90614_ADDR_DEF 0x5A diff --git a/src/detect/ScanI2C.h b/src/detect/ScanI2C.h index 2561a8e17..faa94c7d3 100644 --- a/src/detect/ScanI2C.h +++ b/src/detect/ScanI2C.h @@ -66,6 +66,7 @@ class ScanI2C CGRADSENS, INA226, NXP_SE050, + DFROBOT_RAIN, } DeviceType; // typedef uint8_t DeviceAddress; diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index a786f874d..880e5c131 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -84,23 +84,33 @@ ScanI2C::DeviceType ScanI2CTwoWire::probeOLED(ScanI2C::DeviceAddress addr) const return o_probe; } uint16_t ScanI2CTwoWire::getRegisterValue(const ScanI2CTwoWire::RegisterLocation ®isterLocation, - ScanI2CTwoWire::ResponseWidth responseWidth) const + ScanI2CTwoWire::ResponseWidth responseWidth, bool zeropad = false) const { uint16_t value = 0x00; TwoWire *i2cBus = fetchI2CBus(registerLocation.i2cAddress); i2cBus->beginTransmission(registerLocation.i2cAddress.address); i2cBus->write(registerLocation.registerAddress); + if (zeropad) { + // Lark Commands need the argument list length in 2 bytes. + i2cBus->write((int)0); + i2cBus->write((int)0); + } i2cBus->endTransmission(); delay(20); i2cBus->requestFrom(registerLocation.i2cAddress.address, responseWidth); - if (i2cBus->available() == 2) { + if (i2cBus->available() > 1) { // Read MSB, then LSB value = (uint16_t)i2cBus->read() << 8; value |= i2cBus->read(); } else if (i2cBus->available()) { value = i2cBus->read(); } + // Drain excess bytes + for (uint8_t i = 0; i < responseWidth - 1; i++) { + if (i2cBus->available()) + i2cBus->read(); + } return value; } @@ -286,7 +296,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) RESPONSE_PAYLOAD 0x01 RESPONSE_PAYLOAD+1 0x00 */ - registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x05), 2); + registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x05), 6, true); LOG_DEBUG("Register MFG_UID 05: 0x%x", registerValue); if (registerValue == 0x5305) { logFoundDevice("DFRobot Lark", (uint8_t)addr.address); @@ -402,6 +412,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) SCAN_SIMPLE_CASE(MLX90632_ADDR, MLX90632, "MLX90632", (uint8_t)addr.address); SCAN_SIMPLE_CASE(NAU7802_ADDR, NAU7802, "NAU7802", (uint8_t)addr.address); SCAN_SIMPLE_CASE(MAX1704X_ADDR, MAX17048, "MAX17048", (uint8_t)addr.address); + SCAN_SIMPLE_CASE(DFROBOT_RAIN_ADDR, DFROBOT_RAIN, "DFRobot Rain Gauge", (uint8_t)addr.address); #ifdef HAS_TPS65233 SCAN_SIMPLE_CASE(TPS65233_ADDR, TPS65233, "TPS65233", (uint8_t)addr.address); #endif diff --git a/src/detect/ScanI2CTwoWire.h b/src/detect/ScanI2CTwoWire.h index d0af7cde6..6988091ad 100644 --- a/src/detect/ScanI2CTwoWire.h +++ b/src/detect/ScanI2CTwoWire.h @@ -53,7 +53,7 @@ class ScanI2CTwoWire : public ScanI2C concurrency::Lock lock; - uint16_t getRegisterValue(const RegisterLocation &, ResponseWidth) const; + uint16_t getRegisterValue(const RegisterLocation &, ResponseWidth, bool) const; DeviceType probeOLED(ScanI2C::DeviceAddress) const; diff --git a/src/main.cpp b/src/main.cpp index fc9d24e37..24fc71749 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -610,6 +610,7 @@ void setup() scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::ICM20948, meshtastic_TelemetrySensorType_ICM20948); scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::MAX30102, meshtastic_TelemetrySensorType_MAX30102); scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::CGRADSENS, meshtastic_TelemetrySensorType_RADSENS); + scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::DFROBOT_RAIN, meshtastic_TelemetrySensorType_DFROBOT_RAIN); i2cScanner.reset(); #endif diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index fe1d0d2a9..1af6347f2 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -27,6 +27,7 @@ #include "Sensor/BMP280Sensor.h" #include "Sensor/BMP3XXSensor.h" #include "Sensor/CGRadSensSensor.h" +#include "Sensor/DFRobotGravitySensor.h" #include "Sensor/DFRobotLarkSensor.h" #include "Sensor/LPS22HBSensor.h" #include "Sensor/MCP9808Sensor.h" @@ -56,6 +57,7 @@ RCWL9620Sensor rcwl9620Sensor; AHT10Sensor aht10Sensor; MLX90632Sensor mlx90632Sensor; DFRobotLarkSensor dfRobotLarkSensor; +DFRobotGravitySensor dfRobotGravitySensor; NAU7802Sensor nau7802Sensor; BMP3XXSensor bmp3xxSensor; CGRadSensSensor cgRadSens; @@ -115,6 +117,8 @@ int32_t EnvironmentTelemetryModule::runOnce() #elif !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR_EXTERNAL if (dfRobotLarkSensor.hasSensor()) result = dfRobotLarkSensor.runOnce(); + if (dfRobotGravitySensor.hasSensor()) + result = dfRobotGravitySensor.runOnce(); if (bmp085Sensor.hasSensor()) result = bmp085Sensor.runOnce(); if (bmp280Sensor.hasSensor()) @@ -368,6 +372,10 @@ bool EnvironmentTelemetryModule::getEnvironmentTelemetry(meshtastic_Telemetry *m valid = valid && dfRobotLarkSensor.getMetrics(m); hasSensor = true; } + if (dfRobotGravitySensor.hasSensor()) { + valid = valid && dfRobotGravitySensor.getMetrics(m); + hasSensor = true; + } if (sht31Sensor.hasSensor()) { valid = valid && sht31Sensor.getMetrics(m); hasSensor = true; @@ -569,6 +577,11 @@ AdminMessageHandleResult EnvironmentTelemetryModule::handleAdminMessageForModule if (result != AdminMessageHandleResult::NOT_HANDLED) return result; } + if (dfRobotGravitySensor.hasSensor()) { + result = dfRobotGravitySensor.handleAdminMessage(mp, request, response); + if (result != AdminMessageHandleResult::NOT_HANDLED) + return result; + } if (sht31Sensor.hasSensor()) { result = sht31Sensor.handleAdminMessage(mp, request, response); if (result != AdminMessageHandleResult::NOT_HANDLED) diff --git a/src/modules/Telemetry/Sensor/DFRobotGravitySensor.cpp b/src/modules/Telemetry/Sensor/DFRobotGravitySensor.cpp new file mode 100644 index 000000000..c7fa29966 --- /dev/null +++ b/src/modules/Telemetry/Sensor/DFRobotGravitySensor.cpp @@ -0,0 +1,44 @@ +#include "configuration.h" + +#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR + +#include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "DFRobotGravitySensor.h" +#include "TelemetrySensor.h" +#include +#include + +DFRobotGravitySensor::DFRobotGravitySensor() : TelemetrySensor(meshtastic_TelemetrySensorType_DFROBOT_RAIN, "DFROBOT_RAIN") {} + +int32_t DFRobotGravitySensor::runOnce() +{ + LOG_INFO("Init sensor: %s", sensorName); + if (!hasSensor()) { + return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; + } + + gravity = DFRobot_RainfallSensor_I2C(nodeTelemetrySensorsMap[sensorType].second); + status = gravity.begin(); + + return initI2CSensor(); +} + +void DFRobotGravitySensor::setup() +{ + LOG_DEBUG("%s VID: %x, PID: %x, Version: %s", sensorName, gravity.vid, gravity.pid, gravity.getFirmwareVersion().c_str()); +} + +bool DFRobotGravitySensor::getMetrics(meshtastic_Telemetry *measurement) +{ + measurement->variant.environment_metrics.has_rainfall_1h = true; + measurement->variant.environment_metrics.has_rainfall_24h = true; + + measurement->variant.environment_metrics.rainfall_1h = gravity.getRainfall(1); + measurement->variant.environment_metrics.rainfall_24h = gravity.getRainfall(24); + + LOG_INFO("Rain 1h: %f mm", measurement->variant.environment_metrics.rainfall_1h); + LOG_INFO("Rain 24h: %f mm", measurement->variant.environment_metrics.rainfall_24h); + return true; +} + +#endif \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/DFRobotGravitySensor.h b/src/modules/Telemetry/Sensor/DFRobotGravitySensor.h new file mode 100644 index 000000000..8bd7335b5 --- /dev/null +++ b/src/modules/Telemetry/Sensor/DFRobotGravitySensor.h @@ -0,0 +1,29 @@ +#pragma once + +#ifndef _MT_DFROBOTGRAVITYSENSOR_H +#define _MT_DFROBOTGRAVITYSENSOR_H +#include "configuration.h" + +#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR + +#include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "TelemetrySensor.h" +#include +#include + +class DFRobotGravitySensor : public TelemetrySensor +{ + private: + DFRobot_RainfallSensor_I2C gravity = DFRobot_RainfallSensor_I2C(nodeTelemetrySensorsMap[sensorType].second); + + protected: + virtual void setup() override; + + public: + DFRobotGravitySensor(); + virtual int32_t runOnce() override; + virtual bool getMetrics(meshtastic_Telemetry *measurement) override; +}; + +#endif +#endif \ No newline at end of file From 950341d1f980369b58cc3d63dac6b036effc0270 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 18 Jan 2025 08:15:06 -0600 Subject: [PATCH 116/381] Alert app messages should be treated as text (#5878) --- src/mesh/MeshService.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesh/MeshService.h b/src/mesh/MeshService.h index 175d8a595..42f701d5c 100644 --- a/src/mesh/MeshService.h +++ b/src/mesh/MeshService.h @@ -64,7 +64,8 @@ class MeshService return true; } return p->decoded.portnum == meshtastic_PortNum_TEXT_MESSAGE_APP || - p->decoded.portnum == meshtastic_PortNum_DETECTION_SENSOR_APP; + p->decoded.portnum == meshtastic_PortNum_DETECTION_SENSOR_APP || + p->decoded.portnum == meshtastic_PortNum_ALERT_APP; } /// Called when some new packets have arrived from one of the radios Observable fromNumChanged; From 973b453d43ba5d9d4239dabff56cab676e578e9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 20 Jan 2025 09:34:54 +0100 Subject: [PATCH 117/381] Update RAK2560 code (#5844) * * Update RAK9154 sensor to tx remote power telemetry * remove uf2 script, pio run does that inline * move sensor module to correct position * disable LED and Accelerometer code on rak2560 * trunk fmt * mention epaper variant * attention, revert, revert * Enable Environment Telemetry of these values * fix float values --- src/Power.cpp | 10 +- .../Telemetry/EnvironmentTelemetry.cpp | 10 ++ src/modules/Telemetry/PowerTelemetry.cpp | 16 +-- .../Telemetry/Sensor}/RAK9154Sensor.cpp | 48 ++++++-- .../modules/Telemetry/Sensor}/RAK9154Sensor.h | 15 ++- src/motion/BMX160Sensor.cpp | 2 +- src/motion/BMX160Sensor.h | 2 +- src/power.h | 5 +- variants/rak2560/create_uf2.py | 113 ------------------ variants/rak2560/platformio.ini | 2 - 10 files changed, 76 insertions(+), 147 deletions(-) rename {variants/rak2560 => src/modules/Telemetry/Sensor}/RAK9154Sensor.cpp (76%) rename {variants/rak2560 => src/modules/Telemetry/Sensor}/RAK9154Sensor.h (55%) delete mode 100644 variants/rak2560/create_uf2.py diff --git a/src/Power.cpp b/src/Power.cpp index ae0908ec6..8d5fe1c32 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -87,7 +87,7 @@ MAX17048Sensor max17048Sensor; #endif #endif -#if HAS_RAKPROT && !defined(ARCH_PORTDUINO) +#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && HAS_RAKPROT && !defined(ARCH_PORTDUINO) RAK9154Sensor rak9154Sensor; #endif @@ -243,7 +243,8 @@ class AnalogBatteryLevel : public HasBatteryLevel virtual uint16_t getBattVoltage() override { -#if defined(HAS_RAKPROT) && !defined(ARCH_PORTDUINO) && !defined(HAS_PMU) +#if HAS_TELEMETRY && defined(HAS_RAKPROT) && !defined(ARCH_PORTDUINO) && !defined(HAS_PMU) && \ + !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR if (hasRAK()) { return getRAKVoltage(); } @@ -406,7 +407,8 @@ class AnalogBatteryLevel : public HasBatteryLevel /// we can't be smart enough to say 'full'? virtual bool isCharging() override { -#if defined(HAS_RAKPROT) && !defined(ARCH_PORTDUINO) && !defined(HAS_PMU) +#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && defined(HAS_RAKPROT) && !defined(ARCH_PORTDUINO) && \ + !defined(HAS_PMU) if (hasRAK()) { return (rak9154Sensor.isCharging()) ? OptTrue : OptFalse; } @@ -447,7 +449,7 @@ class AnalogBatteryLevel : public HasBatteryLevel float last_read_value = (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS); uint32_t last_read_time_ms = 0; -#if defined(HAS_RAKPROT) +#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && defined(HAS_RAKPROT) uint16_t getRAKVoltage() { return rak9154Sensor.getBusVoltageMv(); } diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index 1af6347f2..6a5e8376d 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -163,6 +163,12 @@ int32_t EnvironmentTelemetryModule::runOnce() result = max17048Sensor.runOnce(); if (cgRadSens.hasSensor()) result = cgRadSens.runOnce(); + // this only works on the wismesh hub with the solar option. This is not an I2C sensor, so we don't need the + // sensormap here. +#ifdef HAS_RAKPROT + + result = rak9154Sensor.runOnce(); +#endif #endif } return result; @@ -480,6 +486,10 @@ bool EnvironmentTelemetryModule::getEnvironmentTelemetry(meshtastic_Telemetry *m valid = valid && cgRadSens.getMetrics(m); hasSensor = true; } +#ifdef HAS_RAKPROT + valid = valid && rak9154Sensor.getMetrics(m); + hasSensor = true; +#endif #endif return valid && hasSensor; } diff --git a/src/modules/Telemetry/PowerTelemetry.cpp b/src/modules/Telemetry/PowerTelemetry.cpp index 9c794e31e..38a5c6f11 100644 --- a/src/modules/Telemetry/PowerTelemetry.cpp +++ b/src/modules/Telemetry/PowerTelemetry.cpp @@ -100,7 +100,7 @@ void PowerTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *s { display->setTextAlignment(TEXT_ALIGN_LEFT); display->setFont(FONT_SMALL); - + if (lastMeasurementPacket == nullptr) { // In case of no valid packet, display "Power Telemetry", "No measurement" display->drawString(x, y, "Power Telemetry"); @@ -121,23 +121,23 @@ void PowerTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *s } // Display "Pow. From: ..." - display->drawString(x, y, "Pow. From: " + String(lastSender) + "(" + String(agoSecs) + "s)"); + display->drawString(x, y, "Pow. From: " + String(lastSender) + "(" + String(agoSecs) + "s)"); // Display current and voltage based on ...power_metrics.has_[channel/voltage/current]... flags if (lastMeasurement.variant.power_metrics.has_ch1_voltage || lastMeasurement.variant.power_metrics.has_ch1_current) { display->drawString(x, y += _fontHeight(FONT_SMALL), - "Ch1: " + String(lastMeasurement.variant.power_metrics.ch1_voltage, 2) + - "V " + String(lastMeasurement.variant.power_metrics.ch1_current, 0) + "mA"); + "Ch1: " + String(lastMeasurement.variant.power_metrics.ch1_voltage, 2) + "V " + + String(lastMeasurement.variant.power_metrics.ch1_current, 0) + "mA"); } if (lastMeasurement.variant.power_metrics.has_ch2_voltage || lastMeasurement.variant.power_metrics.has_ch2_current) { display->drawString(x, y += _fontHeight(FONT_SMALL), - "Ch2: " + String(lastMeasurement.variant.power_metrics.ch2_voltage, 2) + - "V " + String(lastMeasurement.variant.power_metrics.ch2_current, 0) + "mA"); + "Ch2: " + String(lastMeasurement.variant.power_metrics.ch2_voltage, 2) + "V " + + String(lastMeasurement.variant.power_metrics.ch2_current, 0) + "mA"); } if (lastMeasurement.variant.power_metrics.has_ch3_voltage || lastMeasurement.variant.power_metrics.has_ch3_current) { display->drawString(x, y += _fontHeight(FONT_SMALL), - "Ch3: " + String(lastMeasurement.variant.power_metrics.ch3_voltage, 2) + - "V " + String(lastMeasurement.variant.power_metrics.ch3_current, 0) + "mA"); + "Ch3: " + String(lastMeasurement.variant.power_metrics.ch3_voltage, 2) + "V " + + String(lastMeasurement.variant.power_metrics.ch3_current, 0) + "mA"); } } diff --git a/variants/rak2560/RAK9154Sensor.cpp b/src/modules/Telemetry/Sensor/RAK9154Sensor.cpp similarity index 76% rename from variants/rak2560/RAK9154Sensor.cpp rename to src/modules/Telemetry/Sensor/RAK9154Sensor.cpp index 43affe581..ad3925f08 100644 --- a/variants/rak2560/RAK9154Sensor.cpp +++ b/src/modules/Telemetry/Sensor/RAK9154Sensor.cpp @@ -1,9 +1,10 @@ -#ifdef HAS_RAKPROT -#include "../variants/rak2560/RAK9154Sensor.h" -#include "../mesh/generated/meshtastic/telemetry.pb.h" -#include "../modules/Telemetry/Sensor/TelemetrySensor.h" #include "configuration.h" +#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && defined(HAS_RAKPROT) + +#include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "RAK9154Sensor.h" +#include "TelemetrySensor.h" #include "concurrency/Periodic.h" #include @@ -25,6 +26,8 @@ static uint16_t dc_vol = 0; static uint8_t dc_prec = 0; static uint8_t provision = 0; +extern RAK9154Sensor rak9154Sensor; + static void onewire_evt(const uint8_t pid, const uint8_t sid, const SNHUBAPI_EVT_E eid, uint8_t *msg, uint16_t len) { switch (eid) { @@ -78,6 +81,7 @@ static void onewire_evt(const uint8_t pid, const uint8_t sid, const SNHUBAPI_EVT default: break; } + rak9154Sensor.setLastRead(millis()); break; case SNHUBAPI_EVT_REPORT: @@ -106,6 +110,7 @@ static void onewire_evt(const uint8_t pid, const uint8_t sid, const SNHUBAPI_EVT default: break; } + rak9154Sensor.setLastRead(millis()); break; @@ -145,15 +150,18 @@ static int32_t onewireHandle() int32_t RAK9154Sensor::runOnce() { - onewirePeriodic = new Periodic("onewireHandle", onewireHandle); + if (!rak9154Sensor.isInitialized()) { + onewirePeriodic = new Periodic("onewireHandle", onewireHandle); - mySerial.begin(9600); + mySerial.begin(9600); - RakSNHub_Protocl_API.init(onewire_evt); + RakSNHub_Protocl_API.init(onewire_evt); - status = true; - initialized = true; - return 0; + status = true; + initialized = true; + } + + return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; } void RAK9154Sensor::setup() @@ -163,7 +171,16 @@ void RAK9154Sensor::setup() bool RAK9154Sensor::getMetrics(meshtastic_Telemetry *measurement) { - return true; + if (getBusVoltageMv() > 0) { + measurement->variant.environment_metrics.has_voltage = true; + measurement->variant.environment_metrics.has_current = true; + + measurement->variant.environment_metrics.voltage = (float)getBusVoltageMv() / 1000; + measurement->variant.environment_metrics.current = (float)getCurrentMa() / 1000; + return true; + } else { + return false; + } } uint16_t RAK9154Sensor::getBusVoltageMv() @@ -171,6 +188,11 @@ uint16_t RAK9154Sensor::getBusVoltageMv() return dc_vol; } +int16_t RAK9154Sensor::getCurrentMa() +{ + return dc_cur; +} + int RAK9154Sensor::getBusBatteryPercent() { return (int)dc_prec; @@ -180,4 +202,8 @@ bool RAK9154Sensor::isCharging() { return (dc_cur > 0) ? true : false; } +void RAK9154Sensor::setLastRead(uint32_t lastRead) +{ + this->lastRead = lastRead; +} #endif // HAS_RAKPROT diff --git a/variants/rak2560/RAK9154Sensor.h b/src/modules/Telemetry/Sensor/RAK9154Sensor.h similarity index 55% rename from variants/rak2560/RAK9154Sensor.h rename to src/modules/Telemetry/Sensor/RAK9154Sensor.h index 6c6f304d6..c96139f9c 100644 --- a/variants/rak2560/RAK9154Sensor.h +++ b/src/modules/Telemetry/Sensor/RAK9154Sensor.h @@ -1,23 +1,30 @@ -#ifdef HAS_RAKPROT +#include "configuration.h" + +#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && defined(HAS_RAKPROT) + #ifndef _RAK9154SENSOR_H #define _RAK9154SENSOR_H 1 #include "../mesh/generated/meshtastic/telemetry.pb.h" -#include "../modules/Telemetry/Sensor/TelemetrySensor.h" -#include "../modules/Telemetry/Sensor/VoltageSensor.h" +#include "CurrentSensor.h" +#include "TelemetrySensor.h" +#include "VoltageSensor.h" -class RAK9154Sensor : public TelemetrySensor, VoltageSensor +class RAK9154Sensor : public TelemetrySensor, VoltageSensor, CurrentSensor { private: protected: virtual void setup() override; + uint32_t lastRead = 0; public: RAK9154Sensor(); virtual int32_t runOnce() override; virtual bool getMetrics(meshtastic_Telemetry *measurement) override; virtual uint16_t getBusVoltageMv() override; + virtual int16_t getCurrentMa() override; int getBusBatteryPercent(); bool isCharging(); + void setLastRead(uint32_t lastRead); }; #endif // _RAK9154SENSOR_H #endif // HAS_RAKPROT \ No newline at end of file diff --git a/src/motion/BMX160Sensor.cpp b/src/motion/BMX160Sensor.cpp index 06cea3229..3ddbe46ea 100755 --- a/src/motion/BMX160Sensor.cpp +++ b/src/motion/BMX160Sensor.cpp @@ -4,7 +4,7 @@ BMX160Sensor::BMX160Sensor(ScanI2C::FoundDevice foundDevice) : MotionSensor::MotionSensor(foundDevice) {} -#ifdef RAK_4631 +#if defined(RAK_4631) && !defined(RAK2560) #if !defined(MESHTASTIC_EXCLUDE_SCREEN) // screen is defined in main.cpp diff --git a/src/motion/BMX160Sensor.h b/src/motion/BMX160Sensor.h index 9031b4504..fc5a48aa4 100755 --- a/src/motion/BMX160Sensor.h +++ b/src/motion/BMX160Sensor.h @@ -7,7 +7,7 @@ #if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C -#ifdef RAK_4631 +#if defined(RAK_4631) && !defined(RAK2560) #include "Fusion/Fusion.h" #include diff --git a/src/power.h b/src/power.h index ab55fc7e1..176e16ee5 100644 --- a/src/power.h +++ b/src/power.h @@ -1,5 +1,4 @@ #pragma once -#include "../variants/rak2560/RAK9154Sensor.h" #include "PowerStatus.h" #include "concurrency/OSThread.h" #include "configuration.h" @@ -56,8 +55,8 @@ extern INA3221Sensor ina3221Sensor; extern MAX17048Sensor max17048Sensor; #endif -#if HAS_RAKPROT && !defined(ARCH_PORTDUINO) -#include "../variants/rak2560/RAK9154Sensor.h" +#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && HAS_RAKPROT && !defined(ARCH_PORTDUINO) +#include "modules/Telemetry/Sensor/RAK9154Sensor.h" extern RAK9154Sensor rak9154Sensor; #endif diff --git a/variants/rak2560/create_uf2.py b/variants/rak2560/create_uf2.py deleted file mode 100644 index af78f3e09..000000000 --- a/variants/rak2560/create_uf2.py +++ /dev/null @@ -1,113 +0,0 @@ -import struct - -Import("env") # noqa: F821 - - -# Parse input and create UF2 file -def create_uf2(source, target, env): - # source_hex = target[0].get_abspath() - source_hex = target[0].get_string(False) - source_hex = ".\\" + source_hex - print("#########################################################") - print("Create UF2 from " + source_hex) - print("#########################################################") - # print("Source: " + source_hex) - target = source_hex.replace(".hex", "") - target = target + ".uf2" - # print("Target: " + target) - - with open(source_hex, mode="rb") as f: - inpbuf = f.read() - - outbuf = convert_from_hex_to_uf2(inpbuf.decode("utf-8")) - - write_file(target, outbuf) - print("#########################################################") - print(target + " is ready to flash to target device") - print("#########################################################") - - -# Add callback after .hex file was created -env.AddPostAction("$BUILD_DIR/${PROGNAME}.hex", create_uf2) # noqa: F821 - -# UF2 creation taken from uf2conv.py -UF2_MAGIC_START0 = 0x0A324655 # "UF2\n" -UF2_MAGIC_START1 = 0x9E5D5157 # Randomly selected -UF2_MAGIC_END = 0x0AB16F30 # Ditto - -familyid = 0xADA52840 - - -class Block: - def __init__(self, addr): - self.addr = addr - self.bytes = bytearray(256) - - def encode(self, blockno, numblocks): - global familyid - flags = 0x0 - if familyid: - flags |= 0x2000 - hd = struct.pack( - " Date: Mon, 20 Jan 2025 13:20:59 +0200 Subject: [PATCH 118/381] Create BananaPi-BPI-R4-sx1262.yaml (#5897) --- bin/config.d/BananaPi-BPI-R4-sx1262.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 bin/config.d/BananaPi-BPI-R4-sx1262.yaml diff --git a/bin/config.d/BananaPi-BPI-R4-sx1262.yaml b/bin/config.d/BananaPi-BPI-R4-sx1262.yaml new file mode 100644 index 000000000..825ab2699 --- /dev/null +++ b/bin/config.d/BananaPi-BPI-R4-sx1262.yaml @@ -0,0 +1,9 @@ +Lora: + Module: sx1262 # BananaPi-BPI-R4 SPI via 26p GPIO Header +## CS: 28 + IRQ: 50 + Busy: 62 + Reset: 51 + spidev: spidev1.0 + DIO2_AS_RF_SWITCH: true + DIO3_TCXO_VOLTAGE: true From 0f981153ebbad06675f04bd9b0dd6170c7f08352 Mon Sep 17 00:00:00 2001 From: isseysandei Date: Mon, 20 Jan 2025 17:47:47 +0100 Subject: [PATCH 119/381] No focus on new messages if auto-carousel is off (#5881) * no focus on messages if screen carousel is disabled * trunk + comment * compacted the nested if using ternary operator * trunk --- src/graphics/Screen.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 198dcc235..b7253ca17 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -2662,14 +2662,13 @@ int Screen::handleStatusUpdate(const meshtastic::Status *arg) int Screen::handleTextMessage(const meshtastic_MeshPacket *packet) { - if (showingNormalScreen) { - // Outgoing message - if (packet->from == 0) - setFrames(FOCUS_PRESERVE); // Return to same frame (quietly hiding the rx text message frame) + // If auto carousel is disabled -> return 0 and skip new messages handling + if (config.display.auto_screen_carousel_secs == 0) + return 0; - // Incoming message - else - setFrames(FOCUS_TEXTMESSAGE); // Focus on the new message + // Handle focus change based on message type + if (showingNormalScreen) { + setFrames(packet->from == 0 ? FOCUS_PRESERVE : FOCUS_TEXTMESSAGE); } return 0; @@ -2756,4 +2755,4 @@ int Screen::handleAdminMessage(const meshtastic_AdminMessage *arg) } // namespace graphics #else graphics::Screen::Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY) {} -#endif // HAS_SCREEN +#endif // HAS_SCREEN \ No newline at end of file From c4fcbad3723d75a98a28501c3354cae5a424e20b Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Mon, 20 Jan 2025 09:43:35 -0800 Subject: [PATCH 120/381] Reboot before formatting LittleFS (#5900) Co-authored-by: Ben Meadors --- src/FSCommon.cpp | 29 +++++------------ src/FSCommon.h | 5 +-- src/SafeFile.cpp | 6 +--- src/platform/nrf52/main-nrf52.cpp | 52 ++++++++++++++++++++++++++++++- 4 files changed, 61 insertions(+), 31 deletions(-) diff --git a/src/FSCommon.cpp b/src/FSCommon.cpp index 1f2994b29..461c72c26 100644 --- a/src/FSCommon.cpp +++ b/src/FSCommon.cpp @@ -49,24 +49,6 @@ void OSFS::writeNBytes(uint16_t address, unsigned int num, const byte *input) } #endif -bool lfs_assert_failed = - false; // Note: we use this global on all platforms, though it can only be set true on nrf52 (in our modified lfs_util.h) - -extern "C" void lfs_assert(const char *reason) -{ - LOG_ERROR("LFS assert: %s", reason); - lfs_assert_failed = true; - -#ifndef ARCH_PORTDUINO -#ifdef FSCom - // CORRUPTED FILESYSTEM. This causes bootloop so - // might as well try formatting now. - LOG_ERROR("Trying FSCom.format()"); - FSCom.format(); -#endif -#endif -} - /** * @brief Copies a file from one location to another. * @@ -348,10 +330,16 @@ void rmDir(const char *dirname) #endif } +/** + * Some platforms (nrf52) might need to do an extra step before FSBegin(). + */ +__attribute__((weak, noinline)) void preFSBegin() {} + void fsInit() { #ifdef FSCom - spiLock->lock(); + concurrency::LockGuard g(spiLock); + preFSBegin(); if (!FSBegin()) { LOG_ERROR("Filesystem mount failed"); // assert(0); This auto-formats the partition, so no need to fail here. @@ -362,7 +350,6 @@ void fsInit() LOG_DEBUG("Filesystem files:"); #endif listDir("/", 10); - spiLock->unlock(); #endif } @@ -400,4 +387,4 @@ void setupSDCard() LOG_DEBUG("Total space: %lu MB", (uint32_t)(SD.totalBytes() / (1024 * 1024))); LOG_DEBUG("Used space: %lu MB", (uint32_t)(SD.usedBytes() / (1024 * 1024))); #endif -} +} \ No newline at end of file diff --git a/src/FSCommon.h b/src/FSCommon.h index 254245b29..10ce4aeec 100644 --- a/src/FSCommon.h +++ b/src/FSCommon.h @@ -57,7 +57,4 @@ bool renameFile(const char *pathFrom, const char *pathTo); std::vector getFiles(const char *dirname, uint8_t levels); void listDir(const char *dirname, uint8_t levels, bool del = false); void rmDir(const char *dirname); -void setupSDCard(); - -extern bool lfs_assert_failed; // Note: we use this global on all platforms, though it can only be set true on nrf52 (in our - // modified lfs_util.h) +void setupSDCard(); \ No newline at end of file diff --git a/src/SafeFile.cpp b/src/SafeFile.cpp index f874164ae..94232e81d 100644 --- a/src/SafeFile.cpp +++ b/src/SafeFile.cpp @@ -8,7 +8,6 @@ static File openFile(const char *filename, bool fullAtomic) concurrency::LockGuard g(spiLock); LOG_DEBUG("Opening %s, fullAtomic=%d", filename, fullAtomic); #ifdef ARCH_NRF52 - lfs_assert_failed = false; File file = FSCom.open(filename, FILE_O_WRITE); file.seek(0); return file; @@ -20,7 +19,6 @@ static File openFile(const char *filename, bool fullAtomic) filenameTmp += ".tmp"; // clear any previous LFS errors - lfs_assert_failed = false; return FSCom.open(filenameTmp.c_str(), FILE_O_WRITE); } @@ -96,8 +94,6 @@ bool SafeFile::close() bool SafeFile::testReadback() { concurrency::LockGuard g(spiLock); - bool lfs_failed = lfs_assert_failed; - lfs_assert_failed = false; String filenameTmp = filename; filenameTmp += ".tmp"; @@ -119,7 +115,7 @@ bool SafeFile::testReadback() return false; } - return !lfs_failed; + return true; } #endif \ No newline at end of file diff --git a/src/platform/nrf52/main-nrf52.cpp b/src/platform/nrf52/main-nrf52.cpp index 7ca047654..ad4d7a881 100644 --- a/src/platform/nrf52/main-nrf52.cpp +++ b/src/platform/nrf52/main-nrf52.cpp @@ -1,6 +1,7 @@ #include "configuration.h" #include #include +#include #include #include #include @@ -130,6 +131,54 @@ int printf(const char *fmt, ...) return res; } +namespace +{ +constexpr uint8_t NRF52_MAGIC_LFS_IS_CORRUPT = 0xF5; +constexpr uint32_t MULTIPLE_CORRUPTION_DELAY_MILLIS = 20 * 60 * 1000; +static unsigned long millis_until_formatting_again = 0; + +// Report the critical error from loop(), giving a chance for the screen to be initialized first. +inline void reportLittleFSCorruptionOnce() +{ + static bool report_corruption = !!millis_until_formatting_again; + if (report_corruption) { + report_corruption = false; + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_FLASH_CORRUPTION_UNRECOVERABLE); + } +} +} // namespace + +void preFSBegin() +{ + // The GPREGRET register keeps its value across warm boots. Check that this is a warm boot and, if GPREGRET + // is set to NRF52_MAGIC_LFS_IS_CORRUPT, format LittleFS. + if (!(NRF_POWER->RESETREAS == 0 && NRF_POWER->GPREGRET == NRF52_MAGIC_LFS_IS_CORRUPT)) + return; + NRF_POWER->GPREGRET = 0; + millis_until_formatting_again = millis() + MULTIPLE_CORRUPTION_DELAY_MILLIS; + InternalFS.format(); + LOG_INFO("LittleFS format complete; restoring default settings"); +} + +extern "C" void lfs_assert(const char *reason) +{ + LOG_ERROR("LittleFS corruption detected: %s", reason); + if (millis_until_formatting_again > millis()) { + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_FLASH_CORRUPTION_UNRECOVERABLE); + const long millis_remain = millis_until_formatting_again - millis(); + LOG_WARN("Pausing %d seconds to avoid wear on flash storage", millis_remain / 1000); + delay(millis_remain); + } + LOG_INFO("Rebooting to format LittleFS"); + delay(500); // Give the serial port a bit of time to output that last message. + // Try setting GPREGRET with the SoftDevice first. If that fails (perhaps because the SD hasn't been initialize yet) then set + // NRF_POWER->GPREGRET directly. + if (!(sd_power_gpregret_clr(0, 0xFF) == NRF_SUCCESS && sd_power_gpregret_set(0, NRF52_MAGIC_LFS_IS_CORRUPT) == NRF_SUCCESS)) { + NRF_POWER->GPREGRET = NRF52_MAGIC_LFS_IS_CORRUPT; + } + NVIC_SystemReset(); +} + void checkSDEvents() { if (useSoftDevice) { @@ -154,6 +203,7 @@ void checkSDEvents() void nrf52Loop() { checkSDEvents(); + reportLittleFSCorruptionOnce(); } #ifdef USE_SEMIHOSTING @@ -309,4 +359,4 @@ void enterDfuMode() #else enterUf2Dfu(); #endif -} +} \ No newline at end of file From f87c37012386cc0eab10a100cf161be5dd5f5613 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Tue, 21 Jan 2025 18:11:37 +0100 Subject: [PATCH 121/381] Fix possible memory leak for `ROUTER_LATE` (#5901) --- src/mesh/RadioLibInterface.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index e31f0b3e2..69809b7a4 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -340,8 +340,11 @@ void RadioLibInterface::clampToLateRebroadcastWindow(NodeNum from, PacketId id) meshtastic_MeshPacket *p = txQueue.remove(from, id, true, false); if (p) { p->tx_after = millis() + getTxDelayMsecWeightedWorst(p->rx_snr); - txQueue.enqueue(p); - LOG_DEBUG("Move existing queued packet to the late rebroadcast window %dms from now", p->tx_after - millis()); + if (txQueue.enqueue(p)) { + LOG_DEBUG("Move existing queued packet to the late rebroadcast window %dms from now", p->tx_after - millis()); + } else { + packetPool.release(p); + } } } From 9041af365de649e6c782c6ebedd19a61ea9fb2b6 Mon Sep 17 00:00:00 2001 From: Austin Date: Tue, 21 Jan 2025 17:18:40 -0500 Subject: [PATCH 122/381] Move OpenWRT configs to subdir (#5902) --- bin/config.d/{ => OpenWRT}/BananaPi-BPI-R4-sx1262.yaml | 0 bin/config.d/{ => OpenWRT}/OpenWRT-One-mikroBUS-LR-IOT-CLICK.yaml | 0 bin/config.d/{ => OpenWRT}/OpenWRT_One_mikroBUS_sx1262.yaml | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename bin/config.d/{ => OpenWRT}/BananaPi-BPI-R4-sx1262.yaml (100%) rename bin/config.d/{ => OpenWRT}/OpenWRT-One-mikroBUS-LR-IOT-CLICK.yaml (100%) rename bin/config.d/{ => OpenWRT}/OpenWRT_One_mikroBUS_sx1262.yaml (100%) diff --git a/bin/config.d/BananaPi-BPI-R4-sx1262.yaml b/bin/config.d/OpenWRT/BananaPi-BPI-R4-sx1262.yaml similarity index 100% rename from bin/config.d/BananaPi-BPI-R4-sx1262.yaml rename to bin/config.d/OpenWRT/BananaPi-BPI-R4-sx1262.yaml diff --git a/bin/config.d/OpenWRT-One-mikroBUS-LR-IOT-CLICK.yaml b/bin/config.d/OpenWRT/OpenWRT-One-mikroBUS-LR-IOT-CLICK.yaml similarity index 100% rename from bin/config.d/OpenWRT-One-mikroBUS-LR-IOT-CLICK.yaml rename to bin/config.d/OpenWRT/OpenWRT-One-mikroBUS-LR-IOT-CLICK.yaml diff --git a/bin/config.d/OpenWRT_One_mikroBUS_sx1262.yaml b/bin/config.d/OpenWRT/OpenWRT_One_mikroBUS_sx1262.yaml similarity index 100% rename from bin/config.d/OpenWRT_One_mikroBUS_sx1262.yaml rename to bin/config.d/OpenWRT/OpenWRT_One_mikroBUS_sx1262.yaml From 71591fb06a5d4018bd6ed3ab4c9673c2a03287ac Mon Sep 17 00:00:00 2001 From: Austin Date: Tue, 21 Jan 2025 19:53:32 -0500 Subject: [PATCH 123/381] Build docker images with other linux (#5837) --- .github/workflows/build_docker.yml | 51 -------- .github/workflows/daily_packaging.yml | 6 + .github/workflows/docker_build.yml | 70 +++++++++++ .github/workflows/docker_manifest.yml | 167 +++++++++++++++++++++++++ .github/workflows/main_matrix.yml | 35 +++++- .github/workflows/release_channels.yml | 7 ++ 6 files changed, 281 insertions(+), 55 deletions(-) delete mode 100644 .github/workflows/build_docker.yml create mode 100644 .github/workflows/docker_build.yml create mode 100644 .github/workflows/docker_manifest.yml diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml deleted file mode 100644 index 18787f16a..000000000 --- a/.github/workflows/build_docker.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Build Docker - -on: workflow_call - -permissions: - contents: write - packages: write - -jobs: - build-native: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: recursive - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} - - - name: Get release version string - run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - - name: Docker login - if: ${{ github.event_name != 'pull_request_target' && github.event_name != 'pull_request' }} - uses: docker/login-action@v3 - with: - username: meshtastic - password: ${{ secrets.DOCKER_FIRMWARE_TOKEN }} - - - name: Docker setup - if: ${{ github.event_name != 'pull_request_target' && github.event_name != 'pull_request' }} - uses: docker/setup-buildx-action@v3 - - - name: Docker build and push tagged versions - if: ${{ github.event_name == 'workflow_dispatch' }} - uses: docker/build-push-action@v6 - with: - context: . - file: ./Dockerfile - push: true - tags: meshtastic/meshtasticd:${{ steps.version.outputs.long }} - - - name: Docker build and push - if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request_target' && github.event_name != 'pull_request' }} - uses: docker/build-push-action@v6 - with: - context: . - file: ./Dockerfile - push: true - tags: meshtastic/meshtasticd:latest diff --git a/.github/workflows/daily_packaging.yml b/.github/workflows/daily_packaging.yml index 14daae74d..cb8f866c6 100644 --- a/.github/workflows/daily_packaging.yml +++ b/.github/workflows/daily_packaging.yml @@ -20,6 +20,12 @@ permissions: packages: write jobs: + docker-multiarch: + uses: ./.github/workflows/docker_manifest.yml + with: + release_channel: daily + secrets: inherit + package-ppa: strategy: fail-fast: false diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml new file mode 100644 index 000000000..83c67bb32 --- /dev/null +++ b/.github/workflows/docker_build.yml @@ -0,0 +1,70 @@ +name: Build Docker + +# Build Docker image, push untagged (digest-only) + +on: + workflow_call: + inputs: + distro: + description: Distro to target + required: true + type: string + # choices: [debian, alpine] + platform: + description: Platform to target + required: true + type: string + runs-on: + description: Runner to use + required: true + type: string + push: + description: Push images to registry + required: false + type: boolean + default: false + outputs: + digest: + description: Digest of built image + value: ${{ jobs.docker-build.outputs.digest }} + +permissions: + contents: write + packages: write + +jobs: + docker-build: + outputs: + digest: ${{ steps.docker_variant.outputs.digest }} + runs-on: ${{ inputs.runs-on }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + + - name: Docker login + if: ${{ inputs.push }} + uses: docker/login-action@v3 + with: + username: meshtastic + password: ${{ secrets.DOCKER_FIRMWARE_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Docker setup + uses: docker/setup-buildx-action@v3 + + - name: Docker build and push + uses: docker/build-push-action@v6 + id: docker_variant + with: + context: . + file: | + ${{ contains(inputs.distro, 'debian') && './Dockerfile' || contains(inputs.distro, 'alpine') && './alpine.Dockerfile' }} + push: ${{ inputs.push }} + tags: "" # Intentionally empty, push with digest only + platforms: ${{ inputs.platform }} diff --git a/.github/workflows/docker_manifest.yml b/.github/workflows/docker_manifest.yml new file mode 100644 index 000000000..30dcfb067 --- /dev/null +++ b/.github/workflows/docker_manifest.yml @@ -0,0 +1,167 @@ +name: Build Docker Multi-Arch Manifest + +on: + workflow_call: + inputs: + release_channel: + description: Release channel to target + required: true + type: string + +permissions: + contents: write + packages: write + +jobs: + docker-debian-amd64: + uses: ./.github/workflows/docker_build.yml + with: + distro: debian + platform: linux/amd64 + runs-on: ubuntu-24.04 + push: true + + docker-debian-arm64: + uses: ./.github/workflows/docker_build.yml + with: + distro: debian + platform: linux/arm64 + runs-on: ubuntu-24.04-arm + push: true + + docker-debian-armv7: + uses: ./.github/workflows/docker_build.yml + with: + distro: debian + platform: linux/arm/v7 + runs-on: ubuntu-24.04-arm + push: true + + docker-alpine-amd64: + uses: ./.github/workflows/docker_build.yml + with: + distro: alpine + platform: linux/amd64 + runs-on: ubuntu-24.04 + push: true + + docker-alpine-arm64: + uses: ./.github/workflows/docker_build.yml + with: + distro: alpine + platform: linux/arm64 + runs-on: ubuntu-24.04-arm + push: true + + docker-alpine-armv7: + uses: ./.github/workflows/docker_build.yml + with: + distro: alpine + platform: linux/arm/v7 + runs-on: ubuntu-24.04-arm + push: true + + docker-manifest: + needs: + # Debian + - docker-debian-amd64 + - docker-debian-arm64 + - docker-debian-armv7 + # Alpine + - docker-alpine-amd64 + - docker-alpine-arm64 + - docker-alpine-armv7 + runs-on: ubuntu-24.04 + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + + - name: Get release version string + run: | + echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + echo "short=$(./bin/buildinfo.py short)" >> $GITHUB_OUTPUT + id: version + + - name: Enumerate tags + shell: python + run: | + import os + + short = "${{ steps.version.outputs.short }}" + long = "${{ steps.version.outputs.long }}" + release_channel = "${{ inputs.release_channel }}" + tags = { + "beta": { + "debian": [ + f"{short}", f"{long}", f"{short}-beta", f"{long}-beta", "beta", "latest", + f"{short}-debian", f"{long}-debian", f"{short}-beta-debian", f"{long}-beta-debian", "beta-debian" + ], + "alpine": [ + f"{short}-alpine", f"{long}-alpine", f"{short}-beta-alpine", f"{long}-beta-alpine", "beta-alpine" + ] + }, + "alpha": { + "debian": [ + f"{short}-alpha", f"{long}-alpha", "alpha", + f"{short}-alpha-debian", f"{long}-alpha-debian", "alpha-debian" + ], + "alpine": [ + f"{short}-alpha-alpine", f"{long}-alpha-alpine", "alpha-alpine" + ] + }, + "daily": { + "debian": ["daily", "daily-debian"], + "alpine": ["daily-alpine"] + } + } + + with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: + fh.write(f"debian={','.join(tags[release_channel]['debian'])}\n") + fh.write(f"alpine={','.join(tags[release_channel]['alpine'])}\n") + id: tags + + - name: Docker login + uses: docker/login-action@v3 + with: + username: meshtastic + password: ${{ secrets.DOCKER_FIRMWARE_TOKEN }} + + - name: Docker meta (Debian) + id: meta_debian + uses: docker/metadata-action@v5 + with: + images: meshtastic/meshtasticd + tags: ${{ steps.tags.outputs.debian }} + + - name: Create Docker manifest (Debian) + id: manifest_debian + uses: int128/docker-manifest-create-action@v2 + with: + tags: ${{ steps.meta_debian.outputs.tags }} + push: true + sources: | + meshtastic/meshtasticd@${{ needs.docker-debian-amd64.outputs.digest }} + meshtastic/meshtasticd@${{ needs.docker-debian-arm64.outputs.digest }} + meshtastic/meshtasticd@${{ needs.docker-debian-armv7.outputs.digest }} + + - name: Docker meta (Alpine) + id: meta_alpine + uses: docker/metadata-action@v5 + with: + images: meshtastic/meshtasticd + tags: ${{ steps.tags.outputs.alpine }} + + - name: Create Docker manifest (Alpine) + id: manifest_alpine + uses: int128/docker-manifest-create-action@v2 + with: + tags: ${{ steps.meta_alpine.outputs.tags }} + push: true + sources: | + meshtastic/meshtasticd@${{ needs.docker-alpine-amd64.outputs.digest }} + meshtastic/meshtasticd@${{ needs.docker-alpine-arm64.outputs.digest }} + meshtastic/meshtasticd@${{ needs.docker-alpine-armv7.outputs.digest }} diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 0a0ea9954..a9678f4fc 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -147,10 +147,37 @@ jobs: test-native: uses: ./.github/workflows/test_native.yml - build-docker: - if: ${{ github.event_name == 'workflow_dispatch' }} - uses: ./.github/workflows/build_docker.yml - secrets: inherit + docker-debian-amd64: + uses: ./.github/workflows/docker_build.yml + with: + distro: debian + platform: linux/amd64 + runs-on: ubuntu-24.04 + push: false + + docker-alpine-amd64: + uses: ./.github/workflows/docker_build.yml + with: + distro: debian + platform: linux/amd64 + runs-on: ubuntu-24.04 + push: false + + docker-debian-arm64: + uses: ./.github/workflows/docker_build.yml + with: + distro: debian + platform: linux/arm64 + runs-on: ubuntu-24.04-arm + push: false + + docker-debian-armv7: + uses: ./.github/workflows/docker_build.yml + with: + distro: debian + platform: linux/arm/v7 + runs-on: ubuntu-24.04-arm + push: false after-checks: runs-on: ubuntu-latest diff --git a/.github/workflows/release_channels.yml b/.github/workflows/release_channels.yml index afb7319ed..b59a0316c 100644 --- a/.github/workflows/release_channels.yml +++ b/.github/workflows/release_channels.yml @@ -9,6 +9,13 @@ permissions: packages: write jobs: + build-docker: + uses: ./.github/workflows/docker_manifest.yml + with: + release_channel: |- + ${{ contains(github.event.release.name, 'Beta') && 'beta' || contains(github.event.release.name, 'Alpha') && 'alpha' }} + secrets: inherit + package-ppa: strategy: fail-fast: false From 0fdbf70452158d292d71bdd8b02499d8bd4b2c2a Mon Sep 17 00:00:00 2001 From: Austin Date: Tue, 21 Jan 2025 22:26:10 -0500 Subject: [PATCH 124/381] Small fix: Correctly pass secrets in Docker builds (#5905) --- .github/workflows/docker_build.yml | 3 +++ .github/workflows/docker_manifest.yml | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml index 83c67bb32..43072b777 100644 --- a/.github/workflows/docker_build.yml +++ b/.github/workflows/docker_build.yml @@ -4,6 +4,9 @@ name: Build Docker on: workflow_call: + secrets: + DOCKER_FIRMWARE_TOKEN: + required: false # Only required for push inputs: distro: description: Distro to target diff --git a/.github/workflows/docker_manifest.yml b/.github/workflows/docker_manifest.yml index 30dcfb067..9183dfd6c 100644 --- a/.github/workflows/docker_manifest.yml +++ b/.github/workflows/docker_manifest.yml @@ -2,6 +2,9 @@ name: Build Docker Multi-Arch Manifest on: workflow_call: + secrets: + DOCKER_FIRMWARE_TOKEN: + required: true inputs: release_channel: description: Release channel to target @@ -20,6 +23,7 @@ jobs: platform: linux/amd64 runs-on: ubuntu-24.04 push: true + secrets: inherit docker-debian-arm64: uses: ./.github/workflows/docker_build.yml @@ -28,6 +32,7 @@ jobs: platform: linux/arm64 runs-on: ubuntu-24.04-arm push: true + secrets: inherit docker-debian-armv7: uses: ./.github/workflows/docker_build.yml @@ -36,6 +41,7 @@ jobs: platform: linux/arm/v7 runs-on: ubuntu-24.04-arm push: true + secrets: inherit docker-alpine-amd64: uses: ./.github/workflows/docker_build.yml @@ -44,6 +50,7 @@ jobs: platform: linux/amd64 runs-on: ubuntu-24.04 push: true + secrets: inherit docker-alpine-arm64: uses: ./.github/workflows/docker_build.yml @@ -52,6 +59,7 @@ jobs: platform: linux/arm64 runs-on: ubuntu-24.04-arm push: true + secrets: inherit docker-alpine-armv7: uses: ./.github/workflows/docker_build.yml @@ -60,6 +68,7 @@ jobs: platform: linux/arm/v7 runs-on: ubuntu-24.04-arm push: true + secrets: inherit docker-manifest: needs: From fdc87d492c0bc164a50f02da2f1ab2806013704e Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Wed, 22 Jan 2025 00:45:34 -0800 Subject: [PATCH 125/381] Add quotes around ${platformio.build_dir} (#5906) Fixes #5898 (hopefully) --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index ea4de4db1..1c51e53b4 100644 --- a/platformio.ini +++ b/platformio.ini @@ -20,7 +20,7 @@ extra_scripts = bin/platformio-custom.py build_flags = -Wno-missing-field-initializers -Wno-format - -Isrc -Isrc/mesh -Isrc/mesh/generated -Isrc/gps -Isrc/buzz -Wl,-Map,${platformio.build_dir}/output.map + -Isrc -Isrc/mesh -Isrc/mesh/generated -Isrc/gps -Isrc/buzz -Wl,-Map,"${platformio.build_dir}"/output.map -DUSE_THREAD_NAMES -DTINYGPS_OPTION_NO_CUSTOM_FIELDS -DPB_ENABLE_MALLOC=1 From 7fb22cf678d0e40d7e44e3e9ecd8cb10f734e8c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Wed, 22 Jan 2025 14:11:58 +0100 Subject: [PATCH 126/381] ignore platformio core files when building in place --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 803aee139..b63f431d1 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,9 @@ web.tar *.code-workspace .idea +.platformio +.local +.cache .DS_Store Thumbs.db From 01892cbd1eaa824628315f3c79078763f3e8cc91 Mon Sep 17 00:00:00 2001 From: Austin Date: Wed, 22 Jan 2025 09:55:57 -0500 Subject: [PATCH 127/381] Docker: tag intermediate containers (#5910) --- .github/workflows/docker_build.yml | 21 ++++++++++++++++++++- .github/workflows/docker_manifest.yml | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml index 43072b777..eec0785c0 100644 --- a/.github/workflows/docker_build.yml +++ b/.github/workflows/docker_build.yml @@ -48,6 +48,11 @@ jobs: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} + - name: Get release version string + run: | + echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + - name: Docker login if: ${{ inputs.push }} uses: docker/login-action@v3 @@ -61,6 +66,20 @@ jobs: - name: Docker setup uses: docker/setup-buildx-action@v3 + - name: Sanitize platform string + id: sanitize_platform + # Replace slashes with underscores + run: echo "cleaned_platform=${{ inputs.platform }}" | sed 's/\//_/g' >> $GITHUB_OUTPUT + + - name: Docker tag + id: meta + uses: docker/metadata-action@v5 + with: + images: meshtastic/meshtasticd + tags: | + GHA-${{ steps.version.outputs.long }}-${{ inputs.distro }}-${{ steps.sanitize_platform.outputs.cleaned_platform }} + flavor: latest=false + - name: Docker build and push uses: docker/build-push-action@v6 id: docker_variant @@ -69,5 +88,5 @@ jobs: file: | ${{ contains(inputs.distro, 'debian') && './Dockerfile' || contains(inputs.distro, 'alpine') && './alpine.Dockerfile' }} push: ${{ inputs.push }} - tags: "" # Intentionally empty, push with digest only + tags: ${{ steps.meta.outputs.tags }} # Tag is only meant to be consumed by the "manifest" job platforms: ${{ inputs.platform }} diff --git a/.github/workflows/docker_manifest.yml b/.github/workflows/docker_manifest.yml index 9183dfd6c..28dbf8c21 100644 --- a/.github/workflows/docker_manifest.yml +++ b/.github/workflows/docker_manifest.yml @@ -145,6 +145,7 @@ jobs: with: images: meshtastic/meshtasticd tags: ${{ steps.tags.outputs.debian }} + flavor: latest=false - name: Create Docker manifest (Debian) id: manifest_debian From 8e8b22edb0ae0aa56f92bbf49967b667a9acc747 Mon Sep 17 00:00:00 2001 From: Austin Date: Wed, 22 Jan 2025 12:09:29 -0500 Subject: [PATCH 128/381] Debian: Switch OBS repo to `network:Meshtastic` (#5912) --- .github/workflows/daily_packaging.yml | 2 +- .github/workflows/release_channels.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/daily_packaging.yml b/.github/workflows/daily_packaging.yml index cb8f866c6..11fe2043a 100644 --- a/.github/workflows/daily_packaging.yml +++ b/.github/workflows/daily_packaging.yml @@ -40,7 +40,7 @@ jobs: package-obs: uses: ./.github/workflows/package_obs.yml with: - obs_project: home:meshtastic:daily + obs_project: network:Meshtastic:daily series: unstable secrets: inherit diff --git a/.github/workflows/release_channels.yml b/.github/workflows/release_channels.yml index b59a0316c..a3a105d6d 100644 --- a/.github/workflows/release_channels.yml +++ b/.github/workflows/release_channels.yml @@ -32,7 +32,7 @@ jobs: uses: ./.github/workflows/package_obs.yml with: obs_project: |- - home:meshtastic:${{ contains(github.event.release.name, 'Beta') && 'beta' || contains(github.event.release.name, 'Alpha') && 'alpha' }} + network:Meshtastic:${{ contains(github.event.release.name, 'Beta') && 'beta' || contains(github.event.release.name, 'Alpha') && 'alpha' }} series: |- ${{ contains(github.event.release.name, 'Beta') && 'beta' || contains(github.event.release.name, 'Alpha') && 'alpha' }} secrets: inherit From 3b40fe9805041a69381442bce1b2273bdd91b99d Mon Sep 17 00:00:00 2001 From: Austin Date: Thu, 23 Jan 2025 17:03:03 -0500 Subject: [PATCH 129/381] Docker: Switch tags to newline-seperated (#5919) --- .github/workflows/docker_manifest.yml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker_manifest.yml b/.github/workflows/docker_manifest.yml index 28dbf8c21..d1d1a5634 100644 --- a/.github/workflows/docker_manifest.yml +++ b/.github/workflows/docker_manifest.yml @@ -128,9 +128,14 @@ jobs: } } - with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: - fh.write(f"debian={','.join(tags[release_channel]['debian'])}\n") - fh.write(f"alpine={','.join(tags[release_channel]['alpine'])}\n") + with open(os.environ["GITHUB_OUTPUT"], "a") as fh: + fh.write("debian< Date: Thu, 23 Jan 2025 19:12:20 -0600 Subject: [PATCH 130/381] NRF52 - Remove file totally before opening write (#5916) * Remove prefs first * Remove file first * Remove truncate * No longer needed * Missed a param * That wasn't supposed to be there * Remove vestigal lfs assert * Durr --- src/SafeFile.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/SafeFile.cpp b/src/SafeFile.cpp index 94232e81d..c942aa0ee 100644 --- a/src/SafeFile.cpp +++ b/src/SafeFile.cpp @@ -8,9 +8,8 @@ static File openFile(const char *filename, bool fullAtomic) concurrency::LockGuard g(spiLock); LOG_DEBUG("Opening %s, fullAtomic=%d", filename, fullAtomic); #ifdef ARCH_NRF52 - File file = FSCom.open(filename, FILE_O_WRITE); - file.seek(0); - return file; + FSCom.remove(filename); + return FSCom.open(filename, FILE_O_WRITE); #endif if (!fullAtomic) FSCom.remove(filename); // Nuke the old file to make space (ignore if it !exists) @@ -59,9 +58,6 @@ bool SafeFile::close() return false; spiLock->lock(); -#ifdef ARCH_NRF52 - f.truncate(); -#endif f.close(); spiLock->unlock(); From d1f7739bbea229049ac92d32022888fbd8b8e382 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 23 Jan 2025 19:56:59 -0600 Subject: [PATCH 131/381] Peg NRF52 arduino to meshtastic fork with LFE bluetooth fix (#5924) --- arch/nrf52/nrf52.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/nrf52/nrf52.ini b/arch/nrf52/nrf52.ini index 57b276978..b68977c78 100644 --- a/arch/nrf52/nrf52.ini +++ b/arch/nrf52/nrf52.ini @@ -4,7 +4,7 @@ platform = platformio/nordicnrf52@^10.7.0 extends = arduino_base platform_packages = ; our custom Git version until they merge our PR - framework-arduinoadafruitnrf52 @ https://github.com/geeksville/Adafruit_nRF52_Arduino.git + framework-arduinoadafruitnrf52 @ https://github.com/meshtastic/Adafruit_nRF52_Arduino.git#e13f5820002a4fb2a5e6754b42ace185277e5adf toolchain-gccarmnoneeabi@~1.90301.0 build_type = debug From 3298df953a75d70471ca77abe78dff8cca2eb6bc Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Sat, 25 Jan 2025 00:30:18 +1100 Subject: [PATCH 132/381] Fixed the issue that the wifi configuration saved to RAM did not take effect. (#5925) Co-authored-by: virgil --- src/mesh/wifi/WiFiAPClient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index dcfcdc047..41de89794 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -225,7 +225,7 @@ bool initWifi() #if !MESHTASTIC_EXCLUDE_WEBSERVER createSSLCert(); // For WebServer #endif - esp_wifi_set_storage(WIFI_STORAGE_RAM); // Disable flash storage for WiFi credentials + WiFi.persistent(false); // Disable flash storage for WiFi credentials #endif if (!*wifiPsw) // Treat empty password as no password wifiPsw = NULL; From 4c97351187c80f38d680f2ef3fde18e427d29d50 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 24 Jan 2025 18:52:17 -0600 Subject: [PATCH 133/381] [create-pull-request] automated change (#5926) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/mesh.pb.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/protobufs b/protobufs index fde27e4ef..7f13df0e5 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit fde27e4ef0fcee967063ba353422ed5f9a1c4790 +Subproject commit 7f13df0e5f7cbb07f0e6f3a57c0d86ad448738db diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 5cd23c8e3..3353a020f 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -223,6 +223,9 @@ typedef enum _meshtastic_HardwareModel { /* Mesh-Tab, esp32 based https://github.com/valzzu/Mesh-Tab */ meshtastic_HardwareModel_MESH_TAB = 86, + /* MeshLink board developed by LoraItalia. NRF52840, eByte E22900M22S (Will also come with other frequencies), 25w MPPT solar charger (5v,12v,18v selectable), support for gps, buzzer, oled or e-ink display, 10 gpios, hardware watchdog + https://www.loraitalia.it */ + meshtastic_HardwareModel_MESHLINK = 87, /* ------------------------------------------------------------------------------------------------------------------------------------------ Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. ------------------------------------------------------------------------------------------------------------------------------------------ */ From fd56995764c3ea003a989e85965e197617854e3c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 25 Jan 2025 07:53:24 -0600 Subject: [PATCH 134/381] [create-pull-request] automated change (#5928) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- debian/changelog | 5 +++-- version.properties | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index a1a359cfb..1b371296b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,8 @@ -meshtasticd (2.5.20.0) UNRELEASED; urgency=medium +meshtasticd (2.5.21.0) UNRELEASED; urgency=medium * Initial packaging * GitHub Actions Automatic version bump * GitHub Actions Automatic version bump + * GitHub Actions Automatic version bump - -- Austin Lane Wed, 15 Jan 2025 14:08:54 +0000 + -- Austin Lane Sat, 25 Jan 2025 01:39:16 +0000 diff --git a/version.properties b/version.properties index 4312ae59a..efc42428c 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 5 -build = 20 +build = 21 From a14346bc4f862f8f713e9d2e21704b14ae5c99b1 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sat, 25 Jan 2025 16:24:24 +0100 Subject: [PATCH 135/381] Rate limit position replies to three minutes (#5932) --- src/modules/PositionModule.cpp | 20 ++++++++++++++++---- src/modules/PositionModule.h | 2 ++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/modules/PositionModule.cpp b/src/modules/PositionModule.cpp index 6285d7aa5..95a47f0a1 100644 --- a/src/modules/PositionModule.cpp +++ b/src/modules/PositionModule.cpp @@ -160,7 +160,8 @@ bool PositionModule::hasGPS() #endif } -meshtastic_MeshPacket *PositionModule::allocReply() +// Allocate a packet with our position data if we have one +meshtastic_MeshPacket *PositionModule::allocPositionPacket() { if (precision == 0) { LOG_DEBUG("Skip location send because precision is set to 0!"); @@ -262,7 +263,8 @@ meshtastic_MeshPacket *PositionModule::allocReply() p.has_ground_speed = true; } - LOG_INFO("Position reply: time=%i lat=%i lon=%i", p.time, p.latitude_i, p.longitude_i); + LOG_INFO("Position packet: time=%i lat=%i lon=%i", p.time, p.latitude_i, p.longitude_i); + lastSentToMesh = millis(); // TAK Tracker devices should send their position in a TAK packet over the ATAK port if (config.device.role == meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) @@ -271,6 +273,16 @@ meshtastic_MeshPacket *PositionModule::allocReply() return allocDataProtobuf(p); } +meshtastic_MeshPacket *PositionModule::allocReply() +{ + if (lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 3 * 60 * 1000)) { + LOG_DEBUG("Skip Position reply since we sent it <3min ago"); + ignoreRequest = true; // Mark it as ignored for MeshModule + return nullptr; + } + return allocPositionPacket(); +} + meshtastic_MeshPacket *PositionModule::allocAtakPli() { LOG_INFO("Send TAK PLI packet"); @@ -333,9 +345,9 @@ void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies, uint8_t cha precision = 0; } - meshtastic_MeshPacket *p = allocReply(); + meshtastic_MeshPacket *p = allocPositionPacket(); if (p == nullptr) { - LOG_DEBUG("allocReply returned a nullptr"); + LOG_DEBUG("allocPositionPacket returned a nullptr"); return; } diff --git a/src/modules/PositionModule.h b/src/modules/PositionModule.h index 1e4aa5d29..dc732a3db 100644 --- a/src/modules/PositionModule.h +++ b/src/modules/PositionModule.h @@ -55,6 +55,7 @@ class PositionModule : public ProtobufModule, private concu virtual int32_t runOnce() override; private: + meshtastic_MeshPacket *allocPositionPacket(); struct SmartPosition getDistanceTraveledSinceLastSend(meshtastic_PositionLite currentPosition); meshtastic_MeshPacket *allocAtakPli(); void trySetRtc(meshtastic_Position p, bool isLocal, bool forceUpdate = false); @@ -62,6 +63,7 @@ class PositionModule : public ProtobufModule, private concu void sendLostAndFoundText(); bool hasQualityTimesource(); bool hasGPS(); + uint32_t lastSentToMesh = 0; // Last time we sent our position to the mesh const uint32_t minimumTimeThreshold = Default::getConfiguredOrDefaultMs(config.position.broadcast_smart_minimum_interval_secs, 30); From 7649e70585ab1fa9a67924c7e5ab4a85b4bf702a Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 25 Jan 2025 12:01:25 -0600 Subject: [PATCH 136/381] Revert "No focus on new messages if auto-carousel is off (#5881)" (#5936) This reverts commit 0f981153ebbad06675f04bd9b0dd6170c7f08352. --- src/graphics/Screen.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index b7253ca17..198dcc235 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -2662,13 +2662,14 @@ int Screen::handleStatusUpdate(const meshtastic::Status *arg) int Screen::handleTextMessage(const meshtastic_MeshPacket *packet) { - // If auto carousel is disabled -> return 0 and skip new messages handling - if (config.display.auto_screen_carousel_secs == 0) - return 0; - - // Handle focus change based on message type if (showingNormalScreen) { - setFrames(packet->from == 0 ? FOCUS_PRESERVE : FOCUS_TEXTMESSAGE); + // Outgoing message + if (packet->from == 0) + setFrames(FOCUS_PRESERVE); // Return to same frame (quietly hiding the rx text message frame) + + // Incoming message + else + setFrames(FOCUS_TEXTMESSAGE); // Focus on the new message } return 0; @@ -2755,4 +2756,4 @@ int Screen::handleAdminMessage(const meshtastic_AdminMessage *arg) } // namespace graphics #else graphics::Screen::Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY) {} -#endif // HAS_SCREEN \ No newline at end of file +#endif // HAS_SCREEN From 10d553087c4d8158b961a5b9ab8b6a1ff413ca38 Mon Sep 17 00:00:00 2001 From: Aleksey Vasilenko Date: Sun, 26 Jan 2025 10:54:26 +0200 Subject: [PATCH 137/381] Add missing build_unflags (#5941) Fixes 'undefined reference to app_main' build error for my_esp32s3_diy_eink and my_esp32s3_diy_oled variants. --- variants/my_esp32s3_diy_eink/platformio.ini | 4 +++- variants/my_esp32s3_diy_oled/platformio.ini | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/variants/my_esp32s3_diy_eink/platformio.ini b/variants/my_esp32s3_diy_eink/platformio.ini index e81f2c1ab..b2404566f 100644 --- a/variants/my_esp32s3_diy_eink/platformio.ini +++ b/variants/my_esp32s3_diy_eink/platformio.ini @@ -14,7 +14,9 @@ lib_deps = ${esp32_base.lib_deps} zinggjm/GxEPD2@^1.5.1 adafruit/Adafruit NeoPixel @ ^1.12.0 -build_unflags = -DARDUINO_USB_MODE=1 +build_unflags = + ${esp32s3_base.build_unflags} + -DARDUINO_USB_MODE=1 build_flags = ;${esp32_base.build_flags} -D MY_ESP32S3_DIY -I variants/my_esp32s3_diy_eink ${esp32_base.build_flags} -D PRIVATE_HW -I variants/my_esp32s3_diy_eink diff --git a/variants/my_esp32s3_diy_oled/platformio.ini b/variants/my_esp32s3_diy_oled/platformio.ini index 2d7a5cd91..0fbbaa899 100644 --- a/variants/my_esp32s3_diy_oled/platformio.ini +++ b/variants/my_esp32s3_diy_oled/platformio.ini @@ -13,7 +13,9 @@ platform_packages = lib_deps = ${esp32_base.lib_deps} adafruit/Adafruit NeoPixel @ ^1.12.0 -build_unflags = -DARDUINO_USB_MODE=1 +build_unflags = + ${esp32s3_base.build_unflags} + -DARDUINO_USB_MODE=1 build_flags = ;${esp32_base.build_flags} -D MY_ESP32S3_DIY -I variants/my_esp32s3_diy_oled ${esp32_base.build_flags} -D PRIVATE_HW -I variants/my_esp32s3_diy_oled From 4747e73f37e8f6d14aaa3288841fa0f7d8f1c177 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sun, 26 Jan 2025 20:59:59 +0100 Subject: [PATCH 138/381] Space out periodic broadcasts of modules automatically (#5931) * Space out periodic broadcasts of modules automatically * Add warning for function usage --------- Co-authored-by: Ben Meadors --- src/mesh/MeshModule.cpp | 10 ++++++++++ src/mesh/MeshModule.h | 9 +++++++++ src/modules/DetectionSensorModule.cpp | 4 ++-- src/modules/NodeInfoModule.cpp | 7 ++++--- src/modules/PositionModule.cpp | 5 +++-- src/modules/Telemetry/AirQualityTelemetry.cpp | 4 ++-- src/modules/Telemetry/DeviceTelemetry.h | 4 ++-- src/modules/Telemetry/EnvironmentTelemetry.cpp | 6 +++--- src/modules/Telemetry/HealthTelemetry.cpp | 2 +- src/modules/Telemetry/PowerTelemetry.cpp | 2 +- 10 files changed, 37 insertions(+), 16 deletions(-) diff --git a/src/mesh/MeshModule.cpp b/src/mesh/MeshModule.cpp index 2f2863fa5..62d3c82bc 100644 --- a/src/mesh/MeshModule.cpp +++ b/src/mesh/MeshModule.cpp @@ -10,6 +10,7 @@ std::vector *MeshModule::modules; const meshtastic_MeshPacket *MeshModule::currentRequest; +uint8_t MeshModule::numPeriodicModules = 0; /** * If any of the current chain of modules has already sent a reply, it will be here. This is useful to allow @@ -35,6 +36,15 @@ MeshModule::~MeshModule() modules->erase(it); } +// âš ï¸ **Only call once** to set the initial delay before a module starts broadcasting periodically +int32_t MeshModule::setStartDelay() +{ + int32_t startDelay = MESHMODULE_MIN_BROADCAST_DELAY_MS + numPeriodicModules * MESHMODULE_BROADCAST_SPACING_MS; + numPeriodicModules++; + + return startDelay; +} + meshtastic_MeshPacket *MeshModule::allocAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopLimit) { diff --git a/src/mesh/MeshModule.h b/src/mesh/MeshModule.h index a88f1e6ff..f08b8f49c 100644 --- a/src/mesh/MeshModule.h +++ b/src/mesh/MeshModule.h @@ -9,6 +9,9 @@ #include #endif +#define MESHMODULE_MIN_BROADCAST_DELAY_MS 30 * 1000 // Min. delay after boot before sending first broadcast by any module +#define MESHMODULE_BROADCAST_SPACING_MS 15 * 1000 // Initial spacing between broadcasts of different modules + /** handleReceived return enumeration * * Use ProcessMessage::CONTINUE to allows other modules to process a message. @@ -119,6 +122,12 @@ class MeshModule */ static const meshtastic_MeshPacket *currentRequest; + // We keep track of the number of modules that send a periodic broadcast to schedule them spaced out over time + static uint8_t numPeriodicModules; + + // Set the start delay for module that broadcasts periodically + int32_t setStartDelay(); + /** * If your handler wants to send a response, simply set currentReply and it will be sent at the end of response handling. */ diff --git a/src/modules/DetectionSensorModule.cpp b/src/modules/DetectionSensorModule.cpp index c479867fc..ca682b772 100644 --- a/src/modules/DetectionSensorModule.cpp +++ b/src/modules/DetectionSensorModule.cpp @@ -81,7 +81,7 @@ int32_t DetectionSensorModule::runOnce() } LOG_INFO("Detection Sensor Module: init"); - return DELAYED_INTERVAL; + return setStartDelay(); } // LOG_DEBUG("Detection Sensor Module: Current pin state: %i", digitalRead(moduleConfig.detection_sensor.monitor_pin)); @@ -161,4 +161,4 @@ bool DetectionSensorModule::hasDetectionEvent() bool currentState = digitalRead(moduleConfig.detection_sensor.monitor_pin); // LOG_DEBUG("Detection Sensor Module: Current state: %i", currentState); return (moduleConfig.detection_sensor.detection_trigger_type & 1) ? currentState : !currentState; -} +} \ No newline at end of file diff --git a/src/modules/NodeInfoModule.cpp b/src/modules/NodeInfoModule.cpp index b55d47d5b..ce4a6bd06 100644 --- a/src/modules/NodeInfoModule.cpp +++ b/src/modules/NodeInfoModule.cpp @@ -97,8 +97,9 @@ NodeInfoModule::NodeInfoModule() : ProtobufModule("nodeinfo", meshtastic_PortNum_NODEINFO_APP, &meshtastic_User_msg), concurrency::OSThread("NodeInfo") { isPromiscuous = true; // We always want to update our nodedb, even if we are sniffing on others - setIntervalFromNow(30 * - 1000); // Send our initial owner announcement 30 seconds after we start (to give network time to setup) + + setIntervalFromNow(setStartDelay()); // Send our initial owner announcement 30 seconds + // after we start (to give network time to setup) } int32_t NodeInfoModule::runOnce() @@ -112,4 +113,4 @@ int32_t NodeInfoModule::runOnce() sendOurNodeInfo(NODENUM_BROADCAST, requestReplies); // Send our info (don't request replies) } return Default::getConfiguredOrDefaultMs(config.device.node_info_broadcast_secs, default_node_info_broadcast_secs); -} +} \ No newline at end of file diff --git a/src/modules/PositionModule.cpp b/src/modules/PositionModule.cpp index 95a47f0a1..e0f5b513f 100644 --- a/src/modules/PositionModule.cpp +++ b/src/modules/PositionModule.cpp @@ -28,8 +28,9 @@ PositionModule::PositionModule() nodeStatusObserver.observe(&nodeStatus->onNewStatus); if (config.device.role != meshtastic_Config_DeviceConfig_Role_TRACKER && - config.device.role != meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) - setIntervalFromNow(60 * 1000); + config.device.role != meshtastic_Config_DeviceConfig_Role_TAK_TRACKER) { + setIntervalFromNow(setStartDelay()); + } // Power saving trackers should clear their position on startup to avoid waking up and sending a stale position if ((config.device.role == meshtastic_Config_DeviceConfig_Role_TRACKER || diff --git a/src/modules/Telemetry/AirQualityTelemetry.cpp b/src/modules/Telemetry/AirQualityTelemetry.cpp index 6a8077f03..392bd6148 100644 --- a/src/modules/Telemetry/AirQualityTelemetry.cpp +++ b/src/modules/Telemetry/AirQualityTelemetry.cpp @@ -50,12 +50,12 @@ int32_t AirQualityTelemetryModule::runOnce() nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_PMSA003I].first = found.address.address; nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_PMSA003I].second = i2cScanner->fetchI2CBus(found.address); - return 1000; + return setStartDelay(); } #endif return disable(); } - return 1000; + return setStartDelay(); } return disable(); } else { diff --git a/src/modules/Telemetry/DeviceTelemetry.h b/src/modules/Telemetry/DeviceTelemetry.h index 19b7d5b01..a1d55a596 100644 --- a/src/modules/Telemetry/DeviceTelemetry.h +++ b/src/modules/Telemetry/DeviceTelemetry.h @@ -18,7 +18,7 @@ class DeviceTelemetryModule : private concurrency::OSThread, public ProtobufModu uptimeWrapCount = 0; uptimeLastMs = millis(); nodeStatusObserver.observe(&nodeStatus->onNewStatus); - setIntervalFromNow(45 * 1000); // Wait until NodeInfo is sent + setIntervalFromNow(setStartDelay()); // Wait until NodeInfo is sent } virtual bool wantUIFrame() { return false; } @@ -62,4 +62,4 @@ class DeviceTelemetryModule : private concurrency::OSThread, public ProtobufModu uint32_t uptimeWrapCount; uint32_t uptimeLastMs; -}; +}; \ No newline at end of file diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index 6a5e8376d..3fa3e848a 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -107,8 +107,6 @@ int32_t EnvironmentTelemetryModule::runOnce() if (moduleConfig.telemetry.environment_measurement_enabled) { LOG_INFO("Environment Telemetry: init"); - // it's possible to have this module enabled, only for displaying values on the screen. - // therefore, we should only enable the sensor loop if measurement is also enabled #ifdef SENSECAP_INDICATOR result = indicatorSensor.runOnce(); #endif @@ -171,7 +169,9 @@ int32_t EnvironmentTelemetryModule::runOnce() #endif #endif } - return result; + // it's possible to have this module enabled, only for displaying values on the screen. + // therefore, we should only enable the sensor loop if measurement is also enabled + return result == UINT32_MAX ? disable() : setStartDelay(); } else { // if we somehow got to a second run of this module with measurement disabled, then just wait forever if (!moduleConfig.telemetry.environment_measurement_enabled) { diff --git a/src/modules/Telemetry/HealthTelemetry.cpp b/src/modules/Telemetry/HealthTelemetry.cpp index 1b9b49813..a2a18ba03 100644 --- a/src/modules/Telemetry/HealthTelemetry.cpp +++ b/src/modules/Telemetry/HealthTelemetry.cpp @@ -62,7 +62,7 @@ int32_t HealthTelemetryModule::runOnce() if (max30102Sensor.hasSensor()) result = max30102Sensor.runOnce(); } - return result; + return result == UINT32_MAX ? disable() : setStartDelay(); } else { // if we somehow got to a second run of this module with measurement disabled, then just wait forever if (!moduleConfig.telemetry.health_measurement_enabled) { diff --git a/src/modules/Telemetry/PowerTelemetry.cpp b/src/modules/Telemetry/PowerTelemetry.cpp index 38a5c6f11..04bcbe200 100644 --- a/src/modules/Telemetry/PowerTelemetry.cpp +++ b/src/modules/Telemetry/PowerTelemetry.cpp @@ -65,7 +65,7 @@ int32_t PowerTelemetryModule::runOnce() if (max17048Sensor.hasSensor() && !max17048Sensor.isInitialized()) result = max17048Sensor.runOnce(); } - return result; + return result == UINT32_MAX ? disable() : setStartDelay(); #else return disable(); #endif From 2d42e1b2bcd85ca80ec1c3ed5ba9600a21a75182 Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Mon, 27 Jan 2025 21:00:12 +0100 Subject: [PATCH 139/381] fix: TCXO_OPTIONAL featuring SenseCAP Indicator (V1/V2) (#5948) * fix TCXO_OPTIONAL * fix LOG_WARN * fix lora.begin() returns -707 * trunk fmt --- src/main.cpp | 38 +++++++++---------- src/mesh/SX126xInterface.cpp | 15 ++------ src/mesh/SX126xInterface.h | 3 ++ .../diy/nrf52_promicro_diy_tcxo/variant.h | 3 +- variants/seeed-sensecap-indicator/variant.h | 3 ++ 5 files changed, 28 insertions(+), 34 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 24fc71749..f4599e0e3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -115,10 +115,6 @@ AccelerometerThread *accelerometerThread = nullptr; AudioThread *audioThread = nullptr; #endif -#if defined(TCXO_OPTIONAL) -float tcxoVoltage = SX126X_DIO3_TCXO_VOLTAGE; // if TCXO is optional, put this here so it can be changed further down. -#endif - using namespace concurrency; volatile static const char slipstreamTZString[] = USERPREFS_TZ_STRING; @@ -928,13 +924,16 @@ void setup() #if defined(USE_SX1262) && !defined(ARCH_PORTDUINO) && !defined(TCXO_OPTIONAL) && RADIOLIB_EXCLUDE_SX126X != 1 if ((!rIf) && (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_LORA_24)) { - rIf = new SX1262Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY); - if (!rIf->init()) { + auto *sxIf = new SX1262Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY); +#ifdef SX126X_DIO3_TCXO_VOLTAGE + sxIf->setTCXOVoltage(SX126X_DIO3_TCXO_VOLTAGE); +#endif + if (!sxIf->init()) { LOG_WARN("No SX1262 radio"); - delete rIf; - rIf = NULL; + delete sxIf; } else { LOG_INFO("SX1262 init success"); + rIf = sxIf; radioType = SX1262_RADIO; } } @@ -942,29 +941,28 @@ void setup() #if defined(USE_SX1262) && !defined(ARCH_PORTDUINO) && defined(TCXO_OPTIONAL) if ((!rIf) && (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_LORA_24)) { - // Try using the specified TCXO voltage - rIf = new SX1262Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY); - if (!rIf->init()) { - LOG_WARN("No SX1262 radio with TCXO, Vref %f V", tcxoVoltage); - delete rIf; - rIf = NULL; - tcxoVoltage = 0; // if it fails, set the TCXO voltage to zero for the next attempt + // try using the specified TCXO voltage + auto *sxIf = new SX1262Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY); + sxIf->setTCXOVoltage(SX126X_DIO3_TCXO_VOLTAGE); + if (!sxIf->init()) { + LOG_WARN("No SX1262 radio with TCXO, Vref %fV", SX126X_DIO3_TCXO_VOLTAGE); + delete sxIf; } else { - LOG_WARN("SX1262 init success, TCXO, Vref %f V", tcxoVoltage); + LOG_INFO("SX1262 init success, TCXO, Vref %fV", SX126X_DIO3_TCXO_VOLTAGE); + rIf = sxIf; radioType = SX1262_RADIO; } } if ((!rIf) && (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_LORA_24)) { - // If specified TCXO voltage fails, attempt to use DIO3 as a reference instea + // If specified TCXO voltage fails, attempt to use DIO3 as a reference instead rIf = new SX1262Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY); if (!rIf->init()) { - LOG_WARN("No SX1262 radio with XTAL, Vref %f V", tcxoVoltage); + LOG_WARN("No SX1262 radio with XTAL, Vref 0.0V"); delete rIf; rIf = NULL; - tcxoVoltage = SX126X_DIO3_TCXO_VOLTAGE; // if it fails, set the TCXO voltage back for the next radio search } else { - LOG_INFO("SX1262 init success, XTAL, Vref %f V", tcxoVoltage); + LOG_INFO("SX1262 init success, XTAL, Vref 0.0V"); radioType = SX1262_RADIO; } } diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index 8a7bc7670..5710de7ea 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -50,22 +50,13 @@ template bool SX126xInterface::init() #endif #if ARCH_PORTDUINO - float tcxoVoltage = (float)settingsMap[dio3_tcxo_voltage] / 1000; + tcxoVoltage = (float)settingsMap[dio3_tcxo_voltage] / 1000; if (settingsMap[sx126x_ant_sw_pin] != RADIOLIB_NC) { digitalWrite(settingsMap[sx126x_ant_sw_pin], HIGH); pinMode(settingsMap[sx126x_ant_sw_pin], OUTPUT); } -// FIXME: correct logic to default to not using TCXO if no voltage is specified for SX126X_DIO3_TCXO_VOLTAGE -#elif !defined(SX126X_DIO3_TCXO_VOLTAGE) - float tcxoVoltage = - 0; // "TCXO reference voltage to be set on DIO3. Defaults to 1.6 V, set to 0 to skip." per - // https://github.com/jgromes/RadioLib/blob/690a050ebb46e6097c5d00c371e961c1caa3b52e/src/modules/SX126x/SX126x.h#L471C26-L471C104 - // (DIO3 is free to be used as an IRQ) -#elif !defined(TCXO_OPTIONAL) - float tcxoVoltage = SX126X_DIO3_TCXO_VOLTAGE; - // (DIO3 is not free to be used as an IRQ) #endif - if (tcxoVoltage == 0) + if (tcxoVoltage == 0.0) LOG_DEBUG("SX126X_DIO3_TCXO_VOLTAGE not defined, not using DIO3 as TCXO reference voltage"); else LOG_DEBUG("SX126X_DIO3_TCXO_VOLTAGE defined, using DIO3 as TCXO reference voltage at %f V", tcxoVoltage); @@ -83,7 +74,7 @@ template bool SX126xInterface::init() int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage, useRegulatorLDO); // \todo Display actual typename of the adapter, not just `SX126x` LOG_INFO("SX126x init result %d", res); - if (res == RADIOLIB_ERR_CHIP_NOT_FOUND) + if (res == RADIOLIB_ERR_CHIP_NOT_FOUND || res == RADIOLIB_ERR_SPI_CMD_FAILED) return false; LOG_INFO("Frequency set to %f", getFreq()); diff --git a/src/mesh/SX126xInterface.h b/src/mesh/SX126xInterface.h index 45b39a68a..47b07c284 100644 --- a/src/mesh/SX126xInterface.h +++ b/src/mesh/SX126xInterface.h @@ -28,8 +28,11 @@ template class SX126xInterface : public RadioLibInterface bool isIRQPending() override { return lora.getIrqFlags() != 0; } + void setTCXOVoltage(float voltage) { tcxoVoltage = voltage; } + protected: float currentLimit = 140; // Higher OCP limit for SX126x PA + float tcxoVoltage = 0.0; /** * Specific module instance diff --git a/variants/diy/nrf52_promicro_diy_tcxo/variant.h b/variants/diy/nrf52_promicro_diy_tcxo/variant.h index 6ffb86cff..5e939c023 100644 --- a/variants/diy/nrf52_promicro_diy_tcxo/variant.h +++ b/variants/diy/nrf52_promicro_diy_tcxo/variant.h @@ -183,8 +183,7 @@ settings. */ #define SX126X_DIO3_TCXO_VOLTAGE 1.8 -#define TCXO_OPTIONAL // make it so that the firmware can try both TCXO and XTAL -extern float tcxoVoltage; // make this available everywhere +#define TCXO_OPTIONAL // make it so that the firmware can try both TCXO and XTAL #ifdef __cplusplus } diff --git a/variants/seeed-sensecap-indicator/variant.h b/variants/seeed-sensecap-indicator/variant.h index 29d547be3..c5fc685cd 100644 --- a/variants/seeed-sensecap-indicator/variant.h +++ b/variants/seeed-sensecap-indicator/variant.h @@ -70,5 +70,8 @@ #define SX126X_RESET LORA_RESET #define SX126X_DIO2_AS_RF_SWITCH +#define TCXO_OPTIONAL // handle Indicator V1 and V2 +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 + #define USE_VIRTUAL_KEYBOARD 1 #define DISPLAY_CLOCK_FRAME 1 From 30a31a3a13caec27fa1d09e119e97fdb2881b8a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 28 Jan 2025 15:38:22 +0100 Subject: [PATCH 140/381] Oem logo (#5939) * reinstate oemlogo, add to userPrefs.jsonc * disable from default build --- src/graphics/Screen.cpp | 76 ++++++++++++++++++++++++++++++++++++++--- userPrefs.jsonc | 10 ++++-- 2 files changed, 78 insertions(+), 8 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 198dcc235..c9004432f 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -123,7 +123,7 @@ static bool heartbeat = false; #define getStringCenteredX(s) ((SCREEN_WIDTH - display->getStringWidth(s)) / 2) -/// Check if the display can render a string (detect special chars; emoji) +// Check if the display can render a string (detect special chars; emoji) static bool haveGlyphs(const char *str) { #if defined(OLED_PL) || defined(OLED_UA) || defined(OLED_RU) || defined(OLED_CS) @@ -162,11 +162,7 @@ static void drawIconScreen(const char *upperMsg, OLEDDisplay *display, OLEDDispl display->setFont(FONT_MEDIUM); display->setTextAlignment(TEXT_ALIGN_LEFT); -#ifdef USERPREFS_SPLASH_TITLE - const char *title = USERPREFS_SPLASH_TITLE; -#else const char *title = "meshtastic.org"; -#endif display->drawString(x + getStringCenteredX(title), y + SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM, title); display->setFont(FONT_SMALL); @@ -185,6 +181,56 @@ static void drawIconScreen(const char *upperMsg, OLEDDisplay *display, OLEDDispl display->setTextAlignment(TEXT_ALIGN_LEFT); // Restore left align, just to be kind to any other unsuspecting code } +#ifdef USERPREFS_OEM_TEXT + +static void drawOEMIconScreen(const char *upperMsg, OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) +{ + static const uint8_t xbm[] = USERPREFS_OEM_IMAGE_DATA; + display->drawXbm(x + (SCREEN_WIDTH - USERPREFS_OEM_IMAGE_WIDTH) / 2, + y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - USERPREFS_OEM_IMAGE_HEIGHT) / 2 + 2, USERPREFS_OEM_IMAGE_WIDTH, + USERPREFS_OEM_IMAGE_HEIGHT, xbm); + + switch (USERPREFS_OEM_FONT_SIZE) { + case 0: + display->setFont(FONT_SMALL); + break; + case 2: + display->setFont(FONT_LARGE); + break; + default: + display->setFont(FONT_MEDIUM); + break; + } + + display->setTextAlignment(TEXT_ALIGN_LEFT); + const char *title = USERPREFS_OEM_TEXT; + display->drawString(x + getStringCenteredX(title), y + SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM, title); + display->setFont(FONT_SMALL); + + // Draw region in upper left + if (upperMsg) + display->drawString(x + 0, y + 0, upperMsg); + + // Draw version and shortname in upper right + char buf[25]; + snprintf(buf, sizeof(buf), "%s\n%s", xstr(APP_VERSION_SHORT), haveGlyphs(owner.short_name) ? owner.short_name : ""); + + display->setTextAlignment(TEXT_ALIGN_RIGHT); + display->drawString(x + SCREEN_WIDTH, y + 0, buf); + screen->forceDisplay(); + + display->setTextAlignment(TEXT_ALIGN_LEFT); // Restore left align, just to be kind to any other unsuspecting code +} + +static void drawOEMBootScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) +{ + // Draw region in upper left + const char *region = myRegion ? myRegion->name : NULL; + drawOEMIconScreen(region, display, state, x, y); +} + +#endif + void Screen::drawFrameText(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y, const char *message) { uint16_t x_offset = display->width() / 2; @@ -1658,6 +1704,10 @@ void Screen::setup() // Set the utf8 conversion function dispdev->setFontTableLookupFunction(customFontTableLookup); +#ifdef USERPREFS_OEM_TEXT + logo_timeout *= 2; // Double the time if we have a custom logo +#endif + // Add frames. EINK_ADD_FRAMEFLAG(dispdev, DEMAND_FAST); alertFrames[0] = [this](OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) -> void { @@ -1803,6 +1853,22 @@ int32_t Screen::runOnce() showingBootScreen = false; } +#ifdef USERPREFS_OEM_TEXT + static bool showingOEMBootScreen = true; + if (showingOEMBootScreen && (millis() > ((logo_timeout / 2) + serialSinceMsec))) { + LOG_INFO("Switch to OEM screen..."); + // Change frames. + static FrameCallback bootOEMFrames[] = {drawOEMBootScreen}; + static const int bootOEMFrameCount = sizeof(bootOEMFrames) / sizeof(bootOEMFrames[0]); + ui->setFrames(bootOEMFrames, bootOEMFrameCount); + ui->update(); +#ifndef USE_EINK + ui->update(); +#endif + showingOEMBootScreen = false; + } +#endif + #ifndef DISABLE_WELCOME_UNSET if (showingNormalScreen && config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET) { setWelcomeFrames(); diff --git a/userPrefs.jsonc b/userPrefs.jsonc index 055f59273..de610464d 100644 --- a/userPrefs.jsonc +++ b/userPrefs.jsonc @@ -29,9 +29,13 @@ // "USERPREFS_FIXED_GPS_LON": "2.294508368", // "USERPREFS_LORACONFIG_CHANNEL_NUM": "31", // "USERPREFS_LORACONFIG_MODEM_PRESET": "meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST", - // "USERPREFS_SPLASH_TITLE": "DEFCONtastic", "USERPREFS_TZ_STRING": "tzplaceholder " // "USERPREFS_USE_ADMIN_KEY_0": "{ 0xcd, 0xc0, 0xb4, 0x3c, 0x53, 0x24, 0xdf, 0x13, 0xca, 0x5a, 0xa6, 0x0c, 0x0d, 0xec, 0x85, 0x5a, 0x4c, 0xf6, 0x1a, 0x96, 0x04, 0x1a, 0x3e, 0xfc, 0xbb, 0x8e, 0x33, 0x71, 0xe5, 0xfc, 0xff, 0x3c }", // "USERPREFS_USE_ADMIN_KEY_1": "{}", - // "USERPREFS_USE_ADMIN_KEY_2": "{}" -} \ No newline at end of file + // "USERPREFS_USE_ADMIN_KEY_2": "{}", + // "USERPREFS_OEM_TEXT": "Caterham Car Club", + // "USERPREFS_OEM_FONT_SIZE": "0", + // "USERPREFS_OEM_IMAGE_WIDTH": "50", + // "USERPREFS_OEM_IMAGE_HEIGHT": "28", + // "USERPREFS_OEM_IMAGE_DATA": "{ 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xC0, 0x07, 0x80, 0x0F, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x18, 0xFF, 0xFF, 0x61, 0x00, 0x00, 0x00, 0x0C, 0xFF, 0xFF, 0xC7, 0x00, 0x00, 0x00, 0x0C, 0xFF, 0xFF, 0xC7, 0x00, 0x00, 0x00, 0x18, 0xFF, 0xFF, 0x67, 0x00, 0x00, 0x00, 0x18, 0x1F, 0xF0, 0x67, 0x00, 0x00, 0x00, 0x30, 0x1F, 0xF8, 0x33, 0x00, 0x00, 0x00, 0x30, 0x00, 0xFC, 0x31, 0x00, 0x00, 0x00, 0x60, 0x00, 0xFE, 0x18, 0x00, 0x00, 0x00, 0x60, 0x00, 0x7E, 0x18, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x3F, 0x0C, 0x00, 0x00, 0x00, 0xC0, 0x80, 0x1F, 0x0C, 0x00, 0x00, 0x00, 0x80, 0x81, 0x1F, 0x06, 0x00, 0x00, 0x00, 0x80, 0xC1, 0x0F, 0x06, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0xE6, 0x8F, 0x01, 0x00, 0x00, 0x00, 0x00, 0xEE, 0xC7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x0C, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00}" +} From 6a12760c3d07805b5af614820af8732751be6037 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Wed, 29 Jan 2025 09:57:52 +0800 Subject: [PATCH 141/381] Fix off-by-one error with log writes (#5959) As reported by @jstockdale, when writing coloured logs we were writing the full string, including a null terminator. This caused issues for programs consuming our logs. The fix as identified is not to write the null. Fixes https://github.com/meshtastic/firmware/issues/5945 --- src/RedirectablePrint.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/RedirectablePrint.cpp b/src/RedirectablePrint.cpp index 57f53019d..07f873864 100644 --- a/src/RedirectablePrint.cpp +++ b/src/RedirectablePrint.cpp @@ -79,17 +79,17 @@ size_t RedirectablePrint::vprintf(const char *logLevel, const char *format, va_l } if (color && logLevel != nullptr) { if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_DEBUG) == 0) - Print::write("\u001b[34m", 6); + Print::write("\u001b[34m", 5); if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_INFO) == 0) - Print::write("\u001b[32m", 6); + Print::write("\u001b[32m", 5); if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_WARN) == 0) - Print::write("\u001b[33m", 6); + Print::write("\u001b[33m", 5); if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_ERROR) == 0) - Print::write("\u001b[31m", 6); + Print::write("\u001b[31m", 5); } len = Print::write(printBuf, len); if (color && logLevel != nullptr) { - Print::write("\u001b[0m", 5); + Print::write("\u001b[0m", 4); } return len; } @@ -107,15 +107,15 @@ void RedirectablePrint::log_to_serial(const char *logLevel, const char *format, // include the header if (color) { if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_DEBUG) == 0) - Print::write("\u001b[34m", 6); + Print::write("\u001b[34m", 5); if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_INFO) == 0) - Print::write("\u001b[32m", 6); + Print::write("\u001b[32m", 5); if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_WARN) == 0) - Print::write("\u001b[33m", 6); + Print::write("\u001b[33m", 5); if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_ERROR) == 0) - Print::write("\u001b[31m", 6); + Print::write("\u001b[31m", 5); if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_TRACE) == 0) - Print::write("\u001b[35m", 6); + Print::write("\u001b[35m", 5); } uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice, true); // display local time on logfile @@ -393,4 +393,4 @@ std::string RedirectablePrint::mt_sprintf(const std::string fmt_str, ...) break; } return std::string(formatted.get()); -} +} \ No newline at end of file From 78da8f6fc43591d9fbd5822fb2a885d9e8a93258 Mon Sep 17 00:00:00 2001 From: Austin Date: Wed, 29 Jan 2025 06:51:26 -0500 Subject: [PATCH 142/381] Portduino: Allow limiting TX Power from yaml (#5954) --- bin/config-dist.yaml | 4 +++- bin/config.d/lora-MeshAdv-900M30S.yaml | 3 +++ src/mesh/LR11x0Interface.cpp | 6 ++++++ src/mesh/RF95Interface.cpp | 5 ++++- src/mesh/SX126xInterface.cpp | 5 ++++- src/mesh/SX128xInterface.cpp | 5 ++++- src/platform/portduino/PortduinoGlue.cpp | 8 +++++++- src/platform/portduino/PortduinoGlue.h | 7 ++++++- 8 files changed, 37 insertions(+), 6 deletions(-) diff --git a/bin/config-dist.yaml b/bin/config-dist.yaml index c8f181308..1bf52fda2 100644 --- a/bin/config-dist.yaml +++ b/bin/config-dist.yaml @@ -78,6 +78,8 @@ Lora: # TXen: x # TX and RX enable pins # RXen: x +# SX126X_MAX_POWER: 8 # Limit the output power to 8 dBm, useful for amped nodes + # spiSpeed: 2000000 ### Set default/fallback gpio chip to use in /dev/. Defaults to 0. @@ -188,4 +190,4 @@ General: MaxMessageQueue: 100 ConfigDirectory: /etc/meshtasticd/config.d/ # MACAddress: AA:BB:CC:DD:EE:FF -# MACAddressSource: eth0 +# MACAddressSource: eth0 \ No newline at end of file diff --git a/bin/config.d/lora-MeshAdv-900M30S.yaml b/bin/config.d/lora-MeshAdv-900M30S.yaml index 07dada620..113901d5e 100644 --- a/bin/config.d/lora-MeshAdv-900M30S.yaml +++ b/bin/config.d/lora-MeshAdv-900M30S.yaml @@ -7,3 +7,6 @@ Lora: TXen: 13 RXen: 12 DIO3_TCXO_VOLTAGE: true + # Only for E22-900M33S: + # Limit the output power to 8 dBm + # SX126X_MAX_POWER: 8 \ No newline at end of file diff --git a/src/mesh/LR11x0Interface.cpp b/src/mesh/LR11x0Interface.cpp index ce4f912ba..5a9a53d2d 100644 --- a/src/mesh/LR11x0Interface.cpp +++ b/src/mesh/LR11x0Interface.cpp @@ -20,12 +20,18 @@ static const Module::RfSwitchMode_t rfswitch_table[] = { // Particular boards might define a different max power based on what their hardware can do, default to max power output if not // specified (may be dangerous if using external PA and LR11x0 power config forgotten) +#if ARCH_PORTDUINO +#define LR1110_MAX_POWER settingsMap[lr1110_max_power] +#endif #ifndef LR1110_MAX_POWER #define LR1110_MAX_POWER 22 #endif // the 2.4G part maxes at 13dBm +#if ARCH_PORTDUINO +#define LR1120_MAX_POWER settingsMap[lr1120_max_power] +#endif #ifndef LR1120_MAX_POWER #define LR1120_MAX_POWER 13 #endif diff --git a/src/mesh/RF95Interface.cpp b/src/mesh/RF95Interface.cpp index d4d9ad23c..1dfc72708 100644 --- a/src/mesh/RF95Interface.cpp +++ b/src/mesh/RF95Interface.cpp @@ -9,6 +9,9 @@ #include "PortduinoGlue.h" #endif +#if ARCH_PORTDUINO +#define RF95_MAX_POWER settingsMap[rf95_max_power] +#endif #ifndef RF95_MAX_POWER #define RF95_MAX_POWER 20 #endif @@ -337,4 +340,4 @@ bool RF95Interface::sleep() return true; } -#endif +#endif \ No newline at end of file diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index 5710de7ea..7c950bc8e 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -11,6 +11,9 @@ // Particular boards might define a different max power based on what their hardware can do, default to max power output if not // specified (may be dangerous if using external PA and SX126x power config forgotten) +#if ARCH_PORTDUINO +#define SX126X_MAX_POWER settingsMap[sx126x_max_power] +#endif #ifndef SX126X_MAX_POWER #define SX126X_MAX_POWER 22 #endif @@ -333,4 +336,4 @@ template bool SX126xInterface::sleep() return true; } -#endif +#endif \ No newline at end of file diff --git a/src/mesh/SX128xInterface.cpp b/src/mesh/SX128xInterface.cpp index ee3408456..1032934b8 100644 --- a/src/mesh/SX128xInterface.cpp +++ b/src/mesh/SX128xInterface.cpp @@ -10,6 +10,9 @@ #endif // Particular boards might define a different max power based on what their hardware can do +#if ARCH_PORTDUINO +#define SX128X_MAX_POWER settingsMap[sx128x_max_power] +#endif #ifndef SX128X_MAX_POWER #define SX128X_MAX_POWER 13 #endif @@ -315,4 +318,4 @@ template bool SX128xInterface::sleep() return true; } -#endif +#endif \ No newline at end of file diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index ab78baa1a..d7ff4fc65 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -369,6 +369,12 @@ bool loadConfig(const char *configPath) } } + settingsMap[sx126x_max_power] = yamlConfig["Lora"]["SX126X_MAX_POWER"].as(22); + settingsMap[sx128x_max_power] = yamlConfig["Lora"]["SX128X_MAX_POWER"].as(13); + settingsMap[lr1110_max_power] = yamlConfig["Lora"]["LR1110_MAX_POWER"].as(22); + settingsMap[lr1120_max_power] = yamlConfig["Lora"]["LR1120_MAX_POWER"].as(13); + settingsMap[rf95_max_power] = yamlConfig["Lora"]["RF95_MAX_POWER"].as(20); + settingsMap[dio2_as_rf_switch] = yamlConfig["Lora"]["DIO2_AS_RF_SWITCH"].as(false); settingsMap[dio3_tcxo_voltage] = yamlConfig["Lora"]["DIO3_TCXO_VOLTAGE"].as(0) * 1000; if (settingsMap[dio3_tcxo_voltage] == 0 && yamlConfig["Lora"]["DIO3_TCXO_VOLTAGE"].as(false)) { @@ -569,4 +575,4 @@ bool MAC_from_string(std::string mac_str, uint8_t *dmac) } else { return false; } -} +} \ No newline at end of file diff --git a/src/platform/portduino/PortduinoGlue.h b/src/platform/portduino/PortduinoGlue.h index d1e91956d..c6b5f8b41 100644 --- a/src/platform/portduino/PortduinoGlue.h +++ b/src/platform/portduino/PortduinoGlue.h @@ -27,6 +27,11 @@ enum configNames { sx126x_ant_sw_pin, sx126x_ant_sw_line, sx126x_ant_sw_gpiochip, + sx126x_max_power, + sx128x_max_power, + lr1110_max_power, + lr1120_max_power, + rf95_max_power, dio2_as_rf_switch, dio3_tcxo_voltage, use_rf95, @@ -94,4 +99,4 @@ int initGPIOPin(int pinNum, std::string gpioChipname, int line); bool loadConfig(const char *configPath); static bool ends_with(std::string_view str, std::string_view suffix); void getMacAddr(uint8_t *dmac); -bool MAC_from_string(std::string mac_str, uint8_t *dmac); +bool MAC_from_string(std::string mac_str, uint8_t *dmac); \ No newline at end of file From cd8592ef4accb3e758e8bae80744eacc93df7015 Mon Sep 17 00:00:00 2001 From: Jason P Date: Wed, 29 Jan 2025 06:14:43 -0600 Subject: [PATCH 143/381] Fixes #5766 Updated MQTT privateCidrRanges to add Tailscale (#5957) --- src/mqtt/MQTT.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index f642af231..f808a66ef 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -217,6 +217,7 @@ bool isPrivateIpAddress(const IPAddress &ip) {.network = 169u << 24 | 254 << 16, .mask = 0xffff0000}, // 169.254.0.0/16 {.network = 10u << 24, .mask = 0xff000000}, // 10.0.0.0/8 {.network = 127u << 24 | 1, .mask = 0xffffffff}, // 127.0.0.1/32 + {.network = 100u << 24 | 64 << 16, .mask = 0xffc00000}, // 100.64.0.0/10 }; const uint32_t addr = ntohl(ip); for (const auto &cidrRange : privateCidrRanges) { From b5cad2b65e934efac1bbf1d92a6616c12e680a39 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 29 Jan 2025 20:52:24 -0600 Subject: [PATCH 144/381] Fix negative decimal value detection in userPrefs (#5963) --- bin/platformio-custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/platformio-custom.py b/bin/platformio-custom.py index acfeae10c..09e8e6d83 100644 --- a/bin/platformio-custom.py +++ b/bin/platformio-custom.py @@ -102,7 +102,7 @@ pref_flags = [] for pref in userPrefs: if userPrefs[pref].startswith("{"): pref_flags.append("-D" + pref + "=" + userPrefs[pref]) - elif userPrefs[pref].replace(".", "").isdigit(): + elif userPrefs[pref].lstrip("-").replace(".", "").isdigit(): pref_flags.append("-D" + pref + "=" + userPrefs[pref]) elif userPrefs[pref] == "true" or userPrefs[pref] == "false": pref_flags.append("-D" + pref + "=" + userPrefs[pref]) From 4c0e0b84712e08371d84400187e42996bb5bc254 Mon Sep 17 00:00:00 2001 From: Austin Date: Sat, 1 Feb 2025 03:58:58 -0500 Subject: [PATCH 145/381] Portduino: Set Web SSL Cert / Key paths from yaml (#5961) --- Dockerfile | 3 ++- alpine.Dockerfile | 3 ++- bin/config-dist.yaml | 2 ++ debian/meshtasticd.dirs | 3 ++- meshtasticd.spec.rpkg | 3 +++ src/mesh/raspihttp/PiWebServer.cpp | 18 +++++++++++------- src/platform/portduino/PortduinoGlue.cpp | 7 ++++++- src/platform/portduino/PortduinoGlue.h | 2 ++ 8 files changed, 30 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index f3b294a5b..f9a3b9962 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,8 @@ USER root RUN apt-get update && apt-get --no-install-recommends -y install libc-bin libc6 libgpiod2 libyaml-cpp0.7 libi2c0 libulfius2.7 libusb-1.0-0-dev liborcania2.3 libssl3 && \ apt-get clean && rm -rf /var/lib/apt/lists/* \ && mkdir -p /var/lib/meshtasticd \ - && mkdir -p /etc/meshtasticd/config.d + && mkdir -p /etc/meshtasticd/config.d \ + && mkdir -p /etc/meshtasticd/ssl # Fetch compiled binary from the builder COPY --from=builder /tmp/firmware/release/meshtasticd /usr/sbin/ diff --git a/alpine.Dockerfile b/alpine.Dockerfile index 115602b3b..8b48eeca3 100644 --- a/alpine.Dockerfile +++ b/alpine.Dockerfile @@ -29,7 +29,8 @@ USER root RUN apk add libstdc++ libgpiod yaml-cpp libusb i2c-tools \ && mkdir -p /var/lib/meshtasticd \ - && mkdir -p /etc/meshtasticd/config.d + && mkdir -p /etc/meshtasticd/config.d \ + && mkdir -p /etc/meshtasticd/ssl COPY --from=builder /tmp/firmware/release/meshtasticd /usr/sbin/ WORKDIR /var/lib/meshtasticd diff --git a/bin/config-dist.yaml b/bin/config-dist.yaml index 1bf52fda2..da4c192c7 100644 --- a/bin/config-dist.yaml +++ b/bin/config-dist.yaml @@ -184,6 +184,8 @@ Logging: Webserver: # Port: 443 # Port for Webserver & Webservices # RootPath: /usr/share/meshtasticd/web # Root Dir of WebServer +# SSLKey: /etc/meshtasticd/ssl/private_key.pem # Path to SSL Key, generated if not present +# SSLCert: /etc/meshtasticd/ssl/certificate.pem # Path to SSL Certificate, generated if not present General: MaxNodes: 200 diff --git a/debian/meshtasticd.dirs b/debian/meshtasticd.dirs index 5f57ff7be..45a1ca3db 100644 --- a/debian/meshtasticd.dirs +++ b/debian/meshtasticd.dirs @@ -1,4 +1,5 @@ etc/meshtasticd etc/meshtasticd/config.d etc/meshtasticd/available.d -usr/share/meshtasticd/web \ No newline at end of file +usr/share/meshtasticd/web +etc/meshtasticd/ssl \ No newline at end of file diff --git a/meshtasticd.spec.rpkg b/meshtasticd.spec.rpkg index 1819897b0..720e94408 100644 --- a/meshtasticd.spec.rpkg +++ b/meshtasticd.spec.rpkg @@ -72,6 +72,8 @@ install -D -m 0644 bin/meshtasticd.service %{buildroot}%{_unitdir}/meshtasticd.s # Install the web files under /usr/share/meshtasticd/web mkdir -p %{buildroot}%{_datadir}/meshtasticd/web cp -r web/* %{buildroot}%{_datadir}/meshtasticd/web +# Install default SSL storage directory (for web) +mkdir -p %{buildroot}%{_sysconfdir}/meshtasticd/ssl %files %license LICENSE @@ -86,6 +88,7 @@ cp -r web/* %{buildroot}%{_datadir}/meshtasticd/web %dir %{_datadir}/meshtasticd %dir %{_datadir}/meshtasticd/web %{_datadir}/meshtasticd/web/* +%dir %{_sysconfdir}/meshtasticd/ssl %changelog %autochangelog \ No newline at end of file diff --git a/src/mesh/raspihttp/PiWebServer.cpp b/src/mesh/raspihttp/PiWebServer.cpp index 9d2625410..4fae0bc3d 100644 --- a/src/mesh/raspihttp/PiWebServer.cpp +++ b/src/mesh/raspihttp/PiWebServer.cpp @@ -65,6 +65,9 @@ mail: marchammermann@googlemail.com #define DEFAULT_REALM "default_realm" #define PREFIX "" +#define KEY_PATH settingsStrings[websslkeypath].c_str() +#define CERT_PATH settingsStrings[websslcertpath].c_str() + struct _file_config configWeb; // We need to specify some content-type mapping, so the resources get delivered with the @@ -384,13 +387,13 @@ char *read_file_into_string(const char *filename) int PiWebServerThread::CheckSSLandLoad() { // read certificate - cert_pem = read_file_into_string("certificate.pem"); + cert_pem = read_file_into_string(CERT_PATH); if (cert_pem == NULL) { LOG_ERROR("ERROR SSL Certificate File can't be loaded or is missing"); return 1; } // read private key - key_pem = read_file_into_string("private_key.pem"); + key_pem = read_file_into_string(KEY_PATH); if (key_pem == NULL) { LOG_ERROR("ERROR file private_key can't be loaded or is missing"); return 2; @@ -415,8 +418,8 @@ int PiWebServerThread::CreateSSLCertificate() return 2; } - // Ope file to write private key file - FILE *pkey_file = fopen("private_key.pem", "wb"); + // Open file to write private key file + FILE *pkey_file = fopen(KEY_PATH, "wb"); if (!pkey_file) { LOG_ERROR("Error opening private key file"); return 3; @@ -426,18 +429,19 @@ int PiWebServerThread::CreateSSLCertificate() fclose(pkey_file); // open Certificate file - FILE *x509_file = fopen("certificate.pem", "wb"); + FILE *x509_file = fopen(CERT_PATH, "wb"); if (!x509_file) { LOG_ERROR("Error opening cert"); return 4; } - // write cirtificate + // write certificate PEM_write_X509(x509_file, x509); fclose(x509_file); EVP_PKEY_free(pkey); + LOG_INFO("Create SSL Key %s successful", KEY_PATH); X509_free(x509); - LOG_INFO("Create SSL Cert -certificate.pem- succesfull "); + LOG_INFO("Create SSL Cert %s successful", CERT_PATH); return 0; } diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index d7ff4fc65..9da65c92c 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -524,7 +524,12 @@ bool loadConfig(const char *configPath) if (yamlConfig["Webserver"]) { settingsMap[webserverport] = (yamlConfig["Webserver"]["Port"]).as(-1); - settingsStrings[webserverrootpath] = (yamlConfig["Webserver"]["RootPath"]).as(""); + settingsStrings[webserverrootpath] = + (yamlConfig["Webserver"]["RootPath"]).as("/usr/share/meshtasticd/web"); + settingsStrings[websslkeypath] = + (yamlConfig["Webserver"]["SSLKey"]).as("/etc/meshtasticd/ssl/private_key.pem"); + settingsStrings[websslcertpath] = + (yamlConfig["Webserver"]["SSLCert"]).as("/etc/meshtasticd/ssl/certificate.pem"); } if (yamlConfig["General"]) { diff --git a/src/platform/portduino/PortduinoGlue.h b/src/platform/portduino/PortduinoGlue.h index c6b5f8b41..a52ca88f8 100644 --- a/src/platform/portduino/PortduinoGlue.h +++ b/src/platform/portduino/PortduinoGlue.h @@ -81,6 +81,8 @@ enum configNames { webserver, webserverport, webserverrootpath, + websslkeypath, + websslcertpath, maxtophone, maxnodes, ascii_logs, From d9534cfc9d487f3c4e3b0a92f9b7244e599813db Mon Sep 17 00:00:00 2001 From: Chloe Bethel Date: Mon, 3 Feb 2025 03:31:54 +0000 Subject: [PATCH 146/381] Remove unused usages of #include to save Flash (#5978) Saves ~100KB on wio-e5, which was previously at 99% Flash usage --- src/mesh/NodeDB.cpp | 1 - src/serialization/JSONValue.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 762982287..4a01e0d41 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -23,7 +23,6 @@ #include "modules/NeighborInfoModule.h" #include #include -#include #include #include #include diff --git a/src/serialization/JSONValue.cpp b/src/serialization/JSONValue.cpp index b2e9575bf..64dc10abe 100644 --- a/src/serialization/JSONValue.cpp +++ b/src/serialization/JSONValue.cpp @@ -22,7 +22,6 @@ * THE SOFTWARE. */ -#include #include #include #include From b370717dcd50d3961d6c94565df6a86919688af7 Mon Sep 17 00:00:00 2001 From: Woutvstk <119763111+Woutvstk@users.noreply.github.com> Date: Mon, 3 Feb 2025 06:43:32 +0100 Subject: [PATCH 147/381] Add bearing to other node on device screen in text (#5968) * Merge branch 'store-and-forward' of https://github.com/Woutvstk/meshtastic_firmware into store-and-forward * also show bearing to a waypoint in text on screen --- src/graphics/Screen.cpp | 33 +++++++++++++++++------------- src/modules/WaypointModule.cpp | 37 +++++++++++++++++++--------------- 2 files changed, 40 insertions(+), 30 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index c9004432f..4ee49e3c0 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1446,9 +1446,9 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_ static char distStr[20]; if (config.display.units == meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL) { - strncpy(distStr, "? mi", sizeof(distStr)); // might not have location data + strncpy(distStr, "? mi ?°", sizeof(distStr)); // might not have location data } else { - strncpy(distStr, "? km", sizeof(distStr)); + strncpy(distStr, "? km ?°", sizeof(distStr)); } meshtastic_NodeInfoLite *ourNode = nodeDB->getMeshNode(nodeDB->getNodeNum()); const char *fields[] = {username, lastStr, signalStr, distStr, NULL}; @@ -1481,18 +1481,6 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_ float d = GeoCoord::latLongToMeter(DegD(p.latitude_i), DegD(p.longitude_i), DegD(op.latitude_i), DegD(op.longitude_i)); - if (config.display.units == meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL) { - if (d < (2 * MILES_TO_FEET)) - snprintf(distStr, sizeof(distStr), "%.0f ft", d * METERS_TO_FEET); - else - snprintf(distStr, sizeof(distStr), "%.1f mi", d * METERS_TO_FEET / MILES_TO_FEET); - } else { - if (d < 2000) - snprintf(distStr, sizeof(distStr), "%.0f m", d); - else - snprintf(distStr, sizeof(distStr), "%.1f km", d / 1000); - } - float bearingToOther = GeoCoord::bearing(DegD(op.latitude_i), DegD(op.longitude_i), DegD(p.latitude_i), DegD(p.longitude_i)); // If the top of the compass is a static north then bearingToOther can be drawn on the compass directly @@ -1500,6 +1488,23 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_ if (!config.display.compass_north_top) bearingToOther -= myHeading; screen->drawNodeHeading(display, compassX, compassY, compassDiam, bearingToOther); + + float bearingToOtherDegrees = (bearingToOther < 0) ? bearingToOther + 2*PI : bearingToOther; + bearingToOtherDegrees = bearingToOtherDegrees * 180 / PI; + + if (config.display.units == meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL) { + if (d < (2 * MILES_TO_FEET)) + snprintf(distStr, sizeof(distStr), "%.0fft %.0f°", d * METERS_TO_FEET, bearingToOtherDegrees); + else + snprintf(distStr, sizeof(distStr), "%.1fmi %.0f°", d * METERS_TO_FEET / MILES_TO_FEET, bearingToOtherDegrees); + } else { + if (d < 2000) + snprintf(distStr, sizeof(distStr), "%.0fm %.0f°", d, bearingToOtherDegrees); + else + snprintf(distStr, sizeof(distStr), "%.1fkm %.0f°", d / 1000, bearingToOtherDegrees); + } + + } } if (!hasNodeHeading) { diff --git a/src/modules/WaypointModule.cpp b/src/modules/WaypointModule.cpp index b8b738309..08b48b682 100644 --- a/src/modules/WaypointModule.cpp +++ b/src/modules/WaypointModule.cpp @@ -135,20 +135,6 @@ void WaypointModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, myHeading = screen->estimatedHeading(DegD(op.latitude_i), DegD(op.longitude_i)); screen->drawCompassNorth(display, compassX, compassY, myHeading); - // Distance to Waypoint - float d = GeoCoord::latLongToMeter(DegD(wp.latitude_i), DegD(wp.longitude_i), DegD(op.latitude_i), DegD(op.longitude_i)); - if (config.display.units == meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL) { - if (d < (2 * MILES_TO_FEET)) - snprintf(distStr, sizeof(distStr), "%.0f ft", d * METERS_TO_FEET); - else - snprintf(distStr, sizeof(distStr), "%.1f mi", d * METERS_TO_FEET / MILES_TO_FEET); - } else { - if (d < 2000) - snprintf(distStr, sizeof(distStr), "%.0f m", d); - else - snprintf(distStr, sizeof(distStr), "%.1f km", d / 1000); - } - // Compass bearing to waypoint float bearingToOther = GeoCoord::bearing(DegD(op.latitude_i), DegD(op.longitude_i), DegD(wp.latitude_i), DegD(wp.longitude_i)); @@ -157,6 +143,25 @@ void WaypointModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, if (!config.display.compass_north_top) bearingToOther -= myHeading; screen->drawNodeHeading(display, compassX, compassY, compassDiam, bearingToOther); + + float bearingToOtherDegrees = (bearingToOther < 0) ? bearingToOther + 2*PI : bearingToOther; + bearingToOtherDegrees = bearingToOtherDegrees * 180 / PI; + + // Distance to Waypoint + float d = GeoCoord::latLongToMeter(DegD(wp.latitude_i), DegD(wp.longitude_i), DegD(op.latitude_i), DegD(op.longitude_i)); + if (config.display.units == meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL) { + if (d < (2 * MILES_TO_FEET)) + snprintf(distStr, sizeof(distStr), "%.0fft %.0f°", d * METERS_TO_FEET, bearingToOtherDegrees); + else + snprintf(distStr, sizeof(distStr), "%.1fmi %.0f°", d * METERS_TO_FEET / MILES_TO_FEET, bearingToOtherDegrees); + } else { + if (d < 2000) + snprintf(distStr, sizeof(distStr), "%.0fm %.0f°", d, bearingToOtherDegrees); + else + snprintf(distStr, sizeof(distStr), "%.1fkm %.0f°", d / 1000, bearingToOtherDegrees); + } + + } // If our node doesn't have position @@ -166,9 +171,9 @@ void WaypointModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, // ? in the distance field if (config.display.units == meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL) - strncpy(distStr, "? mi", sizeof(distStr)); + strncpy(distStr, "? mi ?°", sizeof(distStr)); else - strncpy(distStr, "? km", sizeof(distStr)); + strncpy(distStr, "? km ?°", sizeof(distStr)); } // Draw compass circle From d7409342786f8c60b10e012b03810454ebb292c8 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Mon, 3 Feb 2025 12:24:47 +0100 Subject: [PATCH 148/381] Don't rate-limit position requests for Lost and Found role (#5981) --- src/modules/PositionModule.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/PositionModule.cpp b/src/modules/PositionModule.cpp index e0f5b513f..acbc3143d 100644 --- a/src/modules/PositionModule.cpp +++ b/src/modules/PositionModule.cpp @@ -276,7 +276,8 @@ meshtastic_MeshPacket *PositionModule::allocPositionPacket() meshtastic_MeshPacket *PositionModule::allocReply() { - if (lastSentToMesh && Throttle::isWithinTimespanMs(lastSentToMesh, 3 * 60 * 1000)) { + if (config.device.role != meshtastic_Config_DeviceConfig_Role_LOST_AND_FOUND && lastSentToMesh && + Throttle::isWithinTimespanMs(lastSentToMesh, 3 * 60 * 1000)) { LOG_DEBUG("Skip Position reply since we sent it <3min ago"); ignoreRequest = true; // Mark it as ignored for MeshModule return nullptr; From 3a34f8beaff09f494e3996f059737d10d3af75f0 Mon Sep 17 00:00:00 2001 From: Tom <116762865+Nestpebble@users.noreply.github.com> Date: Mon, 3 Feb 2025 12:16:35 +0000 Subject: [PATCH 149/381] E80 promicro update (#5967) * add readme and update rfswitch * Updated readme to include all data from Ebyte * Added results from switch testing & notes thereon * fixed picture * Whoops! Forgot to uncomment some settings from test. * Update readme.md * Delete variants/diy/nrf52_promicro_diy_tcxo/E80_RSSI_per_case.png * Add webp image to appease trunk * Update readme.md * Trunky trunk trunk * Clang and the trunk is done --- .../E80_RSSI_per_case.webp | Bin 0 -> 10512 bytes .../diy/nrf52_promicro_diy_tcxo/readme.md | 107 ++++++++++++++++++ .../diy/nrf52_promicro_diy_tcxo/rfswitch.h | 11 +- .../diy/nrf52_promicro_diy_tcxo/variant.h | 2 +- 4 files changed, 115 insertions(+), 5 deletions(-) create mode 100644 variants/diy/nrf52_promicro_diy_tcxo/E80_RSSI_per_case.webp create mode 100644 variants/diy/nrf52_promicro_diy_tcxo/readme.md diff --git a/variants/diy/nrf52_promicro_diy_tcxo/E80_RSSI_per_case.webp b/variants/diy/nrf52_promicro_diy_tcxo/E80_RSSI_per_case.webp new file mode 100644 index 0000000000000000000000000000000000000000..825c3cbc04ac6bc3f08cb824750e8fa171bd06b3 GIT binary patch literal 10512 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%0ACt7_&<2f9OIt%BE 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 + +

The table of known modules is at the bottom of the variant.h, and reproduced here for convenience. + +| Mfr | Module | TCXO | RF Switch | Notes | +| ------------ | ---------------- | ---- | --------- | ------------------------------------- | +| Ebyte | E22-900M22S | Yes | Ext | | +| Ebyte | E22-900MM22S | No | Ext | | +| Ebyte | E22-900M30S | Yes | Ext | | +| Ebyte | E22-900M33S | Yes | Ext | MAX_POWER must be set to 8 for this | +| Ebyte | E220-900M22S | No | Ext | LLCC68, looks like DIO3 not connected | +| AI-Thinker | RA-01SH | No | Int | SX1262 | +| Heltec | HT-RA62 | Yes | Int | | +| NiceRF | Lora1262 | yes | Int | | +| Waveshare | Core1262-HF | yes | Ext | | +| Waveshare | LoRa Node Module | yes | Int | | +| Seeed | Wio-SX1262 | yes | Int | Sooooo cute! | +| AI-Thinker | RA-02 | No | Int | SX1278 **433mhz band only** | +| RF Solutions | RFM95 | No | Int | Untested | +| Ebyte | E80-900M2213S | Yes | Int | LR1121 radio | + + + +## LR1121 modules - E80 is the default + +The E80 from CDEbyte is the most obtainable module at present, and has been selected as the default option. + +Naturally, CDEbyte have chosen to ignore the generic Semtech impelementation of the RF switching logic and have supplied confusing and contradictory documentation, which is explained below. + +tl;dr: The E80 is chosen as the default. **If you wish to use another module, the table in `rfswitch.h` must be adjusted accordingly.** + +### E80 switching - the saga + +The CDEbyte implementation of the LR1121 is contained in their E80 module. As stated above, CDEbyte have chosen to ignore the generic Semtech implementation of the RF switching logic and have their own table, which is located at the bottom of the page [here](https://www.cdebyte.com/products/E80-900M2213S/2#Pin), and reflected on page 6 of their user manual, and reproduced below: + +| DIO5/RFSW0 | DIO6/RFSW1 | RF status | +| ---------- | ---------- | ----------------------------- | +| 0 | 0 | RX | +| 0 | 1 | TX (Sub-1GHz low power mode) | +| 1 | 0 | TX (Sub-1GHz high power mode) | +| 1 | 1 | TX(2.4GHz) | + +However, looking at the sample code they provide on page 9, the values would be: + +| DIO5/RFSW0 | DIO6/RFSW1 | RF status | +| ---------- | ---------- | ----------------------------- | +| 0 | 1 | RX | +| 1 | 1 | TX (Sub-1GHz low power mode) | +| 1 | 0 | TX (Sub-1GHz high power mode) | +| 0 | 0 | TX(2.4GHz) | + +The Semtech default, the values are (taken from [here](https://github.com/Lora-net/SWSD006/blob/v2.6.1/lib/app_subGHz_config_lr11xx.c#L145-L154)): + +
+ +```cpp + .rfswitch = { + .enable = LR11XX_SYSTEM_RFSW0_HIGH | LR11XX_SYSTEM_RFSW1_HIGH | LR11XX_SYSTEM_RFSW2_HIGH, + .standby = 0, + .rx = LR11XX_SYSTEM_RFSW0_HIGH, + .tx = LR11XX_SYSTEM_RFSW0_HIGH | LR11XX_SYSTEM_RFSW1_HIGH, + .tx_hp = LR11XX_SYSTEM_RFSW1_HIGH, + .tx_hf = 0, + .gnss = LR11XX_SYSTEM_RFSW2_HIGH, + .wifi = 0, + }, +``` + +
+ +| DIO5/RFSW0 | DIO6/RFSW1 | RF status | +| ---------- | ---------- | ----------------------------- | +| 1 | 0 | RX | +| 1 | 1 | TX (Sub-1GHz low power mode) | +| 0 | 1 | TX (Sub-1GHz high power mode) | +| 0 | 0 | TX(2.4GHz) | + +It is evident from the tables above that there is no real consistency to those provided by Ebyte. + +#### An experiment + +Tests were conducted in each of the three configurations between a known-good SX1262 and an E80, passing packets in both directions and recording the reported RSSI. The E80 was set at 22db and 14db to activate the high and low power settings respectively. The results are shown in the chart below. + +![Chart showing RSSI readings in each configuration and setting](./E80_RSSI_per_case.webp) + +## Conclusion + +The RF switching is based on the code example given. Logically, this shows the DIO5 and DIO6 are swapped compared to the reference design. + +If future DIYers wish to use an alternative module, the table in `rfswitch.h` must be adjusted accordingly. diff --git a/variants/diy/nrf52_promicro_diy_tcxo/rfswitch.h b/variants/diy/nrf52_promicro_diy_tcxo/rfswitch.h index 2258c3135..71508c037 100644 --- a/variants/diy/nrf52_promicro_diy_tcxo/rfswitch.h +++ b/variants/diy/nrf52_promicro_diy_tcxo/rfswitch.h @@ -1,17 +1,20 @@ #include "RadioLib.h" +// This is rewritten to match the requirements of the E80-900M2213S +// The E80 does not conform to the reference Semtech switches(!) and therefore needs a custom matrix. +// See footnote #3 in "https://www.cdebyte.com/products/E80-900M2213S/2#Pin" // RF Switch Matrix SubG RFO_HP_LF / RFO_LP_LF / RFI_[NP]_LF0 // DIO5 -> RFSW0_V1 // DIO6 -> RFSW1_V2 -// DIO7 -> ANT_CTRL_ON + ESP_IO9/LR_GPS_ANT_DC_EN -> RFI_GPS (Bias-T GPS) (LR11x0 only) +// DIO7 -> not connected on E80 module - note that GNSS and Wifi scanning are not possible. static const uint32_t rfswitch_dio_pins[] = {RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6, RADIOLIB_LR11X0_DIO7, RADIOLIB_NC, RADIOLIB_NC}; static const Module::RfSwitchMode_t rfswitch_table[] = { // mode DIO5 DIO6 DIO7 - {LR11x0::MODE_STBY, {LOW, LOW, LOW}}, {LR11x0::MODE_RX, {HIGH, LOW, LOW}}, - {LR11x0::MODE_TX, {LOW, HIGH, LOW}}, {LR11x0::MODE_TX_HP, {LOW, HIGH, LOW}}, + {LR11x0::MODE_STBY, {LOW, LOW, LOW}}, {LR11x0::MODE_RX, {LOW, HIGH, LOW}}, + {LR11x0::MODE_TX, {HIGH, HIGH, LOW}}, {LR11x0::MODE_TX_HP, {HIGH, LOW, LOW}}, {LR11x0::MODE_TX_HF, {LOW, LOW, LOW}}, {LR11x0::MODE_GNSS, {LOW, LOW, HIGH}}, {LR11x0::MODE_WIFI, {LOW, LOW, LOW}}, END_OF_MODE_TABLE, -}; \ No newline at end of file +}; diff --git a/variants/diy/nrf52_promicro_diy_tcxo/variant.h b/variants/diy/nrf52_promicro_diy_tcxo/variant.h index 5e939c023..b74b100a3 100644 --- a/variants/diy/nrf52_promicro_diy_tcxo/variant.h +++ b/variants/diy/nrf52_promicro_diy_tcxo/variant.h @@ -193,4 +193,4 @@ settings. * Arduino objects - C++ only *----------------------------------------------------------------------------*/ -#endif \ No newline at end of file +#endif From 8cacdb65d6fe9ce943824e54cc741b2785ec3014 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Mon, 3 Feb 2025 22:39:42 +0800 Subject: [PATCH 150/381] Fix INA226 Sensor Voltage Readings (#5972) They were off by a factor of 1000 due to the difference between Volts and MilliVolts, as reported by @morcant . Fixes https://github.com/meshtastic/firmware/issues/5969 --- src/modules/Telemetry/Sensor/INA226Sensor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/Telemetry/Sensor/INA226Sensor.cpp b/src/modules/Telemetry/Sensor/INA226Sensor.cpp index 1ee7cd92e..8b1cded60 100644 --- a/src/modules/Telemetry/Sensor/INA226Sensor.cpp +++ b/src/modules/Telemetry/Sensor/INA226Sensor.cpp @@ -40,14 +40,14 @@ bool INA226Sensor::getMetrics(meshtastic_Telemetry *measurement) measurement->variant.environment_metrics.has_current = true; // mV conversion to V - measurement->variant.environment_metrics.voltage = ina226.getBusVoltage() / 1000; + measurement->variant.environment_metrics.voltage = ina226.getBusVoltage(); measurement->variant.environment_metrics.current = ina226.getCurrent_mA(); return true; } uint16_t INA226Sensor::getBusVoltageMv() { - return lround(ina226.getBusVoltage()); + return lround(ina226.getBusVoltage() * 1000); } int16_t INA226Sensor::getCurrentMa() From 5c17afb2ac6b40f6cf4a20b8c86f1f906df47273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 3 Feb 2025 16:36:05 +0100 Subject: [PATCH 151/381] Clean up some legacy macro definitions (#5983) --- src/graphics/EInkDynamicDisplay.cpp | 4 ++-- variants/heltec_vision_master_e213/platformio.ini | 4 ---- variants/heltec_vision_master_e290/platformio.ini | 6 +----- variants/heltec_wireless_paper/platformio.ini | 4 ---- variants/heltec_wireless_paper_v1/platformio.ini | 4 ---- variants/t-echo/platformio.ini | 3 --- variants/tlora_t3s3_epaper/platformio.ini | 5 ----- 7 files changed, 3 insertions(+), 27 deletions(-) diff --git a/src/graphics/EInkDynamicDisplay.cpp b/src/graphics/EInkDynamicDisplay.cpp index 6664646b9..47012ca47 100644 --- a/src/graphics/EInkDynamicDisplay.cpp +++ b/src/graphics/EInkDynamicDisplay.cpp @@ -238,7 +238,7 @@ void EInkDynamicDisplay::checkRateLimiting() // Skip update: too soon for BACKGROUND if (frameFlags == BACKGROUND) { - if (Throttle::isWithinTimespanMs(previousRunMs, EINK_LIMIT_RATE_BACKGROUND_SEC * 1000)) { + if (Throttle::isWithinTimespanMs(previousRunMs, 30000)) { refresh = SKIPPED; reason = EXCEEDED_RATELIMIT_FULL; return; @@ -251,7 +251,7 @@ void EInkDynamicDisplay::checkRateLimiting() // Skip update: too soon for RESPONSIVE if (frameFlags & RESPONSIVE) { - if (Throttle::isWithinTimespanMs(previousRunMs, EINK_LIMIT_RATE_RESPONSIVE_SEC * 1000)) { + if (Throttle::isWithinTimespanMs(previousRunMs, 1000)) { refresh = SKIPPED; reason = EXCEEDED_RATELIMIT_FAST; LOG_DEBUG("refresh=SKIPPED, reason=EXCEEDED_RATELIMIT_FAST, frameFlags=0x%x", frameFlags); diff --git a/variants/heltec_vision_master_e213/platformio.ini b/variants/heltec_vision_master_e213/platformio.ini index 709ae321f..cc6f283b5 100644 --- a/variants/heltec_vision_master_e213/platformio.ini +++ b/variants/heltec_vision_master_e213/platformio.ini @@ -10,12 +10,8 @@ build_flags = -DEINK_HEIGHT=122 -DUSE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk -DEINK_LIMIT_FASTREFRESH=10 ; How many consecutive fast-refreshes are permitted - -DEINK_LIMIT_RATE_BACKGROUND_SEC=30 ; Minimum interval between BACKGROUND updates - -DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 ; Minimum interval between RESPONSIVE updates -; -D EINK_LIMIT_GHOSTING_PX=2000 ; (Optional) How much image ghosting is tolerated -DEINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached. -DEINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting" - -DEINK_HASQUIRK_WEAKFASTREFRESH ; Pixels set with fast-refresh are easy to clear, disrupted by sunlight lib_deps = ${esp32s3_base.lib_deps} https://github.com/meshtastic/GxEPD2#b202ebfec6a4821e098cf7a625ba0f6f2400292d diff --git a/variants/heltec_vision_master_e290/platformio.ini b/variants/heltec_vision_master_e290/platformio.ini index e1ba100ae..06804e4f2 100644 --- a/variants/heltec_vision_master_e290/platformio.ini +++ b/variants/heltec_vision_master_e290/platformio.ini @@ -11,12 +11,8 @@ build_flags = -D EINK_HEIGHT=128 -D USE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk -D EINK_LIMIT_FASTREFRESH=10 ; How many consecutive fast-refreshes are permitted - -D EINK_LIMIT_RATE_BACKGROUND_SEC=30 ; Minimum interval between BACKGROUND updates - -D EINK_LIMIT_RATE_RESPONSIVE_SEC=1 ; Minimum interval between RESPONSIVE updates -D EINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting" - -D EINK_HASQUIRK_WEAKFASTREFRESH ; Pixels set with fast-refresh are easy to clear, disrupted by sunlight -; -D EINK_LIMIT_GHOSTING_PX=2000 ; How much image ghosting is tolerated -; -D EINK_BACKGROUND_USES_FAST ; (If enabled) don't redraw RESPONSIVE frames at next BACKGROUND update + lib_deps = ${esp32s3_base.lib_deps} diff --git a/variants/heltec_wireless_paper/platformio.ini b/variants/heltec_wireless_paper/platformio.ini index afbbd8be9..a7045b182 100644 --- a/variants/heltec_wireless_paper/platformio.ini +++ b/variants/heltec_wireless_paper/platformio.ini @@ -10,12 +10,8 @@ build_flags = -D EINK_HEIGHT=122 -D USE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk -D EINK_LIMIT_FASTREFRESH=10 ; How many consecutive fast-refreshes are permitted - -D EINK_LIMIT_RATE_BACKGROUND_SEC=30 ; Minimum interval between BACKGROUND updates - -D EINK_LIMIT_RATE_RESPONSIVE_SEC=1 ; Minimum interval between RESPONSIVE updates -; -D EINK_LIMIT_GHOSTING_PX=2000 ; (Optional) How much image ghosting is tolerated -D EINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached. -D EINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting" - -D EINK_HASQUIRK_WEAKFASTREFRESH ; Pixels set with fast-refresh are easy to clear, disrupted by sunlight lib_deps = ${esp32s3_base.lib_deps} https://github.com/meshtastic/GxEPD2#b202ebfec6a4821e098cf7a625ba0f6f2400292d diff --git a/variants/heltec_wireless_paper_v1/platformio.ini b/variants/heltec_wireless_paper_v1/platformio.ini index c94bcacca..2ce7559f9 100644 --- a/variants/heltec_wireless_paper_v1/platformio.ini +++ b/variants/heltec_wireless_paper_v1/platformio.ini @@ -11,11 +11,7 @@ build_flags = -D EINK_HEIGHT=122 -D USE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk -D EINK_LIMIT_FASTREFRESH=5 ; How many consecutive fast-refreshes are permitted - -D EINK_LIMIT_RATE_BACKGROUND_SEC=30 ; Minimum interval between BACKGROUND updates - -D EINK_LIMIT_RATE_RESPONSIVE_SEC=1 ; Minimum interval between RESPONSIVE updates -D EINK_LIMIT_GHOSTING_PX=2000 ; (Optional) How much image ghosting is tolerated - ;-D EINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached. - -D EINK_HASQUIRK_VICIOUSFASTREFRESH ; Identify that pixels drawn by fast-refresh are harder to clear lib_deps = ${esp32s3_base.lib_deps} https://github.com/meshtastic/GxEPD2#55f618961db45a23eff0233546430f1e5a80f63a diff --git a/variants/t-echo/platformio.ini b/variants/t-echo/platformio.ini index 5b295c96a..ce58c0b88 100644 --- a/variants/t-echo/platformio.ini +++ b/variants/t-echo/platformio.ini @@ -14,9 +14,6 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/t-echo -DEINK_HEIGHT=200 -DUSE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk -DEINK_LIMIT_FASTREFRESH=20 ; How many consecutive fast-refreshes are permitted - -DEINK_LIMIT_RATE_BACKGROUND_SEC=30 ; Minimum interval between BACKGROUND updates - -DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 ; Minimum interval between RESPONSIVE updates -; -DEINK_LIMIT_GHOSTING_PX=2000 ; (Optional) How much image ghosting is tolerated -DEINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached. build_src_filter = ${nrf52_base.build_src_filter} +<../variants/t-echo> diff --git a/variants/tlora_t3s3_epaper/platformio.ini b/variants/tlora_t3s3_epaper/platformio.ini index ceb4fbaf5..3f3b3fe50 100644 --- a/variants/tlora_t3s3_epaper/platformio.ini +++ b/variants/tlora_t3s3_epaper/platformio.ini @@ -12,11 +12,6 @@ build_flags = -DEINK_HEIGHT=122 -DUSE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk -DEINK_LIMIT_FASTREFRESH=10 ; How many consecutive fast-refreshes are permitted - -DEINK_LIMIT_RATE_BACKGROUND_SEC=30 ; Minimum interval between BACKGROUND updates - -DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 ; Minimum interval between RESPONSIVE updates - -DEINK_HASQUIRK_VICIOUSFASTREFRESH ; Identify that pixels drawn by fast-refresh are harder to clear - ;-DEINK_LIMIT_GHOSTING_PX=2000 ; (Optional) How much image ghosting is tolerated - ;-DEINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached. lib_deps = ${esp32s3_base.lib_deps} From a3a295488c5f6092494f139fab93ac4926981949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 3 Feb 2025 16:48:10 +0100 Subject: [PATCH 152/381] add firmware build script for use with docker --- bin/build-firmware.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 bin/build-firmware.sh diff --git a/bin/build-firmware.sh b/bin/build-firmware.sh new file mode 100644 index 000000000..c53f1b660 --- /dev/null +++ b/bin/build-firmware.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +sed -i 's/#-DBUILD_EPOCH=$UNIX_TIME/-DBUILD_EPOCH=$UNIX_TIME/' platformio.ini + +export PIP_BREAK_SYSTEM_PACKAGES=1 + +if (echo $2 | grep -q "esp32"); then + bin/build-esp32.sh $1 +elif (echo $2 | grep -q "nrf52"); then + bin/build-nrf52.sh $1 +elif (echo $2 | grep -q "stm32"); then + bin/build-stm32.sh $1 +elif (echo $2 | grep -q "rpi2040"); then + bin/build-rpi2040.sh $1 +else + echo "Unknown target $2" + exit 1 +fi \ No newline at end of file From 1b457bcfbb36a4032f853c06512f2ac7936fad3a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 3 Feb 2025 20:47:51 -0600 Subject: [PATCH 153/381] [create-pull-request] automated change (#5985) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/config.pb.h | 13 +++++++++---- src/mesh/generated/meshtastic/localonly.pb.h | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/protobufs b/protobufs index 7f13df0e5..b80785b16 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 7f13df0e5f7cbb07f0e6f3a57c0d86ad448738db +Subproject commit b80785b16bc0d243b97917998706e7bf209cd9d0 diff --git a/src/mesh/generated/meshtastic/config.pb.h b/src/mesh/generated/meshtastic/config.pb.h index 14aed9dfe..4747ddb5a 100644 --- a/src/mesh/generated/meshtastic/config.pb.h +++ b/src/mesh/generated/meshtastic/config.pb.h @@ -468,6 +468,9 @@ typedef struct _meshtastic_Config_DisplayConfig { bool wake_on_tap_or_motion; /* Indicates how to rotate or invert the compass output to accurate display on the display. */ meshtastic_Config_DisplayConfig_CompassOrientation compass_orientation; + /* If false (default), the device will display the time in 24-hour format on screen. + If true, the device will display the time in 12-hour format on screen. */ + bool use_12h_clock; } meshtastic_Config_DisplayConfig; /* Lora Config */ @@ -690,7 +693,7 @@ extern "C" { #define meshtastic_Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, "", 0} #define meshtastic_Config_NetworkConfig_IpV4Config_init_default {0, 0, 0, 0} -#define meshtastic_Config_DisplayConfig_init_default {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN} +#define meshtastic_Config_DisplayConfig_init_default {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN, 0} #define meshtastic_Config_LoRaConfig_init_default {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0} #define meshtastic_Config_BluetoothConfig_init_default {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0} #define meshtastic_Config_SecurityConfig_init_default {{0, {0}}, {0, {0}}, 0, {{0, {0}}, {0, {0}}, {0, {0}}}, 0, 0, 0, 0} @@ -701,7 +704,7 @@ extern "C" { #define meshtastic_Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, "", 0} #define meshtastic_Config_NetworkConfig_IpV4Config_init_zero {0, 0, 0, 0} -#define meshtastic_Config_DisplayConfig_init_zero {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN} +#define meshtastic_Config_DisplayConfig_init_zero {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN, 0} #define meshtastic_Config_LoRaConfig_init_zero {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0} #define meshtastic_Config_BluetoothConfig_init_zero {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0} #define meshtastic_Config_SecurityConfig_init_zero {{0, {0}}, {0, {0}}, 0, {{0, {0}}, {0, {0}}, {0, {0}}}, 0, 0, 0, 0} @@ -765,6 +768,7 @@ extern "C" { #define meshtastic_Config_DisplayConfig_heading_bold_tag 9 #define meshtastic_Config_DisplayConfig_wake_on_tap_or_motion_tag 10 #define meshtastic_Config_DisplayConfig_compass_orientation_tag 11 +#define meshtastic_Config_DisplayConfig_use_12h_clock_tag 12 #define meshtastic_Config_LoRaConfig_use_preset_tag 1 #define meshtastic_Config_LoRaConfig_modem_preset_tag 2 #define meshtastic_Config_LoRaConfig_bandwidth_tag 3 @@ -907,7 +911,8 @@ X(a, STATIC, SINGULAR, UENUM, oled, 7) \ X(a, STATIC, SINGULAR, UENUM, displaymode, 8) \ X(a, STATIC, SINGULAR, BOOL, heading_bold, 9) \ X(a, STATIC, SINGULAR, BOOL, wake_on_tap_or_motion, 10) \ -X(a, STATIC, SINGULAR, UENUM, compass_orientation, 11) +X(a, STATIC, SINGULAR, UENUM, compass_orientation, 11) \ +X(a, STATIC, SINGULAR, BOOL, use_12h_clock, 12) #define meshtastic_Config_DisplayConfig_CALLBACK NULL #define meshtastic_Config_DisplayConfig_DEFAULT NULL @@ -985,7 +990,7 @@ extern const pb_msgdesc_t meshtastic_Config_SessionkeyConfig_msg; #define MESHTASTIC_MESHTASTIC_CONFIG_PB_H_MAX_SIZE meshtastic_Config_size #define meshtastic_Config_BluetoothConfig_size 10 #define meshtastic_Config_DeviceConfig_size 98 -#define meshtastic_Config_DisplayConfig_size 30 +#define meshtastic_Config_DisplayConfig_size 32 #define meshtastic_Config_LoRaConfig_size 85 #define meshtastic_Config_NetworkConfig_IpV4Config_size 20 #define meshtastic_Config_NetworkConfig_size 202 diff --git a/src/mesh/generated/meshtastic/localonly.pb.h b/src/mesh/generated/meshtastic/localonly.pb.h index dc0f507c9..7a6712bf0 100644 --- a/src/mesh/generated/meshtastic/localonly.pb.h +++ b/src/mesh/generated/meshtastic/localonly.pb.h @@ -187,7 +187,7 @@ extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg; /* Maximum encoded size of messages (where known) */ #define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalConfig_size -#define meshtastic_LocalConfig_size 741 +#define meshtastic_LocalConfig_size 743 #define meshtastic_LocalModuleConfig_size 699 #ifdef __cplusplus From 447533aae5b82398e8dcd648745a4ff1a3c0a8ac Mon Sep 17 00:00:00 2001 From: Austin Date: Tue, 4 Feb 2025 07:38:54 -0500 Subject: [PATCH 154/381] meshtasticd-debian: Remove existing deb builds (#5792) Replaced with OpenSUSE Build Service https://build.opensuse.org/project/show/network:Meshtastic --- .github/workflows/build_native.yml | 38 -------- .github/workflows/build_raspbian.yml | 52 ----------- .github/workflows/build_raspbian_armv7l.yml | 52 ----------- .github/workflows/main_matrix.yml | 32 +------ .github/workflows/package_amd64.yml | 90 ------------------- .github/workflows/package_raspbian.yml | 90 ------------------- .github/workflows/package_raspbian_armv7l.yml | 90 ------------------- .github/workflows/release_channels.yml | 12 +-- 8 files changed, 9 insertions(+), 447 deletions(-) delete mode 100644 .github/workflows/build_native.yml delete mode 100644 .github/workflows/build_raspbian.yml delete mode 100644 .github/workflows/build_raspbian_armv7l.yml delete mode 100644 .github/workflows/package_amd64.yml delete mode 100644 .github/workflows/package_raspbian.yml delete mode 100644 .github/workflows/package_raspbian_armv7l.yml diff --git a/.github/workflows/build_native.yml b/.github/workflows/build_native.yml deleted file mode 100644 index cca839328..000000000 --- a/.github/workflows/build_native.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Build Native - -on: workflow_call - -permissions: - contents: write - packages: write - -jobs: - build-native: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: recursive - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} - - - name: Setup native build - id: base - uses: ./.github/actions/setup-native - - - name: Build Native - run: bin/build-native.sh - - - name: Get release version string - run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 - with: - name: firmware-native-${{ steps.version.outputs.long }}.zip - overwrite: true - path: | - release/meshtasticd_linux_x86_64 - bin/config-dist.yaml diff --git a/.github/workflows/build_raspbian.yml b/.github/workflows/build_raspbian.yml deleted file mode 100644 index 646c6c9f3..000000000 --- a/.github/workflows/build_raspbian.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Build Raspbian - -on: workflow_call - -permissions: - contents: write - packages: write - -jobs: - build-raspbian: - runs-on: [self-hosted, linux, ARM64] - steps: - - name: Install libbluetooth - shell: bash - run: | - sudo apt-get update -y --fix-missing - sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev libusb-1.0-0-dev libi2c-dev - - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: recursive - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} - - - name: Upgrade python tools - shell: bash - run: | - python -m pip install --upgrade pip - pip install -U platformio adafruit-nrfutil - pip install -U meshtastic --pre - - - name: Upgrade platformio - shell: bash - run: | - pio upgrade - - - name: Build Raspbian - run: bin/build-native.sh - - - name: Get release version string - run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 - with: - name: firmware-raspbian-${{ steps.version.outputs.long }}.zip - overwrite: true - path: | - release/meshtasticd_linux_aarch64 - bin/config-dist.yaml diff --git a/.github/workflows/build_raspbian_armv7l.yml b/.github/workflows/build_raspbian_armv7l.yml deleted file mode 100644 index 21b1aea79..000000000 --- a/.github/workflows/build_raspbian_armv7l.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Build Raspbian Arm - -on: workflow_call - -permissions: - contents: write - packages: write - -jobs: - build-raspbian-armv7l: - runs-on: [self-hosted, linux, ARM] - steps: - - name: Install libbluetooth - shell: bash - run: | - sudo apt-get update -y --fix-missing - sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev libusb-1.0-0-dev libi2c-dev - - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: recursive - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} - - - name: Upgrade python tools - shell: bash - run: | - python -m pip install --upgrade pip - pip install -U platformio adafruit-nrfutil - pip install -U meshtastic --pre - - - name: Upgrade platformio - shell: bash - run: | - pio upgrade - - - name: Build Raspbian - run: bin/build-native.sh - - - name: Get release version string - run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - - name: Store binaries as an artifact - uses: actions/upload-artifact@v4 - with: - name: firmware-raspbian-armv7l-${{ steps.version.outputs.long }}.zip - overwrite: true - path: | - release/meshtasticd_linux_armv7l - bin/config-dist.yaml diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index a9678f4fc..b13866435 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -128,15 +128,6 @@ jobs: with: board: ${{ matrix.board }} - package-raspbian: - uses: ./.github/workflows/package_raspbian.yml - - package-raspbian-armv7l: - uses: ./.github/workflows/package_raspbian_armv7l.yml - - package-native: - uses: ./.github/workflows/package_amd64.yml - build-debian-src: uses: ./.github/workflows/build_debian_src.yml with: @@ -158,7 +149,7 @@ jobs: docker-alpine-amd64: uses: ./.github/workflows/docker_build.yml with: - distro: debian + distro: alpine platform: linux/amd64 runs-on: ubuntu-24.04 push: false @@ -288,14 +279,7 @@ jobs: if: ${{ github.event_name == 'workflow_dispatch' }} outputs: upload_url: ${{ steps.create_release.outputs.upload_url }} - needs: - [ - gather-artifacts, - package-raspbian, - package-raspbian-armv7l, - package-native, - build-debian-src, - ] + needs: [gather-artifacts, build-debian-src] steps: - name: Checkout uses: actions/checkout@v4 @@ -324,13 +308,6 @@ jobs: body: | Autogenerated by github action, developer should edit as required before publishing... - - name: Download deb files - uses: actions/download-artifact@v4 - with: - pattern: meshtasticd_${{ steps.version.outputs.long }}_*.deb - merge-multiple: true - path: ./output - - name: Download source deb uses: actions/download-artifact@v4 with: @@ -346,11 +323,8 @@ jobs: - name: Display structure of downloaded files run: ls -lR - - name: Add deb files to release + - name: Add source deb to release run: | - gh release upload v${{ steps.version.outputs.long }} ./output/meshtasticd_${{ steps.version.outputs.long }}_arm64.deb - gh release upload v${{ steps.version.outputs.long }} ./output/meshtasticd_${{ steps.version.outputs.long }}_armhf.deb - gh release upload v${{ steps.version.outputs.long }} ./output/meshtasticd_${{ steps.version.outputs.long }}_amd64.deb gh release upload v${{ steps.version.outputs.long }} ./output/meshtasticd-${{ steps.version.outputs.deb }}-src.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/package_amd64.yml b/.github/workflows/package_amd64.yml deleted file mode 100644 index d9f041736..000000000 --- a/.github/workflows/package_amd64.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: Package Native - -on: - workflow_call: - workflow_dispatch: - -permissions: - contents: write - packages: write - -jobs: - build-native: - uses: ./.github/workflows/build_native.yml - - package-native: - runs-on: ubuntu-22.04 - needs: build-native - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: recursive - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} - - - name: Pull web ui - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: meshtastic/web - file: build.tar - target: build.tar - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Get release version string - run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: firmware-native-${{ steps.version.outputs.long }}.zip - merge-multiple: true - - - name: Display structure of downloaded files - run: ls -R - - - name: build .debpkg - run: | - mkdir -p .debpkg/DEBIAN - mkdir -p .debpkg/usr/share/meshtasticd/web - mkdir -p .debpkg/usr/sbin - mkdir -p .debpkg/etc/meshtasticd - mkdir -p .debpkg/etc/meshtasticd/config.d - mkdir -p .debpkg/etc/meshtasticd/available.d - mkdir -p .debpkg/usr/lib/systemd/system/ - tar -xf build.tar -C .debpkg/usr/share/meshtasticd/web - shopt -s dotglob nullglob - if [ -d .debpkg/usr/share/meshtasticd/web/build ]; then mv .debpkg/usr/share/meshtasticd/web/build/* .debpkg/usr/share/meshtasticd/web/; fi - if [ -d .debpkg/usr/share/meshtasticd/web/build ]; then rmdir .debpkg/usr/share/meshtasticd/web/build; fi - if [ -d .debpkg/usr/share/meshtasticd/web/.DS_Store ]; then rm -f .debpkg/usr/share/meshtasticd/web/.DS_Store; fi - gunzip .debpkg/usr/share/meshtasticd/web/ -r - cp release/meshtasticd_linux_x86_64 .debpkg/usr/sbin/meshtasticd - cp bin/config-dist.yaml .debpkg/etc/meshtasticd/config.yaml - cp bin/config.d/* .debpkg/etc/meshtasticd/available.d/ -r - chmod +x .debpkg/usr/sbin/meshtasticd - cp bin/meshtasticd.service .debpkg/usr/lib/systemd/system/meshtasticd.service - echo "/etc/meshtasticd/config.yaml" > .debpkg/DEBIAN/conffiles - chmod +x .debpkg/DEBIAN/conffiles - # Transition /usr/share/doc/meshtasticd to /usr/share/meshtasticd - echo "rm -rf /usr/share/doc/meshtasticd" > .debpkg/DEBIAN/preinst - chmod +x .debpkg/DEBIAN/preinst - echo "ln -sf /usr/share/meshtasticd /usr/share/doc/meshtasticd" > .debpkg/DEBIAN/postinst - chmod +x .debpkg/DEBIAN/postinst - - - uses: jiro4989/build-deb-action@v3 - with: - package: meshtasticd - package_root: .debpkg - maintainer: Jonathan Bennett - version: ${{ steps.version.outputs.long }} # refs/tags/v*.*.* - arch: amd64 - depends: libyaml-cpp0.7, openssl, libulfius2.7, libi2c0 - desc: Native Linux Meshtastic binary. - - - uses: actions/upload-artifact@v4 - with: - name: meshtasticd_${{ steps.version.outputs.long }}_amd64.deb - overwrite: true - path: | - ./*.deb diff --git a/.github/workflows/package_raspbian.yml b/.github/workflows/package_raspbian.yml deleted file mode 100644 index 62613f85f..000000000 --- a/.github/workflows/package_raspbian.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: Package Raspbian - -on: - workflow_call: - workflow_dispatch: - -permissions: - contents: write - packages: write - -jobs: - build-raspbian: - uses: ./.github/workflows/build_raspbian.yml - - package-raspbian: - runs-on: ubuntu-22.04 - needs: build-raspbian - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: recursive - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} - - - name: Pull web ui - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: meshtastic/web - file: build.tar - target: build.tar - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Get release version string - run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: firmware-raspbian-${{ steps.version.outputs.long }}.zip - merge-multiple: true - - - name: Display structure of downloaded files - run: ls -R - - - name: build .debpkg - run: | - mkdir -p .debpkg/DEBIAN - mkdir -p .debpkg/usr/share/meshtasticd/web - mkdir -p .debpkg/usr/sbin - mkdir -p .debpkg/etc/meshtasticd - mkdir -p .debpkg/etc/meshtasticd/config.d - mkdir -p .debpkg/etc/meshtasticd/available.d - mkdir -p .debpkg/usr/lib/systemd/system/ - tar -xf build.tar -C .debpkg/usr/share/meshtasticd/web - shopt -s dotglob nullglob - if [ -d .debpkg/usr/share/meshtasticd/web/build ]; then mv .debpkg/usr/share/meshtasticd/web/build/* .debpkg/usr/share/meshtasticd/web/; fi - if [ -d .debpkg/usr/share/meshtasticd/web/build ]; then rmdir .debpkg/usr/share/meshtasticd/web/build; fi - if [ -d .debpkg/usr/share/meshtasticd/web/.DS_Store ]; then rm -f .debpkg/usr/share/meshtasticd/web/.DS_Store; fi - gunzip .debpkg/usr/share/meshtasticd/web/ -r - cp release/meshtasticd_linux_aarch64 .debpkg/usr/sbin/meshtasticd - cp bin/config-dist.yaml .debpkg/etc/meshtasticd/config.yaml - cp bin/config.d/* .debpkg/etc/meshtasticd/available.d/ -r - chmod +x .debpkg/usr/sbin/meshtasticd - cp bin/meshtasticd.service .debpkg/usr/lib/systemd/system/meshtasticd.service - echo "/etc/meshtasticd/config.yaml" > .debpkg/DEBIAN/conffiles - chmod +x .debpkg/DEBIAN/conffiles - # Transition /usr/share/doc/meshtasticd to /usr/share/meshtasticd - echo "rm -rf /usr/share/doc/meshtasticd" > .debpkg/DEBIAN/preinst - chmod +x .debpkg/DEBIAN/preinst - echo "ln -sf /usr/share/meshtasticd /usr/share/doc/meshtasticd" > .debpkg/DEBIAN/postinst - chmod +x .debpkg/DEBIAN/postinst - - - uses: jiro4989/build-deb-action@v3 - with: - package: meshtasticd - package_root: .debpkg - maintainer: Jonathan Bennett - version: ${{ steps.version.outputs.long }} # refs/tags/v*.*.* - arch: arm64 - depends: libyaml-cpp0.7, openssl, libulfius2.7, libi2c0 - desc: Native Linux Meshtastic binary. - - - uses: actions/upload-artifact@v4 - with: - name: meshtasticd_${{ steps.version.outputs.long }}_arm64.deb - overwrite: true - path: | - ./*.deb diff --git a/.github/workflows/package_raspbian_armv7l.yml b/.github/workflows/package_raspbian_armv7l.yml deleted file mode 100644 index 8a9df1710..000000000 --- a/.github/workflows/package_raspbian_armv7l.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: Package Raspbian - -on: - workflow_call: - workflow_dispatch: - -permissions: - contents: write - packages: write - -jobs: - build-raspbian_armv7l: - uses: ./.github/workflows/build_raspbian_armv7l.yml - - package-raspbian_armv7l: - runs-on: ubuntu-22.04 - needs: build-raspbian_armv7l - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: recursive - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} - - - name: Pull web ui - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: meshtastic/web - file: build.tar - target: build.tar - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Get release version string - run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: firmware-raspbian-armv7l-${{ steps.version.outputs.long }}.zip - merge-multiple: true - - - name: Display structure of downloaded files - run: ls -R - - - name: build .debpkg - run: | - mkdir -p .debpkg/DEBIAN - mkdir -p .debpkg/usr/share/meshtasticd/web - mkdir -p .debpkg/usr/sbin - mkdir -p .debpkg/etc/meshtasticd - mkdir -p .debpkg/etc/meshtasticd/config.d - mkdir -p .debpkg/etc/meshtasticd/available.d - mkdir -p .debpkg/usr/lib/systemd/system/ - tar -xf build.tar -C .debpkg/usr/share/meshtasticd/web - shopt -s dotglob nullglob - if [ -d .debpkg/usr/share/meshtasticd/web/build ]; then mv .debpkg/usr/share/meshtasticd/web/build/* .debpkg/usr/share/meshtasticd/web/; fi - if [ -d .debpkg/usr/share/meshtasticd/web/build ]; then rmdir .debpkg/usr/share/meshtasticd/web/build; fi - if [ -d .debpkg/usr/share/meshtasticd/web/.DS_Store ]; then rm -f .debpkg/usr/share/meshtasticd/web/.DS_Store; fi - gunzip .debpkg/usr/share/meshtasticd/web/ -r - cp release/meshtasticd_linux_armv7l .debpkg/usr/sbin/meshtasticd - cp bin/config-dist.yaml .debpkg/etc/meshtasticd/config.yaml - cp bin/config.d/* .debpkg/etc/meshtasticd/available.d/ -r - chmod +x .debpkg/usr/sbin/meshtasticd - cp bin/meshtasticd.service .debpkg/usr/lib/systemd/system/meshtasticd.service - echo "/etc/meshtasticd/config.yaml" > .debpkg/DEBIAN/conffiles - chmod +x .debpkg/DEBIAN/conffiles - # Transition /usr/share/doc/meshtasticd to /usr/share/meshtasticd - echo "rm -rf /usr/share/doc/meshtasticd" > .debpkg/DEBIAN/preinst - chmod +x .debpkg/DEBIAN/preinst - echo "ln -sf /usr/share/meshtasticd /usr/share/doc/meshtasticd" > .debpkg/DEBIAN/postinst - chmod +x .debpkg/DEBIAN/postinst - - - uses: jiro4989/build-deb-action@v3 - with: - package: meshtasticd - package_root: .debpkg - maintainer: Jonathan Bennett - version: ${{ steps.version.outputs.long }} # refs/tags/v*.*.* - arch: armhf - depends: libyaml-cpp0.7, openssl, libulfius2.7, libi2c0 - desc: Native Linux Meshtastic binary. - - - uses: actions/upload-artifact@v4 - with: - name: meshtasticd_${{ steps.version.outputs.long }}_armhf.deb - overwrite: true - path: | - ./*.deb diff --git a/.github/workflows/release_channels.yml b/.github/workflows/release_channels.yml index a3a105d6d..9cdabde9e 100644 --- a/.github/workflows/release_channels.yml +++ b/.github/workflows/release_channels.yml @@ -37,9 +37,9 @@ jobs: ${{ contains(github.event.release.name, 'Beta') && 'beta' || contains(github.event.release.name, 'Alpha') && 'alpha' }} secrets: inherit - # hook-copr: - # uses: ./.github/workflows/hook_copr.yml - # with: - # copr_project: |- - # ${{ contains(github.event.release.name, 'Beta') && 'beta' || contains(github.event.release.name, 'Alpha') && 'alpha' }} - # secrets: inherit + hook-copr: + uses: ./.github/workflows/hook_copr.yml + with: + copr_project: |- + ${{ contains(github.event.release.name, 'Beta') && 'beta' || contains(github.event.release.name, 'Alpha') && 'alpha' }} + secrets: inherit From 1c8eb7ece3895f608a2da84b6e8e47050e639991 Mon Sep 17 00:00:00 2001 From: Austin Date: Wed, 5 Feb 2025 16:19:22 -0500 Subject: [PATCH 155/381] meshtasticd: Fix web download location (#5993) --- debian/ci_pack_sdeb.sh | 2 +- meshtasticd.spec.rpkg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/ci_pack_sdeb.sh b/debian/ci_pack_sdeb.sh index 1f311af93..a8b2252ae 100755 --- a/debian/ci_pack_sdeb.sh +++ b/debian/ci_pack_sdeb.sh @@ -11,7 +11,7 @@ platformio pkg install -e native -t platformio/tool-scons@4.40502.0 tar -cf pio.tar pio/ rm -rf pio # Download the latest meshtastic/web release build.tar to `web.tar` -curl -L https://github.com/meshtastic/web/releases/download/latest/build.tar -o web.tar +curl -L https://github.com/meshtastic/web/releases/latest/download/build.tar -o web.tar package=$(dpkg-parsechangelog --show-field Source) diff --git a/meshtasticd.spec.rpkg b/meshtasticd.spec.rpkg index 720e94408..0a0f03557 100644 --- a/meshtasticd.spec.rpkg +++ b/meshtasticd.spec.rpkg @@ -21,7 +21,7 @@ Summary: Meshtastic daemon for communicating with Meshtastic devices License: GPL-3.0 URL: https://github.com/meshtastic/firmware Source0: {{{ git_dir_pack }}} -Source1: https://github.com/meshtastic/web/releases/download/latest/build.tar +Source1: https://github.com/meshtastic/web/releases/latest/download/build.tar BuildRequires: systemd-rpm-macros BuildRequires: python3-devel From 64def246eeeee4f9139e4c576da92a9faced8853 Mon Sep 17 00:00:00 2001 From: Tom <116762865+NomDeTom@users.noreply.github.com> Date: Thu, 6 Feb 2025 03:36:04 +0000 Subject: [PATCH 156/381] Corrected some misinformation (#5995) Change the module text too soon , before it had chance to reach a final conclusion. Co-authored-by: Tom <116762865+Nestpebble@users.noreply.github.com> --- .../diy/nrf52_promicro_diy_tcxo/readme.md | 2 +- .../diy/nrf52_promicro_diy_tcxo/variant.h | 40 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/variants/diy/nrf52_promicro_diy_tcxo/readme.md b/variants/diy/nrf52_promicro_diy_tcxo/readme.md index 4da6566ec..585ac36de 100644 --- a/variants/diy/nrf52_promicro_diy_tcxo/readme.md +++ b/variants/diy/nrf52_promicro_diy_tcxo/readme.md @@ -31,7 +31,7 @@ Also worth noting that the Seeed WIO SX1262 in particular only has RXEN exposed | NiceRF | Lora1262 | yes | Int | | | Waveshare | Core1262-HF | yes | Ext | | | Waveshare | LoRa Node Module | yes | Int | | -| Seeed | Wio-SX1262 | yes | Int | Sooooo cute! | +| Seeed | Wio-SX1262 | yes | Ext | Cute! DIO2/TXEN are not exposed | | AI-Thinker | RA-02 | No | Int | SX1278 **433mhz band only** | | RF Solutions | RFM95 | No | Int | Untested | | Ebyte | E80-900M2213S | Yes | Int | LR1121 radio | diff --git a/variants/diy/nrf52_promicro_diy_tcxo/variant.h b/variants/diy/nrf52_promicro_diy_tcxo/variant.h index b74b100a3..de49018f4 100644 --- a/variants/diy/nrf52_promicro_diy_tcxo/variant.h +++ b/variants/diy/nrf52_promicro_diy_tcxo/variant.h @@ -22,26 +22,26 @@ extern "C" { /* NRF52 PRO MICRO PIN ASSIGNMENT -| Pin   | Function   |   | Pin     | Function     | RF95 | +| Pin   | Function   |   | Pin     | Function     | RF95 | | ----- | ----------- | --- | -------- | ------------ | ----- | -| Gnd   |             |   | vbat     |             | | -| P0.06 | Serial2 RX |   | vbat     |             | | -| P0.08 | Serial2 TX |   | Gnd     |             | | -| Gnd   |             |   | reset   |             | | -| Gnd   |             |   | ext_vcc | *see 0.13   | | -| P0.17 | RXEN       |   | P0.31   | BATTERY_PIN | | -| P0.20 | GPS_RX     |   | P0.29   | BUSY         | DIO0 | -| P0.22 | GPS_TX     |   | P0.02   | MISO | MISO | -| P0.24 | GPS_EN     |   | P1.15   | MOSI         | MOSI | -| P1.00 | BUTTON_PIN |   | P1.13   | CS           | CS   | -| P0.11 | SCL         |   | P1.11   | SCK         | SCK | -| P1.04 | SDA         |   | P0.10   | DIO1/IRQ     | DIO1 | -| P1.06 | Free pin   |   | P0.09   | RESET       | RST | -|       |             |   |         |             | | -|       | Mid board   |   |         | Internal     | | -| P1.01 | Free pin   |   | 0.15     | LED         | | -| P1.02 | Free pin   |   | 0.13     | 3V3_EN       | | -| P1.07 | Free pin   |   |         |             | | +| Gnd   |             |   | vbat     |             | | +| P0.06 | Serial2 RX |   | vbat     |             | | +| P0.08 | Serial2 TX |   | Gnd     |             | | +| Gnd   |             |   | reset   |             | | +| Gnd   |             |   | ext_vcc | *see 0.13   | | +| P0.17 | RXEN       |   | P0.31   | BATTERY_PIN | | +| P0.20 | GPS_RX     |   | P0.29   | BUSY         | DIO0 | +| P0.22 | GPS_TX     |   | P0.02   | MISO | MISO | +| P0.24 | GPS_EN     |   | P1.15   | MOSI         | MOSI | +| P1.00 | BUTTON_PIN |   | P1.13   | CS           | CS   | +| P0.11 | SCL         |   | P1.11   | SCK         | SCK | +| P1.04 | SDA         |   | P0.10   | DIO1/IRQ     | DIO1 | +| P1.06 | Free pin   |   | P0.09   | RESET       | RST | +|       |             |   |         |             | | +|       | Mid board   |   |         | Internal     | | +| P1.01 | Free pin   |   | 0.15     | LED         | | +| P1.02 | Free pin   |   | 0.13     | 3V3_EN       | | +| P1.07 | Free pin   |   |         |             | | */ // Number of pins defined in PinDescription array @@ -175,7 +175,7 @@ settings. | NiceRF | Lora1262 | yes | Int | | | Waveshare | Core1262-HF | yes | Ext | | | Waveshare | LoRa Node Module | yes | Int | | -| Seeed | Wio-SX1262 | yes | Int | Sooooo cute! | +| Seeed | Wio-SX1262 | yes | Ext | Cute! DIO2/TXEN are not exposed | | AI-Thinker | RA-02 | No | Int | SX1278 **433mhz band only** | | RF Solutions | RFM95 | No | Int | Untested | | Ebyte | E80-900M2213S | Yes | Int | LR1121 radio | From 9db51a72a4459357af28d112baaebe91c0e0c39f Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Thu, 6 Feb 2025 21:11:17 +0100 Subject: [PATCH 157/381] Fix T-Deck/T-Watch no BT (#5998) fixes #5997 --- src/mesh/NodeDB.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 4a01e0d41..9caa03928 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -407,7 +407,7 @@ bool NodeDB::resetRadioConfig(bool factory_reset) rebootAtMsec = millis() + (5 * 1000); } -#if (defined(T_DECK) || defined(T_WATCH_S3) || defined(UNPHONE) || defined(PICOMPUTER_S3)) && defined(HAS_TFT) +#if (defined(T_DECK) || defined(T_WATCH_S3) || defined(UNPHONE) || defined(PICOMPUTER_S3)) && HAS_TFT // as long as PhoneAPI shares BT and TFT app switch BT off config.bluetooth.enabled = false; if (moduleConfig.external_notification.nag_timeout == 60) @@ -1528,4 +1528,4 @@ void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, co LOG_ERROR("A critical failure occurred, portduino is exiting"); exit(2); #endif -} \ No newline at end of file +} From cb0519dd9ce9b19945a791f67ac6b81bf88567b6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 14:11:32 -0600 Subject: [PATCH 158/381] [create-pull-request] automated change (#5989) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- debian/changelog | 5 +++-- version.properties | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1b371296b..3ec57b805 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,9 @@ -meshtasticd (2.5.21.0) UNRELEASED; urgency=medium +meshtasticd (2.5.22.0) UNRELEASED; urgency=medium * Initial packaging * GitHub Actions Automatic version bump * GitHub Actions Automatic version bump * GitHub Actions Automatic version bump + * GitHub Actions Automatic version bump - -- Austin Lane Sat, 25 Jan 2025 01:39:16 +0000 + -- Austin Lane Wed, 05 Feb 2025 01:10:33 +0000 diff --git a/version.properties b/version.properties index efc42428c..2e207e21e 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 5 -build = 21 +build = 22 From 4a6a0efcfd286bc0a2c19e91b2167c6b8dd8577f Mon Sep 17 00:00:00 2001 From: lizthedeveloper <915684+lizTheDeveloper@users.noreply.github.com> Date: Thu, 6 Feb 2025 16:29:48 -0800 Subject: [PATCH 159/381] log the nonce value at DEBUG instead of INFO (#6001) you're leaking the nonce to stdout, if your logs are routed to a folder, this logs the nonce every time, leading to replay attack surface area being higher. Changed to debug. --- src/mesh/CryptoEngine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/CryptoEngine.cpp b/src/mesh/CryptoEngine.cpp index 1624ab0d5..4613a6218 100644 --- a/src/mesh/CryptoEngine.cpp +++ b/src/mesh/CryptoEngine.cpp @@ -74,7 +74,7 @@ bool CryptoEngine::encryptCurve25519(uint32_t toNode, uint32_t fromNode, meshtas auth = bytesOut + numBytes; memcpy((uint8_t *)(auth + 8), &extraNonceTmp, sizeof(uint32_t)); // do not use dereference on potential non aligned pointers : *extraNonce = extraNonceTmp; - LOG_INFO("Random nonce value: %d", extraNonceTmp); + LOG_DEBUG("Random nonce value: %d", extraNonceTmp); if (remotePublic.size == 0) { LOG_DEBUG("Node %d or their public_key not found", toNode); return false; From 4e8c4f0d558e8b9ed852f9fbb60fc5ab0c89864a Mon Sep 17 00:00:00 2001 From: dylanli Date: Fri, 7 Feb 2025 16:02:56 +0800 Subject: [PATCH 160/381] T1000-E hardware updates and GPS positioning accuracy optimisation (#6003) * T1000-E button setting update * T1000-E GNSS lock error fix * T1000-E GNSS improve detection success --------- Co-authored-by: WayenWeng --- src/gps/GPS.cpp | 22 ++++++++++++++++++++++ variants/tracker-t1000-e/variant.h | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 863f956cf..c2aae0381 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -449,7 +449,22 @@ bool GPS::setup() if (!didSerialInit) { int msglen = 0; if (tx_gpio && gnssModel == GNSS_MODEL_UNKNOWN) { +#ifdef TRACKER_T1000_E + // add power up/down strategy, improve ag3335 detection success + digitalWrite(PIN_GPS_EN, LOW); + delay(500); + digitalWrite(GPS_VRTC_EN, LOW); + delay(1000); + digitalWrite(GPS_VRTC_EN, HIGH); + delay(500); + digitalWrite(PIN_GPS_EN, HIGH); + delay(1000); +#endif +#ifdef TRACKER_T1000_E + if (probeTries < 5) { +#else if (probeTries < 2) { +#endif LOG_DEBUG("Probe for GPS at %d", serialSpeeds[speedSelect]); gnssModel = probe(serialSpeeds[speedSelect]); if (gnssModel == GNSS_MODEL_UNKNOWN) { @@ -460,7 +475,11 @@ bool GPS::setup() } } // Rare Serial Speeds +#ifdef TRACKER_T1000_E + if (probeTries == 5) { +#else if (probeTries == 2) { +#endif LOG_DEBUG("Probe for GPS at %d", rareSerialSpeeds[speedSelect]); gnssModel = probe(rareSerialSpeeds[speedSelect]); if (gnssModel == GNSS_MODEL_UNKNOWN) { @@ -772,6 +791,9 @@ void GPS::setPowerState(GPSPowerState newState, uint32_t sleepTime) setPowerPMU(true); // Power (PMU): on writePinStandby(false); // Standby (pin): awake (not standby) setPowerUBLOX(true); // Standby (UBLOX): awake +#ifdef GNSS_AIROHA + lastFixStartMsec = 0; +#endif break; case GPS_SOFTSLEEP: diff --git a/variants/tracker-t1000-e/variant.h b/variants/tracker-t1000-e/variant.h index 6a1f99600..e65f26c93 100644 --- a/variants/tracker-t1000-e/variant.h +++ b/variants/tracker-t1000-e/variant.h @@ -55,7 +55,7 @@ extern "C" { #define BUTTON_PIN (0 + 6) // P0.06 #define BUTTON_ACTIVE_LOW false #define BUTTON_ACTIVE_PULLUP false -#define BUTTON_SENSE_TYPE 0x6 +#define BUTTON_SENSE_TYPE 0x5 // enable input pull-down #define HAS_WIRE 1 From d70a9392affb9ace3c3c32af9acc8129ab6976b7 Mon Sep 17 00:00:00 2001 From: ChangYanChu Date: Sat, 8 Feb 2025 20:03:44 +0800 Subject: [PATCH 161/381] improve UTF-8 string handling in JSONValue (#6011) ```text feat(json): improve UTF-8 string handling in JSONValue - Add proper UTF-8 multi-byte character sequence handling - Add boundary checks for UTF-8 sequences - Keep original code structure and flow - Add detailed comments for UTF-8 processing logic This change improves the robustness of JSON string handling while maintaining compatibility with existing code. --- src/serialization/JSONValue.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/serialization/JSONValue.cpp b/src/serialization/JSONValue.cpp index 64dc10abe..20cd90373 100644 --- a/src/serialization/JSONValue.cpp +++ b/src/serialization/JSONValue.cpp @@ -850,18 +850,26 @@ std::string JSONValue::StringifyString(const std::string &str) str_out += "\\r"; } else if (chr == '\t') { str_out += "\\t"; - } else if (chr < ' ' || chr > 126) { - str_out += "\\u"; - for (int i = 0; i < 4; i++) { - int value = (chr >> 12) & 0xf; - if (value >= 0 && value <= 9) - str_out += (char)('0' + value); - else if (value >= 10 && value <= 15) - str_out += (char)('A' + (value - 10)); - chr <<= 4; - } + } else if (chr < 0x20 || chr == 0x7F) { + char buf[7]; + snprintf(buf, sizeof(buf), "\\u%04x", chr); + str_out += buf; + } else if (chr < 0x80) { + str_out += chr; } else { str_out += chr; + size_t remain = str.end() - iter - 1; + if ((chr & 0xE0) == 0xC0 && remain >= 1) { + ++iter; + str_out += *iter; + } else if ((chr & 0xF0) == 0xE0 && remain >= 2) { + str_out += *(++iter); + str_out += *(++iter); + } else if ((chr & 0xF8) == 0xF0 && remain >= 3) { + str_out += *(++iter); + str_out += *(++iter); + str_out += *(++iter); + } } ++iter; From 39e45d90e16db0352660a912247e27620515ab91 Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Mon, 10 Feb 2025 09:59:13 +0200 Subject: [PATCH 162/381] Create display-x11.yaml (#6021) --- bin/config.d/display-x11.yaml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 bin/config.d/display-x11.yaml diff --git a/bin/config.d/display-x11.yaml b/bin/config.d/display-x11.yaml new file mode 100644 index 000000000..b22df1cb0 --- /dev/null +++ b/bin/config.d/display-x11.yaml @@ -0,0 +1,4 @@ +Display: + Panel: X11 + Width: 480 + Height: 480 From 96262b106c579cccf1fde24a4e8aa771e5f34ae1 Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Mon, 10 Feb 2025 11:53:58 +0200 Subject: [PATCH 163/381] Revert "Create display-x11.yaml (#6021)" (#6022) This reverts commit 39e45d90e16db0352660a912247e27620515ab91. --- bin/config.d/display-x11.yaml | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 bin/config.d/display-x11.yaml diff --git a/bin/config.d/display-x11.yaml b/bin/config.d/display-x11.yaml deleted file mode 100644 index b22df1cb0..000000000 --- a/bin/config.d/display-x11.yaml +++ /dev/null @@ -1,4 +0,0 @@ -Display: - Panel: X11 - Width: 480 - Height: 480 From 7c4bf38647691aa04aaea88f22b1b96d018b3ca2 Mon Sep 17 00:00:00 2001 From: Austin Date: Mon, 10 Feb 2025 15:29:16 -0500 Subject: [PATCH 164/381] meshtasticd flatpak: Include pio deps with release (#6025) --- .github/workflows/main_matrix.yml | 27 +++++++++-- .github/workflows/package_pio_deps.yml | 64 ++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/package_pio_deps.yml diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index b13866435..1dc177cc6 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -135,6 +135,12 @@ jobs: build_location: local secrets: inherit + package-pio-deps-native: + uses: ./.github/workflows/package_pio_deps.yml + with: + pio_env: native + secrets: inherit + test-native: uses: ./.github/workflows/test_native.yml @@ -279,7 +285,10 @@ jobs: if: ${{ github.event_name == 'workflow_dispatch' }} outputs: upload_url: ${{ steps.create_release.outputs.upload_url }} - needs: [gather-artifacts, build-debian-src] + needs: + - gather-artifacts + - build-debian-src + - package-pio-deps-native steps: - name: Checkout uses: actions/checkout@v4 @@ -315,17 +324,27 @@ jobs: merge-multiple: true path: ./output/debian-src - - name: Zip source deb + - name: Download native pio deps + uses: actions/download-artifact@v4 + with: + pattern: platformio-deps-native-${{ steps.version.outputs.long }} + merge-multiple: true + path: ./output/pio-deps-native + + - name: Zip linux sources working-directory: output - run: zip -j -9 -r ./meshtasticd-${{ steps.version.outputs.deb }}-src.zip ./debian-src + run: | + zip -j -9 -r ./meshtasticd-${{ steps.version.outputs.deb }}-src.zip ./debian-src + zip -j -9 -r ./platformio-deps-native-${{ steps.version.outputs.long }}.zip ./pio-deps-native # For diagnostics - name: Display structure of downloaded files run: ls -lR - - name: Add source deb to release + - name: Add linux sources to release run: | gh release upload v${{ steps.version.outputs.long }} ./output/meshtasticd-${{ steps.version.outputs.deb }}-src.zip + gh release upload v${{ steps.version.outputs.long }} ./output/platformio-deps-native-${{ steps.version.outputs.long }}.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/package_pio_deps.yml b/.github/workflows/package_pio_deps.yml new file mode 100644 index 000000000..38c0e8104 --- /dev/null +++ b/.github/workflows/package_pio_deps.yml @@ -0,0 +1,64 @@ +name: Package PlatformIO Library Dependencies +# trunk-ignore-all(checkov/CKV_GHA_7): Allow workflow_dispatch inputs for testing + +on: + workflow_call: + inputs: + pio_env: + description: PlatformIO environment to target + required: true + type: string + workflow_dispatch: + inputs: + pio_env: + description: PlatformIO environment to target + required: true + type: string + +permissions: + contents: write + packages: write + +jobs: + pkg-pio-libdeps: + runs-on: ubuntu-24.04 + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: 3.x + + - name: Install deps + shell: bash + run: | + pip install platformio + + - name: Get release version string + run: | + echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + + - name: Fetch libdeps + shell: bash + run: |- + platformio pkg install -e ${{ inputs.pio_env }} + platformio pkg install -e ${{ inputs.pio_env }} -t platformio/tool-scons@4.40502.0 + env: + PLATFORMIO_LIBDEPS_DIR: pio/libdeps + PLATFORMIO_PACKAGES_DIR: pio/packages + PLATFORMIO_CORE_DIR: pio/core + + - name: Store binaries as an artifact + uses: actions/upload-artifact@v4 + with: + name: platformio-deps-${{ inputs.pio_env }}-${{ steps.version.outputs.long }} + overwrite: true + path: | + pio/* From da1d78c8822a084e9473ff03091fccb3b5ea5228 Mon Sep 17 00:00:00 2001 From: Jason P Date: Mon, 10 Feb 2025 14:30:43 -0600 Subject: [PATCH 165/381] Add support for 12- and 24-hour clock, Minor Settings Frame Adjustment (#5988) * 12- or 24-hour clock work in progress * 12- and 24-hour added to Settings Frame. Also some adjustments to screen layout. * Updated Uptime wording to be "Up" to fit within screen real estate * Removed label from uptime to conserve additional space --------- Co-authored-by: Ben Meadors --- src/graphics/Screen.cpp | 48 +++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 4ee49e3c0..0c18f3287 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1489,22 +1489,21 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_ bearingToOther -= myHeading; screen->drawNodeHeading(display, compassX, compassY, compassDiam, bearingToOther); - float bearingToOtherDegrees = (bearingToOther < 0) ? bearingToOther + 2*PI : bearingToOther; + float bearingToOtherDegrees = (bearingToOther < 0) ? bearingToOther + 2 * PI : bearingToOther; bearingToOtherDegrees = bearingToOtherDegrees * 180 / PI; if (config.display.units == meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL) { if (d < (2 * MILES_TO_FEET)) snprintf(distStr, sizeof(distStr), "%.0fft %.0f°", d * METERS_TO_FEET, bearingToOtherDegrees); else - snprintf(distStr, sizeof(distStr), "%.1fmi %.0f°", d * METERS_TO_FEET / MILES_TO_FEET, bearingToOtherDegrees); + snprintf(distStr, sizeof(distStr), "%.1fmi %.0f°", d * METERS_TO_FEET / MILES_TO_FEET, + bearingToOtherDegrees); } else { if (d < 2000) snprintf(distStr, sizeof(distStr), "%.0fm %.0f°", d, bearingToOtherDegrees); else snprintf(distStr, sizeof(distStr), "%.1fkm %.0f°", d / 1000, bearingToOtherDegrees); } - - } } if (!hasNodeHeading) { @@ -2649,13 +2648,12 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat display->drawString(x + 1, y, String("USB")); } - auto mode = DisplayFormatters::getModemPresetDisplayName(config.lora.modem_preset, true); + // auto mode = DisplayFormatters::getModemPresetDisplayName(config.lora.modem_preset, true); - display->drawString(x + SCREEN_WIDTH - display->getStringWidth(mode), y, mode); - if (config.display.heading_bold) - display->drawString(x + SCREEN_WIDTH - display->getStringWidth(mode) - 1, y, mode); + // display->drawString(x + SCREEN_WIDTH - display->getStringWidth(mode), y, mode); + // if (config.display.heading_bold) + // display->drawString(x + SCREEN_WIDTH - display->getStringWidth(mode) - 1, y, mode); - // Line 2 uint32_t currentMillis = millis(); uint32_t seconds = currentMillis / 1000; uint32_t minutes = seconds / 60; @@ -2668,6 +2666,9 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat display->setColor(WHITE); + // Setup string to assemble analogClock string + std::string analogClock = ""; + // Show uptime as days, hours, minutes OR seconds std::string uptime = screen->drawTimeDelta(days, hours, minutes, seconds); @@ -2684,17 +2685,36 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat int min = (hms % SEC_PER_HOUR) / SEC_PER_MIN; int sec = (hms % SEC_PER_HOUR) % SEC_PER_MIN; // or hms % SEC_PER_MIN - char timebuf[10]; - snprintf(timebuf, sizeof(timebuf), " %02d:%02d:%02d", hour, min, sec); - uptime += timebuf; + char timebuf[12]; + + if (config.display.use_12h_clock) { + std::string meridiem = "am"; + if (hour >= 12) { + if (hour > 12) + hour -= 12; + meridiem = "pm"; + } + if (hour == 00) { + hour = 12; + } + snprintf(timebuf, sizeof(timebuf), "%d:%02d:%02d%s", hour, min, sec, meridiem.c_str()); + } else { + snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d", hour, min, sec); + } + analogClock += timebuf; } - display->drawString(x, y + FONT_HEIGHT_SMALL * 1, uptime.c_str()); + // Line 1 + display->drawString(x + SCREEN_WIDTH - display->getStringWidth(uptime.c_str()), y, uptime.c_str()); + + // Line 2 + display->drawString(x, y + FONT_HEIGHT_SMALL * 1, analogClock.c_str()); // Display Channel Utilization char chUtil[13]; snprintf(chUtil, sizeof(chUtil), "ChUtil %2.0f%%", airTime->channelUtilizationPercent()); display->drawString(x + SCREEN_WIDTH - display->getStringWidth(chUtil), y + FONT_HEIGHT_SMALL * 1, chUtil); + #if HAS_GPS if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED) { // Line 3 @@ -2827,4 +2847,4 @@ int Screen::handleAdminMessage(const meshtastic_AdminMessage *arg) } // namespace graphics #else graphics::Screen::Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY) {} -#endif // HAS_SCREEN +#endif // HAS_SCREEN \ No newline at end of file From 4e2b47cc67d33d399350a2947c4fe61329801cb5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2025 15:02:42 -0600 Subject: [PATCH 166/381] [create-pull-request] automated change (#6027) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/module_config.pb.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/protobufs b/protobufs index b80785b16..068646653 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit b80785b16bc0d243b97917998706e7bf209cd9d0 +Subproject commit 068646653e8375fc145988026ad242a3cf70f7ab diff --git a/src/mesh/generated/meshtastic/module_config.pb.h b/src/mesh/generated/meshtastic/module_config.pb.h index 697b965c5..848b010d3 100644 --- a/src/mesh/generated/meshtastic/module_config.pb.h +++ b/src/mesh/generated/meshtastic/module_config.pb.h @@ -347,7 +347,7 @@ typedef struct _meshtastic_ModuleConfig_TelemetryConfig { bool health_screen_enabled; } meshtastic_ModuleConfig_TelemetryConfig; -/* TODO: REPLACE */ +/* Canned Messages Module Config */ typedef struct _meshtastic_ModuleConfig_CannedMessageConfig { /* Enable the rotary encoder #1. This is a 'dumb' encoder sending pulses on both A and B pins while rotating. */ bool rotary1_enabled; From 8427072d791b5547ec029534e615da1e45b740f3 Mon Sep 17 00:00:00 2001 From: Austin Date: Mon, 10 Feb 2025 18:58:02 -0500 Subject: [PATCH 167/381] meshtasticd: include `.hidden` (.git) dirs in pio-deps (#6028) --- .github/workflows/package_pio_deps.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/package_pio_deps.yml b/.github/workflows/package_pio_deps.yml index 38c0e8104..9f535b7b1 100644 --- a/.github/workflows/package_pio_deps.yml +++ b/.github/workflows/package_pio_deps.yml @@ -60,5 +60,6 @@ jobs: with: name: platformio-deps-${{ inputs.pio_env }}-${{ steps.version.outputs.long }} overwrite: true + include-hidden-files: true path: | pio/* From d1fa27d3537d5b78d0af96fdbcbec580dee36b6a Mon Sep 17 00:00:00 2001 From: Austin Date: Mon, 10 Feb 2025 21:35:06 -0500 Subject: [PATCH 168/381] small fix: don't junk the zip for pio-deps (#6029) --- .github/workflows/main_matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 1dc177cc6..7062ef525 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -335,7 +335,7 @@ jobs: working-directory: output run: | zip -j -9 -r ./meshtasticd-${{ steps.version.outputs.deb }}-src.zip ./debian-src - zip -j -9 -r ./platformio-deps-native-${{ steps.version.outputs.long }}.zip ./pio-deps-native + zip -9 -r ./platformio-deps-native-${{ steps.version.outputs.long }}.zip ./pio-deps-native # For diagnostics - name: Display structure of downloaded files From 7fdd262d55bd694fe9a347ab8c946bd080bb5bce Mon Sep 17 00:00:00 2001 From: nwilde1590 Date: Tue, 11 Feb 2025 00:02:21 -0600 Subject: [PATCH 169/381] Added custom OCV array values for T1000-E (#6031) --- src/power.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/power.h b/src/power.h index 176e16ee5..e9c0deb7c 100644 --- a/src/power.h +++ b/src/power.h @@ -24,6 +24,8 @@ #define OCV_ARRAY 1400, 1300, 1280, 1270, 1260, 1250, 1240, 1230, 1210, 1150, 1000 #elif defined(CELL_TYPE_LTO) #define OCV_ARRAY 2700, 2560, 2540, 2520, 2500, 2460, 2420, 2400, 2380, 2320, 1500 +#elif defined(TRACKER_T1000_E) +#define OCV_ARRAY 4190, 4078, 4017, 3969, 3887, 3818, 3798, 3791, 3766, 3712, 3100 #else // LiIon #define OCV_ARRAY 4190, 4050, 3990, 3890, 3800, 3720, 3630, 3530, 3420, 3300, 3100 #endif From eb650a6adbc4a83ca1df909cec80dd6a56dfd2a9 Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Tue, 11 Feb 2025 17:34:37 +0100 Subject: [PATCH 170/381] set TCXO to 2.4V (#6036) --- variants/seeed-sensecap-indicator/variant.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/seeed-sensecap-indicator/variant.h b/variants/seeed-sensecap-indicator/variant.h index c5fc685cd..58eed7d96 100644 --- a/variants/seeed-sensecap-indicator/variant.h +++ b/variants/seeed-sensecap-indicator/variant.h @@ -71,7 +71,7 @@ #define SX126X_DIO2_AS_RF_SWITCH #define TCXO_OPTIONAL // handle Indicator V1 and V2 -#define SX126X_DIO3_TCXO_VOLTAGE 1.8 +#define SX126X_DIO3_TCXO_VOLTAGE 2.4 #define USE_VIRTUAL_KEYBOARD 1 #define DISPLAY_CLOCK_FRAME 1 From 495f69cf907d03619289e8f6b8563a91fcc9a5e7 Mon Sep 17 00:00:00 2001 From: Austin Date: Tue, 11 Feb 2025 19:57:23 -0500 Subject: [PATCH 171/381] Trunk: Trailing commas begone! (#6038) --- .trunk/configs/.prettierrc | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .trunk/configs/.prettierrc diff --git a/.trunk/configs/.prettierrc b/.trunk/configs/.prettierrc new file mode 100644 index 000000000..edf9dbc9c --- /dev/null +++ b/.trunk/configs/.prettierrc @@ -0,0 +1,10 @@ +{ + "overrides": [ + { + "files": "userPrefs.jsonc", + "options": { + "trailingComma": "none" + } + } + ] +} From 01935ea35e1c2c1bcdb51757e63751e06a5d1899 Mon Sep 17 00:00:00 2001 From: porkcube Date: Fri, 14 Feb 2025 07:50:28 -0500 Subject: [PATCH 172/381] Add XIAO nRF52840 + Wio SX1262 DIY Variant (#5976) * added xiao nRF52840 + xiao wio sx1262 DIY variant * fix path / make buildy buildy * pcf cruft from personal hw --------- Co-authored-by: Ben Meadors --- variants/diy/platformio.ini | 16 +- .../seeed-xiao-nrf52840-wio-sx1262/README.md | 43 ++++ .../variant.cpp | 55 +++++ .../seeed-xiao-nrf52840-wio-sx1262/variant.h | 188 ++++++++++++++++++ 4 files changed, 301 insertions(+), 1 deletion(-) create mode 100644 variants/diy/seeed-xiao-nrf52840-wio-sx1262/README.md create mode 100644 variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.cpp create mode 100644 variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.h diff --git a/variants/diy/platformio.ini b/variants/diy/platformio.ini index b7f3f6a92..229f48bbf 100644 --- a/variants/diy/platformio.ini +++ b/variants/diy/platformio.ini @@ -70,6 +70,20 @@ lib_deps = ${nrf52840_base.lib_deps} debug_tool = jlink +; Seeed XIAO nRF52840 + XIAO Wio SX1262 DIY +[env:seeed-xiao-nrf52840-wio-sx1262] +board = xiao_ble_sense +extends = nrf52840_base +board_level = extra +build_flags = ${nrf52840_base.build_flags} -Ivariants/diy/seeed-xiao-nrf52840-wio-sx1262 -D PRIVATE_HW + -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 + -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" +board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/diy/seeed-xiao-nrf52840-wio-sx1262> +lib_deps = + ${nrf52840_base.lib_deps} +debug_tool = jlink + ; NanoVHF T-Energy-S3 + E22(0)-xxxM - DIY [env:t-energy-s3_e22] extends = esp32s3_base @@ -86,4 +100,4 @@ build_flags = -D BOARD_HAS_PSRAM -D ARDUINO_USB_MODE=0 -D ARDUINO_USB_CDC_ON_BOOT=1 - -I variants/diy/t-energy-s3_e22 + -I variants/diy/t-energy-s3_e22 \ No newline at end of file diff --git a/variants/diy/seeed-xiao-nrf52840-wio-sx1262/README.md b/variants/diy/seeed-xiao-nrf52840-wio-sx1262/README.md new file mode 100644 index 000000000..194c53434 --- /dev/null +++ b/variants/diy/seeed-xiao-nrf52840-wio-sx1262/README.md @@ -0,0 +1,43 @@ +# XIAO nRF52840 + XIAO Wio SX1262 + +For a mere doubling in price you too can swap out the XIAO ESP32C3 for a XIAO nRF52840, stack the Wio SX1262 radio board either above or underneath the nRF52840, solder the pins, and achieve a massive improvement in battery life! + +I'm not really sure why else you would want to as the ESP32C3 is perfectly cromulent, easily connects to the Wio SX1262 via the B2B connector and has an onboard IPEX connector for the included Bluetooth antenna. So you'll also lose BT range, but you will also have working ADC for the battery in Meshtastic and also have an ESP32C3 to use for something else! + +If you're still reading you are clearly gonna do it anyway, so...mount the Wio SX1262 either on top or underneath depending on your preference. The `variant.h` will work with either configuration though it does map the Wio SX1262's button to nRF52840 Pin `D5` as it can still be used as a user button and it's nice to be able to gracefully shutdown a node by holding it down for 5 seconds. + +If you do decide to wire up the button, orient it so looking straight-down at the Wio SX1262 the radio chip is at the bottom, button in the middle and the hole is at the top - the **left** side of the button should be soldered to `GND` (e.g. the 2nd pin down the top on the **right** row of pins) and the **right** side of the button should be soldered to `D5` (e.g. the 2nd pin up from the button on the **left** row of pins.). This mirrors the original wiring and wiring it in reverse could end up connecting GND to voltage and that's no beuno. + +Serial Pins remain available on `D6` (TX) and `D7` (RX) should you want to use them, The same pins could be repurposed for `i2c` if you would like to have that instead of serial, in `variant.h` you would just need to change: + +```c++ +// RX and TX pins +#define PIN_SERIAL1_RX (6) +#define PIN_SERIAL1_TX (7) +``` + +to + +```c++ +// RX and TX pins +#define PIN_SERIAL1_RX (-1) +#define PIN_SERIAL1_TX (-1) +``` + +and + +```c++ +#define PIN_WIRE_SDA (-1) +#define PIN_WIRE_SCL (-1) +// #define PIN_WIRE_SDA (6) +// #define PIN_WIRE_SCL (7) +``` + +to + +```c++ +#define PIN_WIRE_SDA (6) +#define PIN_WIRE_SCL (7) +``` + +If you wanted both serial and i2c you could even go so far as to use the pads for the PDM mic which is missing on the non-sense board (`P1.00` / `P0.16`)... or move up to the nRF52840 Plus which has even more pins available but hasn't been checked/confirmed if it follows the same pin mapping as the non-plus. diff --git a/variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.cpp b/variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.cpp new file mode 100644 index 000000000..2c6c3e539 --- /dev/null +++ b/variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.cpp @@ -0,0 +1,55 @@ +#include "variant.h" +#include "nrf.h" +#include "wiring_constants.h" +#include "wiring_digital.h" + +const uint32_t g_ADigitalPinMap[] = { + // D0 .. D13 + 2, // D0 is P0.02 (A0) + 3, // D1 is P0.03 (A1) + 28, // D2 is P0.28 (A2) + 29, // D3 is P0.29 (A3) + 4, // D4 is P0.04 (A4,SDA) + 5, // D5 is P0.05 (A5,SCL) + 43, // D6 is P1.11 (TX) + 44, // D7 is P1.12 (RX) + 45, // D8 is P1.13 (SCK) + 46, // D9 is P1.14 (MISO) + 47, // D10 is P1.15 (MOSI) + + // LEDs + 26, // D11 is P0.26 (LED RED) + 6, // D12 is P0.06 (LED BLUE) + 30, // D13 is P0.30 (LED GREEN) + 14, // D14 is P0.14 (READ_BAT) + + // LSM6DS3TR + 40, // D15 is P1.08 (6D_PWR) + 27, // D16 is P0.27 (6D_I2C_SCL) + 7, // D17 is P0.07 (6D_I2C_SDA) + 11, // D18 is P0.11 (6D_INT1) + + // MIC + 42, // 17,//42, // D19 is P1.10 (MIC_PWR) + 32, // 26,//32, // D20 is P1.00 (PDM_CLK) + 16, // 25,//16, // D21 is P0.16 (PDM_DATA) + + // BQ25100 + 13, // D22 is P0.13 (HICHG) + 17, // D23 is P0.17 (~CHG) + + // + 21, // D24 is P0.21 (QSPI_SCK) + 25, // D25 is P0.25 (QSPI_CSN) + 20, // D26 is P0.20 (QSPI_SIO_0 DI) + 24, // D27 is P0.24 (QSPI_SIO_1 DO) + 22, // D28 is P0.22 (QSPI_SIO_2 WP) + 23, // D29 is P0.23 (QSPI_SIO_3 HOLD) + + // NFC + 9, // D30 is P0.09 (NFC1) + 10, // D31 is P0.10 (NFC2) + + // VBAT + 31, // D32 is P0.10 (VBAT) +}; \ No newline at end of file diff --git a/variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.h b/variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.h new file mode 100644 index 000000000..d5dfc3fab --- /dev/null +++ b/variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.h @@ -0,0 +1,188 @@ +// basically xiao_ble with pins remapped for: +// Seeed XIAO nRF52840 : https://www.seeedstudio.com/Seeed-XIAO-BLE-nRF52840-p-5201.html +// Seeed Wio SX1626 : https://www.seeedstudio.com/Wio-SX1262-with-XIAO-ESP32S3-p-5982.html + +#ifndef _SEEED_XIAO_NRF52840_SENSE_H_ +#define _SEEED_XIAO_NRF52840_SENSE_H_ + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +#define PINS_COUNT (33) +#define NUM_DIGITAL_PINS (33) +#define NUM_ANALOG_INPUTS (8) // A6 is used for battery, A7 is analog reference +#define NUM_ANALOG_OUTPUTS (0) + +// LEDs +// ---- +#define LED_RED 11 +#define LED_BLUE 12 +#define LED_GREEN 13 + +#define PIN_LED1 LED_GREEN +#define PIN_LED2 LED_BLUE +#define PIN_LED3 LED_RED + +#define PIN_LED PIN_LED1 +#define LED_PWR (PINS_COUNT) + +#define LED_BUILTIN PIN_LED +#define LED_STATE_ON 1 // State when LED is lit + +// XIAO Wio-SX1262 Shield User button +#define PIN_BUTTON1 5 +#define BUTTON_NEED_PULLUP + +// Digital Pins +// ------------ +#define D0 (0ul) +#define D1 (1ul) +#define D2 (2ul) +#define D3 (3ul) +#define D4 (4ul) +#define D5 (5ul) +#define D6 (6ul) +#define D7 (7ul) +#define D8 (8ul) +#define D9 (9ul) +#define D10 (10ul) + +// Analog Pins +// ----------- +#define PIN_A0 (0) +#define PIN_A1 (1) +#define PIN_A2 (2) +#define PIN_A3 (3) +#define PIN_A4 (4) +#define PIN_A5 (5) +#define PIN_VBAT (32) +#define VBAT_ENABLE (14) + +static const uint8_t A0 = PIN_A0; +static const uint8_t A1 = PIN_A1; +static const uint8_t A2 = PIN_A2; +static const uint8_t A3 = PIN_A3; +static const uint8_t A4 = PIN_A4; +static const uint8_t A5 = PIN_A5; +#define ADC_RESOLUTION 12 + +// Other Pins +// ---------- +#define PIN_NFC1 (30) +#define PIN_NFC2 (31) + +// RX and TX pins +#define PIN_SERIAL1_RX (6) +#define PIN_SERIAL1_TX (7) +// complains if not defined +#define PIN_SERIAL2_RX (-1) +#define PIN_SERIAL2_TX (-1) + +// 4 is used as RF_SW and 5 for USR button so... +#define PIN_WIRE_SDA (-1) +#define PIN_WIRE_SCL (-1) +// #define PIN_WIRE_SDA (6) +// #define PIN_WIRE_SCL (7) + +static const uint8_t SDA = PIN_WIRE_SDA; +static const uint8_t SCL = PIN_WIRE_SCL; + +// SPI SX1262 +// ---------- +#define SPI_SX1262 +#ifdef SPI_SX1262 +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (9) +#define PIN_SPI_MOSI (10) +#define PIN_SPI_SCK (8) + +static const uint8_t SS = D3; +static const uint8_t MOSI = PIN_SPI_MOSI; +static const uint8_t MISO = PIN_SPI_MISO; +static const uint8_t SCK = PIN_SPI_SCK; + +// supported modules list +#define USE_SX1262 + +// common pinouts for SX126X modules +#define SX126X_CS D3 +#define SX126X_DIO1 D0 +#define SX126X_BUSY D1 +#define SX126X_RESET D2 + +// DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_RXEN 38 +#define SX126X_TXEN RADIOLIB_NC +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 +#endif + +// Wire Interfaces +// ------------------- +#define WIRE_INTERFACES_COUNT 1 // 2 + +// Sense version has IMU and PDM Mic +// #define XIAO_SENSE +#ifndef XIAO_SENSE +// 6 DoF IMU +#define PIN_LSM6DS3TR_C_POWER (15) +#define PIN_LSM6DS3TR_C_INT1 (18) +// PDM Interfaces +// --------------- +#define PIN_PDM_PWR (19) +#define PIN_PDM_CLK (20) +#define PIN_PDM_DIN (21) +#endif + +// QSPI Pins +// --------- +#define PIN_QSPI_SCK (24) +#define PIN_QSPI_CS (25) +#define PIN_QSPI_IO0 (26) +#define PIN_QSPI_IO1 (27) +#define PIN_QSPI_IO2 (28) +#define PIN_QSPI_IO3 (29) + +// On-board QSPI Flash +// ------------------- +#define EXTERNAL_FLASH_DEVICES P25Q16H +#define EXTERNAL_FLASH_USE_QSPI + +// Battery +// ------- +// P0_14 = 14 Reads battery voltage from divider on signal board. +// PIN_VBAT is reading voltage divider on XIAO and is program pin 32 / or P0.31 +#define BAT_READ 14 +#define BATTERY_SENSE_RESOLUTION_BITS 10 +#define CHARGE_LED 23 // P0_17 = 17 D23 YELLOW CHARGE LED +#define HICHG 22 // P0_13 = 13 D22 Charge-select pin for Lipo for 100 mA instead of default 50mA charge + +// The battery sense is hooked to pin A0 (5) +#define BATTERY_PIN PIN_VBAT // PIN_A0 + +// ratio of voltage divider = 3.0 (R17=1M, R18=510k) +#define ADC_MULTIPLIER 3 // 3.0 + a bit for being optimistic + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#endif \ No newline at end of file From 9b46cb4ef08688a2f424c76d8425561e4f5db844 Mon Sep 17 00:00:00 2001 From: Woutvstk <119763111+Woutvstk@users.noreply.github.com> Date: Fri, 14 Feb 2025 19:53:22 +0100 Subject: [PATCH 173/381] Rak4631 remove spi1 (#6042) * Removed non-existant SPI1 interface on rak4631 * trunk fmt --- src/detect/einkScan.h | 16 ++++++++-------- variants/rak4631/variant.h | 18 +++++++----------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/detect/einkScan.h b/src/detect/einkScan.h index d20c7b6e5..5bc218d00 100644 --- a/src/detect/einkScan.h +++ b/src/detect/einkScan.h @@ -6,28 +6,28 @@ void d_writeCommand(uint8_t c) { - SPI1.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0)); + SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0)); if (PIN_EINK_DC >= 0) digitalWrite(PIN_EINK_DC, LOW); if (PIN_EINK_CS >= 0) digitalWrite(PIN_EINK_CS, LOW); - SPI1.transfer(c); + SPI.transfer(c); if (PIN_EINK_CS >= 0) digitalWrite(PIN_EINK_CS, HIGH); if (PIN_EINK_DC >= 0) digitalWrite(PIN_EINK_DC, HIGH); - SPI1.endTransaction(); + SPI.endTransaction(); } void d_writeData(uint8_t d) { - SPI1.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0)); + SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0)); if (PIN_EINK_CS >= 0) digitalWrite(PIN_EINK_CS, LOW); - SPI1.transfer(d); + SPI.transfer(d); if (PIN_EINK_CS >= 0) digitalWrite(PIN_EINK_CS, HIGH); - SPI1.endTransaction(); + SPI.endTransaction(); } unsigned long d_waitWhileBusy(uint16_t busy_time) @@ -53,7 +53,7 @@ unsigned long d_waitWhileBusy(uint16_t busy_time) void scanEInkDevice(void) { - SPI1.begin(); + SPI.begin(); d_writeCommand(0x22); d_writeData(0x83); d_writeCommand(0x20); @@ -62,6 +62,6 @@ void scanEInkDevice(void) LOG_DEBUG("EInk display found"); else LOG_DEBUG("EInk display not found"); - SPI1.end(); + SPI.end(); } #endif \ No newline at end of file diff --git a/variants/rak4631/variant.h b/variants/rak4631/variant.h index bc5541336..f50f3b880 100644 --- a/variants/rak4631/variant.h +++ b/variants/rak4631/variant.h @@ -107,15 +107,11 @@ static const uint8_t AREF = PIN_AREF; /* * SPI Interfaces */ -#define SPI_INTERFACES_COUNT 2 +#define SPI_INTERFACES_COUNT 1 -#define PIN_SPI_MISO (45) -#define PIN_SPI_MOSI (44) -#define PIN_SPI_SCK (43) - -#define PIN_SPI1_MISO (29) // (0 + 29) -#define PIN_SPI1_MOSI (30) // (0 + 30) -#define PIN_SPI1_SCK (3) // (0 + 3) +#define PIN_SPI_MISO (29) +#define PIN_SPI_MOSI (30) +#define PIN_SPI_SCK (3) static const uint8_t SS = 42; static const uint8_t MOSI = PIN_SPI_MOSI; @@ -130,8 +126,8 @@ static const uint8_t SCK = PIN_SPI_SCK; #define PIN_EINK_BUSY (0 + 4) #define PIN_EINK_DC (0 + 17) #define PIN_EINK_RES (-1) -#define PIN_EINK_SCLK (0 + 3) -#define PIN_EINK_MOSI (0 + 30) // also called SDI +#define PIN_EINK_SCLK PIN_SPI_SCK +#define PIN_EINK_MOSI PIN_SPI_MOSI // also called SDI // #define USE_EINK @@ -259,7 +255,7 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG #define PIN_ETHERNET_RESET 21 #define PIN_ETHERNET_SS PIN_EINK_CS -#define ETH_SPI_PORT SPI1 +#define ETH_SPI_PORT SPI #define AQ_SET_PIN 10 #ifdef __cplusplus From c83ffd4911f1edb8cb437db97346c40ac630e245 Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Fri, 14 Feb 2025 17:19:50 -0800 Subject: [PATCH 174/381] Consider the MQTT TLS remote IP when enabled. (#6058) --- src/mqtt/MQTT.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index f808a66ef..6043daa34 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -412,36 +412,28 @@ void MQTT::reconnect() const char *serverAddr = default_mqtt_address; const char *mqttUsername = default_mqtt_username; const char *mqttPassword = default_mqtt_password; + MQTTClient *clientConnection = mqttClient.get(); if (*moduleConfig.mqtt.address) { serverAddr = moduleConfig.mqtt.address; mqttUsername = moduleConfig.mqtt.username; mqttPassword = moduleConfig.mqtt.password; } -#if HAS_WIFI && !defined(ARCH_PORTDUINO) -#if !defined(CONFIG_IDF_TARGET_ESP32C6) +#if HAS_WIFI && !defined(ARCH_PORTDUINO) && !defined(CONFIG_IDF_TARGET_ESP32C6) if (moduleConfig.mqtt.tls_enabled) { // change default for encrypted to 8883 try { serverPort = 8883; wifiSecureClient.setInsecure(); - - pubSub.setClient(wifiSecureClient); LOG_INFO("Use TLS-encrypted session"); + clientConnection = &wifiSecureClient; } catch (const std::exception &e) { LOG_ERROR("MQTT ERROR: %s", e.what()); } } else { LOG_INFO("Use non-TLS-encrypted session"); - pubSub.setClient(*mqttClient); } -#else - pubSub.setClient(*mqttClient); #endif -#elif HAS_NETWORKING - pubSub.setClient(*mqttClient); -#endif - std::pair hostAndPort = parseHostAndPort(serverAddr, serverPort); serverAddr = hostAndPort.first.c_str(); serverPort = hostAndPort.second; @@ -451,13 +443,14 @@ void MQTT::reconnect() LOG_INFO("Connect directly to MQTT server %s, port: %d, username: %s, password: %s", serverAddr, serverPort, mqttUsername, mqttPassword); + pubSub.setClient(*clientConnection); bool connected = pubSub.connect(owner.id, mqttUsername, mqttPassword); if (connected) { LOG_INFO("MQTT connected"); enabled = true; // Start running background process again runASAP = true; reconnectCount = 0; - isMqttServerAddressPrivate = isPrivateIpAddress(mqttClient->remoteIP()); + isMqttServerAddressPrivate = isPrivateIpAddress(clientConnection->remoteIP()); publishNodeInfo(); sendSubscriptions(); From 50b7d6a0f7e7bac8766a8c467a9a5afad332b072 Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Fri, 14 Feb 2025 18:32:41 -0800 Subject: [PATCH 175/381] Establish MQTT connection only from MQTT::runOnce (#6057) Co-authored-by: Ben Meadors --- src/mesh/eth/ethClient.cpp | 9 --------- src/mesh/wifi/WiFiAPClient.cpp | 9 --------- src/mqtt/MQTT.h | 8 ++++---- test/test_mqtt/MQTT.cpp | 3 ++- 4 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/mesh/eth/ethClient.cpp b/src/mesh/eth/ethClient.cpp index 24c4f0db1..70c6e3fe4 100644 --- a/src/mesh/eth/ethClient.cpp +++ b/src/mesh/eth/ethClient.cpp @@ -5,9 +5,6 @@ #include "configuration.h" #include "main.h" #include "mesh/api/ethServerAPI.h" -#if !MESHTASTIC_EXCLUDE_MQTT -#include "mqtt/MQTT.h" -#endif #include "target_specific.h" #include #include @@ -72,12 +69,6 @@ static int32_t reconnectETH() ethStartupComplete = true; } -#if !MESHTASTIC_EXCLUDE_MQTT - // FIXME this is kinda yucky, instead we should just have an observable for 'wifireconnected' - if (mqtt && !moduleConfig.mqtt.proxy_to_client_enabled && !mqtt->isConnectedDirectly()) { - mqtt->reconnect(); - } -#endif } #ifndef DISABLE_NTP diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index 41de89794..d4a5dbf94 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -7,9 +7,6 @@ #include "main.h" #include "mesh/api/WiFiServerAPI.h" -#if !MESHTASTIC_EXCLUDE_MQTT -#include "mqtt/MQTT.h" -#endif #include "target_specific.h" #include #include @@ -111,12 +108,6 @@ static void onNetworkConnected() #endif APStartupComplete = true; } - - // FIXME this is kinda yucky, instead we should just have an observable for 'wifireconnected' -#ifndef MESHTASTIC_EXCLUDE_MQTT - if (mqtt) - mqtt->reconnect(); -#endif } static int32_t reconnectWiFi() diff --git a/src/mqtt/MQTT.h b/src/mqtt/MQTT.h index cf52ad877..42157fda9 100644 --- a/src/mqtt/MQTT.h +++ b/src/mqtt/MQTT.h @@ -47,10 +47,6 @@ class MQTT : private concurrency::OSThread */ void onSend(const meshtastic_MeshPacket &mp_encrypted, const meshtastic_MeshPacket &mp_decoded, ChannelIndex chIndex); - /** Attempt to connect to server if necessary - */ - void reconnect(); - bool isConnectedDirectly(); bool publish(const char *topic, const char *payload, bool retained); @@ -115,6 +111,10 @@ class MQTT : private concurrency::OSThread */ bool wantsLink() const; + /** Attempt to connect to server if necessary + */ + void reconnect(); + /** Tell the server what subscriptions we want (based on channels.downlink_enabled) */ void sendSubscriptions(); diff --git a/test/test_mqtt/MQTT.cpp b/test/test_mqtt/MQTT.cpp index 55ba479e2..3a4625aed 100644 --- a/test/test_mqtt/MQTT.cpp +++ b/test/test_mqtt/MQTT.cpp @@ -242,6 +242,7 @@ class MQTTUnitTest : public MQTT mqttClient.release(); delete pubsub; } + using MQTT::reconnect; int queueSize() { return mqttQueue.numUsed(); } void reportToMap(std::optional precision = std::nullopt) { @@ -488,7 +489,7 @@ void test_reconnectProxyDoesNotReconnectMqtt(void) moduleConfig.mqtt.proxy_to_client_enabled = true; MQTTUnitTest::restart(); - mqtt->reconnect(); + unitTest->reconnect(); TEST_ASSERT_FALSE(pubsub->connected_); } From 8c9947b05c00e8137200a2b9093cbb19edd2aaa9 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sat, 15 Feb 2025 14:55:51 +0100 Subject: [PATCH 176/381] Allow NeighborInfo on non-default frequency slot (#6061) --- src/modules/NeighborInfoModule.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/NeighborInfoModule.cpp b/src/modules/NeighborInfoModule.cpp index fb658421d..eebf428a4 100644 --- a/src/modules/NeighborInfoModule.cpp +++ b/src/modules/NeighborInfoModule.cpp @@ -121,7 +121,8 @@ Will be used for broadcast. */ int32_t NeighborInfoModule::runOnce() { - if (moduleConfig.neighbor_info.transmit_over_lora && !channels.isDefaultChannel(channels.getPrimaryIndex()) && + if (moduleConfig.neighbor_info.transmit_over_lora && + (!channels.isDefaultChannel(channels.getPrimaryIndex()) || !RadioInterface::uses_default_frequency_slot) && airTime->isTxAllowedChannelUtil(true) && airTime->isTxAllowedAirUtil()) { sendNeighborInfo(NODENUM_BROADCAST, false); } else { From 2f6cd021115d0e63975cf8248bb550c76a7497a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gjels=C3=B8?= <36234524+gjelsoe@users.noreply.github.com> Date: Sat, 15 Feb 2025 15:06:41 +0100 Subject: [PATCH 177/381] Typo for Bandit button LEDs (#6053) Changed Button 2 LED index define from BUTTON1_COLOR_INDEX to correct BUTTON2_COLOR_INDEX --- src/AmbientLightingThread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AmbientLightingThread.h b/src/AmbientLightingThread.h index 600583348..c487f9d53 100644 --- a/src/AmbientLightingThread.h +++ b/src/AmbientLightingThread.h @@ -153,7 +153,7 @@ class AmbientLightingThread : public concurrency::OSThread pixels.fill(BUTTON1_COLOR, BUTTON1_COLOR_INDEX, 1); #endif #if defined(BUTTON2_COLOR) && defined(BUTTON2_COLOR_INDEX) - pixels.fill(BUTTON2_COLOR, BUTTON1_COLOR_INDEX, 1); + pixels.fill(BUTTON2_COLOR, BUTTON2_COLOR_INDEX, 1); #endif #endif pixels.show(); From 27fea5fc0724bbd1d6142f684b529807a91211d2 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sat, 15 Feb 2025 16:06:10 +0100 Subject: [PATCH 178/381] Fix STM32WL TCXO setting; enable logs and modules (#6063) Co-authored-by: Ben Meadors --- arch/stm32/stm32.ini | 10 ++++++++-- src/mesh/STM32WLE5JCInterface.cpp | 5 ++++- src/mesh/STM32WLE5JCInterface.h | 3 --- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/arch/stm32/stm32.ini b/arch/stm32/stm32.ini index 7e211496d..46f41db3a 100644 --- a/arch/stm32/stm32.ini +++ b/arch/stm32/stm32.ini @@ -11,9 +11,15 @@ build_flags = ${arduino_base.build_flags} -flto -Isrc/platform/stm32wl -g - -DMESHTASTIC_MINIMIZE_BUILD + -DMESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR + -DMESHTASTIC_EXCLUDE_INPUTBROKER + -DMESHTASTIC_EXCLUDE_I2C + -DMESHTASTIC_EXCLUDE_POWERMON + -DMESHTASTIC_EXCLUDE_SCREEN + -DMESHTASTIC_EXCLUDE_MQTT + -DMESHTASTIC_EXCLUDE_BLUETOOTH + -DMESHTASTIC_EXCLUDE_PKI -DMESHTASTIC_EXCLUDE_GPS - -DDEBUG_MUTE ; -DVECT_TAB_OFFSET=0x08000000 -DconfigUSE_CMSIS_RTOS_V2=1 ; -DSPI_MODE_0=SPI_MODE0 diff --git a/src/mesh/STM32WLE5JCInterface.cpp b/src/mesh/STM32WLE5JCInterface.cpp index 499db9176..ad1f675b6 100644 --- a/src/mesh/STM32WLE5JCInterface.cpp +++ b/src/mesh/STM32WLE5JCInterface.cpp @@ -18,6 +18,9 @@ bool STM32WLE5JCInterface::init() { RadioLibInterface::init(); + // https://github.com/Seeed-Studio/LoRaWan-E5-Node/blob/main/Middlewares/Third_Party/SubGHz_Phy/stm32_radio_driver/radio_driver.c + setTCXOVoltage(1.7); + lora.setRfSwitchTable(rfswitch_pins, rfswitch_table); if (power > STM32WLx_MAX_POWER) // This chip has lower power limits than some @@ -39,4 +42,4 @@ bool STM32WLE5JCInterface::init() return res == RADIOLIB_ERR_NONE; } -#endif // ARCH_STM32WL +#endif // ARCH_STM32WL \ No newline at end of file diff --git a/src/mesh/STM32WLE5JCInterface.h b/src/mesh/STM32WLE5JCInterface.h index fad793332..0c8140290 100644 --- a/src/mesh/STM32WLE5JCInterface.h +++ b/src/mesh/STM32WLE5JCInterface.h @@ -16,9 +16,6 @@ class STM32WLE5JCInterface : public SX126xInterface virtual bool init() override; }; -// https://github.com/Seeed-Studio/LoRaWan-E5-Node/blob/main/Middlewares/Third_Party/SubGHz_Phy/stm32_radio_driver/radio_driver.c -static const float tcxoVoltage = 1.7; - /* https://wiki.seeedstudio.com/LoRa-E5_STM32WLE5JC_Module/ * Wio-E5 module ONLY transmits through RFO_HP * Receive: PA4=1, PA5=0 From 4407d9e04023a693205aefa36c754d11002c1f0e Mon Sep 17 00:00:00 2001 From: porkcube Date: Sun, 16 Feb 2025 07:39:48 -0500 Subject: [PATCH 179/381] assigning SDA/SCL so it actually works 8| (#6065) --- variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.h b/variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.h index d5dfc3fab..7a76727f2 100644 --- a/variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.h +++ b/variants/diy/seeed-xiao-nrf52840-wio-sx1262/variant.h @@ -84,17 +84,15 @@ static const uint8_t A5 = PIN_A5; #define PIN_NFC2 (31) // RX and TX pins -#define PIN_SERIAL1_RX (6) -#define PIN_SERIAL1_TX (7) +#define PIN_SERIAL1_RX (-1) +#define PIN_SERIAL1_TX (-1) // complains if not defined #define PIN_SERIAL2_RX (-1) #define PIN_SERIAL2_TX (-1) // 4 is used as RF_SW and 5 for USR button so... -#define PIN_WIRE_SDA (-1) -#define PIN_WIRE_SCL (-1) -// #define PIN_WIRE_SDA (6) -// #define PIN_WIRE_SCL (7) +#define PIN_WIRE_SDA (6) +#define PIN_WIRE_SCL (7) static const uint8_t SDA = PIN_WIRE_SDA; static const uint8_t SCL = PIN_WIRE_SCL; From 7648391f91f2b84e367ae2b38220b30936fb45b1 Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Sun, 16 Feb 2025 05:15:30 -0800 Subject: [PATCH 180/381] Reject invalid configuration for the default MQTT server (#6066) * Sanity check configuration for the default MQTT server * Skip for MESHTASTIC_EXCLUDE_MQTT --------- Co-authored-by: Ben Meadors --- src/modules/AdminModule.cpp | 17 ++++++++++++++--- src/modules/AdminModule.h | 2 +- src/mqtt/MQTT.cpp | 27 +++++++++++++++++++++++++-- src/mqtt/MQTT.h | 2 ++ test/test_mqtt/MQTT.cpp | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 78 insertions(+), 6 deletions(-) diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 7906b410b..530d0b82e 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -162,7 +162,9 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta case meshtastic_AdminMessage_set_module_config_tag: LOG_INFO("Client set module config"); - handleSetModuleConfig(r->set_module_config); + if (!handleSetModuleConfig(r->set_module_config)) { + myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp); + } break; case meshtastic_AdminMessage_set_channel_tag: @@ -648,15 +650,23 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c) saveChanges(changes, requiresReboot); } -void AdminModule::handleSetModuleConfig(const meshtastic_ModuleConfig &c) +bool AdminModule::handleSetModuleConfig(const meshtastic_ModuleConfig &c) { if (!hasOpenEditTransaction) disableBluetooth(); switch (c.which_payload_variant) { case meshtastic_ModuleConfig_mqtt_tag: +#if MESHTASTIC_EXCLUDE_MQTT + LOG_WARN("Set module config: MESHTASTIC_EXCLUDE_MQTT is defined. Not setting MQTT config"); + return false; +#else LOG_INFO("Set module config: MQTT"); + if (!MQTT::isValidConfig(c.payload_variant.mqtt)) { + return false; + } moduleConfig.has_mqtt = true; moduleConfig.mqtt = c.payload_variant.mqtt; +#endif break; case meshtastic_ModuleConfig_serial_tag: LOG_INFO("Set module config: Serial"); @@ -724,6 +734,7 @@ void AdminModule::handleSetModuleConfig(const meshtastic_ModuleConfig &c) break; } saveChanges(SEGMENT_MODULECONFIG); + return true; } void AdminModule::handleSetChannel(const meshtastic_Channel &cc) @@ -1160,4 +1171,4 @@ void disableBluetooth() nrf52Bluetooth->shutdown(); #endif #endif -} +} \ No newline at end of file diff --git a/src/modules/AdminModule.h b/src/modules/AdminModule.h index ee2ebfd96..12c857e04 100644 --- a/src/modules/AdminModule.h +++ b/src/modules/AdminModule.h @@ -50,7 +50,7 @@ class AdminModule : public ProtobufModule, public Obser void handleSetOwner(const meshtastic_User &o); void handleSetChannel(const meshtastic_Channel &cc); void handleSetConfig(const meshtastic_Config &c); - void handleSetModuleConfig(const meshtastic_ModuleConfig &c); + bool handleSetModuleConfig(const meshtastic_ModuleConfig &c); void handleSetChannel(); void handleSetHamMode(const meshtastic_HamParameters &req); void handleStoreDeviceUIConfig(const meshtastic_DeviceUIConfig &uicfg); diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 6043daa34..67eba82a6 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -41,6 +41,7 @@ MQTT *mqtt; namespace { constexpr int reconnectMax = 5; +constexpr uint16_t mqttPort = 1883; // FIXME - this size calculation is super sloppy, but it will go away once we dynamically alloc meshpackets static uint8_t bytes[meshtastic_MqttClientProxyMessage_size + 30]; // 12 for channel name and 16 for nodeid @@ -245,6 +246,11 @@ std::pair parseHostAndPort(String server, uint16_t port = 0) } return std::make_pair(std::move(server), port); } + +bool isDefaultServer(const String &host) +{ + return host.length() == 0 || host == default_mqtt_address; +} } // namespace void MQTT::mqttCallback(char *topic, byte *payload, unsigned int length) @@ -324,7 +330,7 @@ MQTT::MQTT() : concurrency::OSThread("mqtt"), mqttQueue(MAX_MQTT_QUEUE) } String host = parseHostAndPort(moduleConfig.mqtt.address).first; - isConfiguredForDefaultServer = host.length() == 0 || host == default_mqtt_address; + isConfiguredForDefaultServer = isDefaultServer(host); IPAddress ip; isMqttServerAddressPrivate = ip.fromString(host.c_str()) && isPrivateIpAddress(ip); @@ -408,7 +414,7 @@ void MQTT::reconnect() } #if HAS_NETWORKING // Defaults - int serverPort = 1883; + int serverPort = mqttPort; const char *serverAddr = default_mqtt_address; const char *mqttUsername = default_mqtt_username; const char *mqttPassword = default_mqtt_password; @@ -561,6 +567,23 @@ int32_t MQTT::runOnce() return 30000; } +bool MQTT::isValidConfig(const meshtastic_ModuleConfig_MQTTConfig &config) +{ + String host; + uint16_t port; + std::tie(host, port) = parseHostAndPort(config.address, mqttPort); + const bool defaultServer = isDefaultServer(host); + if (defaultServer && config.tls_enabled) { + LOG_ERROR("Invalid MQTT config: TLS was enabled, but the default server does not support TLS"); + return false; + } + if (defaultServer && port != mqttPort) { + LOG_ERROR("Invalid MQTT config: Unsupported port '%d' for the default MQTT server", port); + return false; + } + return true; +} + void MQTT::publishNodeInfo() { // TODO: NodeInfo broadcast over MQTT only (NODENUM_BROADCAST_NO_LORA) diff --git a/src/mqtt/MQTT.h b/src/mqtt/MQTT.h index 42157fda9..f7e3864f8 100644 --- a/src/mqtt/MQTT.h +++ b/src/mqtt/MQTT.h @@ -61,6 +61,8 @@ class MQTT : private concurrency::OSThread bool isUsingDefaultServer() { return isConfiguredForDefaultServer; } + static bool isValidConfig(const meshtastic_ModuleConfig_MQTTConfig &config); + protected: struct QueueEntry { std::string topic; diff --git a/test/test_mqtt/MQTT.cpp b/test/test_mqtt/MQTT.cpp index 3a4625aed..c00922548 100644 --- a/test/test_mqtt/MQTT.cpp +++ b/test/test_mqtt/MQTT.cpp @@ -800,6 +800,38 @@ void test_customMqttRoot(void) [] { return pubsub->subscriptions_.count("custom/2/e/test/+") && pubsub->subscriptions_.count("custom/2/e/PKI/+"); })); } +// Empty configuration is valid. +void test_configurationEmptyIsValid(void) +{ + meshtastic_ModuleConfig_MQTTConfig config; + + TEST_ASSERT_TRUE(MQTT::isValidConfig(config)); +} + +// Configuration with the default server is valid. +void test_configWithDefaultServer(void) +{ + meshtastic_ModuleConfig_MQTTConfig config = {.address = default_mqtt_address}; + + TEST_ASSERT_TRUE(MQTT::isValidConfig(config)); +} + +// Configuration with the default server and port 8888 is invalid. +void test_configWithDefaultServerAndInvalidPort(void) +{ + meshtastic_ModuleConfig_MQTTConfig config = {.address = default_mqtt_address ":8888"}; + + TEST_ASSERT_FALSE(MQTT::isValidConfig(config)); +} + +// Configuration with the default server and tls_enabled = true is invalid. +void test_configWithDefaultServerAndInvalidTLSEnabled(void) +{ + meshtastic_ModuleConfig_MQTTConfig config = {.tls_enabled = true}; + + TEST_ASSERT_FALSE(MQTT::isValidConfig(config)); +} + void setup() { initializeTestEnvironment(); @@ -843,6 +875,10 @@ void setup() RUN_TEST(test_enabled); RUN_TEST(test_disabled); RUN_TEST(test_customMqttRoot); + RUN_TEST(test_configurationEmptyIsValid); + RUN_TEST(test_configWithDefaultServer); + RUN_TEST(test_configWithDefaultServerAndInvalidPort); + RUN_TEST(test_configWithDefaultServerAndInvalidTLSEnabled); exit(UNITY_END()); } #else From 7eb77276cdeca95b4a04360333b357921a6ca141 Mon Sep 17 00:00:00 2001 From: A_Ponzano Date: Mon, 17 Feb 2025 02:49:17 +0100 Subject: [PATCH 181/381] Add support for new NRF52 board, MeshLink (#5736) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add support for MeshLink * Updated, enabled watchdog and added button definition * added eink variant and removed some compile errors * Small board json file edit * Finally got trunk working (somehow?), this is just cleanup with trunk fmt * Various improvements and cleanup. Removed the use of PIN_3V3_En and defined a specific WD_EN pin instead for better clarity. Will do a bit more testing asap to make sure everything still works as intended :) * Enable on-board QSPI Flash * run trunk fmt with clang-format --------- Co-authored-by: Ben Meadors Co-authored-by: Thomas Göttgens Co-authored-by: Austin --- boards/meshlink.json | 52 ++++++++ src/graphics/EInkDisplay2.cpp | 9 ++ src/mesh/generated/meshtastic/mesh.pb.h | 2 +- src/modules/SerialModule.cpp | 8 +- src/platform/nrf52/architecture.h | 2 +- src/platform/nrf52/main-nrf52.cpp | 5 + src/sleep.cpp | 5 +- variants/meshlink/platformio.ini | 30 +++++ variants/meshlink/variant.cpp | 23 ++++ variants/meshlink/variant.h | 153 ++++++++++++++++++++++++ variants/meshlink_eink/platformio.ini | 30 +++++ variants/meshlink_eink/variant.cpp | 23 ++++ variants/meshlink_eink/variant.h | 153 ++++++++++++++++++++++++ 13 files changed, 488 insertions(+), 7 deletions(-) create mode 100644 boards/meshlink.json create mode 100644 variants/meshlink/platformio.ini create mode 100644 variants/meshlink/variant.cpp create mode 100644 variants/meshlink/variant.h create mode 100644 variants/meshlink_eink/platformio.ini create mode 100644 variants/meshlink_eink/variant.cpp create mode 100644 variants/meshlink_eink/variant.h diff --git a/boards/meshlink.json b/boards/meshlink.json new file mode 100644 index 000000000..a608de88a --- /dev/null +++ b/boards/meshlink.json @@ -0,0 +1,52 @@ +{ + "build": { + "arduino": { + "ldscript": "nrf52840_s140_v6.ld" + }, + "core": "nRF5", + "cpu": "cortex-m4", + "extra_flags": "-DMESHLINK -DNRF52840_XXAA", + "f_cpu": "64000000L", + "hwids": [ + ["0x239A", "0x00B3"], + ["0x239A", "0x8029"], + ["0x239A", "0x0029"], + ["0x239A", "0x002A"], + ["0x239A", "0x802A"] + ], + "usb_product": "MeshLink", + "mcu": "nrf52840", + "variant": "meshlink", + "bsp": { + "name": "adafruit" + }, + "softdevice": { + "sd_flags": "-DS140", + "sd_name": "s140", + "sd_version": "6.1.1", + "sd_fwid": "0x00B6" + }, + "bootloader": { + "settings_addr": "0xFF000" + } + }, + "connectivity": ["bluetooth"], + "debug": { + "jlink_device": "nRF52840_xxAA", + "svd_path": "nrf52840.svd" + }, + "frameworks": ["arduino"], + "name": "MeshLink", + "upload": { + "maximum_ram_size": 248832, + "maximum_size": 815104, + "speed": 115200, + "protocol": "nrfutil", + "protocols": ["nrfutil", "jlink", "nrfjprog", "stlink"], + "use_1200bps_touch": true, + "require_upload_port": true, + "wait_for_upload_port": true + }, + "url": "https://www.loraitalia.it", + "vendor": "LoraItalia" +} diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index 6c85582c0..9702b0086 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -140,6 +140,15 @@ bool EInkDisplay::connect() adafruitDisplay->setRotation(3); adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); } +#elif defined(MESHLINK) + { + auto lowLevel = new EINK_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, SPI1); + + adafruitDisplay = new GxEPD2_BW(*lowLevel); + adafruitDisplay->init(); + adafruitDisplay->setRotation(3); + adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); + } #elif defined(RAK4630) || defined(MAKERPYTHON) { if (eink_found) { diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 3353a020f..de8a1a353 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -1775,4 +1775,4 @@ extern const pb_msgdesc_t meshtastic_ChunkedPayloadResponse_msg; } /* extern "C" */ #endif -#endif +#endif \ No newline at end of file diff --git a/src/modules/SerialModule.cpp b/src/modules/SerialModule.cpp index bf53b1748..c6a95912b 100644 --- a/src/modules/SerialModule.cpp +++ b/src/modules/SerialModule.cpp @@ -60,7 +60,7 @@ SerialModule *serialModule; SerialModuleRadio *serialModuleRadio; -#if defined(TTGO_T_ECHO) || defined(CANARYONE) +#if defined(TTGO_T_ECHO) || defined(CANARYONE) || defined(MESHLINK) SerialModule::SerialModule() : StreamAPI(&Serial), concurrency::OSThread("Serial") {} static Print *serialPrint = &Serial; #elif defined(CONFIG_IDF_TARGET_ESP32C6) @@ -158,7 +158,7 @@ int32_t SerialModule::runOnce() Serial.begin(baud); Serial.setTimeout(moduleConfig.serial.timeout > 0 ? moduleConfig.serial.timeout : TIMEOUT); } -#elif !defined(TTGO_T_ECHO) && !defined(CANARYONE) +#elif !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(MESHLINK) if (moduleConfig.serial.rxd && moduleConfig.serial.txd) { #ifdef ARCH_RP2040 Serial2.setFIFOSize(RX_BUFFER); @@ -214,7 +214,7 @@ int32_t SerialModule::runOnce() } } -#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) +#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(MESHLINK) else if ((moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_WS85)) { processWXSerial(); @@ -416,7 +416,7 @@ uint32_t SerialModule::getBaudRate() */ void SerialModule::processWXSerial() { -#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(MESHLINK) static unsigned int lastAveraged = 0; static unsigned int averageIntervalMillis = 300000; // 5 minutes hard coded. static double dir_sum_sin = 0; diff --git a/src/platform/nrf52/architecture.h b/src/platform/nrf52/architecture.h index ce99244ba..3e4397686 100644 --- a/src/platform/nrf52/architecture.h +++ b/src/platform/nrf52/architecture.h @@ -127,4 +127,4 @@ #if !defined(PIN_SERIAL_RX) && !defined(NRF52840_XXAA) // No serial ports on this board - ONLY use segger in memory console #define USE_SEGGER -#endif +#endif \ No newline at end of file diff --git a/src/platform/nrf52/main-nrf52.cpp b/src/platform/nrf52/main-nrf52.cpp index ad4d7a881..8483d21c6 100644 --- a/src/platform/nrf52/main-nrf52.cpp +++ b/src/platform/nrf52/main-nrf52.cpp @@ -304,6 +304,11 @@ void cpuDeepSleep(uint32_t msecToWake) nrf_gpio_cfg_default(WB_I2C1_SDA); #endif #endif +#ifdef MESHLINK +#ifdef PIN_WD_EN + digitalWrite(PIN_WD_EN, LOW); +#endif +#endif #ifdef HELTEC_MESH_NODE_T114 nrf_gpio_cfg_default(PIN_GPS_PPS); diff --git a/src/sleep.cpp b/src/sleep.cpp index 161b6e107..437d7b88b 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -245,6 +245,9 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false, bool skipSaveN #ifdef PIN_3V3_EN digitalWrite(PIN_3V3_EN, LOW); #endif +#ifdef PIN_WD_EN + digitalWrite(PIN_WD_EN, LOW); +#endif #endif ledBlink.set(false); @@ -530,4 +533,4 @@ void enableLoraInterrupt() } #endif } -#endif +#endif \ No newline at end of file diff --git a/variants/meshlink/platformio.ini b/variants/meshlink/platformio.ini new file mode 100644 index 000000000..180dddd49 --- /dev/null +++ b/variants/meshlink/platformio.ini @@ -0,0 +1,30 @@ +; MeshLink board developed by LoraItalia. NRF52840, eByte E22900M22S (Will also come with other frequencies), 25w MPPT solar charger (5v,12v,18v selectable), support for gps, buzzer, oled or e-ink display, 10 gpios, hardware watchdog +; https://www.loraitalia.it +; firmware for boards with or without oled display +[env:meshlink] +extends = nrf52840_base +board = meshlink +;board_check = true +build_flags = ${nrf52840_base.build_flags} -I variants/meshlink -D MESHLINK + -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" + -D GPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. + -D EINK_DISPLAY_MODEL=GxEPD2_213_B74 + -D EINK_WIDTH=250 + -D EINK_HEIGHT=122 + -D USE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk + -D EINK_LIMIT_FASTREFRESH=5 ; How many consecutive fast-refreshes are permitted + -D EINK_LIMIT_RATE_BACKGROUND_SEC=30 ; Minimum interval between BACKGROUND updates + -D EINK_LIMIT_RATE_RESPONSIVE_SEC=1 ; Minimum interval between RESPONSIVE updates + -D EINK_LIMIT_GHOSTING_PX=2000 ; (Optional) How much image ghosting is tolerated + -D EINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached. + -D EINK_HASQUIRK_VICIOUSFASTREFRESH ; Identify that pixels drawn by fast-refresh are harder to clear + + +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/meshlink> +lib_deps = + ${nrf52840_base.lib_deps} + https://github.com/meshtastic/GxEPD2#55f618961db45a23eff0233546430f1e5a80f63a +debug_tool = jlink +; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) +; Note: as of 6/2013 the serial/bootloader based programming takes approximately 30 seconds +;upload_protocol = jlink \ No newline at end of file diff --git a/variants/meshlink/variant.cpp b/variants/meshlink/variant.cpp new file mode 100644 index 000000000..81a5097c4 --- /dev/null +++ b/variants/meshlink/variant.cpp @@ -0,0 +1,23 @@ +#include "variant.h" +#include "nrf.h" +#include "wiring_constants.h" +#include "wiring_digital.h" + +const uint32_t g_ADigitalPinMap[] = { + // P0 + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + + // P1 + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}; + +void initVariant() +{ + pinMode(PIN_LED1, OUTPUT); + digitalWrite(PIN_LED1, HIGH); // turn off the white led while booting + // otherwise it will stay lit for several seconds (could be annoying) + +#ifdef PIN_WD_EN + pinMode(PIN_WD_EN, OUTPUT); + digitalWrite(PIN_WD_EN, HIGH); // Enable the Watchdog at boot +#endif +} \ No newline at end of file diff --git a/variants/meshlink/variant.h b/variants/meshlink/variant.h new file mode 100644 index 000000000..54df03691 --- /dev/null +++ b/variants/meshlink/variant.h @@ -0,0 +1,153 @@ +#ifndef _VARIANT_MESHLINK_ +#define _VARIANT_MESHLINK_ +#ifndef MESHLINK +#define MESHLINK +#endif +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +// #define USE_LFXO // Board uses 32khz crystal for LF +#define USE_LFRC // Board uses RC for LF + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Number of pins defined in PinDescription array +#define PINS_COUNT (48) +#define NUM_DIGITAL_PINS (48) +#define NUM_ANALOG_INPUTS (2) +#define NUM_ANALOG_OUTPUTS (0) + +#define BUTTON_PIN (-1) // If defined, this will be used for user button presses, +#define BUTTON_NEED_PULLUP + +// LEDs +#define PIN_LED1 (24) // Built in white led for status +#define LED_BLUE PIN_LED1 +#define LED_BUILTIN PIN_LED1 + +#define LED_STATE_ON 0 // State when LED is litted +#define LED_INVERTED 1 + +// Testing USB detection +// #define NRF_APM + +/* + * Analog pins + */ +#define PIN_A1 (3) // P0.03/AIN1 +#define ADC_RESOLUTION 14 + +// Other pins +// #define PIN_AREF (2) +// static const uint8_t AREF = PIN_AREF; + +/* + * Serial interfaces + */ +#define PIN_SERIAL1_RX (32 + 8) +#define PIN_SERIAL1_TX (7) + +/* + * SPI Interfaces + */ +#define SPI_INTERFACES_COUNT 2 + +#define PIN_SPI_MISO (8) +#define PIN_SPI_MOSI (32 + 9) +#define PIN_SPI_SCK (11) + +#define PIN_SPI1_MISO (23) +#define PIN_SPI1_MOSI (21) +#define PIN_SPI1_SCK (19) + +static const uint8_t SS = 12; +static const uint8_t MOSI = PIN_SPI_MOSI; +static const uint8_t MISO = PIN_SPI_MISO; +static const uint8_t SCK = PIN_SPI_SCK; + +/* + * eink display pins + */ +// #define USE_EINK + +#define PIN_EINK_CS (15) +#define PIN_EINK_BUSY (16) +#define PIN_EINK_DC (14) +#define PIN_EINK_RES (17) +#define PIN_EINK_SCLK (19) +#define PIN_EINK_MOSI (21) // also called SDI + +/* + * Wire Interfaces + */ +#define WIRE_INTERFACES_COUNT 1 + +#define PIN_WIRE_SDA (1) +#define PIN_WIRE_SCL (27) + +// QSPI Pins +#define PIN_QSPI_SCK 19 +#define PIN_QSPI_CS 22 +#define PIN_QSPI_IO0 21 +#define PIN_QSPI_IO1 23 +#define PIN_QSPI_IO2 32 +#define PIN_QSPI_IO3 20 + +// On-board QSPI Flash +#define EXTERNAL_FLASH_DEVICES W25Q16JVUXIQ +#define EXTERNAL_FLASH_USE_QSPI + +#define USE_SX1262 +#define SX126X_CS (12) +#define SX126X_DIO1 (32 + 1) +#define SX126X_BUSY (32 + 3) +#define SX126X_RESET (6) +// #define SX126X_RXEN (13) +// DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 + +// pin 25 is used to enable or disable the watchdog. This pin has to be disabled when cpu is put to sleep +// otherwise the timer will expire and wd will reboot the cpu +#define PIN_WD_EN (25) + +#define PIN_GPS_PPS (26) // Pulse per second input from the GPS + +#define GPS_TX_PIN PIN_SERIAL1_RX // This is for bits going TOWARDS the CPU +#define GPS_RX_PIN PIN_SERIAL1_TX // This is for bits going TOWARDS the GPS + +// #define GPS_THREAD_INTERVAL 50 + +// Define pin to enable GPS toggle (set GPIO to LOW) via user button triple press +#define PIN_GPS_EN (0) +#define GPS_EN_ACTIVE LOW + +#define PIN_BUZZER (31) // P0.31/AIN7 + +// Battery +// The battery sense is hooked to pin A0 (2) +#define BATTERY_PIN (2) +// and has 12 bit resolution +#define BATTERY_SENSE_RESOLUTION_BITS 12 +#define BATTERY_SENSE_RESOLUTION 4096.0 +#undef AREF_VOLTAGE +#define AREF_VOLTAGE 3.0 +#define VBAT_AR_INTERNAL AR_INTERNAL_3_0 +#define ADC_MULTIPLIER 1.42 // fine tuning of voltage + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ +#endif \ No newline at end of file diff --git a/variants/meshlink_eink/platformio.ini b/variants/meshlink_eink/platformio.ini new file mode 100644 index 000000000..db3647e73 --- /dev/null +++ b/variants/meshlink_eink/platformio.ini @@ -0,0 +1,30 @@ +; MeshLink board developed by LoraItalia. NRF52840, eByte E22900M22S (Will also come with other frequencies), 25w MPPT solar charger (5v,12v,18v selectable), support for gps, buzzer, oled or e-ink display, 10 gpios, hardware watchdog +; https://www.loraitalia.it +; firmware for boards with a 250x122 e-ink display +[env:meshlink_eink] +extends = nrf52840_base +board = meshlink +;board_check = true +build_flags = ${nrf52840_base.build_flags} -I variants/meshlink_eink -D MESHLINK + -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" + -D GPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. + -D EINK_DISPLAY_MODEL=GxEPD2_213_B74 + -D EINK_WIDTH=250 + -D EINK_HEIGHT=122 + -D USE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk + -D EINK_LIMIT_FASTREFRESH=5 ; How many consecutive fast-refreshes are permitted + -D EINK_LIMIT_RATE_BACKGROUND_SEC=30 ; Minimum interval between BACKGROUND updates + -D EINK_LIMIT_RATE_RESPONSIVE_SEC=1 ; Minimum interval between RESPONSIVE updates + -D EINK_LIMIT_GHOSTING_PX=2000 ; (Optional) How much image ghosting is tolerated + -D EINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached. + -D EINK_HASQUIRK_VICIOUSFASTREFRESH ; Identify that pixels drawn by fast-refresh are harder to clear + + +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/meshlink_eink> +lib_deps = + ${nrf52840_base.lib_deps} + https://github.com/meshtastic/GxEPD2#55f618961db45a23eff0233546430f1e5a80f63a +debug_tool = jlink +; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) +; Note: as of 6/2013 the serial/bootloader based programming takes approximately 30 seconds +;upload_protocol = jlink \ No newline at end of file diff --git a/variants/meshlink_eink/variant.cpp b/variants/meshlink_eink/variant.cpp new file mode 100644 index 000000000..81a5097c4 --- /dev/null +++ b/variants/meshlink_eink/variant.cpp @@ -0,0 +1,23 @@ +#include "variant.h" +#include "nrf.h" +#include "wiring_constants.h" +#include "wiring_digital.h" + +const uint32_t g_ADigitalPinMap[] = { + // P0 + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + + // P1 + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}; + +void initVariant() +{ + pinMode(PIN_LED1, OUTPUT); + digitalWrite(PIN_LED1, HIGH); // turn off the white led while booting + // otherwise it will stay lit for several seconds (could be annoying) + +#ifdef PIN_WD_EN + pinMode(PIN_WD_EN, OUTPUT); + digitalWrite(PIN_WD_EN, HIGH); // Enable the Watchdog at boot +#endif +} \ No newline at end of file diff --git a/variants/meshlink_eink/variant.h b/variants/meshlink_eink/variant.h new file mode 100644 index 000000000..b605d7082 --- /dev/null +++ b/variants/meshlink_eink/variant.h @@ -0,0 +1,153 @@ +#ifndef _VARIANT_MESHLINK_ +#define _VARIANT_MESHLINK_ +#ifndef MESHLINK +#define MESHLINK +#endif +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +// #define USE_LFXO // Board uses 32khz crystal for LF +#define USE_LFRC // Board uses RC for LF + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Number of pins defined in PinDescription array +#define PINS_COUNT (48) +#define NUM_DIGITAL_PINS (48) +#define NUM_ANALOG_INPUTS (2) +#define NUM_ANALOG_OUTPUTS (0) + +#define BUTTON_PIN (-1) // If defined, this will be used for user button presses, +#define BUTTON_NEED_PULLUP + +// LEDs +#define PIN_LED1 (24) // Built in white led for status +#define LED_BLUE PIN_LED1 +#define LED_BUILTIN PIN_LED1 + +#define LED_STATE_ON 0 // State when LED is litted +#define LED_INVERTED 1 + +// Testing USB detection +// #define NRF_APM + +/* + * Analog pins + */ +#define PIN_A1 (3) // P0.03/AIN1 +#define ADC_RESOLUTION 14 + +// Other pins +// #define PIN_AREF (2) +// static const uint8_t AREF = PIN_AREF; + +/* + * Serial interfaces + */ +#define PIN_SERIAL1_RX (32 + 8) +#define PIN_SERIAL1_TX (7) + +/* + * SPI Interfaces + */ +#define SPI_INTERFACES_COUNT 2 + +#define PIN_SPI_MISO (8) +#define PIN_SPI_MOSI (32 + 9) +#define PIN_SPI_SCK (11) + +#define PIN_SPI1_MISO (23) +#define PIN_SPI1_MOSI (21) +#define PIN_SPI1_SCK (19) + +static const uint8_t SS = 12; +static const uint8_t MOSI = PIN_SPI_MOSI; +static const uint8_t MISO = PIN_SPI_MISO; +static const uint8_t SCK = PIN_SPI_SCK; + +/* + * eink display pins + */ +#define USE_EINK + +#define PIN_EINK_CS (15) +#define PIN_EINK_BUSY (16) +#define PIN_EINK_DC (14) +#define PIN_EINK_RES (17) +#define PIN_EINK_SCLK (19) +#define PIN_EINK_MOSI (21) // also called SDI + +/* + * Wire Interfaces + */ +#define WIRE_INTERFACES_COUNT 1 + +#define PIN_WIRE_SDA (1) +#define PIN_WIRE_SCL (27) + +// QSPI Pins +#define PIN_QSPI_SCK 19 +#define PIN_QSPI_CS 22 +#define PIN_QSPI_IO0 21 +#define PIN_QSPI_IO1 23 +#define PIN_QSPI_IO2 32 +#define PIN_QSPI_IO3 20 + +// On-board QSPI Flash +#define EXTERNAL_FLASH_DEVICES W25Q16JVUXIQ +#define EXTERNAL_FLASH_USE_QSPI + +#define USE_SX1262 +#define SX126X_CS (12) +#define SX126X_DIO1 (32 + 1) +#define SX126X_BUSY (32 + 3) +#define SX126X_RESET (6) +// #define SX126X_RXEN (13) +// DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 + +// pin 25 is used to enable or disable the watchdog. This pin has to be disabled when cpu is put to sleep +// otherwise the timer will expire and wd will reboot the cpu +#define PIN_WD_EN (25) + +#define PIN_GPS_PPS (26) // Pulse per second input from the GPS + +#define GPS_TX_PIN PIN_SERIAL1_RX // This is for bits going TOWARDS the CPU +#define GPS_RX_PIN PIN_SERIAL1_TX // This is for bits going TOWARDS the GPS + +// #define GPS_THREAD_INTERVAL 50 + +// Define pin to enable GPS toggle (set GPIO to LOW) via user button triple press +#define PIN_GPS_EN (0) +#define GPS_EN_ACTIVE LOW + +#define PIN_BUZZER (31) // P0.31/AIN7 + +// Battery +// The battery sense is hooked to pin A0 (2) +#define BATTERY_PIN (2) +// and has 12 bit resolution +#define BATTERY_SENSE_RESOLUTION_BITS 12 +#define BATTERY_SENSE_RESOLUTION 4096.0 +#undef AREF_VOLTAGE +#define AREF_VOLTAGE 3.0 +#define VBAT_AR_INTERNAL AR_INTERNAL_3_0 +#define ADC_MULTIPLIER 1.42 // fine tuning of voltage + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ +#endif \ No newline at end of file From 3b0232de1b6282eacfbff6e50b68fca7e67b8511 Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Mon, 17 Feb 2025 13:03:44 -0800 Subject: [PATCH 182/381] Validate MQTT config by testing a connection (#6076) --- src/mqtt/MQTT.cpp | 158 +++++++++++++++++++++++++--------------- src/mqtt/MQTT.h | 30 ++++---- test/test_mqtt/MQTT.cpp | 63 +++++++++++++++- 3 files changed, 173 insertions(+), 78 deletions(-) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 67eba82a6..5f16f909f 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -41,7 +41,6 @@ MQTT *mqtt; namespace { constexpr int reconnectMax = 5; -constexpr uint16_t mqttPort = 1883; // FIXME - this size calculation is super sloppy, but it will go away once we dynamically alloc meshpackets static uint8_t bytes[meshtastic_MqttClientProxyMessage_size + 30]; // 12 for channel name and 16 for nodeid @@ -251,6 +250,68 @@ bool isDefaultServer(const String &host) { return host.length() == 0 || host == default_mqtt_address; } + +struct PubSubConfig { + explicit PubSubConfig(const meshtastic_ModuleConfig_MQTTConfig &config) + { + if (*config.address) { + serverAddr = config.address; + mqttUsername = config.username; + mqttPassword = config.password; + } + if (config.tls_enabled) { + serverPort = 8883; + } + std::tie(serverAddr, serverPort) = parseHostAndPort(serverAddr.c_str(), serverPort); + } + + // Defaults + static constexpr uint16_t defaultPort = 1883; + uint16_t serverPort = defaultPort; + String serverAddr = default_mqtt_address; + const char *mqttUsername = default_mqtt_username; + const char *mqttPassword = default_mqtt_password; +}; + +#if HAS_NETWORKING +bool connectPubSub(const PubSubConfig &config, PubSubClient &pubSub, Client &client) +{ + pubSub.setBufferSize(1024); + pubSub.setClient(client); + pubSub.setServer(config.serverAddr.c_str(), config.serverPort); + + LOG_INFO("Connecting directly to MQTT server %s, port: %d, username: %s, password: %s", config.serverAddr.c_str(), + config.serverPort, config.mqttUsername, config.mqttPassword); + + const bool connected = pubSub.connect(owner.id, config.mqttUsername, config.mqttPassword); + if (connected) { + LOG_INFO("MQTT connected"); + } else { + LOG_WARN("Failed to connect to MQTT server"); + } + return connected; +} +#endif + +inline bool isConnectedToNetwork() +{ +#if HAS_WIFI + return WiFi.isConnected(); +#elif HAS_ETHERNET + return Ethernet.linkStatus() == LinkON; +#else + return false; +#endif +} + +/** return true if we have a channel that wants uplink/downlink or map reporting is enabled + */ +bool wantsLink() +{ + const bool hasChannelorMapReport = + moduleConfig.mqtt.enabled && (moduleConfig.mqtt.map_reporting_enabled || channels.anyMqttEnabled()); + return hasChannelorMapReport && (moduleConfig.mqtt.proxy_to_client_enabled || isConnectedToNetwork()); +} } // namespace void MQTT::mqttCallback(char *topic, byte *payload, unsigned int length) @@ -413,46 +474,18 @@ void MQTT::reconnect() return; // Don't try to connect directly to the server } #if HAS_NETWORKING - // Defaults - int serverPort = mqttPort; - const char *serverAddr = default_mqtt_address; - const char *mqttUsername = default_mqtt_username; - const char *mqttPassword = default_mqtt_password; + const PubSubConfig config(moduleConfig.mqtt); MQTTClient *clientConnection = mqttClient.get(); - - if (*moduleConfig.mqtt.address) { - serverAddr = moduleConfig.mqtt.address; - mqttUsername = moduleConfig.mqtt.username; - mqttPassword = moduleConfig.mqtt.password; - } -#if HAS_WIFI && !defined(ARCH_PORTDUINO) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if MQTT_SUPPORTS_TLS if (moduleConfig.mqtt.tls_enabled) { - // change default for encrypted to 8883 - try { - serverPort = 8883; - wifiSecureClient.setInsecure(); - LOG_INFO("Use TLS-encrypted session"); - clientConnection = &wifiSecureClient; - } catch (const std::exception &e) { - LOG_ERROR("MQTT ERROR: %s", e.what()); - } + mqttClientTLS.setInsecure(); + LOG_INFO("Use TLS-encrypted session"); + clientConnection = &mqttClientTLS; } else { LOG_INFO("Use non-TLS-encrypted session"); } #endif - std::pair hostAndPort = parseHostAndPort(serverAddr, serverPort); - serverAddr = hostAndPort.first.c_str(); - serverPort = hostAndPort.second; - pubSub.setServer(serverAddr, serverPort); - pubSub.setBufferSize(1024); - - LOG_INFO("Connect directly to MQTT server %s, port: %d, username: %s, password: %s", serverAddr, serverPort, mqttUsername, - mqttPassword); - - pubSub.setClient(*clientConnection); - bool connected = pubSub.connect(owner.id, mqttUsername, mqttPassword); - if (connected) { - LOG_INFO("MQTT connected"); + if (connectPubSub(config, pubSub, *clientConnection)) { enabled = true; // Start running background process again runASAP = true; reconnectCount = 0; @@ -507,23 +540,6 @@ void MQTT::sendSubscriptions() #endif } -bool MQTT::wantsLink() const -{ - bool hasChannelorMapReport = - moduleConfig.mqtt.enabled && (moduleConfig.mqtt.map_reporting_enabled || channels.anyMqttEnabled()); - - if (hasChannelorMapReport && moduleConfig.mqtt.proxy_to_client_enabled) - return true; - -#if HAS_WIFI - return hasChannelorMapReport && WiFi.isConnected(); -#endif -#if HAS_ETHERNET - return hasChannelorMapReport && Ethernet.linkStatus() == LinkON; -#endif - return false; -} - int32_t MQTT::runOnce() { #if HAS_NETWORKING @@ -567,18 +583,42 @@ int32_t MQTT::runOnce() return 30000; } -bool MQTT::isValidConfig(const meshtastic_ModuleConfig_MQTTConfig &config) +bool MQTT::isValidConfig(const meshtastic_ModuleConfig_MQTTConfig &config, MQTTClient *client) { - String host; - uint16_t port; - std::tie(host, port) = parseHostAndPort(config.address, mqttPort); - const bool defaultServer = isDefaultServer(host); + const PubSubConfig parsed(config); + + if (config.enabled && !config.proxy_to_client_enabled) { +#if HAS_NETWORKING + std::unique_ptr clientConnection; + if (config.tls_enabled) { +#if MQTT_SUPPORTS_TLS + MQTTClientTLS *tlsClient = new MQTTClientTLS; + clientConnection.reset(tlsClient); + tlsClient->setInsecure(); +#else + LOG_ERROR("Invalid MQTT config: tls_enabled is not supported on this node"); + return false; +#endif + } else { + clientConnection.reset(new MQTTClient); + } + std::unique_ptr pubSub(new PubSubClient); + if (isConnectedToNetwork()) { + return connectPubSub(parsed, *pubSub, (client != nullptr) ? *client : *clientConnection); + } +#else + LOG_ERROR("Invalid MQTT config: proxy_to_client_enabled must be enabled on nodes that do not have a network"); + return false; +#endif + } + + const bool defaultServer = isDefaultServer(parsed.serverAddr); if (defaultServer && config.tls_enabled) { LOG_ERROR("Invalid MQTT config: TLS was enabled, but the default server does not support TLS"); return false; } - if (defaultServer && port != mqttPort) { - LOG_ERROR("Invalid MQTT config: Unsupported port '%d' for the default MQTT server", port); + if (defaultServer && parsed.serverPort != PubSubConfig::defaultPort) { + LOG_ERROR("Invalid MQTT config: Unsupported port '%d' for the default MQTT server", parsed.serverPort); return false; } return true; diff --git a/src/mqtt/MQTT.h b/src/mqtt/MQTT.h index f7e3864f8..5cda90218 100644 --- a/src/mqtt/MQTT.h +++ b/src/mqtt/MQTT.h @@ -10,12 +10,10 @@ #endif #if HAS_WIFI #include -#if !defined(ARCH_PORTDUINO) -#if defined(ESP_ARDUINO_VERSION_MAJOR) && ESP_ARDUINO_VERSION_MAJOR < 3 +#if __has_include() #include #endif #endif -#endif #if HAS_ETHERNET #include #endif @@ -61,7 +59,8 @@ class MQTT : private concurrency::OSThread bool isUsingDefaultServer() { return isConfiguredForDefaultServer; } - static bool isValidConfig(const meshtastic_ModuleConfig_MQTTConfig &config); + /// Validate the meshtastic_ModuleConfig_MQTTConfig. + static bool isValidConfig(const meshtastic_ModuleConfig_MQTTConfig &config) { return isValidConfig(config, nullptr); } protected: struct QueueEntry { @@ -78,22 +77,23 @@ class MQTT : private concurrency::OSThread #ifndef PIO_UNIT_TESTING private: #endif - // supposedly the current version is busted: - // http://www.iotsharing.com/2017/08/how-to-use-esp32-mqtts-with-mqtts-mosquitto-broker-tls-ssl.html #if HAS_WIFI using MQTTClient = WiFiClient; -#if !defined(ARCH_PORTDUINO) -#if (defined(ESP_ARDUINO_VERSION_MAJOR) && ESP_ARDUINO_VERSION_MAJOR < 3) || defined(RPI_PICO) - WiFiClientSecure wifiSecureClient; +#if __has_include() + using MQTTClientTLS = WiFiClientSecure; +#define MQTT_SUPPORTS_TLS 1 #endif -#endif -#endif -#if HAS_ETHERNET +#elif HAS_ETHERNET using MQTTClient = EthernetClient; +#else + using MQTTClient = void; #endif #if HAS_NETWORKING std::unique_ptr mqttClient; +#if MQTT_SUPPORTS_TLS + MQTTClientTLS mqttClientTLS; +#endif PubSubClient pubSub; explicit MQTT(std::unique_ptr mqttClient); #endif @@ -109,10 +109,6 @@ class MQTT : private concurrency::OSThread uint32_t map_position_precision = default_map_position_precision; uint32_t map_publish_interval_msecs = default_map_publish_interval_secs * 1000; - /** return true if we have a channel that wants uplink/downlink or map reporting is enabled - */ - bool wantsLink() const; - /** Attempt to connect to server if necessary */ void reconnect(); @@ -124,6 +120,8 @@ class MQTT : private concurrency::OSThread /// Callback for direct mqtt subscription messages static void mqttCallback(char *topic, byte *payload, unsigned int length); + static bool isValidConfig(const meshtastic_ModuleConfig_MQTTConfig &config, MQTTClient *client); + /// Called when a new publish arrives from the MQTT server void onReceive(char *topic, byte *payload, size_t length); diff --git a/test/test_mqtt/MQTT.cpp b/test/test_mqtt/MQTT.cpp index c00922548..50a98001a 100644 --- a/test/test_mqtt/MQTT.cpp +++ b/test/test_mqtt/MQTT.cpp @@ -94,6 +94,7 @@ class MockPubSubServer : public WiFiClient int connect(IPAddress ip, uint16_t port) override { + port_ = port; if (refuseConnection_) return 0; connected_ = true; @@ -101,6 +102,8 @@ class MockPubSubServer : public WiFiClient } int connect(const char *host, uint16_t port) override { + host_ = host; + port_ = port; if (refuseConnection_) return 0; connected_ = true; @@ -197,6 +200,8 @@ class MockPubSubServer : public WiFiClient bool connected_ = false; bool refuseConnection_ = false; // Simulate a failed connection. uint32_t ipAddress_ = 0x01010101; // IP address of the MQTT server. + std::string host_; // Requested host. + uint16_t port_; // Requested port. std::list buffer_; // Buffer of messages for the pubSub client to receive. std::string command_; // Current command received from the pubSub client. std::set subscriptions_; // Topics that the pubSub client has subscribed to. @@ -242,6 +247,7 @@ class MQTTUnitTest : public MQTT mqttClient.release(); delete pubsub; } + using MQTT::isValidConfig; using MQTT::reconnect; int queueSize() { return mqttQueue.numUsed(); } void reportToMap(std::optional precision = std::nullopt) @@ -801,13 +807,25 @@ void test_customMqttRoot(void) } // Empty configuration is valid. -void test_configurationEmptyIsValid(void) +void test_configEmptyIsValid(void) { - meshtastic_ModuleConfig_MQTTConfig config; + meshtastic_ModuleConfig_MQTTConfig config = {}; TEST_ASSERT_TRUE(MQTT::isValidConfig(config)); } +// Empty 'enabled' configuration is valid. +void test_configEnabledEmptyIsValid(void) +{ + meshtastic_ModuleConfig_MQTTConfig config = {.enabled = true}; + MockPubSubServer client; + + TEST_ASSERT_TRUE(MQTTUnitTest::isValidConfig(config, &client)); + TEST_ASSERT_TRUE(client.connected_); + TEST_ASSERT_EQUAL_STRING(default_mqtt_address, client.host_.c_str()); + TEST_ASSERT_EQUAL(1883, client.port_); +} + // Configuration with the default server is valid. void test_configWithDefaultServer(void) { @@ -832,6 +850,41 @@ void test_configWithDefaultServerAndInvalidTLSEnabled(void) TEST_ASSERT_FALSE(MQTT::isValidConfig(config)); } +// isValidConfig connects to a custom host and port. +void test_configCustomHostAndPort(void) +{ + meshtastic_ModuleConfig_MQTTConfig config = {.enabled = true, .address = "server:1234"}; + MockPubSubServer client; + + TEST_ASSERT_TRUE(MQTTUnitTest::isValidConfig(config, &client)); + TEST_ASSERT_TRUE(client.connected_); + TEST_ASSERT_EQUAL_STRING("server", client.host_.c_str()); + TEST_ASSERT_EQUAL(1234, client.port_); +} + +// isValidConfig returns false if a connection cannot be established. +void test_configWithConnectionFailure(void) +{ + meshtastic_ModuleConfig_MQTTConfig config = {.enabled = true, .address = "server"}; + MockPubSubServer client; + client.refuseConnection_ = true; + + TEST_ASSERT_FALSE(MQTTUnitTest::isValidConfig(config, &client)); +} + +// isValidConfig returns true when tls_enabled is supported, or false otherwise. +void test_configWithTLSEnabled(void) +{ + meshtastic_ModuleConfig_MQTTConfig config = {.enabled = true, .address = "server", .tls_enabled = true}; + MockPubSubServer client; + +#if MQTT_SUPPORTS_TLS + TEST_ASSERT_TRUE(MQTTUnitTest::isValidConfig(config, &client)); +#else + TEST_ASSERT_FALSE(MQTTUnitTest::isValidConfig(config, &client)); +#endif +} + void setup() { initializeTestEnvironment(); @@ -875,10 +928,14 @@ void setup() RUN_TEST(test_enabled); RUN_TEST(test_disabled); RUN_TEST(test_customMqttRoot); - RUN_TEST(test_configurationEmptyIsValid); + RUN_TEST(test_configEmptyIsValid); + RUN_TEST(test_configEnabledEmptyIsValid); RUN_TEST(test_configWithDefaultServer); RUN_TEST(test_configWithDefaultServerAndInvalidPort); RUN_TEST(test_configWithDefaultServerAndInvalidTLSEnabled); + RUN_TEST(test_configCustomHostAndPort); + RUN_TEST(test_configWithConnectionFailure); + RUN_TEST(test_configWithTLSEnabled); exit(UNITY_END()); } #else From c67aa25d19aaa4773fc3ee457ad421c9daf2c01d Mon Sep 17 00:00:00 2001 From: noahhaon <170715+noahhaon@users.noreply.github.com> Date: Tue, 18 Feb 2025 20:25:55 +0100 Subject: [PATCH 183/381] Add missing traceroute fields to serialized JSON output (#6087) --- src/serialization/MeshPacketSerializer.cpp | 23 +++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/serialization/MeshPacketSerializer.cpp b/src/serialization/MeshPacketSerializer.cpp index 2f0d881f2..2c1dc0ca7 100644 --- a/src/serialization/MeshPacketSerializer.cpp +++ b/src/serialization/MeshPacketSerializer.cpp @@ -220,7 +220,11 @@ std::string MeshPacketSerializer::JsonSerialize(const meshtastic_MeshPacket *mp, if (pb_decode_from_bytes(mp->decoded.payload.bytes, mp->decoded.payload.size, &meshtastic_RouteDiscovery_msg, &scratch)) { decoded = &scratch; - JSONArray route; // Route this message took + JSONArray route; // Route this message took + JSONArray routeBack; // Route this message took back + JSONArray snrTowards; // Snr for forward route + JSONArray snrBack; // Snr for reverse route + // Lambda function for adding a long name to the route auto addToRoute = [](JSONArray *route, NodeNum num) { char long_name[40] = "Unknown"; @@ -236,7 +240,24 @@ std::string MeshPacketSerializer::JsonSerialize(const meshtastic_MeshPacket *mp, } addToRoute(&route, mp->from); // Ended at the original destination (source of response) + addToRoute(&routeBack, mp->from); // Started at the original destination (source of response) + for (uint8_t i = 0; i < decoded->route_back_count; i++) { + addToRoute(&routeBack, decoded->route_back[i]); + } + addToRoute(&routeBack, mp->to); // Ended at the original transmitter (destination of response) + + for (uint8_t i = 0; i < decoded->snr_back_count; i++) { + snrBack.push_back(new JSONValue((float)decoded->snr_back[i] / 4)); + } + + for (uint8_t i = 0; i < decoded->snr_towards_count; i++) { + snrTowards.push_back(new JSONValue((float)decoded->snr_towards[i] / 4)); + } + msgPayload["route"] = new JSONValue(route); + msgPayload["route_back"] = new JSONValue(routeBack); + msgPayload["snr_back"] = new JSONValue(snrBack); + msgPayload["snr_towards"] = new JSONValue(snrTowards); jsonObj["payload"] = new JSONValue(msgPayload); } else if (shouldLog) { LOG_ERROR(errStr, msgType.c_str()); From 191ca8ce124d9adbc9843ec5de0a3edf3f2c0af9 Mon Sep 17 00:00:00 2001 From: rcarteraz Date: Tue, 18 Feb 2025 14:56:13 -0700 Subject: [PATCH 184/381] update readme add logo image (#6088) --- .github/meshtastic_logo.png | Bin 0 -> 91300 bytes README.md | 31 ++++++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 .github/meshtastic_logo.png diff --git a/.github/meshtastic_logo.png b/.github/meshtastic_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..11c5db18c71249b1ac78d30ca2ffeafd5629912b GIT binary patch literal 91300 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 K{aMp7;(q|(7(V|1 literal 0 HcmV?d00001 diff --git a/README.md b/README.md index ca8a924fd..f34bf1839 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ -# Meshtastic Firmware + + + + + + ## Overview -This repository contains the device firmware for the Meshtastic project. +This repository contains the official device firmware for Meshtastic, an open-source LoRa mesh networking project designed for long-range, low-power communication without relying on internet or cellular infrastructure. The firmware supports various hardware platforms, including ESP32, nRF52, RP2040/RP2350, and Linux-based devices. -- **[Building Instructions](https://meshtastic.org/docs/development/firmware/build)** -- **[Flashing Instructions](https://meshtastic.org/docs/getting-started/flashing-firmware/)** +Meshtastic enables text messaging, location sharing, and telemetry over a decentralized mesh network, making it ideal for outdoor adventures, emergency preparedness, and remote operations. + +### Get Started + +- 🔧 **[Building Instructions](https://meshtastic.org/docs/development/firmware/build)** – Learn how to compile the firmware from source. +- âš¡ **[Flashing Instructions](https://meshtastic.org/docs/getting-started/flashing-firmware/)** – Install or update the firmware on your device. + +Join our community and help improve Meshtastic! 🚀 ## Stats -![Alt](https://repobeats.axiom.co/api/embed/a92f097d9197ae853e780ec53d7d126e545629ab.svg "Repobeats analytics image") +![Alt](https://repobeats.axiom.co/api/embed/8025e56c482ec63541593cc5bd322c19d5c0bdcf.svg "Repobeats analytics image") From 79b3a1e60e6080d6b27ea43e98012a9cf32fa9a3 Mon Sep 17 00:00:00 2001 From: Ikko Eltociear Ashimine Date: Wed, 19 Feb 2025 20:58:41 +0900 Subject: [PATCH 185/381] chore: update unishox2.h (#6092) occuring -> occurring --- src/mesh/compression/unishox2.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mesh/compression/unishox2.h b/src/mesh/compression/unishox2.h index 5e2cc8b4c..823128f02 100644 --- a/src/mesh/compression/unishox2.h +++ b/src/mesh/compression/unishox2.h @@ -291,8 +291,8 @@ extern int unishox2_decompress_simple(const char *in, int len, char *out); * @param[in] olen length of 'out' buffer in bytes. Can be omitted if sufficient buffer is provided * @param[in] usx_hcodes Horizontal codes (array of bytes). See macro section for samples. * @param[in] usx_hcode_lens Length of each element in usx_hcodes array - * @param[in] usx_freq_seq Frequently occuring sequences. See USX_FREQ_SEQ_* macros for samples - * @param[in] usx_templates Templates of frequently occuring patterns. See USX_TEMPLATES macro. + * @param[in] usx_freq_seq Frequently occurring sequences. See USX_FREQ_SEQ_* macros for samples + * @param[in] usx_templates Templates of frequently occurring patterns. See USX_TEMPLATES macro. */ extern int unishox2_compress(const char *in, int len, UNISHOX_API_OUT_AND_LEN(char *out, int olen), const unsigned char usx_hcodes[], const unsigned char usx_hcode_lens[], const char *usx_freq_seq[], @@ -310,8 +310,8 @@ extern int unishox2_compress(const char *in, int len, UNISHOX_API_OUT_AND_LEN(ch * @param[in] olen length of 'out' buffer in bytes. Can be omitted if sufficient buffer is provided * @param[in] usx_hcodes Horizontal codes (array of bytes). See macro section for samples. * @param[in] usx_hcode_lens Length of each element in usx_hcodes array - * @param[in] usx_freq_seq Frequently occuring sequences. See USX_FREQ_SEQ_* macros for samples - * @param[in] usx_templates Templates of frequently occuring patterns. See USX_TEMPLATES macro. + * @param[in] usx_freq_seq Frequently occurring sequences. See USX_FREQ_SEQ_* macros for samples + * @param[in] usx_templates Templates of frequently occurring patterns. See USX_TEMPLATES macro. */ extern int unishox2_decompress(const char *in, int len, UNISHOX_API_OUT_AND_LEN(char *out, int olen), const unsigned char usx_hcodes[], const unsigned char usx_hcode_lens[], const char *usx_freq_seq[], @@ -344,4 +344,4 @@ extern int unishox2_decompress_lines(const char *in, int len, UNISHOX_API_OUT_AN const unsigned char usx_hcodes[], const unsigned char usx_hcode_lens[], const char *usx_freq_seq[], const char *usx_templates[], struct us_lnk_lst *prev_lines); -#endif \ No newline at end of file +#endif From 5da5803c4c99d2fbce6ef8cf45ce1b1f6656c721 Mon Sep 17 00:00:00 2001 From: Austin Date: Wed, 19 Feb 2025 07:14:46 -0500 Subject: [PATCH 186/381] Trunk: Annotate PRs and Auto-Upgrade (#6091) --- .github/workflows/nightly.yml | 20 ++++++++++++-- .github/workflows/trunk_annotate.pr.yml | 26 +++++++++++++++++++ .../{trunk-check.yml => trunk_check.yml} | 0 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/trunk_annotate.pr.yml rename .github/workflows/{trunk-check.yml => trunk_check.yml} (100%) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index e249823a7..7a35e2b99 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -4,9 +4,11 @@ on: - cron: 0 8 * * 1-5 workflow_dispatch: {} +permissions: read-all + jobs: trunk_check: - name: Trunk Check Upload + name: Trunk Check and Upload runs-on: ubuntu-latest steps: @@ -14,6 +16,20 @@ jobs: uses: actions/checkout@v4 - name: Trunk Check - uses: trunk-io/trunk-action@782e83f803ca6e369f035d64c6ba2768174ba61b + uses: trunk-io/trunk-action@v1 with: trunk-token: ${{ secrets.TRUNK_TOKEN }} + + trunk_upgrade: + name: Trunk Upgrade (PR) + runs-on: ubuntu-latest + permissions: + contents: write # For trunk to create PRs + pull-requests: write # For trunk to create PRs + steps: + - name: Checkout + uses: actions/checkout@v4 + + # See https://github.com/trunk-io/trunk-action/blob/v1/readme.md#automatic-upgrades + - name: Trunk Upgrade + uses: trunk-io/trunk-action/upgrade@v1 diff --git a/.github/workflows/trunk_annotate.pr.yml b/.github/workflows/trunk_annotate.pr.yml new file mode 100644 index 000000000..ac5cdc0d5 --- /dev/null +++ b/.github/workflows/trunk_annotate.pr.yml @@ -0,0 +1,26 @@ +name: Annotate PR with trunk issues +# See: https://github.com/trunk-io/trunk-action/blob/v1/readme.md#getting-inline-annotations-for-fork-prs + +on: + workflow_run: + workflows: [Pull Request] # Name from `trunk_check.yml` + types: [completed] + +permissions: read-all + +jobs: + trunk_check: + name: Trunk Code Quality Annotate + runs-on: ubuntu-latest + permissions: + checks: write # For trunk to post annotations + contents: read # For repo checkout + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Trunk Check + uses: trunk-io/trunk-action@v1 + with: + post-annotations: true diff --git a/.github/workflows/trunk-check.yml b/.github/workflows/trunk_check.yml similarity index 100% rename from .github/workflows/trunk-check.yml rename to .github/workflows/trunk_check.yml From 93c64cb44227f46a9aa6839603fec1e025bf24df Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Wed, 19 Feb 2025 20:32:38 +0800 Subject: [PATCH 187/381] Dependencies: minor version updates (#6045) platformio/espressif32@6.9.0 --> 6.10.0 lewisxhe/XPowersLib@^0.2.6 --> 0.2.7 platformio/framework-arduinoststm32@~Oct 2024 --> 4.20900.0 zinggjm/GxEPD2@^1.4.9 --> 1.6.2 tool-esptoolpy@^1.40500.0 --> 1.40801.0 Used platformio tool to check, kept to minor version updates, checked release notes for any breaking changes. --- arch/esp32/esp32.ini | 8 ++++---- arch/esp32/esp32c6.ini | 4 ++-- arch/stm32/stm32.ini | 4 ++-- platformio.ini | 2 +- variants/Dongle_nRF52840-pca10059-v1/platformio.ini | 4 ++-- variants/ME25LS01-4Y10TD_e-ink/platformio.ini | 4 ++-- variants/MakePython_nRF52840_eink/platformio.ini | 2 +- variants/TWC_mesh_v4/platformio.ini | 4 ++-- variants/esp32-s3-pico/platformio.ini | 2 +- variants/m5stack_coreink/platformio.ini | 4 ++-- variants/my_esp32s3_diy_eink/platformio.ini | 6 +++--- variants/my_esp32s3_diy_oled/platformio.ini | 4 ++-- variants/rak4631_epaper/platformio.ini | 4 ++-- variants/rak4631_epaper_onrxtx/platformio.ini | 4 ++-- 14 files changed, 28 insertions(+), 28 deletions(-) diff --git a/arch/esp32/esp32.ini b/arch/esp32/esp32.ini index d6a756bec..e02e3ed85 100644 --- a/arch/esp32/esp32.ini +++ b/arch/esp32/esp32.ini @@ -2,7 +2,7 @@ [esp32_base] extends = arduino_base custom_esp32_kind = esp32 -platform = platformio/espressif32@6.9.0 +platform = platformio/espressif32@6.10.0 build_src_filter = ${arduino_base.build_src_filter} - - - - - @@ -45,9 +45,9 @@ lib_deps = ${environmental_base.lib_deps} ${radiolib_base.lib_deps} https://github.com/meshtastic/esp32_https_server.git#23665b3adc080a311dcbb586ed5941b5f94d6ea2 - h2zero/NimBLE-Arduino@^1.4.2 + h2zero/NimBLE-Arduino@^1.4.3 https://github.com/dbinfrago/libpax.git#3cdc0371c375676a97967547f4065607d4c53fd1 - lewisxhe/XPowersLib@^0.2.6 + lewisxhe/XPowersLib@^0.2.7 https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f rweather/Crypto@^0.4.0 @@ -65,4 +65,4 @@ lib_ignore = ; customize the partition table ; http://docs.platformio.org/en/latest/platforms/espressif32.html#partition-tables -board_build.partitions = partition-table.csv \ No newline at end of file +board_build.partitions = partition-table.csv diff --git a/arch/esp32/esp32c6.ini b/arch/esp32/esp32c6.ini index 3f8b1bdbe..d0425812f 100644 --- a/arch/esp32/esp32c6.ini +++ b/arch/esp32/esp32c6.ini @@ -24,7 +24,7 @@ lib_deps = ${networking_base.lib_deps} ${environmental_base.lib_deps} ${radiolib_base.lib_deps} - lewisxhe/XPowersLib@^0.2.6 + lewisxhe/XPowersLib@^0.2.7 https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f rweather/Crypto@^0.4.0 @@ -38,4 +38,4 @@ lib_ignore = NonBlockingRTTTL NimBLE-Arduino libpax - \ No newline at end of file + diff --git a/arch/stm32/stm32.ini b/arch/stm32/stm32.ini index 46f41db3a..d7bb0c583 100644 --- a/arch/stm32/stm32.ini +++ b/arch/stm32/stm32.ini @@ -1,7 +1,7 @@ [stm32_base] extends = arduino_base platform = ststm32 -platform_packages = platformio/framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32.git#ea74156acd823b6d14739f389e6cdc648f8ee36e +platform_packages = platformio/framework-arduinoststm32@^4.20900.0 build_type = release @@ -41,4 +41,4 @@ lib_deps = lib_ignore = mathertel/OneButton@2.6.1 - Wire \ No newline at end of file + Wire diff --git a/platformio.ini b/platformio.ini index 1c51e53b4..98b93c34d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -59,7 +59,7 @@ lib_deps = https://github.com/meshtastic/arduino-fsm.git#7db3702bf0cfe97b783d6c72595e3f38e0b19159 https://github.com/meshtastic/TinyGPSPlus.git#71a82db35f3b973440044c476d4bcdc673b104f4 https://github.com/meshtastic/ArduinoThread.git#1ae8778c85d0a2a729f989e0b1e7d7c4dc84eef0 - nanopb/Nanopb@0.4.9 + nanopb/Nanopb@0.4.91 erriez/ErriezCRC32@1.0.1 ; Used for the code analysis in PIO Home / Inspect diff --git a/variants/Dongle_nRF52840-pca10059-v1/platformio.ini b/variants/Dongle_nRF52840-pca10059-v1/platformio.ini index a98656e86..9e87fd237 100644 --- a/variants/Dongle_nRF52840-pca10059-v1/platformio.ini +++ b/variants/Dongle_nRF52840-pca10059-v1/platformio.ini @@ -10,5 +10,5 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/Dongle_nRF52840-pca10059-v build_src_filter = ${nrf52_base.build_src_filter} +<../variants/Dongle_nRF52840-pca10059-v1> lib_deps = ${nrf52840_base.lib_deps} - zinggjm/GxEPD2@^1.4.9 -debug_tool = jlink \ No newline at end of file + zinggjm/GxEPD2@^1.6.2 +debug_tool = jlink diff --git a/variants/ME25LS01-4Y10TD_e-ink/platformio.ini b/variants/ME25LS01-4Y10TD_e-ink/platformio.ini index f2e3a49e3..62314040a 100644 --- a/variants/ME25LS01-4Y10TD_e-ink/platformio.ini +++ b/variants/ME25LS01-4Y10TD_e-ink/platformio.ini @@ -13,7 +13,7 @@ board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld build_src_filter = ${nrf52_base.build_src_filter} +<../variants/ME25LS01-4Y10TD_e-ink> lib_deps = ${nrf52840_base.lib_deps} - zinggjm/GxEPD2@^1.5.8 + zinggjm/GxEPD2@^1.6.2 ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) upload_protocol = nrfutil -upload_port = /dev/ttyACM1 \ No newline at end of file +upload_port = /dev/ttyACM1 diff --git a/variants/MakePython_nRF52840_eink/platformio.ini b/variants/MakePython_nRF52840_eink/platformio.ini index b11b54c7d..db7c967e5 100644 --- a/variants/MakePython_nRF52840_eink/platformio.ini +++ b/variants/MakePython_nRF52840_eink/platformio.ini @@ -9,7 +9,7 @@ build_src_filter = ${nrf52_base.build_src_filter} +<../variants/MakePython_nRF52 lib_deps = ${nrf52840_base.lib_deps} https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f - zinggjm/GxEPD2@^1.4.9 + zinggjm/GxEPD2@^1.6.2 -DEINK_DISPLAY_MODEL=GxEPD2_290_T5D -DEINK_WIDTH=296 -DEINK_HEIGHT=128 diff --git a/variants/TWC_mesh_v4/platformio.ini b/variants/TWC_mesh_v4/platformio.ini index 4fb382334..2eb58bf9f 100644 --- a/variants/TWC_mesh_v4/platformio.ini +++ b/variants/TWC_mesh_v4/platformio.ini @@ -6,5 +6,5 @@ build_flags = ${nrf52840_base.build_flags} -I variants/TWC_mesh_v4 -D TWC_mesh_v build_src_filter = ${nrf52_base.build_src_filter} +<../variants/TWC_mesh_v4> lib_deps = ${nrf52840_base.lib_deps} - zinggjm/GxEPD2@^1.4.9 -debug_tool = jlink \ No newline at end of file + zinggjm/GxEPD2@^1.6.2 +debug_tool = jlink diff --git a/variants/esp32-s3-pico/platformio.ini b/variants/esp32-s3-pico/platformio.ini index 916f623bd..20a41ba56 100644 --- a/variants/esp32-s3-pico/platformio.ini +++ b/variants/esp32-s3-pico/platformio.ini @@ -21,5 +21,5 @@ build_flags = ${esp32s3_base.build_flags} -DEINK_HEIGHT=128 lib_deps = ${esp32s3_base.lib_deps} - zinggjm/GxEPD2@^1.5.3 + zinggjm/GxEPD2@^1.6.2 adafruit/Adafruit NeoPixel @ ^1.12.0 diff --git a/variants/m5stack_coreink/platformio.ini b/variants/m5stack_coreink/platformio.ini index c0c8bd30e..70da53379 100644 --- a/variants/m5stack_coreink/platformio.ini +++ b/variants/m5stack_coreink/platformio.ini @@ -17,11 +17,11 @@ build_flags = -DM5STACK lib_deps = ${esp32_base.lib_deps} - zinggjm/GxEPD2@^1.5.3 + zinggjm/GxEPD2@^1.6.2 lewisxhe/PCF8563_Library@^1.0.1 lib_ignore = m5stack-coreink monitor_filters = esp32_exception_decoder board_build.f_cpu = 240000000L upload_protocol = esptool -upload_port = /dev/ttyACM0 \ No newline at end of file +upload_port = /dev/ttyACM0 diff --git a/variants/my_esp32s3_diy_eink/platformio.ini b/variants/my_esp32s3_diy_eink/platformio.ini index b2404566f..22643597f 100644 --- a/variants/my_esp32s3_diy_eink/platformio.ini +++ b/variants/my_esp32s3_diy_eink/platformio.ini @@ -9,10 +9,10 @@ upload_protocol = esptool ;upload_port = /dev/ttyACM1 upload_speed = 921600 platform_packages = - tool-esptoolpy@^1.40500.0 + tool-esptoolpy@^1.40801.0 lib_deps = ${esp32_base.lib_deps} - zinggjm/GxEPD2@^1.5.1 + zinggjm/GxEPD2@^1.6.2 adafruit/Adafruit NeoPixel @ ^1.12.0 build_unflags = ${esp32s3_base.build_unflags} @@ -26,4 +26,4 @@ build_flags = -DEINK_HEIGHT=128 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue - -DARDUINO_USB_MODE=0 \ No newline at end of file + -DARDUINO_USB_MODE=0 diff --git a/variants/my_esp32s3_diy_oled/platformio.ini b/variants/my_esp32s3_diy_oled/platformio.ini index 0fbbaa899..ce65c516e 100644 --- a/variants/my_esp32s3_diy_oled/platformio.ini +++ b/variants/my_esp32s3_diy_oled/platformio.ini @@ -9,7 +9,7 @@ upload_protocol = esptool ;upload_port = /dev/ttyACM0 upload_speed = 921600 platform_packages = - tool-esptoolpy@^1.40500.0 + tool-esptoolpy@^1.40801.0 lib_deps = ${esp32_base.lib_deps} adafruit/Adafruit NeoPixel @ ^1.12.0 @@ -21,4 +21,4 @@ build_flags = ${esp32_base.build_flags} -D PRIVATE_HW -I variants/my_esp32s3_diy_oled -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue - -DARDUINO_USB_MODE=0 \ No newline at end of file + -DARDUINO_USB_MODE=0 diff --git a/variants/rak4631_epaper/platformio.ini b/variants/rak4631_epaper/platformio.ini index 2479f09c8..b851691ed 100644 --- a/variants/rak4631_epaper/platformio.ini +++ b/variants/rak4631_epaper/platformio.ini @@ -13,10 +13,10 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/rak4631_epaper -D RAK_4631 build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak4631_epaper> lib_deps = ${nrf52840_base.lib_deps} - zinggjm/GxEPD2@^1.4.9 + zinggjm/GxEPD2@^1.6.2 melopero/Melopero RV3028@^1.1.0 rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2 beegee-tokyo/RAKwireless RAK12034@^1.0.0 debug_tool = jlink ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) -;upload_protocol = jlink \ No newline at end of file +;upload_protocol = jlink diff --git a/variants/rak4631_epaper_onrxtx/platformio.ini b/variants/rak4631_epaper_onrxtx/platformio.ini index 8c1b8eee8..8612a3f3d 100644 --- a/variants/rak4631_epaper_onrxtx/platformio.ini +++ b/variants/rak4631_epaper_onrxtx/platformio.ini @@ -15,11 +15,11 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/rak4631_epaper -D RAK_4631 build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak4631_epaper_onrxtx> lib_deps = ${nrf52840_base.lib_deps} - zinggjm/GxEPD2@^1.5.1 + zinggjm/GxEPD2@^1.6.2 melopero/Melopero RV3028@^1.1.0 rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2 beegee-tokyo/RAKwireless RAK12034@^1.0.0 debug_tool = jlink ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) ;upload_protocol = jlink -;upload_port = /dev/ttyACM3 \ No newline at end of file +;upload_port = /dev/ttyACM3 From bb73555209323017da121ce4b6be5d5ba84db46e Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Wed, 19 Feb 2025 13:36:59 +0100 Subject: [PATCH 188/381] Expose INA219 measurement as battery voltage for Seeed Xiao ESP32S3 (#6070) * Expose INA219 measurement as battery voltage for Seeed Xiao ESP32S3 * Define BATTERY_PIN and don't block a random GPIO --- variants/seeed_xiao_s3/variant.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/variants/seeed_xiao_s3/variant.h b/variants/seeed_xiao_s3/variant.h index 8f9282a7a..d8dcbc8d4 100644 --- a/variants/seeed_xiao_s3/variant.h +++ b/variants/seeed_xiao_s3/variant.h @@ -36,6 +36,10 @@ L76K GPS Module Information : https://www.seeedstudio.com/L76K-GNSS-Module-for-S #define BUTTON_PIN 21 // This is the Program Button #define BUTTON_NEED_PULLUP +#define BATTERY_PIN -1 +#define ADC_CHANNEL ADC1_GPIO1_CHANNEL +#define BATTERY_SENSE_RESOLUTION_BITS 12 + /*Warning: https://www.seeedstudio.com/L76K-GNSS-Module-for-Seeed-Studio-XIAO-p-5864.html L76K Expansion Board can not directly used, L76K Reset Pin needs to override or physically remove it, From 337265a07f4aa076eebb50b1b7333d55ae9f2dfd Mon Sep 17 00:00:00 2001 From: Austin Date: Wed, 19 Feb 2025 18:43:23 -0500 Subject: [PATCH 189/381] Trunk: Another annotation attempt (#6100) --- .github/workflows/nightly.yml | 4 ++- ..._annotate.pr.yml => trunk_annotate_pr.yml} | 0 .github/workflows/trunk_check.yml | 2 ++ .trunk/trunk.yaml | 32 +++++++++---------- 4 files changed, 20 insertions(+), 18 deletions(-) rename .github/workflows/{trunk_annotate.pr.yml => trunk_annotate_pr.yml} (100%) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 7a35e2b99..28ba12fcc 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -21,6 +21,7 @@ jobs: trunk-token: ${{ secrets.TRUNK_TOKEN }} trunk_upgrade: + # See: https://github.com/trunk-io/trunk-action/blob/v1/readme.md#automatic-upgrades name: Trunk Upgrade (PR) runs-on: ubuntu-latest permissions: @@ -30,6 +31,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - # See https://github.com/trunk-io/trunk-action/blob/v1/readme.md#automatic-upgrades - name: Trunk Upgrade uses: trunk-io/trunk-action/upgrade@v1 + with: + base: master diff --git a/.github/workflows/trunk_annotate.pr.yml b/.github/workflows/trunk_annotate_pr.yml similarity index 100% rename from .github/workflows/trunk_annotate.pr.yml rename to .github/workflows/trunk_annotate_pr.yml diff --git a/.github/workflows/trunk_check.yml b/.github/workflows/trunk_check.yml index 6ed905bc8..2e74ab25f 100644 --- a/.github/workflows/trunk_check.yml +++ b/.github/workflows/trunk_check.yml @@ -20,3 +20,5 @@ jobs: - name: Trunk Check uses: trunk-io/trunk-action@v1 + with: + save-annotations: true diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index f2393592c..12b8608f2 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -1,37 +1,35 @@ version: 0.1 cli: - version: 1.22.8 + version: 1.22.10 plugins: sources: - id: trunk - ref: v1.6.6 + ref: v1.6.7 uri: https://github.com/trunk-io/plugins lint: enabled: - - prettier@3.4.2 - - trufflehog@3.86.1 + - prettier@3.5.1 + - trufflehog@3.88.10 - yamllint@1.35.1 - - bandit@1.8.0 - - checkov@3.2.334 + - bandit@1.8.3 + - checkov@3.2.372 - terrascan@1.19.9 - - trivy@0.58.0 - #- trufflehog@3.63.2-rc0 + - trivy@0.59.1 - taplo@0.9.3 - - ruff@0.8.3 - - isort@5.13.2 - - markdownlint@0.43.0 - - oxipng@9.1.3 + - ruff@0.9.6 + - isort@6.0.0 + - markdownlint@0.44.0 + - oxipng@9.1.4 - svgo@3.3.2 - - actionlint@1.7.4 - - flake8@7.1.1 + - actionlint@1.7.7 + - flake8@7.1.2 - hadolint@2.12.1-beta - shfmt@3.6.0 - shellcheck@0.10.0 - - black@24.10.0 + - black@25.1.0 - git-diff-check - - gitleaks@8.21.2 + - gitleaks@8.23.3 - clang-format@16.0.3 - #- prettier@3.3.3 ignore: - linters: [ALL] paths: From f1dc1b309a46190670d5a42f3880d0d1573b5887 Mon Sep 17 00:00:00 2001 From: Austin Date: Wed, 19 Feb 2025 19:14:54 -0500 Subject: [PATCH 190/381] PIO: Cleanup dependency naming (#6090) --- arch/nrf52/nrf52.ini | 4 ++-- arch/stm32/stm32.ini | 4 ++-- variants/MakePython_nRF52840_eink/platformio.ini | 8 ++++---- variants/icarus/platformio.ini | 4 ++-- variants/my_esp32s3_diy_eink/platformio.ini | 4 ++-- variants/my_esp32s3_diy_oled/platformio.ini | 4 ++-- variants/rak11310/platformio.ini | 2 +- variants/trackerd/platformio.ini | 7 +------ 8 files changed, 16 insertions(+), 21 deletions(-) diff --git a/arch/nrf52/nrf52.ini b/arch/nrf52/nrf52.ini index b68977c78..606cabac6 100644 --- a/arch/nrf52/nrf52.ini +++ b/arch/nrf52/nrf52.ini @@ -4,8 +4,8 @@ platform = platformio/nordicnrf52@^10.7.0 extends = arduino_base platform_packages = ; our custom Git version until they merge our PR - framework-arduinoadafruitnrf52 @ https://github.com/meshtastic/Adafruit_nRF52_Arduino.git#e13f5820002a4fb2a5e6754b42ace185277e5adf - toolchain-gccarmnoneeabi@~1.90301.0 + platformio/framework-arduinoadafruitnrf52 @ https://github.com/meshtastic/Adafruit_nRF52_Arduino.git#e13f5820002a4fb2a5e6754b42ace185277e5adf + platformio/toolchain-gccarmnoneeabi@~1.90301.0 build_type = debug build_flags = diff --git a/arch/stm32/stm32.ini b/arch/stm32/stm32.ini index d7bb0c583..efa1ab0e4 100644 --- a/arch/stm32/stm32.ini +++ b/arch/stm32/stm32.ini @@ -1,6 +1,6 @@ [stm32_base] extends = arduino_base -platform = ststm32 +platform = platformio/ststm32 platform_packages = platformio/framework-arduinoststm32@^4.20900.0 build_type = release @@ -41,4 +41,4 @@ lib_deps = lib_ignore = mathertel/OneButton@2.6.1 - Wire + Wire \ No newline at end of file diff --git a/variants/MakePython_nRF52840_eink/platformio.ini b/variants/MakePython_nRF52840_eink/platformio.ini index db7c967e5..b7ce97dcb 100644 --- a/variants/MakePython_nRF52840_eink/platformio.ini +++ b/variants/MakePython_nRF52840_eink/platformio.ini @@ -5,13 +5,13 @@ board = nordic_pca10059 build_flags = ${nrf52840_base.build_flags} -Ivariants/MakePython_nRF52840_eink -D PRIVATE_HW -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -D PIN_EINK_EN + -DEINK_DISPLAY_MODEL=GxEPD2_290_T5D + -DEINK_WIDTH=296 + -DEINK_HEIGHT=128 build_src_filter = ${nrf52_base.build_src_filter} +<../variants/MakePython_nRF52840_eink> lib_deps = ${nrf52840_base.lib_deps} https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f zinggjm/GxEPD2@^1.6.2 - -DEINK_DISPLAY_MODEL=GxEPD2_290_T5D - -DEINK_WIDTH=296 - -DEINK_HEIGHT=128 debug_tool = jlink -;upload_port = /dev/ttyACM4 +;upload_port = /dev/ttyACM4 \ No newline at end of file diff --git a/variants/icarus/platformio.ini b/variants/icarus/platformio.ini index 11f09cab4..b1dc01fc1 100644 --- a/variants/icarus/platformio.ini +++ b/variants/icarus/platformio.ini @@ -6,7 +6,7 @@ board_check = true board_build.mcu = esp32s3 upload_protocol = esptool upload_speed = 921600 -platform_packages = framework-arduinoespressif32@https://github.com/PowerFeather/powerfeather-meshtastic-arduino-lib/releases/download/2.0.16a/esp32-2.0.16.zip +platform_packages = platformio/framework-arduinoespressif32@https://github.com/PowerFeather/powerfeather-meshtastic-arduino-lib/releases/download/2.0.16a/esp32-2.0.16.zip lib_deps = ${esp32s3_base.lib_deps} build_unflags = @@ -16,4 +16,4 @@ build_flags = ${esp32s3_base.build_flags} -D PRIVATE_HW -I variants/icarus -DBOARD_HAS_PSRAM - -DARDUINO_USB_MODE=0 + -DARDUINO_USB_MODE=0 \ No newline at end of file diff --git a/variants/my_esp32s3_diy_eink/platformio.ini b/variants/my_esp32s3_diy_eink/platformio.ini index 22643597f..98613e4fb 100644 --- a/variants/my_esp32s3_diy_eink/platformio.ini +++ b/variants/my_esp32s3_diy_eink/platformio.ini @@ -9,7 +9,7 @@ upload_protocol = esptool ;upload_port = /dev/ttyACM1 upload_speed = 921600 platform_packages = - tool-esptoolpy@^1.40801.0 + platformio/tool-esptoolpy@^1.40801.0 lib_deps = ${esp32_base.lib_deps} zinggjm/GxEPD2@^1.6.2 @@ -26,4 +26,4 @@ build_flags = -DEINK_HEIGHT=128 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue - -DARDUINO_USB_MODE=0 + -DARDUINO_USB_MODE=0 \ No newline at end of file diff --git a/variants/my_esp32s3_diy_oled/platformio.ini b/variants/my_esp32s3_diy_oled/platformio.ini index ce65c516e..346cc9cac 100644 --- a/variants/my_esp32s3_diy_oled/platformio.ini +++ b/variants/my_esp32s3_diy_oled/platformio.ini @@ -9,7 +9,7 @@ upload_protocol = esptool ;upload_port = /dev/ttyACM0 upload_speed = 921600 platform_packages = - tool-esptoolpy@^1.40801.0 + platformio/tool-esptoolpy@^1.40801.0 lib_deps = ${esp32_base.lib_deps} adafruit/Adafruit NeoPixel @ ^1.12.0 @@ -21,4 +21,4 @@ build_flags = ${esp32_base.build_flags} -D PRIVATE_HW -I variants/my_esp32s3_diy_oled -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue - -DARDUINO_USB_MODE=0 + -DARDUINO_USB_MODE=0 \ No newline at end of file diff --git a/variants/rak11310/platformio.ini b/variants/rak11310/platformio.ini index 0cc60bc7c..d1da962ca 100644 --- a/variants/rak11310/platformio.ini +++ b/variants/rak11310/platformio.ini @@ -18,4 +18,4 @@ lib_deps = ${networking_base.lib_deps} https://github.com/RAKWireless/RAK13800-W5100S.git#1.0.2 debug_build_flags = ${rp2040_base.build_flags}, -g -debug_tool = cmsis-dap ; for e.g. Picotool +debug_tool = cmsis-dap ; for e.g. Picotool \ No newline at end of file diff --git a/variants/trackerd/platformio.ini b/variants/trackerd/platformio.ini index 6fba190f3..654534a15 100644 --- a/variants/trackerd/platformio.ini +++ b/variants/trackerd/platformio.ini @@ -1,13 +1,8 @@ [env:trackerd] extends = esp32_base -;platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream -platform = espressif32 board = pico32 board_build.f_flash = 80000000L build_flags = ${esp32_base.build_flags} -D PRIVATE_HW -I variants/trackerd -D BSFILE=\"boards/dragino_lbt2.h\" -;board_build.partitions = no_ota.csv -;platform_packages = -; platformio/framework-arduinoespressif32@3 -;platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.1-RC1 +;board_build.partitions = no_ota.csv \ No newline at end of file From 9930bba3f5c65b679449cea5f8b990e7728fa4f1 Mon Sep 17 00:00:00 2001 From: Mictronics Date: Thu, 20 Feb 2025 10:56:34 +0100 Subject: [PATCH 191/381] Add Pico2W variant including Wifi support. (#6062) --- arch/rp2xx0/rp2350.ini | 5 ++- src/mesh/api/ServerAPI.cpp | 4 ++- variants/rpipico2/platformio.ini | 2 +- variants/rpipico2w/platformio.ini | 30 ++++++++++++++++++ variants/rpipico2w/variant.h | 52 +++++++++++++++++++++++++++++++ 5 files changed, 88 insertions(+), 5 deletions(-) create mode 100644 variants/rpipico2w/platformio.ini create mode 100644 variants/rpipico2w/variant.h diff --git a/arch/rp2xx0/rp2350.ini b/arch/rp2xx0/rp2350.ini index ab16e24b4..6f1e4400e 100644 --- a/arch/rp2xx0/rp2350.ini +++ b/arch/rp2xx0/rp2350.ini @@ -1,8 +1,8 @@ ; Common settings for rp2040 Processor based targets [rp2350_base] -platform = https://github.com/maxgerhardt/platform-raspberrypi.git#19e30129fb1428b823be585c787dcb4ac0d9014c ; For arduino-pico >=4.2.1 +platform = https://github.com/maxgerhardt/platform-raspberrypi.git#76ecf3c7e9dd4503af0331154c4ca1cddc4b03e5 ; For arduino-pico >= 4.4.3 extends = arduino_base -platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#6024e9a7e82a72e38dd90f42029ba3748835eb2e ; 4.3.0 with fix MDNS +platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#4.4.3 board_build.core = earlephilhower board_build.filesystem_size = 0.5m @@ -10,7 +10,6 @@ build_flags = ${arduino_base.build_flags} -Wno-unused-variable -Wcast-align -Isrc/platform/rp2xx0 -D__PLAT_RP2350__ -# -D _POSIX_THREADS build_src_filter = ${arduino_base.build_src_filter} - - - - - - - - - - - diff --git a/src/mesh/api/ServerAPI.cpp b/src/mesh/api/ServerAPI.cpp index e28e4c815..1a506421c 100644 --- a/src/mesh/api/ServerAPI.cpp +++ b/src/mesh/api/ServerAPI.cpp @@ -51,6 +51,8 @@ template int32_t APIServerPort::runOnce() #else auto client = U::available(); #endif +#elif defined(ARCH_RP2040) + auto client = U::accept(); #else auto client = U::available(); #endif @@ -78,4 +80,4 @@ template int32_t APIServerPort::runOnce() waitTime = 100; #endif return 100; // only check occasionally for incoming connections -} +} \ No newline at end of file diff --git a/variants/rpipico2/platformio.ini b/variants/rpipico2/platformio.ini index 24714efd5..de4954ea2 100644 --- a/variants/rpipico2/platformio.ini +++ b/variants/rpipico2/platformio.ini @@ -9,7 +9,7 @@ build_flags = ${rp2350_base.build_flags} -Ivariants/rpipico2 -DDEBUG_RP2040_PORT=Serial -DHW_SPI1_DEVICE - -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" + -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m33" lib_deps = ${rp2350_base.lib_deps} debug_build_flags = ${rp2350_base.build_flags}, -g diff --git a/variants/rpipico2w/platformio.ini b/variants/rpipico2w/platformio.ini new file mode 100644 index 000000000..351774221 --- /dev/null +++ b/variants/rpipico2w/platformio.ini @@ -0,0 +1,30 @@ +[env:pico2w] +extends = rp2350_base +board = rpipico2w +upload_protocol = jlink +# debug settings for external openocd with RP2040 support (custom build) +debug_tool = custom +debug_init_cmds = + target extended-remote localhost:3333 + $INIT_BREAK + monitor reset halt + $LOAD_CMDS + monitor init + monitor reset halt + +# add our variants files to the include and src paths +build_flags = ${rp2350_base.build_flags} + -DRPI_PICO2 + -Ivariants/rpipico2w +# -DDEBUG_RP2040_PORT=Serial + -DHW_SPI1_DEVICE + -DARDUINO_RASPBERRY_PI_PICO_2W + -DARDUINO_ARCH_RP2040 + -DHAS_WIFI=1 + -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m33" + -fexceptions # for exception handling in MQTT +build_src_filter = ${rp2350_base.build_src_filter} + +lib_deps = + ${rp2350_base.lib_deps} + ${networking_base.lib_deps} +debug_build_flags = ${rp2350_base.build_flags}, -g \ No newline at end of file diff --git a/variants/rpipico2w/variant.h b/variants/rpipico2w/variant.h new file mode 100644 index 000000000..c7689048a --- /dev/null +++ b/variants/rpipico2w/variant.h @@ -0,0 +1,52 @@ +// #define RADIOLIB_CUSTOM_ARDUINO 1 +// #define RADIOLIB_TONE_UNSUPPORTED 1 +// #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED 1 + +#define ARDUINO_ARCH_AVR + +#ifndef HAS_WIFI +#define HAS_WIFI 1 +#endif + +// default I2C pins: +// SDA = 4 +// SCL = 5 + +// Recommended pins for SerialModule: +// txd = 8 +// rxd = 9 + +#define EXT_NOTIFY_OUT 22 +#define BUTTON_PIN 17 + +#define BATTERY_PIN 26 +// ratio of voltage divider = 3.0 (R17=200k, R18=100k) +#define ADC_MULTIPLIER 3.1 // 3.0 + a bit for being optimistic +#define BATTERY_SENSE_RESOLUTION_BITS ADC_RESOLUTION + +#define USE_SX1262 + +#undef LORA_SCK +#undef LORA_MISO +#undef LORA_MOSI +#undef LORA_CS + +#define LORA_SCK 10 +#define LORA_MISO 12 +#define LORA_MOSI 11 +#define LORA_CS 3 + +#define LORA_DIO0 RADIOLIB_NC +#define LORA_RESET 15 +#define LORA_DIO1 20 +#define LORA_DIO2 2 +#define LORA_DIO3 RADIOLIB_NC + +#ifdef USE_SX1262 +#define SX126X_CS LORA_CS +#define SX126X_DIO1 LORA_DIO1 +#define SX126X_BUSY LORA_DIO2 +#define SX126X_RESET LORA_RESET +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 +#endif \ No newline at end of file From 994e22aba9e1bee9124a1d7e265de5f0c35d09f3 Mon Sep 17 00:00:00 2001 From: rostekus <34031791+rostekus@users.noreply.github.com> Date: Thu, 20 Feb 2025 14:36:49 +0100 Subject: [PATCH 192/381] feat: added BMP-390 support to the BMP-3xx sensors (#6103) --- src/detect/ScanI2CTwoWire.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index 880e5c131..41cfe1517 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -244,6 +244,10 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) logFoundDevice("BMP-388", (uint8_t)addr.address); type = BMP_3XX; break; + case 0x60: // BMP-390 should be 0x60 + logFoundDevice("BMP-390", (uint8_t)addr.address); + type = BMP_3XX; + break; case 0x58: // BMP-280 should be 0x58 default: logFoundDevice("BMP-280", (uint8_t)addr.address); @@ -521,4 +525,4 @@ void ScanI2CTwoWire::logFoundDevice(const char *device, uint8_t address) { LOG_INFO("%s found at address 0x%x", device, address); } -#endif +#endif \ No newline at end of file From ec0eafedab6b3a49cb26c1017a59e5717cb36a31 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Thu, 20 Feb 2025 21:48:37 +0800 Subject: [PATCH 193/381] Move variant-specific lines back to variant (#6044) Last release a change introduced different branching functions in gps.cpp based on the model of a device. This makes the code less readable and introduces the potential for bugs. This patch creates a new variable, GPS_PROBETRIES that can be set in variant.h of devices that will control how many times we will probe for GPS presence. It sets up the T1000-E to use this variable and cleans the code in gps.c --- src/gps/GPS.cpp | 16 ++++++---------- variants/tracker-t1000-e/variant.h | 1 + 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index c2aae0381..f4b07664f 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -437,6 +437,10 @@ static const int serialSpeeds[3] = {9600, 115200, 38400}; static const int rareSerialSpeeds[3] = {4800, 57600, GPS_BAUDRATE}; #endif +#ifndef GPS_PROBETRIES +#define GPS_PROBETRIES 2 +#endif + /** * @brief Setup the GPS based on the model detected. * We detect the GPS by cycling through a set of baud rates, first common then rare. @@ -460,11 +464,7 @@ bool GPS::setup() digitalWrite(PIN_GPS_EN, HIGH); delay(1000); #endif -#ifdef TRACKER_T1000_E - if (probeTries < 5) { -#else - if (probeTries < 2) { -#endif + if (probeTries < GPS_PROBETRIES) { LOG_DEBUG("Probe for GPS at %d", serialSpeeds[speedSelect]); gnssModel = probe(serialSpeeds[speedSelect]); if (gnssModel == GNSS_MODEL_UNKNOWN) { @@ -475,11 +475,7 @@ bool GPS::setup() } } // Rare Serial Speeds -#ifdef TRACKER_T1000_E - if (probeTries == 5) { -#else - if (probeTries == 2) { -#endif + if (probeTries == GPS_PROBETRIES) { LOG_DEBUG("Probe for GPS at %d", rareSerialSpeeds[speedSelect]); gnssModel = probe(rareSerialSpeeds[speedSelect]); if (gnssModel == GNSS_MODEL_UNKNOWN) { diff --git a/variants/tracker-t1000-e/variant.h b/variants/tracker-t1000-e/variant.h index e65f26c93..0d98a3033 100644 --- a/variants/tracker-t1000-e/variant.h +++ b/variants/tracker-t1000-e/variant.h @@ -111,6 +111,7 @@ extern "C" { #define GPS_TX_PIN PIN_SERIAL1_TX #define GPS_BAUDRATE 115200 +#define GPS_PROBETRIES 5 #define PIN_GPS_EN (32 + 11) // P1.11 #define GPS_EN_ACTIVE HIGH From 4709d21df845222aa5aa6dfe91bf82a3bd09b1cc Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Thu, 20 Feb 2025 21:34:09 +0100 Subject: [PATCH 194/381] Ignore and disallow multi-hop traceroutes destined to broadcast address (#6109) * Ignore traceroutes destined to broadcast address * Disallow multi-hop traceroute request to broadcast address * Allow zero-hop broadcast requests --- src/mesh/PhoneAPI.cpp | 5 +++++ src/modules/TraceRouteModule.cpp | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 6789acbb3..699e6e0e4 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -643,6 +643,11 @@ bool PhoneAPI::handleToRadioPacket(meshtastic_MeshPacket &p) meshtastic_QueueStatus qs = router->getQueueStatus(); service->sendQueueStatusToPhone(qs, 0, p.id); return false; + } else if (p.decoded.portnum == meshtastic_PortNum_TRACEROUTE_APP && isBroadcast(p.to) && p.hop_limit > 0) { + sendNotification(meshtastic_LogRecord_Level_WARNING, p.id, "Multi-hop traceroute to broadcast address is not allowed"); + meshtastic_QueueStatus qs = router->getQueueStatus(); + service->sendQueueStatusToPhone(qs, 0, p.id); + return false; } else if (p.decoded.portnum == meshtastic_PortNum_POSITION_APP && lastPortNumToRadio[p.decoded.portnum] && Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], FIVE_SECONDS_MS)) { LOG_WARN("Rate limit portnum %d", p.decoded.portnum); diff --git a/src/modules/TraceRouteModule.cpp b/src/modules/TraceRouteModule.cpp index 79b14de0a..e9aaf9d30 100644 --- a/src/modules/TraceRouteModule.cpp +++ b/src/modules/TraceRouteModule.cpp @@ -150,6 +150,12 @@ meshtastic_MeshPacket *TraceRouteModule::allocReply() { assert(currentRequest); + // Ignore multi-hop broadcast requests + if (isBroadcast(currentRequest->to) && currentRequest->hop_limit < currentRequest->hop_start) { + ignoreRequest = true; + return NULL; + } + // Copy the payload of the current request auto req = *currentRequest; const auto &p = req.decoded; From 4942c7b71fb0ca759789943418697a3d2013861f Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Thu, 20 Feb 2025 22:28:01 +0100 Subject: [PATCH 195/381] Fix PowerTelemetry initialization (#6106) --- src/modules/Telemetry/PowerTelemetry.cpp | 41 +++++++++++++----------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/modules/Telemetry/PowerTelemetry.cpp b/src/modules/Telemetry/PowerTelemetry.cpp index 04bcbe200..14901f0af 100644 --- a/src/modules/Telemetry/PowerTelemetry.cpp +++ b/src/modules/Telemetry/PowerTelemetry.cpp @@ -31,7 +31,6 @@ int32_t PowerTelemetryModule::runOnce() doDeepSleep(nightyNightMs, true, false); } - uint32_t result = UINT32_MAX; /* Uncomment the preferences below if you want to use the module without having to configure it from the PythonAPI or WebUI. @@ -46,25 +45,33 @@ int32_t PowerTelemetryModule::runOnce() return disable(); } + uint32_t sendToMeshIntervalMs = Default::getConfiguredOrDefaultMsScaled( + moduleConfig.telemetry.power_update_interval, default_telemetry_broadcast_interval_secs, numOnlineNodes); + if (firstTime) { // This is the first time the OSThread library has called this function, so do some setup firstTime = 0; + uint32_t result = UINT32_MAX; + #if HAS_TELEMETRY && !defined(ARCH_PORTDUINO) if (moduleConfig.telemetry.power_measurement_enabled) { LOG_INFO("Power Telemetry: init"); - // it's possible to have this module enabled, only for displaying values on the screen. - // therefore, we should only enable the sensor loop if measurement is also enabled - if (ina219Sensor.hasSensor() && !ina219Sensor.isInitialized()) - result = ina219Sensor.runOnce(); - if (ina226Sensor.hasSensor() && !ina226Sensor.isInitialized()) - result = ina226Sensor.runOnce(); - if (ina260Sensor.hasSensor() && !ina260Sensor.isInitialized()) - result = ina260Sensor.runOnce(); - if (ina3221Sensor.hasSensor() && !ina3221Sensor.isInitialized()) - result = ina3221Sensor.runOnce(); - if (max17048Sensor.hasSensor() && !max17048Sensor.isInitialized()) - result = max17048Sensor.runOnce(); + // If sensor is already initialized by EnvironmentTelemetryModule, then we don't need to initialize it again, + // but we need to set the result to != UINT32_MAX to avoid it being disabled + if (ina219Sensor.hasSensor()) + result = ina219Sensor.isInitialized() ? 0 : ina219Sensor.runOnce(); + if (ina226Sensor.hasSensor()) + result = ina226Sensor.isInitialized() ? 0 : ina226Sensor.runOnce(); + if (ina260Sensor.hasSensor()) + result = ina260Sensor.isInitialized() ? 0 : ina260Sensor.runOnce(); + if (ina3221Sensor.hasSensor()) + result = ina3221Sensor.isInitialized() ? 0 : ina3221Sensor.runOnce(); + if (max17048Sensor.hasSensor()) + result = max17048Sensor.isInitialized() ? 0 : max17048Sensor.runOnce(); } + + // it's possible to have this module enabled, only for displaying values on the screen. + // therefore, we should only enable the sensor loop if measurement is also enabled return result == UINT32_MAX ? disable() : setStartDelay(); #else return disable(); @@ -74,10 +81,7 @@ int32_t PowerTelemetryModule::runOnce() if (!moduleConfig.telemetry.power_measurement_enabled) return disable(); - if (((lastSentToMesh == 0) || - !Throttle::isWithinTimespanMs(lastSentToMesh, Default::getConfiguredOrDefaultMsScaled( - moduleConfig.telemetry.power_update_interval, - default_telemetry_broadcast_interval_secs, numOnlineNodes))) && + if (((lastSentToMesh == 0) || !Throttle::isWithinTimespanMs(lastSentToMesh, sendToMeshIntervalMs)) && airTime->isTxAllowedAirUtil()) { sendTelemetry(); lastSentToMesh = millis(); @@ -89,8 +93,9 @@ int32_t PowerTelemetryModule::runOnce() lastSentToPhone = millis(); } } - return min(sendToPhoneIntervalMs, result); + return min(sendToPhoneIntervalMs, sendToMeshIntervalMs); } + bool PowerTelemetryModule::wantUIFrame() { return moduleConfig.telemetry.power_screen_enabled; From 1be28520a70376457e333fe242dc19afff5ae7b5 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 20 Feb 2025 18:30:09 -0600 Subject: [PATCH 196/381] Perhaps fix TXCO reports on pro-micro (#6110) * Perhaps fix TXCO reports on pro-micro * Missed one --- src/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index f4599e0e3..be498421c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -931,6 +931,7 @@ void setup() if (!sxIf->init()) { LOG_WARN("No SX1262 radio"); delete sxIf; + rIf = NULL; } else { LOG_INFO("SX1262 init success"); rIf = sxIf; @@ -947,6 +948,7 @@ void setup() if (!sxIf->init()) { LOG_WARN("No SX1262 radio with TCXO, Vref %fV", SX126X_DIO3_TCXO_VOLTAGE); delete sxIf; + rIf = NULL; } else { LOG_INFO("SX1262 init success, TCXO, Vref %fV", SX126X_DIO3_TCXO_VOLTAGE); rIf = sxIf; From 3787cf78034fad1534a954c7b654dace05cbf4e4 Mon Sep 17 00:00:00 2001 From: Austin Date: Thu, 20 Feb 2025 20:55:38 -0500 Subject: [PATCH 197/381] meshtasticd deb: Build armv6-compatible binary (#6104) --- debian/control | 1 + debian/rules | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/debian/control b/debian/control index bb79d1958..b3a8eb58e 100644 --- a/debian/control +++ b/debian/control @@ -3,6 +3,7 @@ Section: misc Priority: optional Maintainer: Austin Lane Build-Depends: debhelper-compat (= 13), + lsb-release, tar, gzip, platformio, diff --git a/debian/rules b/debian/rules index a1a27c2f2..0612ba352 100755 --- a/debian/rules +++ b/debian/rules @@ -11,6 +11,15 @@ PIO_ENV:=\ PLATFORMIO_LIBDEPS_DIR=pio/libdeps \ PLATFORMIO_PACKAGES_DIR=pio/packages +# Raspbian armhf builds should be compatible with armv6-hardfloat +# https://www.valvers.com/open-software/raspberry-pi/bare-metal-programming-in-c-part-1/#rpi1-compiler-flags +ifneq (,$(findstring Raspbian,$(shell lsb_release -is))) +ifeq ($(DEB_BUILD_ARCH),armhf) +PIO_ENV+=\ + PLATFORMIO_BUILD_FLAGS="-mfloat-abi=hard -mfpu=vfp -march=armv6zk" +endif +endif + override_dh_auto_build: # Extract tarballs within source deb tar -xf pio.tar From fe1ced748046f9a2f0c4e544177ac15bd51f609f Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Sat, 22 Feb 2025 06:53:46 +0800 Subject: [PATCH 198/381] GPS Factory Reset no longer needed. (#6116) In 2020 there was a bad batch of tbeams whose ubloxen went a little loopy. We factory reset them to bring them sane again. It's now 2025, the problem with tbeam is long fixed, and this is not necessary for any other devices we're aware of. Removing the function to make our code more maintainable. There is an associated protobuf entry did_gps_reset that we might be able to re-purpose for something else, or remove in 3.0. --- src/gps/GPS.cpp | 84 ------------------------------------------------- src/gps/GPS.h | 2 -- 2 files changed, 86 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index f4b07664f..2989a59bd 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -48,8 +48,6 @@ HardwareSerial *GPS::_serial_gps = nullptr; GPS *gps = nullptr; -static const char *ACK_SUCCESS_MESSAGE = "Get ack success!"; - static GPSUpdateScheduling scheduling; /// Multiple GPS instances might use the same serial port (in sequence), but we can @@ -1039,14 +1037,6 @@ int32_t GPS::runOnce() if (config.position.gps_mode != meshtastic_Config_PositionConfig_GpsMode_ENABLED) { return disable(); } - // ONCE we will factory reset the GPS for bug #327 - if (!devicestate.did_gps_reset) { - LOG_WARN("GPS FactoryReset requested"); - if (gps->factoryReset()) { // If we don't succeed try again next time - devicestate.did_gps_reset = true; - nodeDB->saveToDisk(SEGMENT_DEVICESTATE); - } - } GPSInitFinished = true; publishUpdate(); } @@ -1059,24 +1049,6 @@ int32_t GPS::runOnce() if (whileActive()) { // if we have received valid NMEA claim we are connected setConnected(); - } else { - if ((config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED) && - IS_ONE_OF(gnssModel, GNSS_MODEL_UBLOX6, GNSS_MODEL_UBLOX7, GNSS_MODEL_UBLOX8, GNSS_MODEL_UBLOX9, - GNSS_MODEL_UBLOX10)) { - // reset the GPS on next bootup - if (devicestate.did_gps_reset && scheduling.elapsedSearchMs() > 60 * 1000UL && !hasFlow()) { - LOG_DEBUG("GPS is not found, try factory reset on next boot"); - devicestate.did_gps_reset = false; - nodeDB->saveToDisk(SEGMENT_DEVICESTATE); - return disable(); // Stop the GPS thread as it can do nothing useful until next reboot. - } - } - } - // At least one GPS has a bad habit of losing its mind from time to time - if (rebootsSeen > 2) { - rebootsSeen = 0; - LOG_DEBUG("Would normally factoryReset()"); - // gps->factoryReset(); } // If we're due for an update, wake the GPS @@ -1411,62 +1383,6 @@ static int32_t toDegInt(RawDegrees d) return r; } -bool GPS::factoryReset() -{ -#ifdef PIN_GPS_REINIT - // The L76K GNSS on the T-Echo requires the RESET pin to be pulled LOW - pinMode(PIN_GPS_REINIT, OUTPUT); - digitalWrite(PIN_GPS_REINIT, 0); - delay(150); // The L76K datasheet calls for at least 100MS delay - digitalWrite(PIN_GPS_REINIT, 1); -#endif - - if (HW_VENDOR == meshtastic_HardwareModel_TBEAM) { - byte _message_reset1[] = {0xB5, 0x62, 0x06, 0x09, 0x0D, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x1C, 0xA2}; - _serial_gps->write(_message_reset1, sizeof(_message_reset1)); - if (getACK(0x05, 0x01, 10000)) { - LOG_DEBUG(ACK_SUCCESS_MESSAGE); - } - delay(100); - byte _message_reset2[] = {0xB5, 0x62, 0x06, 0x09, 0x0D, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1B, 0xA1}; - _serial_gps->write(_message_reset2, sizeof(_message_reset2)); - if (getACK(0x05, 0x01, 10000)) { - LOG_DEBUG(ACK_SUCCESS_MESSAGE); - } - delay(100); - byte _message_reset3[] = {0xB5, 0x62, 0x06, 0x09, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x03, 0x1D, 0xB3}; - _serial_gps->write(_message_reset3, sizeof(_message_reset3)); - if (getACK(0x05, 0x01, 10000)) { - LOG_DEBUG(ACK_SUCCESS_MESSAGE); - } - } else if (gnssModel == GNSS_MODEL_MTK) { - // send the CAS10 to perform a factory restart of the device (and other device that support PCAS statements) - LOG_INFO("GNSS Factory Reset via PCAS10,3"); - _serial_gps->write("$PCAS10,3*1F\r\n"); - delay(100); - } else if (gnssModel == GNSS_MODEL_ATGM336H) { - LOG_INFO("Factory Reset via CAS-CFG-RST"); - uint8_t msglen = makeCASPacket(0x06, 0x02, sizeof(_message_CAS_CFG_RST_FACTORY), _message_CAS_CFG_RST_FACTORY); - _serial_gps->write(UBXscratch, msglen); - delay(100); - } else { - // fire this for good measure, if we have an L76B - won't harm other devices. - _serial_gps->write("$PMTK104*37\r\n"); - // No PMTK_ACK for this command. - delay(100); - // send the UBLOX Factory Reset Command regardless of detect state, something is very wrong, just assume it's - // UBLOX. Factory Reset - byte _message_reset[] = {0xB5, 0x62, 0x06, 0x09, 0x0D, 0x00, 0xFF, 0xFB, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x17, 0x2B, 0x7E}; - _serial_gps->write(_message_reset, sizeof(_message_reset)); - } - delay(1000); - return true; -} - /** * Perform any processing that should be done only while the GPS is awake and looking for a fix. * Override this method to check for new locations diff --git a/src/gps/GPS.h b/src/gps/GPS.h index df85b7cbf..01a4fe745 100644 --- a/src/gps/GPS.h +++ b/src/gps/GPS.h @@ -101,8 +101,6 @@ class GPS : private concurrency::OSThread // Empty the input buffer as quickly as possible void clearBuffer(); - virtual bool factoryReset(); - // Creates an instance of the GPS class. // Returns the new instance or null if the GPS is not present. static GPS *createGps(); From cfcd9cc21044dfb8795bbf04caf77a14cd2aa040 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sat, 22 Feb 2025 15:03:05 +0100 Subject: [PATCH 199/381] Revert "Rak4631 remove spi1 (#6042)" (#6121) This reverts commit 9b46cb4ef08688a2f424c76d8425561e4f5db844. --- src/detect/einkScan.h | 16 ++++++++-------- variants/rak4631/variant.h | 18 +++++++++++------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/detect/einkScan.h b/src/detect/einkScan.h index 5bc218d00..d20c7b6e5 100644 --- a/src/detect/einkScan.h +++ b/src/detect/einkScan.h @@ -6,28 +6,28 @@ void d_writeCommand(uint8_t c) { - SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0)); + SPI1.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0)); if (PIN_EINK_DC >= 0) digitalWrite(PIN_EINK_DC, LOW); if (PIN_EINK_CS >= 0) digitalWrite(PIN_EINK_CS, LOW); - SPI.transfer(c); + SPI1.transfer(c); if (PIN_EINK_CS >= 0) digitalWrite(PIN_EINK_CS, HIGH); if (PIN_EINK_DC >= 0) digitalWrite(PIN_EINK_DC, HIGH); - SPI.endTransaction(); + SPI1.endTransaction(); } void d_writeData(uint8_t d) { - SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0)); + SPI1.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0)); if (PIN_EINK_CS >= 0) digitalWrite(PIN_EINK_CS, LOW); - SPI.transfer(d); + SPI1.transfer(d); if (PIN_EINK_CS >= 0) digitalWrite(PIN_EINK_CS, HIGH); - SPI.endTransaction(); + SPI1.endTransaction(); } unsigned long d_waitWhileBusy(uint16_t busy_time) @@ -53,7 +53,7 @@ unsigned long d_waitWhileBusy(uint16_t busy_time) void scanEInkDevice(void) { - SPI.begin(); + SPI1.begin(); d_writeCommand(0x22); d_writeData(0x83); d_writeCommand(0x20); @@ -62,6 +62,6 @@ void scanEInkDevice(void) LOG_DEBUG("EInk display found"); else LOG_DEBUG("EInk display not found"); - SPI.end(); + SPI1.end(); } #endif \ No newline at end of file diff --git a/variants/rak4631/variant.h b/variants/rak4631/variant.h index f50f3b880..bc5541336 100644 --- a/variants/rak4631/variant.h +++ b/variants/rak4631/variant.h @@ -107,11 +107,15 @@ static const uint8_t AREF = PIN_AREF; /* * SPI Interfaces */ -#define SPI_INTERFACES_COUNT 1 +#define SPI_INTERFACES_COUNT 2 -#define PIN_SPI_MISO (29) -#define PIN_SPI_MOSI (30) -#define PIN_SPI_SCK (3) +#define PIN_SPI_MISO (45) +#define PIN_SPI_MOSI (44) +#define PIN_SPI_SCK (43) + +#define PIN_SPI1_MISO (29) // (0 + 29) +#define PIN_SPI1_MOSI (30) // (0 + 30) +#define PIN_SPI1_SCK (3) // (0 + 3) static const uint8_t SS = 42; static const uint8_t MOSI = PIN_SPI_MOSI; @@ -126,8 +130,8 @@ static const uint8_t SCK = PIN_SPI_SCK; #define PIN_EINK_BUSY (0 + 4) #define PIN_EINK_DC (0 + 17) #define PIN_EINK_RES (-1) -#define PIN_EINK_SCLK PIN_SPI_SCK -#define PIN_EINK_MOSI PIN_SPI_MOSI // also called SDI +#define PIN_EINK_SCLK (0 + 3) +#define PIN_EINK_MOSI (0 + 30) // also called SDI // #define USE_EINK @@ -255,7 +259,7 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG #define PIN_ETHERNET_RESET 21 #define PIN_ETHERNET_SS PIN_EINK_CS -#define ETH_SPI_PORT SPI +#define ETH_SPI_PORT SPI1 #define AQ_SET_PIN 10 #ifdef __cplusplus From efca2b5849d1636914f0da6fbfdab2cad9d746c0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 22 Feb 2025 11:19:07 -0600 Subject: [PATCH 200/381] [create-pull-request] automated change (#6122) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/deviceonly.pb.h | 3 ++- src/mesh/generated/meshtastic/mesh.pb.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/protobufs b/protobufs index 068646653..e2790151f 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 068646653e8375fc145988026ad242a3cf70f7ab +Subproject commit e2790151f058c0e885863a15eea0b4e4edf4aaaa diff --git a/src/mesh/generated/meshtastic/deviceonly.pb.h b/src/mesh/generated/meshtastic/deviceonly.pb.h index c0a0fee91..4fda082e3 100644 --- a/src/mesh/generated/meshtastic/deviceonly.pb.h +++ b/src/mesh/generated/meshtastic/deviceonly.pb.h @@ -122,7 +122,8 @@ typedef struct _meshtastic_DeviceState { Indicates developer is testing and changes should never be saved to flash. Deprecated in 2.3.1 */ bool no_save; - /* Some GPS receivers seem to have bogus settings from the factory, so we always do one factory reset. */ + /* Previously used to manage GPS factory resets. + Deprecated in 2.5.23 */ bool did_gps_reset; /* We keep the last received waypoint stored in the device flash, so we can show it on the screen. diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index de8a1a353..3353a020f 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -1775,4 +1775,4 @@ extern const pb_msgdesc_t meshtastic_ChunkedPayloadResponse_msg; } /* extern "C" */ #endif -#endif \ No newline at end of file +#endif From 7d8e0ede6ccb4c621c70589834562276cb128687 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Sun, 23 Feb 2025 20:14:37 +0800 Subject: [PATCH 201/381] Reduce some log levels. (#6127) This patch takes a few LOG_INFO messages and turns them into LOG_DEBUG. The logs appear to be mostly useful to developers, rather than end users and as such placing them at INFO level is too high a priority. --- src/modules/AdminModule.cpp | 24 ++++++++++++------------ src/nimble/NimbleBluetooth.cpp | 6 +++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 530d0b82e..631afd737 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -123,23 +123,23 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta * Getters */ case meshtastic_AdminMessage_get_owner_request_tag: - LOG_INFO("Client got owner"); + LOG_DEBUG("Client got owner"); handleGetOwner(mp); break; case meshtastic_AdminMessage_get_config_request_tag: - LOG_INFO("Client got config"); + LOG_DEBUG("Client got config"); handleGetConfig(mp, r->get_config_request); break; case meshtastic_AdminMessage_get_module_config_request_tag: - LOG_INFO("Client got module config"); + LOG_DEBUG("Client got module config"); handleGetModuleConfig(mp, r->get_module_config_request); break; case meshtastic_AdminMessage_get_channel_request_tag: { uint32_t i = r->get_channel_request - 1; - LOG_INFO("Client got channel %u", i); + LOG_DEBUG("Client got channel %u", i); if (i >= MAX_NUM_CHANNELS) myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp); else @@ -151,35 +151,35 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta * Setters */ case meshtastic_AdminMessage_set_owner_tag: - LOG_INFO("Client set owner"); + LOG_DEBUG("Client set owner"); handleSetOwner(r->set_owner); break; case meshtastic_AdminMessage_set_config_tag: - LOG_INFO("Client set config"); + LOG_DEBUG("Client set config"); handleSetConfig(r->set_config); break; case meshtastic_AdminMessage_set_module_config_tag: - LOG_INFO("Client set module config"); + LOG_DEBUG("Client set module config"); if (!handleSetModuleConfig(r->set_module_config)) { myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp); } break; case meshtastic_AdminMessage_set_channel_tag: - LOG_INFO("Client set channel %d", r->set_channel.index); + LOG_DEBUG("Client set channel %d", r->set_channel.index); if (r->set_channel.index < 0 || r->set_channel.index >= (int)MAX_NUM_CHANNELS) myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp); else handleSetChannel(r->set_channel); break; case meshtastic_AdminMessage_set_ham_mode_tag: - LOG_INFO("Client set ham mode"); + LOG_DEBUG("Client set ham mode"); handleSetHamMode(r->set_ham_mode); break; case meshtastic_AdminMessage_get_ui_config_request_tag: { - LOG_INFO("Client is getting device-ui config"); + LOG_DEBUG("Client is getting device-ui config"); handleGetDeviceUIConfig(mp); handled = true; break; @@ -391,7 +391,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta LOG_DEBUG("Did not responded to a request that wanted a respond. req.variant=%d", r->which_payload_variant); } else if (handleResult != AdminMessageHandleResult::HANDLED) { // Probably a message sent by us or sent to our local node. FIXME, we should avoid scanning these messages - LOG_INFO("Ignore irrelevant admin %d", r->which_payload_variant); + LOG_DEBUG("Ignore irrelevant admin %d", r->which_payload_variant); } break; } @@ -1171,4 +1171,4 @@ void disableBluetooth() nrf52Bluetooth->shutdown(); #endif #endif -} \ No newline at end of file +} diff --git a/src/nimble/NimbleBluetooth.cpp b/src/nimble/NimbleBluetooth.cpp index 2662ef0bc..6315fdec9 100644 --- a/src/nimble/NimbleBluetooth.cpp +++ b/src/nimble/NimbleBluetooth.cpp @@ -26,7 +26,7 @@ class BluetoothPhoneAPI : public PhoneAPI { PhoneAPI::onNowHasData(fromRadioNum); - LOG_INFO("BLE notify fromNum"); + LOG_DEBUG("BLE notify fromNum"); uint8_t val[4]; put_le32(val, fromRadioNum); @@ -51,7 +51,7 @@ class NimbleBluetoothToRadioCallback : public NimBLECharacteristicCallbacks { virtual void onWrite(NimBLECharacteristic *pCharacteristic) { - LOG_INFO("To Radio onwrite"); + LOG_DEBUG("To Radio onwrite"); auto val = pCharacteristic->getValue(); if (memcmp(lastToRadio, val.data(), val.length()) != 0) { @@ -298,4 +298,4 @@ void clearNVS() ESP.restart(); #endif } -#endif \ No newline at end of file +#endif From 7061fd1f16c43e72b923cf951ab2cae41a047c6f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 24 Feb 2025 11:12:18 +0100 Subject: [PATCH 202/381] Upgrade trunk (#6139) --- .trunk/trunk.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 12b8608f2..931dcc7c7 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -9,14 +9,14 @@ plugins: lint: enabled: - prettier@3.5.1 - - trufflehog@3.88.10 + - trufflehog@3.88.12 - yamllint@1.35.1 - bandit@1.8.3 - checkov@3.2.372 - terrascan@1.19.9 - trivy@0.59.1 - taplo@0.9.3 - - ruff@0.9.6 + - ruff@0.9.7 - isort@6.0.0 - markdownlint@0.44.0 - oxipng@9.1.4 @@ -28,7 +28,7 @@ lint: - shellcheck@0.10.0 - black@25.1.0 - git-diff-check - - gitleaks@8.23.3 + - gitleaks@8.24.0 - clang-format@16.0.3 ignore: - linters: [ALL] From 01c717a41d3f995568267f7552e9f0955f72b67a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Feb 2025 22:35:14 +0800 Subject: [PATCH 203/381] Bump actions/stale from 9.0.0 to 9.1.0 in /.github/workflows (#6143) Bumps [actions/stale](https://github.com/actions/stale) from 9.0.0 to 9.1.0. - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/stale/compare/v9.0.0...v9.1.0) --- updated-dependencies: - dependency-name: actions/stale dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/stale_bot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale_bot.yml b/.github/workflows/stale_bot.yml index 0ce0579de..19b7cf7fd 100644 --- a/.github/workflows/stale_bot.yml +++ b/.github/workflows/stale_bot.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Stale PR+Issues - uses: actions/stale@v9.0.0 + uses: actions/stale@v9.1.0 with: exempt-issue-labels: pinned,3.0 exempt-pr-labels: pinned,3.0 From c93728eb75b47ddcdb258d78faccd2f908295e79 Mon Sep 17 00:00:00 2001 From: Austin Date: Mon, 24 Feb 2025 10:16:18 -0500 Subject: [PATCH 204/381] Debian: Ensure deps exist for changelog bump (#6145) --- .github/workflows/main_matrix.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 7062ef525..ef0ab81a6 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -352,6 +352,12 @@ jobs: run: >- bin/bump_version.py + - name: Ensure debian deps are installed + shell: bash + run: | + sudo apt-get update -y --fix-missing + sudo apt-get install -y devscripts + - name: Update debian changelog run: >- debian/ci_changelog.sh From bf958ed01da26a57d0a6d655d003ecb255f0004e Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 24 Feb 2025 10:23:24 -0600 Subject: [PATCH 205/381] Update version.properties --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 2e207e21e..55a220b4b 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 5 -build = 22 +build = 23 From 4e575872da0cfaddd346acc7c24e0cf130aabc80 Mon Sep 17 00:00:00 2001 From: Austin Date: Tue, 25 Feb 2025 03:41:45 -0500 Subject: [PATCH 206/381] junk in the Trunk (#6149) --- .github/ISSUE_TEMPLATE/Bug Report.yml | 2 +- .github/ISSUE_TEMPLATE/New Board.yml | 2 +- .github/ISSUE_TEMPLATE/feature.yml | 2 +- .github/actionlint.yaml | 5 +++ .github/actions/build-variant/action.yml | 2 +- .github/actions/setup-base/action.yml | 8 ++-- .github/dependabot.yml | 9 +++-- .github/workflows/build_nrf52.yml | 2 + .github/workflows/build_rpi2040.yml | 2 + .github/workflows/build_stm32.yml | 2 + .github/workflows/tests.yml | 4 +- .trunk/configs/.markdownlint.yaml | 1 + Dockerfile | 19 +++++---- alpine.Dockerfile | 16 +++++--- src/modules/WaypointModule.cpp | 7 ++-- test/test_crypto/test_main.cpp | 1 + variants/xiao_ble/README.md | 51 +++++++++++++----------- 17 files changed, 81 insertions(+), 54 deletions(-) create mode 100644 .github/actionlint.yaml diff --git a/.github/ISSUE_TEMPLATE/Bug Report.yml b/.github/ISSUE_TEMPLATE/Bug Report.yml index f2d2f6507..f638b9018 100644 --- a/.github/ISSUE_TEMPLATE/Bug Report.yml +++ b/.github/ISSUE_TEMPLATE/Bug Report.yml @@ -1,7 +1,7 @@ name: Bug Report description: File a bug report title: "[Bug]: " -labels: ["bug", "triage"] +labels: [bug, triage] body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/New Board.yml b/.github/ISSUE_TEMPLATE/New Board.yml index c71ed4ba2..90b2a9bf9 100644 --- a/.github/ISSUE_TEMPLATE/New Board.yml +++ b/.github/ISSUE_TEMPLATE/New Board.yml @@ -1,7 +1,7 @@ name: New Board description: Request us to support new hardware title: "[Board]: " -labels: ["enhancement", "triage"] +labels: [enhancement, triage] body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml index b50ccac26..311f097c4 100644 --- a/.github/ISSUE_TEMPLATE/feature.yml +++ b/.github/ISSUE_TEMPLATE/feature.yml @@ -1,7 +1,7 @@ name: Feature Request description: Request a new feature title: "[Feature Request]: " -labels: ["enhancement"] +labels: [enhancement] body: - type: markdown attributes: diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml new file mode 100644 index 000000000..f7bf95f83 --- /dev/null +++ b/.github/actionlint.yaml @@ -0,0 +1,5 @@ +# Configuration related to self-hosted runner. +self-hosted-runner: + # Labels of self-hosted runner in array of strings. + labels: + - test-runner diff --git a/.github/actions/build-variant/action.yml b/.github/actions/build-variant/action.yml index b24a5fc12..2f0883fad 100644 --- a/.github/actions/build-variant/action.yml +++ b/.github/actions/build-variant/action.yml @@ -34,7 +34,7 @@ inputs: arch: description: Processor arch name required: true - default: "esp32" + default: esp32 runs: using: composite diff --git a/.github/actions/setup-base/action.yml b/.github/actions/setup-base/action.yml index 7364c4ddb..7cd0dfcac 100644 --- a/.github/actions/setup-base/action.yml +++ b/.github/actions/setup-base/action.yml @@ -1,13 +1,13 @@ -name: "Setup Build Base Composite Action" -description: "Base build actions for Meshtastic Platform IO steps" +name: Setup Build Base Composite Action +description: Base build actions for Meshtastic Platform IO steps runs: - using: "composite" + using: composite steps: - name: Checkout code uses: actions/checkout@v4 with: - submodules: "recursive" + submodules: recursive ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 616c16ce2..cf840b1ff 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,26 +1,27 @@ +#trunk-ignore-all(yamllint/quoted-strings): required by dependabot syntax check version: 2 updates: - package-ecosystem: docker directory: devcontainer schedule: interval: daily - time: "05:00" # trunk-ignore(yamllint/quoted-strings): required by dependabot syntax check + time: "05:00" timezone: US/Pacific - package-ecosystem: docker directory: / schedule: interval: daily - time: "05:00" # trunk-ignore(yamllint/quoted-strings): required by dependabot syntax check + time: "05:00" timezone: US/Pacific - package-ecosystem: gitsubmodule directory: / schedule: interval: daily - time: "05:00" # trunk-ignore(yamllint/quoted-strings): required by dependabot syntax check + time: "05:00" timezone: US/Pacific - package-ecosystem: github-actions directory: /.github/workflows schedule: interval: daily - time: "05:00" # trunk-ignore(yamllint/quoted-strings): required by dependabot syntax check + time: "05:00" timezone: US/Pacific diff --git a/.github/workflows/build_nrf52.yml b/.github/workflows/build_nrf52.yml index ce26838f2..786508f86 100644 --- a/.github/workflows/build_nrf52.yml +++ b/.github/workflows/build_nrf52.yml @@ -7,6 +7,8 @@ on: required: true type: string +permissions: read-all + jobs: build-nrf52: runs-on: ubuntu-latest diff --git a/.github/workflows/build_rpi2040.yml b/.github/workflows/build_rpi2040.yml index 492a1f010..53fee34d2 100644 --- a/.github/workflows/build_rpi2040.yml +++ b/.github/workflows/build_rpi2040.yml @@ -7,6 +7,8 @@ on: required: true type: string +permissions: read-all + jobs: build-rpi2040: runs-on: ubuntu-latest diff --git a/.github/workflows/build_stm32.yml b/.github/workflows/build_stm32.yml index b463bab71..dc469d994 100644 --- a/.github/workflows/build_stm32.yml +++ b/.github/workflows/build_stm32.yml @@ -7,6 +7,8 @@ on: required: true type: string +permissions: read-all + jobs: build-stm32: runs-on: ubuntu-latest diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c9489db1a..0f0ee0af4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,9 +2,11 @@ name: End to end tests on: schedule: - - cron: "0 0 * * *" # Run every day at midnight + - cron: 0 0 * * * # Run every day at midnight workflow_dispatch: {} +permissions: read-all + jobs: native-tests: uses: ./.github/workflows/test_native.yml diff --git a/.trunk/configs/.markdownlint.yaml b/.trunk/configs/.markdownlint.yaml index fb940393d..6486f050e 100644 --- a/.trunk/configs/.markdownlint.yaml +++ b/.trunk/configs/.markdownlint.yaml @@ -8,3 +8,4 @@ line_length: false spaces: false url: false whitespace: false +headings: false diff --git a/Dockerfile b/Dockerfile index f9a3b9962..4796df301 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,9 @@ # trunk-ignore-all(terrascan/AC_DOCKER_0002): Known terrascan issue -# trunk-ignore-all(hadolint/DL3008): Use latest version of apt packages for buildchain # trunk-ignore-all(trivy/DS002): We must run as root for this container # trunk-ignore-all(checkov/CKV_DOCKER_8): We must run as root for this container # trunk-ignore-all(hadolint/DL3002): We must run as root for this container +# trunk-ignore-all(hadolint/DL3008): Do not pin apt package versions +# trunk-ignore-all(hadolint/DL3013): Do not pin pip package versions FROM python:3.12-bookworm AS builder ENV DEBIAN_FRONTEND=noninteractive @@ -10,12 +11,13 @@ ENV TZ=Etc/UTC # Install Dependencies ENV PIP_ROOT_USER_ACTION=ignore -RUN apt-get update && apt-get install --no-install-recommends -y wget g++ zip git ca-certificates \ +RUN apt-get update && apt-get install --no-install-recommends -y \ + wget g++ zip git ca-certificates \ libgpiod-dev libyaml-cpp-dev libbluetooth-dev libi2c-dev \ - libusb-1.0-0-dev libulfius-dev liborcania-dev libssl-dev pkg-config && \ - apt-get clean && rm -rf /var/lib/apt/lists/* && \ - pip install --no-cache-dir -U platformio==6.1.16 && \ - mkdir /tmp/firmware + libusb-1.0-0-dev libulfius-dev liborcania-dev libssl-dev pkg-config \ + && apt-get clean && rm -rf /var/lib/apt/lists/* \ + && pip install --no-cache-dir -U platformio \ + && mkdir /tmp/firmware # Copy source code WORKDIR /tmp/firmware @@ -35,8 +37,9 @@ ENV TZ=Etc/UTC # nosemgrep: dockerfile.security.last-user-is-root.last-user-is-root USER root -RUN apt-get update && apt-get --no-install-recommends -y install libc-bin libc6 libgpiod2 libyaml-cpp0.7 libi2c0 libulfius2.7 libusb-1.0-0-dev liborcania2.3 libssl3 && \ - apt-get clean && rm -rf /var/lib/apt/lists/* \ +RUN apt-get update && apt-get --no-install-recommends -y install \ + libc-bin libc6 libgpiod2 libyaml-cpp0.7 libi2c0 libulfius2.7 libusb-1.0-0-dev liborcania2.3 libssl3 \ + && apt-get clean && rm -rf /var/lib/apt/lists/* \ && mkdir -p /var/lib/meshtasticd \ && mkdir -p /etc/meshtasticd/config.d \ && mkdir -p /etc/meshtasticd/ssl diff --git a/alpine.Dockerfile b/alpine.Dockerfile index 8b48eeca3..caa86187f 100644 --- a/alpine.Dockerfile +++ b/alpine.Dockerfile @@ -1,14 +1,18 @@ # trunk-ignore-all(trivy/DS002): We must run as root for this container # trunk-ignore-all(checkov/CKV_DOCKER_8): We must run as root for this container # trunk-ignore-all(hadolint/DL3002): We must run as root for this container +# trunk-ignore-all(hadolint/DL3018): Do not pin apk package versions +# trunk-ignore-all(hadolint/DL3013): Do not pin pip package versions FROM python:3.12-alpine3.21 AS builder ENV PIP_ROOT_USER_ACTION=ignore -RUN apk add bash g++ libstdc++-dev linux-headers zip git ca-certificates libgpiod-dev yaml-cpp-dev bluez-dev \ - libusb-dev i2c-tools-dev openssl-dev pkgconf argp-standalone && \ - pip install --no-cache-dir -U platformio==6.1.16 && \ - mkdir /tmp/firmware +RUN apk --no-cache add \ + bash g++ libstdc++-dev linux-headers zip git ca-certificates libgpiod-dev yaml-cpp-dev bluez-dev \ + libusb-dev i2c-tools-dev openssl-dev pkgconf argp-standalone \ + && rm -rf /var/cache/apk/* \ + && pip install --no-cache-dir -U platformio \ + && mkdir /tmp/firmware WORKDIR /tmp/firmware COPY . /tmp/firmware @@ -27,7 +31,9 @@ FROM alpine:3.21 # nosemgrep: dockerfile.security.last-user-is-root.last-user-is-root USER root -RUN apk add libstdc++ libgpiod yaml-cpp libusb i2c-tools \ +RUN apk --no-cache add \ + libstdc++ libgpiod yaml-cpp libusb i2c-tools \ + && rm -rf /var/cache/apk/* \ && mkdir -p /var/lib/meshtasticd \ && mkdir -p /etc/meshtasticd/config.d \ && mkdir -p /etc/meshtasticd/ssl diff --git a/src/modules/WaypointModule.cpp b/src/modules/WaypointModule.cpp index 08b48b682..479a973c2 100644 --- a/src/modules/WaypointModule.cpp +++ b/src/modules/WaypointModule.cpp @@ -144,9 +144,9 @@ void WaypointModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, bearingToOther -= myHeading; screen->drawNodeHeading(display, compassX, compassY, compassDiam, bearingToOther); - float bearingToOtherDegrees = (bearingToOther < 0) ? bearingToOther + 2*PI : bearingToOther; - bearingToOtherDegrees = bearingToOtherDegrees * 180 / PI; - + float bearingToOtherDegrees = (bearingToOther < 0) ? bearingToOther + 2 * PI : bearingToOther; + bearingToOtherDegrees = bearingToOtherDegrees * 180 / PI; + // Distance to Waypoint float d = GeoCoord::latLongToMeter(DegD(wp.latitude_i), DegD(wp.longitude_i), DegD(op.latitude_i), DegD(op.longitude_i)); if (config.display.units == meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL) { @@ -161,7 +161,6 @@ void WaypointModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, snprintf(distStr, sizeof(distStr), "%.1fkm %.0f°", d / 1000, bearingToOtherDegrees); } - } // If our node doesn't have position diff --git a/test/test_crypto/test_main.cpp b/test/test_crypto/test_main.cpp index fd7706e6e..ac507116c 100644 --- a/test/test_crypto/test_main.cpp +++ b/test/test_crypto/test_main.cpp @@ -1,3 +1,4 @@ +// trunk-ignore-all(gitleaks): These are dummy values. Not real secrets. #include "CryptoEngine.h" #include "TestUtil.h" diff --git a/variants/xiao_ble/README.md b/variants/xiao_ble/README.md index 6fff9cd22..2a08138ba 100644 --- a/variants/xiao_ble/README.md +++ b/variants/xiao_ble/README.md @@ -116,24 +116,26 @@ The default pin mapping in `variant.h` uses 'automatic Tx/Rx switching' mode. If   MCU -> E22 connections -| Xiao BLE pin | variant.h definition | E22 pin | Notes | -| :------------ | :---------------------------- | :-----------------| :------------------------------------------------------------------------------------------------------------------- | -| D0 | SX126X_CS | 19 (NSS) | | -| D1 | SX126X_DIO1 | 13 (DIO1) | | -| D2 | SX126X_BUSY | 14 (BUSY) | | -| D3 | SX126X_RESET | 15 (NRST) | | -| D7 | SX126X_RXEN | 6 (RXEN) | These pins must still be connected, and `SX126X_RXEN` defined in `variant.h`, otherwise Rx sensitivity will be poor. | -| D8 | PIN_SPI_SCK | 18 (SCK) | | -| D9 | PIN_SPI_MISO | 16 (MISO) | | -| D10 | PIN_SPI_MOSI | 17 (MOSI) | | + +| Xiao BLE pin | variant.h definition | E22 pin | Notes | +| :----------- | :------------------- | :-------- | :------------------------------------------------------------------------------------------------------------------- | +| D0 | SX126X_CS | 19 (NSS) | | +| D1 | SX126X_DIO1 | 13 (DIO1) | | +| D2 | SX126X_BUSY | 14 (BUSY) | | +| D3 | SX126X_RESET | 15 (NRST) | | +| D7 | SX126X_RXEN | 6 (RXEN) | These pins must still be connected, and `SX126X_RXEN` defined in `variant.h`, otherwise Rx sensitivity will be poor. | +| D8 | PIN_SPI_SCK | 18 (SCK) | | +| D9 | PIN_SPI_MISO | 16 (MISO) | | +| D10 | PIN_SPI_MOSI | 17 (MOSI) | |     E22 -> E22 connections: -| E22 pin | E22 pin | Notes | -| :------------ | :---------------------------- | :------------------------------------------------------------------------ | -| TXEN | DIO2 | These must be physically connected for automatic Tx/Rx switching to work. | + +| E22 pin | E22 pin | Notes | +| :------ | :------ | :------------------------------------------------------------------------ | +| TXEN | DIO2 | These must be physically connected for automatic Tx/Rx switching to work. |

Note

@@ -148,17 +150,18 @@ The schematic (`xiao-ble-e22-schematic.png`) in the `eagle-project` directory us

Example wiring for "Manual Tx/Rx switching" mode:

MCU -> E22 connections -| Xiao BLE pin | variant.h definition | E22 pin | Notes | -| :------------ | :---------------------------- | :-----------------| :--------------------------- | -| D0 | SX126X_CS | 19 (NSS) | | -| D1 | SX126X_DIO1 | 13 (DIO1) | | -| D2 | SX126X_BUSY | 14 (BUSY) | | -| D3 | SX126X_RESET | 15 (NRST) | | -| D6 | SX126X_TXEN | 7 (TXEN) | | -| D7 | SX126X_RXEN | 6 (RXEN) | | -| D8 | PIN_SPI_SCK | 18 (SCK) | | -| D9 | PIN_SPI_MISO | 16 (MISO) | | -| D10 | PIN_SPI_MOSI | 17 (MOSI) | | + +| Xiao BLE pin | variant.h definition | E22 pin | Notes | +| :----------- | :------------------- | :-------- | :---- | +| D0 | SX126X_CS | 19 (NSS) | | +| D1 | SX126X_DIO1 | 13 (DIO1) | | +| D2 | SX126X_BUSY | 14 (BUSY) | | +| D3 | SX126X_RESET | 15 (NRST) | | +| D6 | SX126X_TXEN | 7 (TXEN) | | +| D7 | SX126X_RXEN | 6 (RXEN) | | +| D8 | PIN_SPI_SCK | 18 (SCK) | | +| D9 | PIN_SPI_MISO | 16 (MISO) | | +| D10 | PIN_SPI_MOSI | 17 (MOSI) | | E22 -> E22 connections: (none) From 3a0ad9bb580d234f3d2af2609a825eb33f41cded Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Feb 2025 20:53:33 +0800 Subject: [PATCH 207/381] Bump python from 3.12-alpine3.21 to 3.13-alpine3.21 (#6142) Bumps python from 3.12-alpine3.21 to 3.13-alpine3.21. --- updated-dependencies: - dependency-name: python dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Dockerfile | 2 +- alpine.Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4796df301..fd1bb6164 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ # trunk-ignore-all(hadolint/DL3008): Do not pin apt package versions # trunk-ignore-all(hadolint/DL3013): Do not pin pip package versions -FROM python:3.12-bookworm AS builder +FROM python:3.13-bookworm AS builder ENV DEBIAN_FRONTEND=noninteractive ENV TZ=Etc/UTC diff --git a/alpine.Dockerfile b/alpine.Dockerfile index caa86187f..b6d91a75a 100644 --- a/alpine.Dockerfile +++ b/alpine.Dockerfile @@ -4,7 +4,7 @@ # trunk-ignore-all(hadolint/DL3018): Do not pin apk package versions # trunk-ignore-all(hadolint/DL3013): Do not pin pip package versions -FROM python:3.12-alpine3.21 AS builder +FROM python:3.13-alpine3.21 AS builder ENV PIP_ROOT_USER_ACTION=ignore RUN apk --no-cache add \ From f2e49aa4eef7490477874495f8a5074a3d5898bf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 25 Feb 2025 16:27:45 -0500 Subject: [PATCH 208/381] Upgrade trunk (#6151) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 931dcc7c7..becd6f55f 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -8,11 +8,11 @@ plugins: uri: https://github.com/trunk-io/plugins lint: enabled: - - prettier@3.5.1 + - prettier@3.5.2 - trufflehog@3.88.12 - yamllint@1.35.1 - bandit@1.8.3 - - checkov@3.2.372 + - checkov@3.2.373 - terrascan@1.19.9 - trivy@0.59.1 - taplo@0.9.3 From 598cfcc08149835484f4a00af89fc73430129ffc Mon Sep 17 00:00:00 2001 From: Mictronics Date: Thu, 27 Feb 2025 01:21:03 +0100 Subject: [PATCH 209/381] Cast user pref strings. (#6123) --- src/main.cpp | 2 +- src/mesh/Channels.cpp | 6 +++--- src/mesh/NodeDB.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index be498421c..e31ece106 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -117,7 +117,7 @@ AudioThread *audioThread = nullptr; using namespace concurrency; -volatile static const char slipstreamTZString[] = USERPREFS_TZ_STRING; +volatile static const char slipstreamTZString[] = {USERPREFS_TZ_STRING}; // We always create a screen object, but we only init it if we find the hardware graphics::Screen *screen = nullptr; diff --git a/src/mesh/Channels.cpp b/src/mesh/Channels.cpp index 4bc91ce4e..19c0ff347 100644 --- a/src/mesh/Channels.cpp +++ b/src/mesh/Channels.cpp @@ -119,7 +119,7 @@ void Channels::initDefaultChannel(ChannelIndex chIndex) channelSettings.psk.size = sizeof(defaultpsk0); #endif #ifdef USERPREFS_CHANNEL_0_NAME - strcpy(channelSettings.name, USERPREFS_CHANNEL_0_NAME); + strcpy(channelSettings.name, (const char *)USERPREFS_CHANNEL_0_NAME); #endif #ifdef USERPREFS_CHANNEL_0_PRECISION channelSettings.module_settings.position_precision = USERPREFS_CHANNEL_0_PRECISION; @@ -138,7 +138,7 @@ void Channels::initDefaultChannel(ChannelIndex chIndex) channelSettings.psk.size = sizeof(defaultpsk1); #endif #ifdef USERPREFS_CHANNEL_1_NAME - strcpy(channelSettings.name, USERPREFS_CHANNEL_1_NAME); + strcpy(channelSettings.name, (const char *)USERPREFS_CHANNEL_1_NAME); #endif #ifdef USERPREFS_CHANNEL_1_PRECISION channelSettings.module_settings.position_precision = USERPREFS_CHANNEL_1_PRECISION; @@ -157,7 +157,7 @@ void Channels::initDefaultChannel(ChannelIndex chIndex) channelSettings.psk.size = sizeof(defaultpsk2); #endif #ifdef USERPREFS_CHANNEL_2_NAME - strcpy(channelSettings.name, USERPREFS_CHANNEL_2_NAME); + strcpy(channelSettings.name, (const char *)USERPREFS_CHANNEL_2_NAME); #endif #ifdef USERPREFS_CHANNEL_2_PRECISION channelSettings.module_settings.position_precision = USERPREFS_CHANNEL_2_PRECISION; diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 9caa03928..f328718b0 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -859,12 +859,12 @@ void NodeDB::installDefaultDeviceState() // Set default owner name pickNewNodeNum(); // based on macaddr now #ifdef USERPREFS_CONFIG_OWNER_LONG_NAME - snprintf(owner.long_name, sizeof(owner.long_name), USERPREFS_CONFIG_OWNER_LONG_NAME); + snprintf(owner.long_name, sizeof(owner.long_name), (const char *)USERPREFS_CONFIG_OWNER_LONG_NAME); #else snprintf(owner.long_name, sizeof(owner.long_name), "Meshtastic %04x", getNodeNum() & 0x0ffff); #endif #ifdef USERPREFS_CONFIG_OWNER_SHORT_NAME - snprintf(owner.short_name, sizeof(owner.short_name), USERPREFS_CONFIG_OWNER_SHORT_NAME); + snprintf(owner.short_name, sizeof(owner.short_name), (const char *)USERPREFS_CONFIG_OWNER_SHORT_NAME); #else snprintf(owner.short_name, sizeof(owner.short_name), "%04x", getNodeNum() & 0x0ffff); #endif From ffe4e7b6be2b8b260bc0e28f4e9fa1c29300821c Mon Sep 17 00:00:00 2001 From: Karch Date: Wed, 26 Feb 2025 19:57:43 -0500 Subject: [PATCH 210/381] Add some minor additional options to userPrefs.jsonc (#6137) * added some additional userPrefs options * linted * some further changes * fixed some option ordering --- src/mesh/NodeDB.cpp | 12 ++++++++++++ userPrefs.jsonc | 7 +++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index f328718b0..c06b5df83 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -555,7 +555,11 @@ void NodeDB::installDefaultConfig(bool preserveKey = false) #else config.position.gps_mode = meshtastic_Config_PositionConfig_GpsMode_ENABLED; #endif +#ifdef USERPREFS_CONFIG_SMART_POSITION_ENABLED + config.position.position_broadcast_smart_enabled = USERPREFS_CONFIG_SMART_POSITION_ENABLED; +#else config.position.position_broadcast_smart_enabled = true; +#endif config.position.broadcast_smart_minimum_distance = 100; config.position.broadcast_smart_minimum_interval_secs = 30; if (config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER) @@ -618,8 +622,16 @@ void NodeDB::installDefaultConfig(bool preserveKey = false) void NodeDB::initConfigIntervals() { +#ifdef USERPREFS_CONFIG_GPS_UPDATE_INTERVAL + config.position.gps_update_interval = USERPREFS_CONFIG_GPS_UPDATE_INTERVAL; +#else config.position.gps_update_interval = default_gps_update_interval; +#endif +#ifdef USERPREFS_CONFIG_POSITION_BROADCAST_INTERVAL + config.position.position_broadcast_secs = USERPREFS_CONFIG_POSITION_BROADCAST_INTERVAL; +#else config.position.position_broadcast_secs = default_broadcast_interval_secs; +#endif config.power.ls_secs = default_ls_secs; config.power.min_wake_secs = default_min_wake_secs; diff --git a/userPrefs.jsonc b/userPrefs.jsonc index de610464d..6a3fdbb55 100644 --- a/userPrefs.jsonc +++ b/userPrefs.jsonc @@ -27,9 +27,11 @@ // "USERPREFS_FIXED_GPS_ALT": "0", // "USERPREFS_FIXED_GPS_LAT": "48.85873920", // "USERPREFS_FIXED_GPS_LON": "2.294508368", + // "USERPREFS_CONFIG_SMART_POSITION_ENABLED": "false", + // "USERPREFS_CONFIG_GPS_UPDATE_INTERVAL": "600", + // "USERPREFS_CONFIG_POSITION_BROADCAST_INTERVAL": "1800", // "USERPREFS_LORACONFIG_CHANNEL_NUM": "31", // "USERPREFS_LORACONFIG_MODEM_PRESET": "meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST", - "USERPREFS_TZ_STRING": "tzplaceholder " // "USERPREFS_USE_ADMIN_KEY_0": "{ 0xcd, 0xc0, 0xb4, 0x3c, 0x53, 0x24, 0xdf, 0x13, 0xca, 0x5a, 0xa6, 0x0c, 0x0d, 0xec, 0x85, 0x5a, 0x4c, 0xf6, 0x1a, 0x96, 0x04, 0x1a, 0x3e, 0xfc, 0xbb, 0x8e, 0x33, 0x71, 0xe5, 0xfc, 0xff, 0x3c }", // "USERPREFS_USE_ADMIN_KEY_1": "{}", // "USERPREFS_USE_ADMIN_KEY_2": "{}", @@ -37,5 +39,6 @@ // "USERPREFS_OEM_FONT_SIZE": "0", // "USERPREFS_OEM_IMAGE_WIDTH": "50", // "USERPREFS_OEM_IMAGE_HEIGHT": "28", - // "USERPREFS_OEM_IMAGE_DATA": "{ 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xC0, 0x07, 0x80, 0x0F, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x18, 0xFF, 0xFF, 0x61, 0x00, 0x00, 0x00, 0x0C, 0xFF, 0xFF, 0xC7, 0x00, 0x00, 0x00, 0x0C, 0xFF, 0xFF, 0xC7, 0x00, 0x00, 0x00, 0x18, 0xFF, 0xFF, 0x67, 0x00, 0x00, 0x00, 0x18, 0x1F, 0xF0, 0x67, 0x00, 0x00, 0x00, 0x30, 0x1F, 0xF8, 0x33, 0x00, 0x00, 0x00, 0x30, 0x00, 0xFC, 0x31, 0x00, 0x00, 0x00, 0x60, 0x00, 0xFE, 0x18, 0x00, 0x00, 0x00, 0x60, 0x00, 0x7E, 0x18, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x3F, 0x0C, 0x00, 0x00, 0x00, 0xC0, 0x80, 0x1F, 0x0C, 0x00, 0x00, 0x00, 0x80, 0x81, 0x1F, 0x06, 0x00, 0x00, 0x00, 0x80, 0xC1, 0x0F, 0x06, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0xE6, 0x8F, 0x01, 0x00, 0x00, 0x00, 0x00, 0xEE, 0xC7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x0C, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00}" + // "USERPREFS_OEM_IMAGE_DATA": "{ 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xC0, 0x07, 0x80, 0x0F, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x18, 0xFF, 0xFF, 0x61, 0x00, 0x00, 0x00, 0x0C, 0xFF, 0xFF, 0xC7, 0x00, 0x00, 0x00, 0x0C, 0xFF, 0xFF, 0xC7, 0x00, 0x00, 0x00, 0x18, 0xFF, 0xFF, 0x67, 0x00, 0x00, 0x00, 0x18, 0x1F, 0xF0, 0x67, 0x00, 0x00, 0x00, 0x30, 0x1F, 0xF8, 0x33, 0x00, 0x00, 0x00, 0x30, 0x00, 0xFC, 0x31, 0x00, 0x00, 0x00, 0x60, 0x00, 0xFE, 0x18, 0x00, 0x00, 0x00, 0x60, 0x00, 0x7E, 0x18, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x3F, 0x0C, 0x00, 0x00, 0x00, 0xC0, 0x80, 0x1F, 0x0C, 0x00, 0x00, 0x00, 0x80, 0x81, 0x1F, 0x06, 0x00, 0x00, 0x00, 0x80, 0xC1, 0x0F, 0x06, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0xE6, 0x8F, 0x01, 0x00, 0x00, 0x00, 0x00, 0xEE, 0xC7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x0C, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00}", + "USERPREFS_TZ_STRING": "tzplaceholder " } From b437f0fb545c8aa62858bcec69a3f0e31c5ac2c9 Mon Sep 17 00:00:00 2001 From: Austin Date: Wed, 26 Feb 2025 20:43:01 -0500 Subject: [PATCH 211/381] More trunk junk / remove old workflows (#6153) --- .github/dependabot.yml | 2 +- .github/workflows/generate-userprefs.yml | 35 - .github/workflows/nightly.yml | 4 +- .github/workflows/sec_sast_flawfinder.yml | 41 - .github/workflows/sec_sast_semgrep_cron.yml | 6 +- .github/workflows/sec_sast_semgrep_pull.yml | 2 + .github/workflows/trunk_annotate_pr.yml | 2 +- .github/workflows/trunk_check.yml | 2 +- .github/workflows/trunk_format_pr.yml | 6 +- .github/workflows/update_protobufs.yml | 6 +- monitor/filter_c3_exception_decoder.py | 3 + src/graphics/fonts/OLEDDisplayFontsPL.cpp | 2605 ++++++++++--------- 12 files changed, 1326 insertions(+), 1388 deletions(-) delete mode 100644 .github/workflows/generate-userprefs.yml delete mode 100644 .github/workflows/sec_sast_flawfinder.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index cf840b1ff..a7b4a0f1b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,7 +2,7 @@ version: 2 updates: - package-ecosystem: docker - directory: devcontainer + directory: /.devcontainer schedule: interval: daily time: "05:00" diff --git a/.github/workflows/generate-userprefs.yml b/.github/workflows/generate-userprefs.yml deleted file mode 100644 index 10dd1ff7d..000000000 --- a/.github/workflows/generate-userprefs.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Generate UsersPrefs JSON manifest - -on: - push: - paths: - - userPrefs.h - branches: - - master - -jobs: - generate-userprefs: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install Clang - run: sudo apt-get install -y clang - - - name: Install trunk - run: curl https://get.trunk.io -fsSL | bash - - - name: Generate userPrefs.jsom - run: python3 ./bin/build-userprefs-json.py - - - name: Trunk format json - run: trunk format userPrefs.json - - - name: Commit userPrefs.json - run: | - git config --global user.email "actions@github.com" - git config --global user.name "GitHub Actions" - git add userPrefs.json - git commit -m "Update userPrefs.json" - git push diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 28ba12fcc..36ec22f17 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -9,7 +9,7 @@ permissions: read-all jobs: trunk_check: name: Trunk Check and Upload - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout @@ -23,7 +23,7 @@ jobs: trunk_upgrade: # See: https://github.com/trunk-io/trunk-action/blob/v1/readme.md#automatic-upgrades name: Trunk Upgrade (PR) - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 permissions: contents: write # For trunk to create PRs pull-requests: write # For trunk to create PRs diff --git a/.github/workflows/sec_sast_flawfinder.yml b/.github/workflows/sec_sast_flawfinder.yml deleted file mode 100644 index 99cc72190..000000000 --- a/.github/workflows/sec_sast_flawfinder.yml +++ /dev/null @@ -1,41 +0,0 @@ ---- -name: Flawfinder Scan - -on: - push: - branches: [master, develop] - paths-ignore: - - "**.md" - - "version.properties" - -jobs: - flawfinder: - runs-on: ubuntu-latest - name: Flawfinder - - steps: - # step 1 - - name: clone application source code - uses: actions/checkout@v4 - - # step 2 - - name: flawfinder_scan - uses: david-a-wheeler/flawfinder@2.0.19 - with: - arguments: "--sarif ./" - output: "flawfinder_report.sarif" - - # step 3 - - name: save report as pipeline artifact - uses: actions/upload-artifact@v4 - with: - name: flawfinder_report.sarif - overwrite: true - path: flawfinder_report.sarif - - # step 4 - - name: publish code scanning alerts - uses: github/codeql-action/upload-sarif@v3 - with: - sarif_file: flawfinder_report.sarif - category: flawfinder diff --git a/.github/workflows/sec_sast_semgrep_cron.yml b/.github/workflows/sec_sast_semgrep_cron.yml index 54bbbe6d2..944103562 100644 --- a/.github/workflows/sec_sast_semgrep_cron.yml +++ b/.github/workflows/sec_sast_semgrep_cron.yml @@ -3,10 +3,10 @@ name: Semgrep Full Scan on: workflow_dispatch: - branches: - - master schedule: - - cron: "0 1 * * 6" + - cron: 0 1 * * 6 + +permissions: read-all jobs: semgrep-full: diff --git a/.github/workflows/sec_sast_semgrep_pull.yml b/.github/workflows/sec_sast_semgrep_pull.yml index 9013f1c74..527a5c076 100644 --- a/.github/workflows/sec_sast_semgrep_pull.yml +++ b/.github/workflows/sec_sast_semgrep_pull.yml @@ -2,6 +2,8 @@ name: Semgrep Differential Scan on: pull_request +permissions: read-all + jobs: semgrep-diff: runs-on: ubuntu-22.04 diff --git a/.github/workflows/trunk_annotate_pr.yml b/.github/workflows/trunk_annotate_pr.yml index ac5cdc0d5..62c1c01b7 100644 --- a/.github/workflows/trunk_annotate_pr.yml +++ b/.github/workflows/trunk_annotate_pr.yml @@ -11,7 +11,7 @@ permissions: read-all jobs: trunk_check: name: Trunk Code Quality Annotate - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 permissions: checks: write # For trunk to post annotations contents: read # For repo checkout diff --git a/.github/workflows/trunk_check.yml b/.github/workflows/trunk_check.yml index 2e74ab25f..55656bf48 100644 --- a/.github/workflows/trunk_check.yml +++ b/.github/workflows/trunk_check.yml @@ -9,7 +9,7 @@ permissions: read-all jobs: trunk_check: name: Trunk Check Runner - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 permissions: checks: write # For trunk to post annotations contents: read # For repo checkout diff --git a/.github/workflows/trunk_format_pr.yml b/.github/workflows/trunk_format_pr.yml index 0d6eb6041..33f4182eb 100644 --- a/.github/workflows/trunk_format_pr.yml +++ b/.github/workflows/trunk_format_pr.yml @@ -4,11 +4,15 @@ on: issue_comment: types: [created] +permissions: read-all + jobs: trunk-fmt: if: github.event.issue.pull_request != null && contains(github.event.comment.body, 'trunk fmt') runs-on: ubuntu-latest - + permissions: + contents: write + pull-requests: write steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/update_protobufs.yml b/.github/workflows/update_protobufs.yml index e7b3c1f40..5aa295b89 100644 --- a/.github/workflows/update_protobufs.yml +++ b/.github/workflows/update_protobufs.yml @@ -1,10 +1,14 @@ name: Update protobufs and regenerate classes on: workflow_dispatch +permissions: read-all + jobs: update-protobufs: runs-on: ubuntu-latest - + permissions: + contents: write + pull-requests: write steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/monitor/filter_c3_exception_decoder.py b/monitor/filter_c3_exception_decoder.py index 6d7b5370c..5e74dc2b9 100644 --- a/monitor/filter_c3_exception_decoder.py +++ b/monitor/filter_c3_exception_decoder.py @@ -1,3 +1,6 @@ +# trunk-ignore-all(bandit/B404): subprocess is used to call addr2line +# trunk-ignore-all(bandit/B603): subprocess is used to call addr2line + # Copyright (c) 2014-present PlatformIO # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/graphics/fonts/OLEDDisplayFontsPL.cpp b/src/graphics/fonts/OLEDDisplayFontsPL.cpp index 1f43967aa..0767e24e7 100644 --- a/src/graphics/fonts/OLEDDisplayFontsPL.cpp +++ b/src/graphics/fonts/OLEDDisplayFontsPL.cpp @@ -1,1312 +1,1313 @@ +// trunk-ignore-all(clang-format): Preserve long lines #include "OLEDDisplayFontsPL.h" const uint8_t ArialMT_Plain_10_PL[] PROGMEM = { -0x0A, // Width: 10 -0x0D, // Height: 13 -0x20, // First char: 32 -0xE0, // Number of chars: 224 -// Jump Table: -0xFF, 0xFF, 0x00, 0x03, // 32 -0x00, 0x00, 0x04, 0x03, // 33 -0x00, 0x04, 0x05, 0x04, // 34 -0x00, 0x09, 0x09, 0x06, // 35 -0x00, 0x12, 0x0A, 0x06, // 36 -0x00, 0x1C, 0x10, 0x09, // 37 -0x00, 0x2C, 0x0E, 0x08, // 38 -0x00, 0x3A, 0x01, 0x02, // 39 -0x00, 0x3B, 0x06, 0x04, // 40 -0x00, 0x41, 0x06, 0x04, // 41 -0x00, 0x47, 0x05, 0x04, // 42 -0x00, 0x4C, 0x09, 0x06, // 43 -0x00, 0x55, 0x04, 0x03, // 44 -0x00, 0x59, 0x03, 0x03, // 45 -0x00, 0x5C, 0x04, 0x03, // 46 -0x00, 0x60, 0x05, 0x04, // 47 -0x00, 0x65, 0x0A, 0x06, // 48 -0x00, 0x6F, 0x08, 0x05, // 49 -0x00, 0x77, 0x0A, 0x06, // 50 -0x00, 0x81, 0x0A, 0x06, // 51 -0x00, 0x8B, 0x0B, 0x07, // 52 -0x00, 0x96, 0x0A, 0x06, // 53 -0x00, 0xA0, 0x0A, 0x06, // 54 -0x00, 0xAA, 0x09, 0x06, // 55 -0x00, 0xB3, 0x0A, 0x06, // 56 -0x00, 0xBD, 0x0A, 0x06, // 57 -0x00, 0xC7, 0x04, 0x03, // 58 -0x00, 0xCB, 0x04, 0x03, // 59 -0x00, 0xCF, 0x0A, 0x06, // 60 -0x00, 0xD9, 0x09, 0x06, // 61 -0x00, 0xE2, 0x09, 0x06, // 62 -0x00, 0xEB, 0x0B, 0x07, // 63 -0x00, 0xF6, 0x14, 0x0B, // 64 -0x01, 0x0A, 0x0E, 0x08, // 65 -0x01, 0x18, 0x0C, 0x07, // 66 -0x01, 0x24, 0x0C, 0x07, // 67 -0x01, 0x30, 0x0B, 0x07, // 68 -0x01, 0x3B, 0x0C, 0x07, // 69 -0x01, 0x47, 0x09, 0x06, // 70 -0x01, 0x50, 0x0D, 0x08, // 71 -0x01, 0x5D, 0x0C, 0x07, // 72 -0x01, 0x69, 0x04, 0x03, // 73 -0x01, 0x6D, 0x08, 0x05, // 74 -0x01, 0x75, 0x0E, 0x08, // 75 -0x01, 0x83, 0x0C, 0x07, // 76 -0x01, 0x8F, 0x10, 0x09, // 77 -0x01, 0x9F, 0x0C, 0x07, // 78 -0x01, 0xAB, 0x0E, 0x08, // 79 -0x01, 0xB9, 0x0B, 0x07, // 80 -0x01, 0xC4, 0x0E, 0x08, // 81 -0x01, 0xD2, 0x0C, 0x07, // 82 -0x01, 0xDE, 0x0C, 0x07, // 83 -0x01, 0xEA, 0x0B, 0x07, // 84 -0x01, 0xF5, 0x0C, 0x07, // 85 -0x02, 0x01, 0x0D, 0x08, // 86 -0x02, 0x0E, 0x11, 0x0A, // 87 -0x02, 0x1F, 0x0E, 0x08, // 88 -0x02, 0x2D, 0x0D, 0x08, // 89 -0x02, 0x3A, 0x0C, 0x07, // 90 -0x02, 0x46, 0x06, 0x04, // 91 -0x02, 0x4C, 0x06, 0x04, // 92 -0x02, 0x52, 0x04, 0x03, // 93 -0x02, 0x56, 0x09, 0x06, // 94 -0x02, 0x5F, 0x0C, 0x07, // 95 -0x02, 0x6B, 0x03, 0x03, // 96 -0x02, 0x6E, 0x0A, 0x06, // 97 -0x02, 0x78, 0x0A, 0x06, // 98 -0x02, 0x82, 0x0A, 0x06, // 99 -0x02, 0x8C, 0x0A, 0x06, // 100 -0x02, 0x96, 0x0A, 0x06, // 101 -0x02, 0xA0, 0x05, 0x04, // 102 -0x02, 0xA5, 0x0A, 0x06, // 103 -0x02, 0xAF, 0x0A, 0x06, // 104 -0x02, 0xB9, 0x04, 0x03, // 105 -0x02, 0xBD, 0x04, 0x03, // 106 -0x02, 0xC1, 0x08, 0x05, // 107 -0x02, 0xC9, 0x04, 0x03, // 108 -0x02, 0xCD, 0x10, 0x09, // 109 -0x02, 0xDD, 0x0A, 0x06, // 110 -0x02, 0xE7, 0x0A, 0x06, // 111 -0x02, 0xF1, 0x0A, 0x06, // 112 -0x02, 0xFB, 0x0A, 0x06, // 113 -0x03, 0x05, 0x05, 0x04, // 114 -0x03, 0x0A, 0x08, 0x05, // 115 -0x03, 0x12, 0x06, 0x04, // 116 -0x03, 0x18, 0x0A, 0x06, // 117 -0x03, 0x22, 0x09, 0x06, // 118 -0x03, 0x2B, 0x0E, 0x08, // 119 -0x03, 0x39, 0x0A, 0x06, // 120 -0x03, 0x43, 0x09, 0x06, // 121 -0x03, 0x4C, 0x0A, 0x06, // 122 -0x03, 0x56, 0x06, 0x04, // 123 -0x03, 0x5C, 0x04, 0x03, // 124 -0x03, 0x60, 0x05, 0x04, // 125 -0x03, 0x65, 0x09, 0x06, // 126 -0xFF, 0xFF, 0x00, 0x0A, // 127 -0xFF, 0xFF, 0x00, 0x0A, // 128 -0x03, 0x6E, 0x0C, 0x07, // 129 -0x03, 0x7A, 0x05, 0x04, // 130 -0x03, 0x7F, 0x0C, 0x07, // 131 -0x03, 0x8B, 0x0E, 0x08, // 132 -0x03, 0x99, 0x0A, 0x06, // 133 -0x03, 0xA3, 0x0C, 0x07, // 134 -0x03, 0xAF, 0x0A, 0x06, // 135 -0x03, 0xB9, 0x0A, 0x06, // 136 -0x03, 0xC3, 0x0A, 0x06, // 137 -0xFF, 0xFF, 0x00, 0x0A, // 138 -0xFF, 0xFF, 0x00, 0x0A, // 139 -0xFF, 0xFF, 0x00, 0x0A, // 140 -0xFF, 0xFF, 0x00, 0x0A, // 141 -0xFF, 0xFF, 0x00, 0x0A, // 142 -0xFF, 0xFF, 0x00, 0x0A, // 143 -0xFF, 0xFF, 0x00, 0x0A, // 144 -0xFF, 0xFF, 0x00, 0x0A, // 145 -0xFF, 0xFF, 0x00, 0x0A, // 146 -0x03, 0xCD, 0x0E, 0x08, // 147 -0x03, 0xDB, 0x0A, 0x06, // 148 -0xFF, 0xFF, 0x00, 0x0A, // 149 -0xFF, 0xFF, 0x00, 0x0A, // 150 -0xFF, 0xFF, 0x00, 0x0A, // 151 -0x03, 0xE5, 0x0C, 0x07, // 152 -0x03, 0xF1, 0x0A, 0x06, // 153 -0x03, 0xFB, 0x0C, 0x07, // 154 -0x04, 0x07, 0x08, 0x05, // 155 -0xFF, 0xFF, 0x00, 0x0A, // 156 -0xFF, 0xFF, 0x00, 0x0A, // 157 -0xFF, 0xFF, 0x00, 0x0A, // 158 -0xFF, 0xFF, 0x00, 0x0A, // 159 -0xFF, 0xFF, 0x00, 0x0A, // 160 -0x04, 0x0F, 0x04, 0x03, // 161 -0x04, 0x13, 0x0A, 0x06, // 162 -0x04, 0x1D, 0x0C, 0x07, // 163 -0x04, 0x29, 0x0A, 0x06, // 164 -0x04, 0x33, 0x0A, 0x06, // 165 -0x04, 0x3D, 0x04, 0x03, // 166 -0x04, 0x41, 0x0A, 0x06, // 167 -0x04, 0x4B, 0x05, 0x04, // 168 -0x04, 0x50, 0x0D, 0x08, // 169 -0x04, 0x5D, 0x07, 0x05, // 170 -0x04, 0x64, 0x0A, 0x06, // 171 -0x04, 0x6E, 0x09, 0x06, // 172 -0x04, 0x77, 0x03, 0x03, // 173 -0x04, 0x7A, 0x0D, 0x08, // 174 -0x04, 0x87, 0x0B, 0x07, // 175 -0x04, 0x92, 0x07, 0x05, // 176 -0x04, 0x99, 0x0A, 0x06, // 177 -0x04, 0xA3, 0x05, 0x04, // 178 -0x04, 0xA8, 0x05, 0x04, // 179 -0x04, 0xAD, 0x05, 0x04, // 180 -0x04, 0xB2, 0x0A, 0x06, // 181 -0x04, 0xBC, 0x09, 0x06, // 182 -0x04, 0xC5, 0x03, 0x03, // 183 -0x04, 0xC8, 0x06, 0x04, // 184 -0x04, 0xCE, 0x0C, 0x07, // 185 -0x04, 0xDA, 0x07, 0x05, // 186 -0x04, 0xE1, 0x0C, 0x07, // 187 -0x04, 0xED, 0x0A, 0x06, // 188 -0x04, 0xF7, 0x10, 0x09, // 189 -0x05, 0x07, 0x10, 0x09, // 190 -0x05, 0x17, 0x0A, 0x06, // 191 -0x05, 0x21, 0x0E, 0x08, // 192 -0x05, 0x2F, 0x0E, 0x08, // 193 -0x05, 0x3D, 0x0E, 0x08, // 194 -0x05, 0x4B, 0x0E, 0x08, // 195 -0x05, 0x59, 0x0E, 0x08, // 196 -0x05, 0x67, 0x0E, 0x08, // 197 -0x05, 0x75, 0x12, 0x0A, // 198 -0x05, 0x87, 0x0C, 0x07, // 199 -0x05, 0x93, 0x0C, 0x07, // 200 -0x05, 0x9F, 0x0C, 0x07, // 201 -0x05, 0xAB, 0x0C, 0x07, // 202 -0x05, 0xB7, 0x0C, 0x07, // 203 -0x05, 0xC3, 0x05, 0x04, // 204 -0x05, 0xC8, 0x04, 0x03, // 205 -0x05, 0xCC, 0x04, 0x03, // 206 -0x05, 0xD0, 0x05, 0x04, // 207 -0x05, 0xD5, 0x0B, 0x07, // 208 -0x05, 0xE0, 0x0C, 0x07, // 209 -0x05, 0xEC, 0x0E, 0x08, // 210 -0x05, 0xFA, 0x0E, 0x08, // 211 -0x06, 0x08, 0x0E, 0x08, // 212 -0x06, 0x16, 0x0E, 0x08, // 213 -0x06, 0x24, 0x0E, 0x08, // 214 -0x06, 0x32, 0x0A, 0x06, // 215 -0x06, 0x3C, 0x0D, 0x08, // 216 -0x06, 0x49, 0x0C, 0x07, // 217 -0x06, 0x55, 0x0C, 0x07, // 218 -0x06, 0x61, 0x0C, 0x07, // 219 -0x06, 0x6D, 0x0C, 0x07, // 220 -0x06, 0x79, 0x0D, 0x08, // 221 -0x06, 0x86, 0x0B, 0x07, // 222 -0x06, 0x91, 0x0C, 0x07, // 223 -0x06, 0x9D, 0x0A, 0x06, // 224 -0x06, 0xA7, 0x0A, 0x06, // 225 -0x06, 0xB1, 0x0A, 0x06, // 226 -0x06, 0xBB, 0x0A, 0x06, // 227 -0x06, 0xC5, 0x0A, 0x06, // 228 -0x06, 0xCF, 0x0A, 0x06, // 229 -0x06, 0xD9, 0x10, 0x09, // 230 -0x06, 0xE9, 0x0A, 0x06, // 231 -0x06, 0xF3, 0x0A, 0x06, // 232 -0x06, 0xFD, 0x0A, 0x06, // 233 -0x07, 0x07, 0x0A, 0x06, // 234 -0x07, 0x11, 0x0A, 0x06, // 235 -0x07, 0x1B, 0x05, 0x04, // 236 -0x07, 0x20, 0x04, 0x03, // 237 -0x07, 0x24, 0x05, 0x04, // 238 -0x07, 0x29, 0x05, 0x04, // 239 -0x07, 0x2E, 0x0A, 0x06, // 240 -0x07, 0x38, 0x0A, 0x06, // 241 -0x07, 0x42, 0x0A, 0x06, // 242 -0x07, 0x4C, 0x0A, 0x06, // 243 -0x07, 0x56, 0x0A, 0x06, // 244 -0x07, 0x60, 0x0A, 0x06, // 245 -0x07, 0x6A, 0x0A, 0x06, // 246 -0x07, 0x74, 0x09, 0x06, // 247 -0x07, 0x7D, 0x0A, 0x06, // 248 -0x07, 0x87, 0x0A, 0x06, // 249 -0x07, 0x91, 0x0A, 0x06, // 250 -0x07, 0x9B, 0x0A, 0x06, // 251 -0x07, 0xA5, 0x0A, 0x06, // 252 -0x07, 0xAF, 0x09, 0x06, // 253 -0x07, 0xB8, 0x0A, 0x06, // 254 -0x07, 0xC2, 0x09, 0x06, // 255 -// Font Data: -0x00, 0x00, 0xF8, 0x02, // 33 -0x38, 0x00, 0x00, 0x00, 0x38, // 34 -0xA0, 0x03, 0xE0, 0x00, 0xB8, 0x03, 0xE0, 0x00, 0xB8, // 35 -0x30, 0x01, 0x28, 0x02, 0xF8, 0x07, 0x48, 0x02, 0x90, 0x01, // 36 -0x00, 0x00, 0x30, 0x00, 0x48, 0x00, 0x30, 0x03, 0xC0, 0x00, 0xB0, 0x01, 0x48, 0x02, 0x80, 0x01, // 37 -0x80, 0x01, 0x50, 0x02, 0x68, 0x02, 0xA8, 0x02, 0x18, 0x01, 0x80, 0x03, 0x80, 0x02, // 38 -0x38, // 39 -0xE0, 0x03, 0x10, 0x04, 0x08, 0x08, // 40 -0x08, 0x08, 0x10, 0x04, 0xE0, 0x03, // 41 -0x28, 0x00, 0x18, 0x00, 0x28, // 42 -0x40, 0x00, 0x40, 0x00, 0xF0, 0x01, 0x40, 0x00, 0x40, // 43 -0x00, 0x00, 0x00, 0x06, // 44 -0x80, 0x00, 0x80, // 45 -0x00, 0x00, 0x00, 0x02, // 46 -0x00, 0x03, 0xE0, 0x00, 0x18, // 47 -0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x02, 0xF0, 0x01, // 48 -0x00, 0x00, 0x20, 0x00, 0x10, 0x00, 0xF8, 0x03, // 49 -0x10, 0x02, 0x08, 0x03, 0x88, 0x02, 0x48, 0x02, 0x30, 0x02, // 50 -0x10, 0x01, 0x08, 0x02, 0x48, 0x02, 0x48, 0x02, 0xB0, 0x01, // 51 -0xC0, 0x00, 0xA0, 0x00, 0x90, 0x00, 0x88, 0x00, 0xF8, 0x03, 0x80, // 52 -0x60, 0x01, 0x38, 0x02, 0x28, 0x02, 0x28, 0x02, 0xC8, 0x01, // 53 -0xF0, 0x01, 0x28, 0x02, 0x28, 0x02, 0x28, 0x02, 0xD0, 0x01, // 54 -0x08, 0x00, 0x08, 0x03, 0xC8, 0x00, 0x38, 0x00, 0x08, // 55 -0xB0, 0x01, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, 0xB0, 0x01, // 56 -0x70, 0x01, 0x88, 0x02, 0x88, 0x02, 0x88, 0x02, 0xF0, 0x01, // 57 -0x00, 0x00, 0x20, 0x02, // 58 -0x00, 0x00, 0x20, 0x06, // 59 -0x00, 0x00, 0x40, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0x10, 0x01, // 60 -0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, // 61 -0x00, 0x00, 0x10, 0x01, 0xA0, 0x00, 0xA0, 0x00, 0x40, // 62 -0x10, 0x00, 0x08, 0x00, 0x08, 0x00, 0xC8, 0x02, 0x48, 0x00, 0x30, // 63 -0x00, 0x00, 0xC0, 0x03, 0x30, 0x04, 0xD0, 0x09, 0x28, 0x0A, 0x28, 0x0A, 0xC8, 0x0B, 0x68, 0x0A, 0x10, 0x05, 0xE0, 0x04, // 64 -0x00, 0x02, 0xC0, 0x01, 0xB0, 0x00, 0x88, 0x00, 0xB0, 0x00, 0xC0, 0x01, 0x00, 0x02, // 65 -0x00, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, 0xF0, 0x01, // 66 -0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x02, 0x10, 0x01, // 67 -0x00, 0x00, 0xF8, 0x03, 0x08, 0x02, 0x08, 0x02, 0x10, 0x01, 0xE0, // 68 -0x00, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, // 69 -0x00, 0x00, 0xF8, 0x03, 0x48, 0x00, 0x48, 0x00, 0x08, // 70 -0x00, 0x00, 0xE0, 0x00, 0x10, 0x01, 0x08, 0x02, 0x48, 0x02, 0x50, 0x01, 0xC0, // 71 -0x00, 0x00, 0xF8, 0x03, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0xF8, 0x03, // 72 -0x00, 0x00, 0xF8, 0x03, // 73 -0x00, 0x03, 0x00, 0x02, 0x00, 0x02, 0xF8, 0x01, // 74 -0x00, 0x00, 0xF8, 0x03, 0x80, 0x00, 0x60, 0x00, 0x90, 0x00, 0x08, 0x01, 0x00, 0x02, // 75 -0x00, 0x00, 0xF8, 0x03, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, // 76 -0x00, 0x00, 0xF8, 0x03, 0x30, 0x00, 0xC0, 0x01, 0x00, 0x02, 0xC0, 0x01, 0x30, 0x00, 0xF8, 0x03, // 77 -0x00, 0x00, 0xF8, 0x03, 0x30, 0x00, 0x40, 0x00, 0x80, 0x01, 0xF8, 0x03, // 78 -0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x02, 0x08, 0x02, 0xF0, 0x01, // 79 -0x00, 0x00, 0xF8, 0x03, 0x48, 0x00, 0x48, 0x00, 0x48, 0x00, 0x30, // 80 -0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x03, 0x08, 0x03, 0xF0, 0x02, // 81 -0x00, 0x00, 0xF8, 0x03, 0x48, 0x00, 0x48, 0x00, 0xC8, 0x00, 0x30, 0x03, // 82 -0x00, 0x00, 0x30, 0x01, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, 0x90, 0x01, // 83 -0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0xF8, 0x03, 0x08, 0x00, 0x08, // 84 -0x00, 0x00, 0xF8, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0xF8, 0x01, // 85 -0x08, 0x00, 0x70, 0x00, 0x80, 0x01, 0x00, 0x02, 0x80, 0x01, 0x70, 0x00, 0x08, // 86 -0x18, 0x00, 0xE0, 0x01, 0x00, 0x02, 0xF0, 0x01, 0x08, 0x00, 0xF0, 0x01, 0x00, 0x02, 0xE0, 0x01, 0x18, // 87 -0x00, 0x02, 0x08, 0x01, 0x90, 0x00, 0x60, 0x00, 0x90, 0x00, 0x08, 0x01, 0x00, 0x02, // 88 -0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0xC0, 0x03, 0x20, 0x00, 0x10, 0x00, 0x08, // 89 -0x08, 0x03, 0x88, 0x02, 0xC8, 0x02, 0x68, 0x02, 0x38, 0x02, 0x18, 0x02, // 90 -0x00, 0x00, 0xF8, 0x0F, 0x08, 0x08, // 91 -0x18, 0x00, 0xE0, 0x00, 0x00, 0x03, // 92 -0x08, 0x08, 0xF8, 0x0F, // 93 -0x40, 0x00, 0x30, 0x00, 0x08, 0x00, 0x30, 0x00, 0x40, // 94 -0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, // 95 -0x08, 0x00, 0x10, // 96 -0x00, 0x00, 0x00, 0x03, 0xA0, 0x02, 0xA0, 0x02, 0xE0, 0x03, // 97 -0x00, 0x00, 0xF8, 0x03, 0x20, 0x02, 0x20, 0x02, 0xC0, 0x01, // 98 -0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x20, 0x02, 0x40, 0x01, // 99 -0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x20, 0x02, 0xF8, 0x03, // 100 -0x00, 0x00, 0xC0, 0x01, 0xA0, 0x02, 0xA0, 0x02, 0xC0, 0x02, // 101 -0x20, 0x00, 0xF0, 0x03, 0x28, // 102 -0x00, 0x00, 0xC0, 0x05, 0x20, 0x0A, 0x20, 0x0A, 0xE0, 0x07, // 103 -0x00, 0x00, 0xF8, 0x03, 0x20, 0x00, 0x20, 0x00, 0xC0, 0x03, // 104 -0x00, 0x00, 0xE8, 0x03, // 105 -0x00, 0x08, 0xE8, 0x07, // 106 -0xF8, 0x03, 0x80, 0x00, 0xC0, 0x01, 0x20, 0x02, // 107 -0x00, 0x00, 0xF8, 0x03, // 108 -0x00, 0x00, 0xE0, 0x03, 0x20, 0x00, 0x20, 0x00, 0xE0, 0x03, 0x20, 0x00, 0x20, 0x00, 0xC0, 0x03, // 109 -0x00, 0x00, 0xE0, 0x03, 0x20, 0x00, 0x20, 0x00, 0xC0, 0x03, // 110 -0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x20, 0x02, 0xC0, 0x01, // 111 -0x00, 0x00, 0xE0, 0x0F, 0x20, 0x02, 0x20, 0x02, 0xC0, 0x01, // 112 -0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x20, 0x02, 0xE0, 0x0F, // 113 -0x00, 0x00, 0xE0, 0x03, 0x20, // 114 -0x40, 0x02, 0xA0, 0x02, 0xA0, 0x02, 0x20, 0x01, // 115 -0x20, 0x00, 0xF8, 0x03, 0x20, 0x02, // 116 -0x00, 0x00, 0xE0, 0x01, 0x00, 0x02, 0x00, 0x02, 0xE0, 0x03, // 117 -0x20, 0x00, 0xC0, 0x01, 0x00, 0x02, 0xC0, 0x01, 0x20, // 118 -0xE0, 0x01, 0x00, 0x02, 0xC0, 0x01, 0x20, 0x00, 0xC0, 0x01, 0x00, 0x02, 0xE0, 0x01, // 119 -0x20, 0x02, 0x40, 0x01, 0x80, 0x00, 0x40, 0x01, 0x20, 0x02, // 120 -0x20, 0x00, 0xC0, 0x09, 0x00, 0x06, 0xC0, 0x01, 0x20, // 121 -0x20, 0x02, 0x20, 0x03, 0xA0, 0x02, 0x60, 0x02, 0x20, 0x02, // 122 -0x80, 0x00, 0x78, 0x0F, 0x08, 0x08, // 123 -0x00, 0x00, 0xF8, 0x0F, // 124 -0x08, 0x08, 0x78, 0x0F, 0x80, // 125 -0xC0, 0x00, 0x40, 0x00, 0xC0, 0x00, 0x80, 0x00, 0xC0, // 126 -0x00, 0x00, 0xF8, 0x03, 0x40, 0x02, 0x20, 0x02, 0x00, 0x02, 0x00, 0x02, // 129 -0x40, 0x00, 0xF8, 0x03, 0x20, // 130 -0x00, 0x00, 0xF8, 0x03, 0x30, 0x00, 0x44, 0x00, 0x82, 0x01, 0xF8, 0x03, // 131 -0x00, 0x02, 0xC0, 0x01, 0xB0, 0x00, 0x88, 0x00, 0xB0, 0x00, 0xC0, 0x0D, 0x00, 0x0A, // 132 -0x00, 0x00, 0x00, 0x03, 0xA0, 0x02, 0xA0, 0x0E, 0xE0, 0x0B, // 133 -0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x0A, 0x02, 0x09, 0x02, 0x10, 0x01, // 134 -0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x28, 0x02, 0x44, 0x01, // 135 -0x00, 0x00, 0xE0, 0x03, 0x20, 0x00, 0x28, 0x00, 0xC4, 0x03, // 136 -0x20, 0x02, 0x20, 0x03, 0xA8, 0x02, 0x64, 0x02, 0x20, 0x02, // 137 -0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x0A, 0x02, 0x09, 0x02, 0xF0, 0x01, // 147 -0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x28, 0x02, 0xC4, 0x01, // 148 -0x00, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x0E, 0x48, 0x0A, 0x48, 0x02, // 152 -0x00, 0x00, 0xC0, 0x01, 0xA0, 0x02, 0xA0, 0x0E, 0xC0, 0x0A, // 153 -0x00, 0x00, 0x30, 0x01, 0x48, 0x02, 0x4A, 0x02, 0x49, 0x02, 0x90, 0x01, // 154 -0x40, 0x02, 0xA0, 0x02, 0xA8, 0x02, 0x24, 0x01, // 155 -0x00, 0x00, 0xA0, 0x0F, // 161 -0x00, 0x00, 0xC0, 0x01, 0xA0, 0x0F, 0x78, 0x02, 0x40, 0x01, // 162 -0x40, 0x02, 0x70, 0x03, 0xC8, 0x02, 0x48, 0x02, 0x08, 0x02, 0x10, 0x02, // 163 -0x00, 0x00, 0xE0, 0x01, 0x20, 0x01, 0x20, 0x01, 0xE0, 0x01, // 164 -0x48, 0x01, 0x70, 0x01, 0xC0, 0x03, 0x70, 0x01, 0x48, 0x01, // 165 -0x00, 0x00, 0x38, 0x0F, // 166 -0xD0, 0x04, 0x28, 0x09, 0x48, 0x09, 0x48, 0x0A, 0x90, 0x05, // 167 -0x08, 0x00, 0x00, 0x00, 0x08, // 168 -0xE0, 0x00, 0x10, 0x01, 0x48, 0x02, 0xA8, 0x02, 0xA8, 0x02, 0x10, 0x01, 0xE0, // 169 -0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x78, // 170 -0x00, 0x00, 0x80, 0x01, 0x40, 0x02, 0x80, 0x01, 0x40, 0x02, // 171 -0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0xE0, // 172 -0x80, 0x00, 0x80, // 173 -0xE0, 0x00, 0x10, 0x01, 0xE8, 0x02, 0x68, 0x02, 0xC8, 0x02, 0x10, 0x01, 0xE0, // 174 -0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, // 175 -0x00, 0x00, 0x38, 0x00, 0x28, 0x00, 0x38, // 176 -0x40, 0x02, 0x40, 0x02, 0xF0, 0x03, 0x40, 0x02, 0x40, 0x02, // 177 -0x48, 0x00, 0x68, 0x00, 0x58, // 178 -0x48, 0x00, 0x58, 0x00, 0x68, // 179 -0x00, 0x00, 0x10, 0x00, 0x08, // 180 -0x00, 0x00, 0xE0, 0x0F, 0x00, 0x02, 0x00, 0x02, 0xE0, 0x03, // 181 -0x70, 0x00, 0xF8, 0x0F, 0x08, 0x00, 0xF8, 0x0F, 0x08, // 182 -0x00, 0x00, 0x40, // 183 -0x00, 0x00, 0x00, 0x14, 0x00, 0x18, // 184 -0x08, 0x03, 0x88, 0x02, 0xCA, 0x02, 0x69, 0x02, 0x38, 0x02, 0x18, 0x02, // 185 -0x30, 0x00, 0x48, 0x00, 0x48, 0x00, 0x30, // 186 -0x08, 0x03, 0x88, 0x02, 0xC8, 0x02, 0x6A, 0x02, 0x38, 0x02, 0x18, 0x02, // 187 -0x20, 0x02, 0x20, 0x03, 0xA8, 0x02, 0x60, 0x02, 0x20, 0x02, // 188 -0x00, 0x00, 0x10, 0x02, 0x78, 0x01, 0x80, 0x00, 0x60, 0x00, 0x50, 0x02, 0x48, 0x03, 0xC0, 0x02, // 189 -0x48, 0x00, 0x58, 0x00, 0x68, 0x03, 0x80, 0x00, 0x60, 0x01, 0x90, 0x01, 0xC8, 0x03, 0x00, 0x01, // 190 -0x00, 0x00, 0x00, 0x06, 0x00, 0x09, 0xA0, 0x09, 0x00, 0x04, // 191 -0x00, 0x02, 0xC0, 0x01, 0xB0, 0x00, 0x89, 0x00, 0xB2, 0x00, 0xC0, 0x01, 0x00, 0x02, // 192 -0x00, 0x02, 0xC0, 0x01, 0xB0, 0x00, 0x8A, 0x00, 0xB1, 0x00, 0xC0, 0x01, 0x00, 0x02, // 193 -0x00, 0x02, 0xC0, 0x01, 0xB2, 0x00, 0x89, 0x00, 0xB2, 0x00, 0xC0, 0x01, 0x00, 0x02, // 194 -0x00, 0x02, 0xC2, 0x01, 0xB1, 0x00, 0x8A, 0x00, 0xB1, 0x00, 0xC0, 0x01, 0x00, 0x02, // 195 -0x00, 0x02, 0xC0, 0x01, 0xB2, 0x00, 0x88, 0x00, 0xB2, 0x00, 0xC0, 0x01, 0x00, 0x02, // 196 -0x00, 0x02, 0xC0, 0x01, 0xBE, 0x00, 0x8A, 0x00, 0xBE, 0x00, 0xC0, 0x01, 0x00, 0x02, // 197 -0x00, 0x03, 0xC0, 0x00, 0xE0, 0x00, 0x98, 0x00, 0x88, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, // 198 -0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x16, 0x08, 0x1A, 0x10, 0x01, // 199 -0x00, 0x00, 0xF8, 0x03, 0x49, 0x02, 0x4A, 0x02, 0x48, 0x02, 0x48, 0x02, // 200 -0x00, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x4A, 0x02, 0x49, 0x02, 0x48, 0x02, // 201 -0x00, 0x00, 0xFA, 0x03, 0x49, 0x02, 0x4A, 0x02, 0x48, 0x02, 0x48, 0x02, // 202 -0x00, 0x00, 0xF8, 0x03, 0x4A, 0x02, 0x48, 0x02, 0x4A, 0x02, 0x48, 0x02, // 203 -0x00, 0x00, 0xF9, 0x03, 0x02, // 204 -0x02, 0x00, 0xF9, 0x03, // 205 -0x01, 0x00, 0xFA, 0x03, // 206 -0x02, 0x00, 0xF8, 0x03, 0x02, // 207 -0x40, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x02, 0x10, 0x01, 0xE0, // 208 -0x00, 0x00, 0xFA, 0x03, 0x31, 0x00, 0x42, 0x00, 0x81, 0x01, 0xF8, 0x03, // 209 -0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x09, 0x02, 0x0A, 0x02, 0x08, 0x02, 0xF0, 0x01, // 210 -0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x0A, 0x02, 0x09, 0x02, 0x08, 0x02, 0xF0, 0x01, // 211 -0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x0A, 0x02, 0x09, 0x02, 0x0A, 0x02, 0xF0, 0x01, // 212 -0x00, 0x00, 0xF0, 0x01, 0x0A, 0x02, 0x09, 0x02, 0x0A, 0x02, 0x09, 0x02, 0xF0, 0x01, // 213 -0x00, 0x00, 0xF0, 0x01, 0x0A, 0x02, 0x08, 0x02, 0x0A, 0x02, 0x08, 0x02, 0xF0, 0x01, // 214 -0x10, 0x01, 0xA0, 0x00, 0xE0, 0x00, 0xA0, 0x00, 0x10, 0x01, // 215 -0x00, 0x00, 0xF0, 0x02, 0x08, 0x03, 0xC8, 0x02, 0x28, 0x02, 0x18, 0x03, 0xE8, // 216 -0x00, 0x00, 0xF8, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x02, 0xF8, 0x01, // 217 -0x00, 0x00, 0xF8, 0x01, 0x02, 0x02, 0x01, 0x02, 0x00, 0x02, 0xF8, 0x01, // 218 -0x00, 0x00, 0xF8, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x02, 0xF8, 0x01, // 219 -0x00, 0x00, 0xF8, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0xF8, 0x01, // 220 -0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0xC2, 0x03, 0x21, 0x00, 0x10, 0x00, 0x08, // 221 -0x00, 0x00, 0xF8, 0x03, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0xE0, // 222 -0x00, 0x00, 0xF0, 0x03, 0x08, 0x01, 0x48, 0x02, 0xB0, 0x02, 0x80, 0x01, // 223 -0x00, 0x00, 0x00, 0x03, 0xA4, 0x02, 0xA8, 0x02, 0xE0, 0x03, // 224 -0x00, 0x00, 0x00, 0x03, 0xA8, 0x02, 0xA4, 0x02, 0xE0, 0x03, // 225 -0x00, 0x00, 0x00, 0x03, 0xA8, 0x02, 0xA4, 0x02, 0xE8, 0x03, // 226 -0x00, 0x00, 0x08, 0x03, 0xA4, 0x02, 0xA8, 0x02, 0xE4, 0x03, // 227 -0x00, 0x00, 0x00, 0x03, 0xA8, 0x02, 0xA0, 0x02, 0xE8, 0x03, // 228 -0x00, 0x00, 0x00, 0x03, 0xAE, 0x02, 0xAA, 0x02, 0xEE, 0x03, // 229 -0x00, 0x00, 0x40, 0x03, 0xA0, 0x02, 0xA0, 0x02, 0xC0, 0x01, 0xA0, 0x02, 0xA0, 0x02, 0xC0, 0x02, // 230 -0x00, 0x00, 0xC0, 0x01, 0x20, 0x16, 0x20, 0x1A, 0x40, 0x01, // 231 -0x00, 0x00, 0xC0, 0x01, 0xA4, 0x02, 0xA8, 0x02, 0xC0, 0x02, // 232 -0x00, 0x00, 0xC0, 0x01, 0xA8, 0x02, 0xA4, 0x02, 0xC0, 0x02, // 233 -0x00, 0x00, 0xC0, 0x01, 0xA8, 0x02, 0xA4, 0x02, 0xC8, 0x02, // 234 -0x00, 0x00, 0xC0, 0x01, 0xA8, 0x02, 0xA0, 0x02, 0xC8, 0x02, // 235 -0x00, 0x00, 0xE4, 0x03, 0x08, // 236 -0x08, 0x00, 0xE4, 0x03, // 237 -0x08, 0x00, 0xE4, 0x03, 0x08, // 238 -0x08, 0x00, 0xE0, 0x03, 0x08, // 239 -0x00, 0x00, 0xC0, 0x01, 0x28, 0x02, 0x38, 0x02, 0xE0, 0x01, // 240 -0x00, 0x00, 0xE8, 0x03, 0x24, 0x00, 0x28, 0x00, 0xC4, 0x03, // 241 -0x00, 0x00, 0xC0, 0x01, 0x24, 0x02, 0x28, 0x02, 0xC0, 0x01, // 242 -0x00, 0x00, 0xC0, 0x01, 0x28, 0x02, 0x24, 0x02, 0xC0, 0x01, // 243 -0x00, 0x00, 0xC0, 0x01, 0x28, 0x02, 0x24, 0x02, 0xC8, 0x01, // 244 -0x00, 0x00, 0xC8, 0x01, 0x24, 0x02, 0x28, 0x02, 0xC4, 0x01, // 245 -0x00, 0x00, 0xC0, 0x01, 0x28, 0x02, 0x20, 0x02, 0xC8, 0x01, // 246 -0x40, 0x00, 0x40, 0x00, 0x50, 0x01, 0x40, 0x00, 0x40, // 247 -0x00, 0x00, 0xC0, 0x02, 0xA0, 0x03, 0x60, 0x02, 0xA0, 0x01, // 248 -0x00, 0x00, 0xE0, 0x01, 0x04, 0x02, 0x08, 0x02, 0xE0, 0x03, // 249 -0x00, 0x00, 0xE0, 0x01, 0x08, 0x02, 0x04, 0x02, 0xE0, 0x03, // 250 -0x00, 0x00, 0xE8, 0x01, 0x04, 0x02, 0x08, 0x02, 0xE0, 0x03, // 251 -0x00, 0x00, 0xE0, 0x01, 0x08, 0x02, 0x00, 0x02, 0xE8, 0x03, // 252 -0x20, 0x00, 0xC0, 0x09, 0x08, 0x06, 0xC4, 0x01, 0x20, // 253 -0x00, 0x00, 0xF8, 0x0F, 0x20, 0x02, 0x20, 0x02, 0xC0, 0x01, // 254 -0x20, 0x00, 0xC8, 0x09, 0x00, 0x06, 0xC8, 0x01, 0x20, // 255 + 0x0A, // Width: 10 + 0x0D, // Height: 13 + 0x20, // First char: 32 + 0xE0, // Number of chars: 224 + // Jump Table: + 0xFF, 0xFF, 0x00, 0x03, // 32 + 0x00, 0x00, 0x04, 0x03, // 33 + 0x00, 0x04, 0x05, 0x04, // 34 + 0x00, 0x09, 0x09, 0x06, // 35 + 0x00, 0x12, 0x0A, 0x06, // 36 + 0x00, 0x1C, 0x10, 0x09, // 37 + 0x00, 0x2C, 0x0E, 0x08, // 38 + 0x00, 0x3A, 0x01, 0x02, // 39 + 0x00, 0x3B, 0x06, 0x04, // 40 + 0x00, 0x41, 0x06, 0x04, // 41 + 0x00, 0x47, 0x05, 0x04, // 42 + 0x00, 0x4C, 0x09, 0x06, // 43 + 0x00, 0x55, 0x04, 0x03, // 44 + 0x00, 0x59, 0x03, 0x03, // 45 + 0x00, 0x5C, 0x04, 0x03, // 46 + 0x00, 0x60, 0x05, 0x04, // 47 + 0x00, 0x65, 0x0A, 0x06, // 48 + 0x00, 0x6F, 0x08, 0x05, // 49 + 0x00, 0x77, 0x0A, 0x06, // 50 + 0x00, 0x81, 0x0A, 0x06, // 51 + 0x00, 0x8B, 0x0B, 0x07, // 52 + 0x00, 0x96, 0x0A, 0x06, // 53 + 0x00, 0xA0, 0x0A, 0x06, // 54 + 0x00, 0xAA, 0x09, 0x06, // 55 + 0x00, 0xB3, 0x0A, 0x06, // 56 + 0x00, 0xBD, 0x0A, 0x06, // 57 + 0x00, 0xC7, 0x04, 0x03, // 58 + 0x00, 0xCB, 0x04, 0x03, // 59 + 0x00, 0xCF, 0x0A, 0x06, // 60 + 0x00, 0xD9, 0x09, 0x06, // 61 + 0x00, 0xE2, 0x09, 0x06, // 62 + 0x00, 0xEB, 0x0B, 0x07, // 63 + 0x00, 0xF6, 0x14, 0x0B, // 64 + 0x01, 0x0A, 0x0E, 0x08, // 65 + 0x01, 0x18, 0x0C, 0x07, // 66 + 0x01, 0x24, 0x0C, 0x07, // 67 + 0x01, 0x30, 0x0B, 0x07, // 68 + 0x01, 0x3B, 0x0C, 0x07, // 69 + 0x01, 0x47, 0x09, 0x06, // 70 + 0x01, 0x50, 0x0D, 0x08, // 71 + 0x01, 0x5D, 0x0C, 0x07, // 72 + 0x01, 0x69, 0x04, 0x03, // 73 + 0x01, 0x6D, 0x08, 0x05, // 74 + 0x01, 0x75, 0x0E, 0x08, // 75 + 0x01, 0x83, 0x0C, 0x07, // 76 + 0x01, 0x8F, 0x10, 0x09, // 77 + 0x01, 0x9F, 0x0C, 0x07, // 78 + 0x01, 0xAB, 0x0E, 0x08, // 79 + 0x01, 0xB9, 0x0B, 0x07, // 80 + 0x01, 0xC4, 0x0E, 0x08, // 81 + 0x01, 0xD2, 0x0C, 0x07, // 82 + 0x01, 0xDE, 0x0C, 0x07, // 83 + 0x01, 0xEA, 0x0B, 0x07, // 84 + 0x01, 0xF5, 0x0C, 0x07, // 85 + 0x02, 0x01, 0x0D, 0x08, // 86 + 0x02, 0x0E, 0x11, 0x0A, // 87 + 0x02, 0x1F, 0x0E, 0x08, // 88 + 0x02, 0x2D, 0x0D, 0x08, // 89 + 0x02, 0x3A, 0x0C, 0x07, // 90 + 0x02, 0x46, 0x06, 0x04, // 91 + 0x02, 0x4C, 0x06, 0x04, // 92 + 0x02, 0x52, 0x04, 0x03, // 93 + 0x02, 0x56, 0x09, 0x06, // 94 + 0x02, 0x5F, 0x0C, 0x07, // 95 + 0x02, 0x6B, 0x03, 0x03, // 96 + 0x02, 0x6E, 0x0A, 0x06, // 97 + 0x02, 0x78, 0x0A, 0x06, // 98 + 0x02, 0x82, 0x0A, 0x06, // 99 + 0x02, 0x8C, 0x0A, 0x06, // 100 + 0x02, 0x96, 0x0A, 0x06, // 101 + 0x02, 0xA0, 0x05, 0x04, // 102 + 0x02, 0xA5, 0x0A, 0x06, // 103 + 0x02, 0xAF, 0x0A, 0x06, // 104 + 0x02, 0xB9, 0x04, 0x03, // 105 + 0x02, 0xBD, 0x04, 0x03, // 106 + 0x02, 0xC1, 0x08, 0x05, // 107 + 0x02, 0xC9, 0x04, 0x03, // 108 + 0x02, 0xCD, 0x10, 0x09, // 109 + 0x02, 0xDD, 0x0A, 0x06, // 110 + 0x02, 0xE7, 0x0A, 0x06, // 111 + 0x02, 0xF1, 0x0A, 0x06, // 112 + 0x02, 0xFB, 0x0A, 0x06, // 113 + 0x03, 0x05, 0x05, 0x04, // 114 + 0x03, 0x0A, 0x08, 0x05, // 115 + 0x03, 0x12, 0x06, 0x04, // 116 + 0x03, 0x18, 0x0A, 0x06, // 117 + 0x03, 0x22, 0x09, 0x06, // 118 + 0x03, 0x2B, 0x0E, 0x08, // 119 + 0x03, 0x39, 0x0A, 0x06, // 120 + 0x03, 0x43, 0x09, 0x06, // 121 + 0x03, 0x4C, 0x0A, 0x06, // 122 + 0x03, 0x56, 0x06, 0x04, // 123 + 0x03, 0x5C, 0x04, 0x03, // 124 + 0x03, 0x60, 0x05, 0x04, // 125 + 0x03, 0x65, 0x09, 0x06, // 126 + 0xFF, 0xFF, 0x00, 0x0A, // 127 + 0xFF, 0xFF, 0x00, 0x0A, // 128 + 0x03, 0x6E, 0x0C, 0x07, // 129 + 0x03, 0x7A, 0x05, 0x04, // 130 + 0x03, 0x7F, 0x0C, 0x07, // 131 + 0x03, 0x8B, 0x0E, 0x08, // 132 + 0x03, 0x99, 0x0A, 0x06, // 133 + 0x03, 0xA3, 0x0C, 0x07, // 134 + 0x03, 0xAF, 0x0A, 0x06, // 135 + 0x03, 0xB9, 0x0A, 0x06, // 136 + 0x03, 0xC3, 0x0A, 0x06, // 137 + 0xFF, 0xFF, 0x00, 0x0A, // 138 + 0xFF, 0xFF, 0x00, 0x0A, // 139 + 0xFF, 0xFF, 0x00, 0x0A, // 140 + 0xFF, 0xFF, 0x00, 0x0A, // 141 + 0xFF, 0xFF, 0x00, 0x0A, // 142 + 0xFF, 0xFF, 0x00, 0x0A, // 143 + 0xFF, 0xFF, 0x00, 0x0A, // 144 + 0xFF, 0xFF, 0x00, 0x0A, // 145 + 0xFF, 0xFF, 0x00, 0x0A, // 146 + 0x03, 0xCD, 0x0E, 0x08, // 147 + 0x03, 0xDB, 0x0A, 0x06, // 148 + 0xFF, 0xFF, 0x00, 0x0A, // 149 + 0xFF, 0xFF, 0x00, 0x0A, // 150 + 0xFF, 0xFF, 0x00, 0x0A, // 151 + 0x03, 0xE5, 0x0C, 0x07, // 152 + 0x03, 0xF1, 0x0A, 0x06, // 153 + 0x03, 0xFB, 0x0C, 0x07, // 154 + 0x04, 0x07, 0x08, 0x05, // 155 + 0xFF, 0xFF, 0x00, 0x0A, // 156 + 0xFF, 0xFF, 0x00, 0x0A, // 157 + 0xFF, 0xFF, 0x00, 0x0A, // 158 + 0xFF, 0xFF, 0x00, 0x0A, // 159 + 0xFF, 0xFF, 0x00, 0x0A, // 160 + 0x04, 0x0F, 0x04, 0x03, // 161 + 0x04, 0x13, 0x0A, 0x06, // 162 + 0x04, 0x1D, 0x0C, 0x07, // 163 + 0x04, 0x29, 0x0A, 0x06, // 164 + 0x04, 0x33, 0x0A, 0x06, // 165 + 0x04, 0x3D, 0x04, 0x03, // 166 + 0x04, 0x41, 0x0A, 0x06, // 167 + 0x04, 0x4B, 0x05, 0x04, // 168 + 0x04, 0x50, 0x0D, 0x08, // 169 + 0x04, 0x5D, 0x07, 0x05, // 170 + 0x04, 0x64, 0x0A, 0x06, // 171 + 0x04, 0x6E, 0x09, 0x06, // 172 + 0x04, 0x77, 0x03, 0x03, // 173 + 0x04, 0x7A, 0x0D, 0x08, // 174 + 0x04, 0x87, 0x0B, 0x07, // 175 + 0x04, 0x92, 0x07, 0x05, // 176 + 0x04, 0x99, 0x0A, 0x06, // 177 + 0x04, 0xA3, 0x05, 0x04, // 178 + 0x04, 0xA8, 0x05, 0x04, // 179 + 0x04, 0xAD, 0x05, 0x04, // 180 + 0x04, 0xB2, 0x0A, 0x06, // 181 + 0x04, 0xBC, 0x09, 0x06, // 182 + 0x04, 0xC5, 0x03, 0x03, // 183 + 0x04, 0xC8, 0x06, 0x04, // 184 + 0x04, 0xCE, 0x0C, 0x07, // 185 + 0x04, 0xDA, 0x07, 0x05, // 186 + 0x04, 0xE1, 0x0C, 0x07, // 187 + 0x04, 0xED, 0x0A, 0x06, // 188 + 0x04, 0xF7, 0x10, 0x09, // 189 + 0x05, 0x07, 0x10, 0x09, // 190 + 0x05, 0x17, 0x0A, 0x06, // 191 + 0x05, 0x21, 0x0E, 0x08, // 192 + 0x05, 0x2F, 0x0E, 0x08, // 193 + 0x05, 0x3D, 0x0E, 0x08, // 194 + 0x05, 0x4B, 0x0E, 0x08, // 195 + 0x05, 0x59, 0x0E, 0x08, // 196 + 0x05, 0x67, 0x0E, 0x08, // 197 + 0x05, 0x75, 0x12, 0x0A, // 198 + 0x05, 0x87, 0x0C, 0x07, // 199 + 0x05, 0x93, 0x0C, 0x07, // 200 + 0x05, 0x9F, 0x0C, 0x07, // 201 + 0x05, 0xAB, 0x0C, 0x07, // 202 + 0x05, 0xB7, 0x0C, 0x07, // 203 + 0x05, 0xC3, 0x05, 0x04, // 204 + 0x05, 0xC8, 0x04, 0x03, // 205 + 0x05, 0xCC, 0x04, 0x03, // 206 + 0x05, 0xD0, 0x05, 0x04, // 207 + 0x05, 0xD5, 0x0B, 0x07, // 208 + 0x05, 0xE0, 0x0C, 0x07, // 209 + 0x05, 0xEC, 0x0E, 0x08, // 210 + 0x05, 0xFA, 0x0E, 0x08, // 211 + 0x06, 0x08, 0x0E, 0x08, // 212 + 0x06, 0x16, 0x0E, 0x08, // 213 + 0x06, 0x24, 0x0E, 0x08, // 214 + 0x06, 0x32, 0x0A, 0x06, // 215 + 0x06, 0x3C, 0x0D, 0x08, // 216 + 0x06, 0x49, 0x0C, 0x07, // 217 + 0x06, 0x55, 0x0C, 0x07, // 218 + 0x06, 0x61, 0x0C, 0x07, // 219 + 0x06, 0x6D, 0x0C, 0x07, // 220 + 0x06, 0x79, 0x0D, 0x08, // 221 + 0x06, 0x86, 0x0B, 0x07, // 222 + 0x06, 0x91, 0x0C, 0x07, // 223 + 0x06, 0x9D, 0x0A, 0x06, // 224 + 0x06, 0xA7, 0x0A, 0x06, // 225 + 0x06, 0xB1, 0x0A, 0x06, // 226 + 0x06, 0xBB, 0x0A, 0x06, // 227 + 0x06, 0xC5, 0x0A, 0x06, // 228 + 0x06, 0xCF, 0x0A, 0x06, // 229 + 0x06, 0xD9, 0x10, 0x09, // 230 + 0x06, 0xE9, 0x0A, 0x06, // 231 + 0x06, 0xF3, 0x0A, 0x06, // 232 + 0x06, 0xFD, 0x0A, 0x06, // 233 + 0x07, 0x07, 0x0A, 0x06, // 234 + 0x07, 0x11, 0x0A, 0x06, // 235 + 0x07, 0x1B, 0x05, 0x04, // 236 + 0x07, 0x20, 0x04, 0x03, // 237 + 0x07, 0x24, 0x05, 0x04, // 238 + 0x07, 0x29, 0x05, 0x04, // 239 + 0x07, 0x2E, 0x0A, 0x06, // 240 + 0x07, 0x38, 0x0A, 0x06, // 241 + 0x07, 0x42, 0x0A, 0x06, // 242 + 0x07, 0x4C, 0x0A, 0x06, // 243 + 0x07, 0x56, 0x0A, 0x06, // 244 + 0x07, 0x60, 0x0A, 0x06, // 245 + 0x07, 0x6A, 0x0A, 0x06, // 246 + 0x07, 0x74, 0x09, 0x06, // 247 + 0x07, 0x7D, 0x0A, 0x06, // 248 + 0x07, 0x87, 0x0A, 0x06, // 249 + 0x07, 0x91, 0x0A, 0x06, // 250 + 0x07, 0x9B, 0x0A, 0x06, // 251 + 0x07, 0xA5, 0x0A, 0x06, // 252 + 0x07, 0xAF, 0x09, 0x06, // 253 + 0x07, 0xB8, 0x0A, 0x06, // 254 + 0x07, 0xC2, 0x09, 0x06, // 255 + // Font Data: + 0x00, 0x00, 0xF8, 0x02, // 33 + 0x38, 0x00, 0x00, 0x00, 0x38, // 34 + 0xA0, 0x03, 0xE0, 0x00, 0xB8, 0x03, 0xE0, 0x00, 0xB8, // 35 + 0x30, 0x01, 0x28, 0x02, 0xF8, 0x07, 0x48, 0x02, 0x90, 0x01, // 36 + 0x00, 0x00, 0x30, 0x00, 0x48, 0x00, 0x30, 0x03, 0xC0, 0x00, 0xB0, 0x01, 0x48, 0x02, 0x80, 0x01, // 37 + 0x80, 0x01, 0x50, 0x02, 0x68, 0x02, 0xA8, 0x02, 0x18, 0x01, 0x80, 0x03, 0x80, 0x02, // 38 + 0x38, // 39 + 0xE0, 0x03, 0x10, 0x04, 0x08, 0x08, // 40 + 0x08, 0x08, 0x10, 0x04, 0xE0, 0x03, // 41 + 0x28, 0x00, 0x18, 0x00, 0x28, // 42 + 0x40, 0x00, 0x40, 0x00, 0xF0, 0x01, 0x40, 0x00, 0x40, // 43 + 0x00, 0x00, 0x00, 0x06, // 44 + 0x80, 0x00, 0x80, // 45 + 0x00, 0x00, 0x00, 0x02, // 46 + 0x00, 0x03, 0xE0, 0x00, 0x18, // 47 + 0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x02, 0xF0, 0x01, // 48 + 0x00, 0x00, 0x20, 0x00, 0x10, 0x00, 0xF8, 0x03, // 49 + 0x10, 0x02, 0x08, 0x03, 0x88, 0x02, 0x48, 0x02, 0x30, 0x02, // 50 + 0x10, 0x01, 0x08, 0x02, 0x48, 0x02, 0x48, 0x02, 0xB0, 0x01, // 51 + 0xC0, 0x00, 0xA0, 0x00, 0x90, 0x00, 0x88, 0x00, 0xF8, 0x03, 0x80, // 52 + 0x60, 0x01, 0x38, 0x02, 0x28, 0x02, 0x28, 0x02, 0xC8, 0x01, // 53 + 0xF0, 0x01, 0x28, 0x02, 0x28, 0x02, 0x28, 0x02, 0xD0, 0x01, // 54 + 0x08, 0x00, 0x08, 0x03, 0xC8, 0x00, 0x38, 0x00, 0x08, // 55 + 0xB0, 0x01, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, 0xB0, 0x01, // 56 + 0x70, 0x01, 0x88, 0x02, 0x88, 0x02, 0x88, 0x02, 0xF0, 0x01, // 57 + 0x00, 0x00, 0x20, 0x02, // 58 + 0x00, 0x00, 0x20, 0x06, // 59 + 0x00, 0x00, 0x40, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0x10, 0x01, // 60 + 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, // 61 + 0x00, 0x00, 0x10, 0x01, 0xA0, 0x00, 0xA0, 0x00, 0x40, // 62 + 0x10, 0x00, 0x08, 0x00, 0x08, 0x00, 0xC8, 0x02, 0x48, 0x00, 0x30, // 63 + 0x00, 0x00, 0xC0, 0x03, 0x30, 0x04, 0xD0, 0x09, 0x28, 0x0A, 0x28, 0x0A, 0xC8, 0x0B, 0x68, 0x0A, 0x10, 0x05, 0xE0, 0x04, // 64 + 0x00, 0x02, 0xC0, 0x01, 0xB0, 0x00, 0x88, 0x00, 0xB0, 0x00, 0xC0, 0x01, 0x00, 0x02, // 65 + 0x00, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, 0xF0, 0x01, // 66 + 0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x02, 0x10, 0x01, // 67 + 0x00, 0x00, 0xF8, 0x03, 0x08, 0x02, 0x08, 0x02, 0x10, 0x01, 0xE0, // 68 + 0x00, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, // 69 + 0x00, 0x00, 0xF8, 0x03, 0x48, 0x00, 0x48, 0x00, 0x08, // 70 + 0x00, 0x00, 0xE0, 0x00, 0x10, 0x01, 0x08, 0x02, 0x48, 0x02, 0x50, 0x01, 0xC0, // 71 + 0x00, 0x00, 0xF8, 0x03, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0xF8, 0x03, // 72 + 0x00, 0x00, 0xF8, 0x03, // 73 + 0x00, 0x03, 0x00, 0x02, 0x00, 0x02, 0xF8, 0x01, // 74 + 0x00, 0x00, 0xF8, 0x03, 0x80, 0x00, 0x60, 0x00, 0x90, 0x00, 0x08, 0x01, 0x00, 0x02, // 75 + 0x00, 0x00, 0xF8, 0x03, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, // 76 + 0x00, 0x00, 0xF8, 0x03, 0x30, 0x00, 0xC0, 0x01, 0x00, 0x02, 0xC0, 0x01, 0x30, 0x00, 0xF8, 0x03, // 77 + 0x00, 0x00, 0xF8, 0x03, 0x30, 0x00, 0x40, 0x00, 0x80, 0x01, 0xF8, 0x03, // 78 + 0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x02, 0x08, 0x02, 0xF0, 0x01, // 79 + 0x00, 0x00, 0xF8, 0x03, 0x48, 0x00, 0x48, 0x00, 0x48, 0x00, 0x30, // 80 + 0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x08, 0x03, 0x08, 0x03, 0xF0, 0x02, // 81 + 0x00, 0x00, 0xF8, 0x03, 0x48, 0x00, 0x48, 0x00, 0xC8, 0x00, 0x30, 0x03, // 82 + 0x00, 0x00, 0x30, 0x01, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, 0x90, 0x01, // 83 + 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0xF8, 0x03, 0x08, 0x00, 0x08, // 84 + 0x00, 0x00, 0xF8, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0xF8, 0x01, // 85 + 0x08, 0x00, 0x70, 0x00, 0x80, 0x01, 0x00, 0x02, 0x80, 0x01, 0x70, 0x00, 0x08, // 86 + 0x18, 0x00, 0xE0, 0x01, 0x00, 0x02, 0xF0, 0x01, 0x08, 0x00, 0xF0, 0x01, 0x00, 0x02, 0xE0, 0x01, 0x18, // 87 + 0x00, 0x02, 0x08, 0x01, 0x90, 0x00, 0x60, 0x00, 0x90, 0x00, 0x08, 0x01, 0x00, 0x02, // 88 + 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0xC0, 0x03, 0x20, 0x00, 0x10, 0x00, 0x08, // 89 + 0x08, 0x03, 0x88, 0x02, 0xC8, 0x02, 0x68, 0x02, 0x38, 0x02, 0x18, 0x02, // 90 + 0x00, 0x00, 0xF8, 0x0F, 0x08, 0x08, // 91 + 0x18, 0x00, 0xE0, 0x00, 0x00, 0x03, // 92 + 0x08, 0x08, 0xF8, 0x0F, // 93 + 0x40, 0x00, 0x30, 0x00, 0x08, 0x00, 0x30, 0x00, 0x40, // 94 + 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, // 95 + 0x08, 0x00, 0x10, // 96 + 0x00, 0x00, 0x00, 0x03, 0xA0, 0x02, 0xA0, 0x02, 0xE0, 0x03, // 97 + 0x00, 0x00, 0xF8, 0x03, 0x20, 0x02, 0x20, 0x02, 0xC0, 0x01, // 98 + 0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x20, 0x02, 0x40, 0x01, // 99 + 0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x20, 0x02, 0xF8, 0x03, // 100 + 0x00, 0x00, 0xC0, 0x01, 0xA0, 0x02, 0xA0, 0x02, 0xC0, 0x02, // 101 + 0x20, 0x00, 0xF0, 0x03, 0x28, // 102 + 0x00, 0x00, 0xC0, 0x05, 0x20, 0x0A, 0x20, 0x0A, 0xE0, 0x07, // 103 + 0x00, 0x00, 0xF8, 0x03, 0x20, 0x00, 0x20, 0x00, 0xC0, 0x03, // 104 + 0x00, 0x00, 0xE8, 0x03, // 105 + 0x00, 0x08, 0xE8, 0x07, // 106 + 0xF8, 0x03, 0x80, 0x00, 0xC0, 0x01, 0x20, 0x02, // 107 + 0x00, 0x00, 0xF8, 0x03, // 108 + 0x00, 0x00, 0xE0, 0x03, 0x20, 0x00, 0x20, 0x00, 0xE0, 0x03, 0x20, 0x00, 0x20, 0x00, 0xC0, 0x03, // 109 + 0x00, 0x00, 0xE0, 0x03, 0x20, 0x00, 0x20, 0x00, 0xC0, 0x03, // 110 + 0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x20, 0x02, 0xC0, 0x01, // 111 + 0x00, 0x00, 0xE0, 0x0F, 0x20, 0x02, 0x20, 0x02, 0xC0, 0x01, // 112 + 0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x20, 0x02, 0xE0, 0x0F, // 113 + 0x00, 0x00, 0xE0, 0x03, 0x20, // 114 + 0x40, 0x02, 0xA0, 0x02, 0xA0, 0x02, 0x20, 0x01, // 115 + 0x20, 0x00, 0xF8, 0x03, 0x20, 0x02, // 116 + 0x00, 0x00, 0xE0, 0x01, 0x00, 0x02, 0x00, 0x02, 0xE0, 0x03, // 117 + 0x20, 0x00, 0xC0, 0x01, 0x00, 0x02, 0xC0, 0x01, 0x20, // 118 + 0xE0, 0x01, 0x00, 0x02, 0xC0, 0x01, 0x20, 0x00, 0xC0, 0x01, 0x00, 0x02, 0xE0, 0x01, // 119 + 0x20, 0x02, 0x40, 0x01, 0x80, 0x00, 0x40, 0x01, 0x20, 0x02, // 120 + 0x20, 0x00, 0xC0, 0x09, 0x00, 0x06, 0xC0, 0x01, 0x20, // 121 + 0x20, 0x02, 0x20, 0x03, 0xA0, 0x02, 0x60, 0x02, 0x20, 0x02, // 122 + 0x80, 0x00, 0x78, 0x0F, 0x08, 0x08, // 123 + 0x00, 0x00, 0xF8, 0x0F, // 124 + 0x08, 0x08, 0x78, 0x0F, 0x80, // 125 + 0xC0, 0x00, 0x40, 0x00, 0xC0, 0x00, 0x80, 0x00, 0xC0, // 126 + 0x00, 0x00, 0xF8, 0x03, 0x40, 0x02, 0x20, 0x02, 0x00, 0x02, 0x00, 0x02, // 129 + 0x40, 0x00, 0xF8, 0x03, 0x20, // 130 + 0x00, 0x00, 0xF8, 0x03, 0x30, 0x00, 0x44, 0x00, 0x82, 0x01, 0xF8, 0x03, // 131 + 0x00, 0x02, 0xC0, 0x01, 0xB0, 0x00, 0x88, 0x00, 0xB0, 0x00, 0xC0, 0x0D, 0x00, 0x0A, // 132 + 0x00, 0x00, 0x00, 0x03, 0xA0, 0x02, 0xA0, 0x0E, 0xE0, 0x0B, // 133 + 0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x0A, 0x02, 0x09, 0x02, 0x10, 0x01, // 134 + 0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x28, 0x02, 0x44, 0x01, // 135 + 0x00, 0x00, 0xE0, 0x03, 0x20, 0x00, 0x28, 0x00, 0xC4, 0x03, // 136 + 0x20, 0x02, 0x20, 0x03, 0xA8, 0x02, 0x64, 0x02, 0x20, 0x02, // 137 + 0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x02, 0x0A, 0x02, 0x09, 0x02, 0xF0, 0x01, // 147 + 0x00, 0x00, 0xC0, 0x01, 0x20, 0x02, 0x28, 0x02, 0xC4, 0x01, // 148 + 0x00, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x0E, 0x48, 0x0A, 0x48, 0x02, // 152 + 0x00, 0x00, 0xC0, 0x01, 0xA0, 0x02, 0xA0, 0x0E, 0xC0, 0x0A, // 153 + 0x00, 0x00, 0x30, 0x01, 0x48, 0x02, 0x4A, 0x02, 0x49, 0x02, 0x90, 0x01, // 154 + 0x40, 0x02, 0xA0, 0x02, 0xA8, 0x02, 0x24, 0x01, // 155 + 0x00, 0x00, 0xA0, 0x0F, // 161 + 0x00, 0x00, 0xC0, 0x01, 0xA0, 0x0F, 0x78, 0x02, 0x40, 0x01, // 162 + 0x40, 0x02, 0x70, 0x03, 0xC8, 0x02, 0x48, 0x02, 0x08, 0x02, 0x10, 0x02, // 163 + 0x00, 0x00, 0xE0, 0x01, 0x20, 0x01, 0x20, 0x01, 0xE0, 0x01, // 164 + 0x48, 0x01, 0x70, 0x01, 0xC0, 0x03, 0x70, 0x01, 0x48, 0x01, // 165 + 0x00, 0x00, 0x38, 0x0F, // 166 + 0xD0, 0x04, 0x28, 0x09, 0x48, 0x09, 0x48, 0x0A, 0x90, 0x05, // 167 + 0x08, 0x00, 0x00, 0x00, 0x08, // 168 + 0xE0, 0x00, 0x10, 0x01, 0x48, 0x02, 0xA8, 0x02, 0xA8, 0x02, 0x10, 0x01, 0xE0, // 169 + 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x78, // 170 + 0x00, 0x00, 0x80, 0x01, 0x40, 0x02, 0x80, 0x01, 0x40, 0x02, // 171 + 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0xE0, // 172 + 0x80, 0x00, 0x80, // 173 + 0xE0, 0x00, 0x10, 0x01, 0xE8, 0x02, 0x68, 0x02, 0xC8, 0x02, 0x10, 0x01, 0xE0, // 174 + 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, // 175 + 0x00, 0x00, 0x38, 0x00, 0x28, 0x00, 0x38, // 176 + 0x40, 0x02, 0x40, 0x02, 0xF0, 0x03, 0x40, 0x02, 0x40, 0x02, // 177 + 0x48, 0x00, 0x68, 0x00, 0x58, // 178 + 0x48, 0x00, 0x58, 0x00, 0x68, // 179 + 0x00, 0x00, 0x10, 0x00, 0x08, // 180 + 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x02, 0x00, 0x02, 0xE0, 0x03, // 181 + 0x70, 0x00, 0xF8, 0x0F, 0x08, 0x00, 0xF8, 0x0F, 0x08, // 182 + 0x00, 0x00, 0x40, // 183 + 0x00, 0x00, 0x00, 0x14, 0x00, 0x18, // 184 + 0x08, 0x03, 0x88, 0x02, 0xCA, 0x02, 0x69, 0x02, 0x38, 0x02, 0x18, 0x02, // 185 + 0x30, 0x00, 0x48, 0x00, 0x48, 0x00, 0x30, // 186 + 0x08, 0x03, 0x88, 0x02, 0xC8, 0x02, 0x6A, 0x02, 0x38, 0x02, 0x18, 0x02, // 187 + 0x20, 0x02, 0x20, 0x03, 0xA8, 0x02, 0x60, 0x02, 0x20, 0x02, // 188 + 0x00, 0x00, 0x10, 0x02, 0x78, 0x01, 0x80, 0x00, 0x60, 0x00, 0x50, 0x02, 0x48, 0x03, 0xC0, 0x02, // 189 + 0x48, 0x00, 0x58, 0x00, 0x68, 0x03, 0x80, 0x00, 0x60, 0x01, 0x90, 0x01, 0xC8, 0x03, 0x00, 0x01, // 190 + 0x00, 0x00, 0x00, 0x06, 0x00, 0x09, 0xA0, 0x09, 0x00, 0x04, // 191 + 0x00, 0x02, 0xC0, 0x01, 0xB0, 0x00, 0x89, 0x00, 0xB2, 0x00, 0xC0, 0x01, 0x00, 0x02, // 192 + 0x00, 0x02, 0xC0, 0x01, 0xB0, 0x00, 0x8A, 0x00, 0xB1, 0x00, 0xC0, 0x01, 0x00, 0x02, // 193 + 0x00, 0x02, 0xC0, 0x01, 0xB2, 0x00, 0x89, 0x00, 0xB2, 0x00, 0xC0, 0x01, 0x00, 0x02, // 194 + 0x00, 0x02, 0xC2, 0x01, 0xB1, 0x00, 0x8A, 0x00, 0xB1, 0x00, 0xC0, 0x01, 0x00, 0x02, // 195 + 0x00, 0x02, 0xC0, 0x01, 0xB2, 0x00, 0x88, 0x00, 0xB2, 0x00, 0xC0, 0x01, 0x00, 0x02, // 196 + 0x00, 0x02, 0xC0, 0x01, 0xBE, 0x00, 0x8A, 0x00, 0xBE, 0x00, 0xC0, 0x01, 0x00, 0x02, // 197 + 0x00, 0x03, 0xC0, 0x00, 0xE0, 0x00, 0x98, 0x00, 0x88, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x02, 0x48, 0x02, // 198 + 0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x08, 0x16, 0x08, 0x1A, 0x10, 0x01, // 199 + 0x00, 0x00, 0xF8, 0x03, 0x49, 0x02, 0x4A, 0x02, 0x48, 0x02, 0x48, 0x02, // 200 + 0x00, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x4A, 0x02, 0x49, 0x02, 0x48, 0x02, // 201 + 0x00, 0x00, 0xFA, 0x03, 0x49, 0x02, 0x4A, 0x02, 0x48, 0x02, 0x48, 0x02, // 202 + 0x00, 0x00, 0xF8, 0x03, 0x4A, 0x02, 0x48, 0x02, 0x4A, 0x02, 0x48, 0x02, // 203 + 0x00, 0x00, 0xF9, 0x03, 0x02, // 204 + 0x02, 0x00, 0xF9, 0x03, // 205 + 0x01, 0x00, 0xFA, 0x03, // 206 + 0x02, 0x00, 0xF8, 0x03, 0x02, // 207 + 0x40, 0x00, 0xF8, 0x03, 0x48, 0x02, 0x48, 0x02, 0x10, 0x01, 0xE0, // 208 + 0x00, 0x00, 0xFA, 0x03, 0x31, 0x00, 0x42, 0x00, 0x81, 0x01, 0xF8, 0x03, // 209 + 0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x09, 0x02, 0x0A, 0x02, 0x08, 0x02, 0xF0, 0x01, // 210 + 0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x0A, 0x02, 0x09, 0x02, 0x08, 0x02, 0xF0, 0x01, // 211 + 0x00, 0x00, 0xF0, 0x01, 0x08, 0x02, 0x0A, 0x02, 0x09, 0x02, 0x0A, 0x02, 0xF0, 0x01, // 212 + 0x00, 0x00, 0xF0, 0x01, 0x0A, 0x02, 0x09, 0x02, 0x0A, 0x02, 0x09, 0x02, 0xF0, 0x01, // 213 + 0x00, 0x00, 0xF0, 0x01, 0x0A, 0x02, 0x08, 0x02, 0x0A, 0x02, 0x08, 0x02, 0xF0, 0x01, // 214 + 0x10, 0x01, 0xA0, 0x00, 0xE0, 0x00, 0xA0, 0x00, 0x10, 0x01, // 215 + 0x00, 0x00, 0xF0, 0x02, 0x08, 0x03, 0xC8, 0x02, 0x28, 0x02, 0x18, 0x03, 0xE8, // 216 + 0x00, 0x00, 0xF8, 0x01, 0x01, 0x02, 0x02, 0x02, 0x00, 0x02, 0xF8, 0x01, // 217 + 0x00, 0x00, 0xF8, 0x01, 0x02, 0x02, 0x01, 0x02, 0x00, 0x02, 0xF8, 0x01, // 218 + 0x00, 0x00, 0xF8, 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x02, 0xF8, 0x01, // 219 + 0x00, 0x00, 0xF8, 0x01, 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0xF8, 0x01, // 220 + 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0xC2, 0x03, 0x21, 0x00, 0x10, 0x00, 0x08, // 221 + 0x00, 0x00, 0xF8, 0x03, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0xE0, // 222 + 0x00, 0x00, 0xF0, 0x03, 0x08, 0x01, 0x48, 0x02, 0xB0, 0x02, 0x80, 0x01, // 223 + 0x00, 0x00, 0x00, 0x03, 0xA4, 0x02, 0xA8, 0x02, 0xE0, 0x03, // 224 + 0x00, 0x00, 0x00, 0x03, 0xA8, 0x02, 0xA4, 0x02, 0xE0, 0x03, // 225 + 0x00, 0x00, 0x00, 0x03, 0xA8, 0x02, 0xA4, 0x02, 0xE8, 0x03, // 226 + 0x00, 0x00, 0x08, 0x03, 0xA4, 0x02, 0xA8, 0x02, 0xE4, 0x03, // 227 + 0x00, 0x00, 0x00, 0x03, 0xA8, 0x02, 0xA0, 0x02, 0xE8, 0x03, // 228 + 0x00, 0x00, 0x00, 0x03, 0xAE, 0x02, 0xAA, 0x02, 0xEE, 0x03, // 229 + 0x00, 0x00, 0x40, 0x03, 0xA0, 0x02, 0xA0, 0x02, 0xC0, 0x01, 0xA0, 0x02, 0xA0, 0x02, 0xC0, 0x02, // 230 + 0x00, 0x00, 0xC0, 0x01, 0x20, 0x16, 0x20, 0x1A, 0x40, 0x01, // 231 + 0x00, 0x00, 0xC0, 0x01, 0xA4, 0x02, 0xA8, 0x02, 0xC0, 0x02, // 232 + 0x00, 0x00, 0xC0, 0x01, 0xA8, 0x02, 0xA4, 0x02, 0xC0, 0x02, // 233 + 0x00, 0x00, 0xC0, 0x01, 0xA8, 0x02, 0xA4, 0x02, 0xC8, 0x02, // 234 + 0x00, 0x00, 0xC0, 0x01, 0xA8, 0x02, 0xA0, 0x02, 0xC8, 0x02, // 235 + 0x00, 0x00, 0xE4, 0x03, 0x08, // 236 + 0x08, 0x00, 0xE4, 0x03, // 237 + 0x08, 0x00, 0xE4, 0x03, 0x08, // 238 + 0x08, 0x00, 0xE0, 0x03, 0x08, // 239 + 0x00, 0x00, 0xC0, 0x01, 0x28, 0x02, 0x38, 0x02, 0xE0, 0x01, // 240 + 0x00, 0x00, 0xE8, 0x03, 0x24, 0x00, 0x28, 0x00, 0xC4, 0x03, // 241 + 0x00, 0x00, 0xC0, 0x01, 0x24, 0x02, 0x28, 0x02, 0xC0, 0x01, // 242 + 0x00, 0x00, 0xC0, 0x01, 0x28, 0x02, 0x24, 0x02, 0xC0, 0x01, // 243 + 0x00, 0x00, 0xC0, 0x01, 0x28, 0x02, 0x24, 0x02, 0xC8, 0x01, // 244 + 0x00, 0x00, 0xC8, 0x01, 0x24, 0x02, 0x28, 0x02, 0xC4, 0x01, // 245 + 0x00, 0x00, 0xC0, 0x01, 0x28, 0x02, 0x20, 0x02, 0xC8, 0x01, // 246 + 0x40, 0x00, 0x40, 0x00, 0x50, 0x01, 0x40, 0x00, 0x40, // 247 + 0x00, 0x00, 0xC0, 0x02, 0xA0, 0x03, 0x60, 0x02, 0xA0, 0x01, // 248 + 0x00, 0x00, 0xE0, 0x01, 0x04, 0x02, 0x08, 0x02, 0xE0, 0x03, // 249 + 0x00, 0x00, 0xE0, 0x01, 0x08, 0x02, 0x04, 0x02, 0xE0, 0x03, // 250 + 0x00, 0x00, 0xE8, 0x01, 0x04, 0x02, 0x08, 0x02, 0xE0, 0x03, // 251 + 0x00, 0x00, 0xE0, 0x01, 0x08, 0x02, 0x00, 0x02, 0xE8, 0x03, // 252 + 0x20, 0x00, 0xC0, 0x09, 0x08, 0x06, 0xC4, 0x01, 0x20, // 253 + 0x00, 0x00, 0xF8, 0x0F, 0x20, 0x02, 0x20, 0x02, 0xC0, 0x01, // 254 + 0x20, 0x00, 0xC8, 0x09, 0x00, 0x06, 0xC8, 0x01, 0x20, // 255 }; const uint8_t ArialMT_Plain_16_PL[] PROGMEM = { -0x10, // Width: 16 -0x13, // Height: 19 -0x20, // First char: 32 -0xE0, // Number of chars: 224 -// Jump Table: -0xFF, 0xFF, 0x00, 0x04, // 32 -0x00, 0x00, 0x08, 0x04, // 33 -0x00, 0x08, 0x0D, 0x06, // 34 -0x00, 0x15, 0x1A, 0x0A, // 35 -0x00, 0x2F, 0x17, 0x09, // 36 -0x00, 0x46, 0x26, 0x0E, // 37 -0x00, 0x6C, 0x1D, 0x0B, // 38 -0x00, 0x89, 0x04, 0x03, // 39 -0x00, 0x8D, 0x0C, 0x05, // 40 -0x00, 0x99, 0x0B, 0x05, // 41 -0x00, 0xA4, 0x0D, 0x06, // 42 -0x00, 0xB1, 0x17, 0x09, // 43 -0x00, 0xC8, 0x09, 0x04, // 44 -0x00, 0xD1, 0x0B, 0x05, // 45 -0x00, 0xDC, 0x08, 0x04, // 46 -0x00, 0xE4, 0x0A, 0x05, // 47 -0x00, 0xEE, 0x17, 0x09, // 48 -0x01, 0x05, 0x11, 0x07, // 49 -0x01, 0x16, 0x17, 0x09, // 50 -0x01, 0x2D, 0x17, 0x09, // 51 -0x01, 0x44, 0x17, 0x09, // 52 -0x01, 0x5B, 0x17, 0x09, // 53 -0x01, 0x72, 0x17, 0x09, // 54 -0x01, 0x89, 0x16, 0x09, // 55 -0x01, 0x9F, 0x17, 0x09, // 56 -0x01, 0xB6, 0x17, 0x09, // 57 -0x01, 0xCD, 0x05, 0x03, // 58 -0x01, 0xD2, 0x06, 0x03, // 59 -0x01, 0xD8, 0x17, 0x09, // 60 -0x01, 0xEF, 0x17, 0x09, // 61 -0x02, 0x06, 0x17, 0x09, // 62 -0x02, 0x1D, 0x16, 0x09, // 63 -0x02, 0x33, 0x2F, 0x11, // 64 -0x02, 0x62, 0x1D, 0x0B, // 65 -0x02, 0x7F, 0x1D, 0x0B, // 66 -0x02, 0x9C, 0x20, 0x0C, // 67 -0x02, 0xBC, 0x20, 0x0C, // 68 -0x02, 0xDC, 0x1D, 0x0B, // 69 -0x02, 0xF9, 0x19, 0x0A, // 70 -0x03, 0x12, 0x20, 0x0C, // 71 -0x03, 0x32, 0x1D, 0x0B, // 72 -0x03, 0x4F, 0x05, 0x03, // 73 -0x03, 0x54, 0x14, 0x08, // 74 -0x03, 0x68, 0x1D, 0x0B, // 75 -0x03, 0x85, 0x17, 0x09, // 76 -0x03, 0x9C, 0x23, 0x0D, // 77 -0x03, 0xBF, 0x1D, 0x0B, // 78 -0x03, 0xDC, 0x20, 0x0C, // 79 -0x03, 0xFC, 0x1C, 0x0B, // 80 -0x04, 0x18, 0x20, 0x0C, // 81 -0x04, 0x38, 0x1D, 0x0B, // 82 -0x04, 0x55, 0x1D, 0x0B, // 83 -0x04, 0x72, 0x19, 0x0A, // 84 -0x04, 0x8B, 0x1D, 0x0B, // 85 -0x04, 0xA8, 0x1C, 0x0B, // 86 -0x04, 0xC4, 0x2B, 0x10, // 87 -0x04, 0xEF, 0x20, 0x0C, // 88 -0x05, 0x0F, 0x19, 0x0A, // 89 -0x05, 0x28, 0x1A, 0x0A, // 90 -0x05, 0x42, 0x0C, 0x05, // 91 -0x05, 0x4E, 0x0B, 0x05, // 92 -0x05, 0x59, 0x09, 0x04, // 93 -0x05, 0x62, 0x14, 0x08, // 94 -0x05, 0x76, 0x1B, 0x0A, // 95 -0x05, 0x91, 0x07, 0x04, // 96 -0x05, 0x98, 0x17, 0x09, // 97 -0x05, 0xAF, 0x17, 0x09, // 98 -0x05, 0xC6, 0x14, 0x08, // 99 -0x05, 0xDA, 0x17, 0x09, // 100 -0x05, 0xF1, 0x17, 0x09, // 101 -0x06, 0x08, 0x0A, 0x05, // 102 -0x06, 0x12, 0x17, 0x09, // 103 -0x06, 0x29, 0x14, 0x08, // 104 -0x06, 0x3D, 0x05, 0x03, // 105 -0x06, 0x42, 0x06, 0x03, // 106 -0x06, 0x48, 0x17, 0x09, // 107 -0x06, 0x5F, 0x05, 0x03, // 108 -0x06, 0x64, 0x23, 0x0D, // 109 -0x06, 0x87, 0x14, 0x08, // 110 -0x06, 0x9B, 0x17, 0x09, // 111 -0x06, 0xB2, 0x17, 0x09, // 112 -0x06, 0xC9, 0x18, 0x09, // 113 -0x06, 0xE1, 0x0D, 0x06, // 114 -0x06, 0xEE, 0x14, 0x08, // 115 -0x07, 0x02, 0x0B, 0x05, // 116 -0x07, 0x0D, 0x14, 0x08, // 117 -0x07, 0x21, 0x13, 0x08, // 118 -0x07, 0x34, 0x1F, 0x0C, // 119 -0x07, 0x53, 0x14, 0x08, // 120 -0x07, 0x67, 0x13, 0x08, // 121 -0x07, 0x7A, 0x14, 0x08, // 122 -0x07, 0x8E, 0x0F, 0x06, // 123 -0x07, 0x9D, 0x06, 0x03, // 124 -0x07, 0xA3, 0x0E, 0x06, // 125 -0x07, 0xB1, 0x17, 0x09, // 126 -0xFF, 0xFF, 0x00, 0x10, // 127 -0xFF, 0xFF, 0x00, 0x10, // 128 -0x07, 0xC8, 0x17, 0x09, // 129 -0x07, 0xDF, 0x07, 0x04, // 130 -0x07, 0xE6, 0x1D, 0x0B, // 131 -0x08, 0x03, 0x1E, 0x0B, // 132 -0x08, 0x21, 0x1B, 0x0A, // 133 -0x08, 0x3C, 0x20, 0x0C, // 134 -0x08, 0x5C, 0x14, 0x08, // 135 -0x08, 0x70, 0x14, 0x08, // 136 -0x08, 0x84, 0x14, 0x08, // 137 -0xFF, 0xFF, 0x00, 0x10, // 138 -0xFF, 0xFF, 0x00, 0x10, // 139 -0xFF, 0xFF, 0x00, 0x10, // 140 -0xFF, 0xFF, 0x00, 0x10, // 141 -0xFF, 0xFF, 0x00, 0x10, // 142 -0xFF, 0xFF, 0x00, 0x10, // 143 -0xFF, 0xFF, 0x00, 0x10, // 144 -0xFF, 0xFF, 0x00, 0x10, // 145 -0xFF, 0xFF, 0x00, 0x10, // 146 -0x08, 0x98, 0x20, 0x0C, // 147 -0x08, 0xB8, 0x17, 0x09, // 148 -0xFF, 0xFF, 0x00, 0x10, // 149 -0xFF, 0xFF, 0x00, 0x10, // 150 -0xFF, 0xFF, 0x00, 0x10, // 151 -0x08, 0xCF, 0x1D, 0x0B, // 152 -0x08, 0xEC, 0x17, 0x09, // 153 -0x09, 0x03, 0x1D, 0x0B, // 154 -0x09, 0x20, 0x14, 0x08, // 155 -0xFF, 0xFF, 0x00, 0x10, // 156 -0xFF, 0xFF, 0x00, 0x10, // 157 -0xFF, 0xFF, 0x00, 0x10, // 158 -0xFF, 0xFF, 0x00, 0x10, // 159 -0xFF, 0xFF, 0x00, 0x10, // 160 -0x09, 0x34, 0x09, 0x04, // 161 -0x09, 0x3D, 0x17, 0x09, // 162 -0x09, 0x54, 0x17, 0x09, // 163 -0x09, 0x6B, 0x14, 0x08, // 164 -0x09, 0x7F, 0x1A, 0x0A, // 165 -0x09, 0x99, 0x06, 0x03, // 166 -0x09, 0x9F, 0x17, 0x09, // 167 -0x09, 0xB6, 0x07, 0x04, // 168 -0x09, 0xBD, 0x23, 0x0D, // 169 -0x09, 0xE0, 0x0E, 0x06, // 170 -0x09, 0xEE, 0x14, 0x08, // 171 -0x0A, 0x02, 0x17, 0x09, // 172 -0x0A, 0x19, 0x0B, 0x05, // 173 -0x0A, 0x24, 0x23, 0x0D, // 174 -0x0A, 0x47, 0x19, 0x0A, // 175 -0x0A, 0x60, 0x0D, 0x06, // 176 -0x0A, 0x6D, 0x17, 0x09, // 177 -0x0A, 0x84, 0x0E, 0x06, // 178 -0x0A, 0x92, 0x0D, 0x06, // 179 -0x0A, 0x9F, 0x0A, 0x05, // 180 -0x0A, 0xA9, 0x17, 0x09, // 181 -0x0A, 0xC0, 0x19, 0x0A, // 182 -0x0A, 0xD9, 0x08, 0x04, // 183 -0x0A, 0xE1, 0x0C, 0x05, // 184 -0x0A, 0xED, 0x1A, 0x0A, // 185 -0x0B, 0x07, 0x0D, 0x06, // 186 -0x0B, 0x14, 0x1A, 0x0A, // 187 -0x0B, 0x2E, 0x14, 0x08, // 188 -0x0B, 0x42, 0x26, 0x0E, // 189 -0x0B, 0x68, 0x26, 0x0E, // 190 -0x0B, 0x8E, 0x1A, 0x0A, // 191 -0x0B, 0xA8, 0x1D, 0x0B, // 192 -0x0B, 0xC5, 0x1D, 0x0B, // 193 -0x0B, 0xE2, 0x1D, 0x0B, // 194 -0x0B, 0xFF, 0x1D, 0x0B, // 195 -0x0C, 0x1C, 0x1D, 0x0B, // 196 -0x0C, 0x39, 0x1D, 0x0B, // 197 -0x0C, 0x56, 0x2C, 0x10, // 198 -0x0C, 0x82, 0x20, 0x0C, // 199 -0x0C, 0xA2, 0x1D, 0x0B, // 200 -0x0C, 0xBF, 0x1D, 0x0B, // 201 -0x0C, 0xDC, 0x1D, 0x0B, // 202 -0x0C, 0xF9, 0x1D, 0x0B, // 203 -0x0D, 0x16, 0x05, 0x03, // 204 -0x0D, 0x1B, 0x07, 0x04, // 205 -0x0D, 0x22, 0x0A, 0x05, // 206 -0x0D, 0x2C, 0x07, 0x04, // 207 -0x0D, 0x33, 0x20, 0x0C, // 208 -0x0D, 0x53, 0x1D, 0x0B, // 209 -0x0D, 0x70, 0x20, 0x0C, // 210 -0x0D, 0x90, 0x20, 0x0C, // 211 -0x0D, 0xB0, 0x20, 0x0C, // 212 -0x0D, 0xD0, 0x20, 0x0C, // 213 -0x0D, 0xF0, 0x20, 0x0C, // 214 -0x0E, 0x10, 0x17, 0x09, // 215 -0x0E, 0x27, 0x20, 0x0C, // 216 -0x0E, 0x47, 0x1D, 0x0B, // 217 -0x0E, 0x64, 0x1D, 0x0B, // 218 -0x0E, 0x81, 0x1D, 0x0B, // 219 -0x0E, 0x9E, 0x1D, 0x0B, // 220 -0x0E, 0xBB, 0x19, 0x0A, // 221 -0x0E, 0xD4, 0x1D, 0x0B, // 222 -0x0E, 0xF1, 0x17, 0x09, // 223 -0x0F, 0x08, 0x17, 0x09, // 224 -0x0F, 0x1F, 0x17, 0x09, // 225 -0x0F, 0x36, 0x17, 0x09, // 226 -0x0F, 0x4D, 0x17, 0x09, // 227 -0x0F, 0x64, 0x17, 0x09, // 228 -0x0F, 0x7B, 0x17, 0x09, // 229 -0x0F, 0x92, 0x29, 0x0F, // 230 -0x0F, 0xBB, 0x14, 0x08, // 231 -0x0F, 0xCF, 0x17, 0x09, // 232 -0x0F, 0xE6, 0x17, 0x09, // 233 -0x0F, 0xFD, 0x17, 0x09, // 234 -0x10, 0x14, 0x17, 0x09, // 235 -0x10, 0x2B, 0x05, 0x03, // 236 -0x10, 0x30, 0x07, 0x04, // 237 -0x10, 0x37, 0x0A, 0x05, // 238 -0x10, 0x41, 0x07, 0x04, // 239 -0x10, 0x48, 0x17, 0x09, // 240 -0x10, 0x5F, 0x14, 0x08, // 241 -0x10, 0x73, 0x17, 0x09, // 242 -0x10, 0x8A, 0x17, 0x09, // 243 -0x10, 0xA1, 0x17, 0x09, // 244 -0x10, 0xB8, 0x17, 0x09, // 245 -0x10, 0xCF, 0x17, 0x09, // 246 -0x10, 0xE6, 0x17, 0x09, // 247 -0x10, 0xFD, 0x17, 0x09, // 248 -0x11, 0x14, 0x14, 0x08, // 249 -0x11, 0x28, 0x14, 0x08, // 250 -0x11, 0x3C, 0x14, 0x08, // 251 -0x11, 0x50, 0x14, 0x08, // 252 -0x11, 0x64, 0x13, 0x08, // 253 -0x11, 0x77, 0x17, 0x09, // 254 -0x11, 0x8E, 0x13, 0x08, // 255 -// Font Data: -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x5F, // 33 -0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, // 34 -0x80, 0x08, 0x00, 0x80, 0x78, 0x00, 0xC0, 0x0F, 0x00, 0xB8, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x78, 0x00, 0xC0, 0x0F, 0x00, 0xB8, 0x08, 0x00, 0x80, 0x08, // 35 -0x00, 0x00, 0x00, 0xE0, 0x10, 0x00, 0x10, 0x21, 0x00, 0x08, 0x41, 0x00, 0xFC, 0xFF, 0x00, 0x08, 0x42, 0x00, 0x10, 0x22, 0x00, 0x20, 0x1C, // 36 -0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x08, 0x01, 0x00, 0x08, 0x01, 0x00, 0x08, 0x61, 0x00, 0xF0, 0x18, 0x00, 0x00, 0x06, 0x00, 0xC0, 0x01, 0x00, 0x30, 0x3C, 0x00, 0x08, 0x42, 0x00, 0x00, 0x42, 0x00, 0x00, 0x42, 0x00, 0x00, 0x3C, // 37 -0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x70, 0x22, 0x00, 0x88, 0x41, 0x00, 0x08, 0x43, 0x00, 0x88, 0x44, 0x00, 0x70, 0x28, 0x00, 0x00, 0x10, 0x00, 0x00, 0x28, 0x00, 0x00, 0x44, // 38 -0x00, 0x00, 0x00, 0x78, // 39 -0x00, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x70, 0xC0, 0x01, 0x08, 0x00, 0x02, // 40 -0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x70, 0xC0, 0x01, 0x80, 0x3F, // 41 -0x10, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x38, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x10, // 42 -0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, // 43 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, // 44 -0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, // 45 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, // 46 -0x00, 0x60, 0x00, 0x00, 0x1E, 0x00, 0xE0, 0x01, 0x00, 0x18, // 47 -0x00, 0x00, 0x00, 0xE0, 0x1F, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0xE0, 0x1F, // 48 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0x00, 0x10, 0x00, 0x00, 0xF8, 0x7F, // 49 -0x00, 0x00, 0x00, 0x20, 0x40, 0x00, 0x10, 0x60, 0x00, 0x08, 0x50, 0x00, 0x08, 0x48, 0x00, 0x08, 0x44, 0x00, 0x10, 0x43, 0x00, 0xE0, 0x40, // 50 -0x00, 0x00, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x88, 0x41, 0x00, 0xF0, 0x22, 0x00, 0x00, 0x1C, // 51 -0x00, 0x0C, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x09, 0x00, 0xC0, 0x08, 0x00, 0x20, 0x08, 0x00, 0x10, 0x08, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x08, // 52 -0x00, 0x00, 0x00, 0xC0, 0x11, 0x00, 0xB8, 0x20, 0x00, 0x88, 0x40, 0x00, 0x88, 0x40, 0x00, 0x88, 0x40, 0x00, 0x08, 0x21, 0x00, 0x08, 0x1E, // 53 -0x00, 0x00, 0x00, 0xE0, 0x1F, 0x00, 0x10, 0x21, 0x00, 0x88, 0x40, 0x00, 0x88, 0x40, 0x00, 0x88, 0x40, 0x00, 0x10, 0x21, 0x00, 0x20, 0x1E, // 54 -0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x78, 0x00, 0x08, 0x07, 0x00, 0xC8, 0x00, 0x00, 0x28, 0x00, 0x00, 0x18, // 55 -0x00, 0x00, 0x00, 0x60, 0x1C, 0x00, 0x90, 0x22, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x90, 0x22, 0x00, 0x60, 0x1C, // 56 -0x00, 0x00, 0x00, 0xE0, 0x11, 0x00, 0x10, 0x22, 0x00, 0x08, 0x44, 0x00, 0x08, 0x44, 0x00, 0x08, 0x44, 0x00, 0x10, 0x22, 0x00, 0xE0, 0x1F, // 57 -0x00, 0x00, 0x00, 0x40, 0x40, // 58 -0x00, 0x00, 0x00, 0x40, 0xC0, 0x01, // 59 -0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x05, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x40, 0x10, // 60 -0x00, 0x00, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, // 61 -0x00, 0x00, 0x00, 0x40, 0x10, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x00, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, 0x02, // 62 -0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x5C, 0x00, 0x08, 0x02, 0x00, 0x10, 0x01, 0x00, 0xE0, // 63 -0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0xC0, 0x40, 0x00, 0x20, 0x80, 0x00, 0x10, 0x1E, 0x01, 0x10, 0x21, 0x01, 0x88, 0x40, 0x02, 0x48, 0x40, 0x02, 0x48, 0x40, 0x02, 0x48, 0x20, 0x02, 0x88, 0x7C, 0x02, 0xC8, 0x43, 0x02, 0x10, 0x40, 0x02, 0x10, 0x20, 0x01, 0x60, 0x10, 0x01, 0x80, 0x8F, // 64 -0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x70, 0x04, 0x00, 0x08, 0x04, 0x00, 0x70, 0x04, 0x00, 0x80, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 65 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x90, 0x22, 0x00, 0x60, 0x1C, // 66 -0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, // 67 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 68 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x40, // 69 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, // 70 -0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x42, 0x00, 0x08, 0x42, 0x00, 0x10, 0x22, 0x00, 0x20, 0x12, 0x00, 0x00, 0x0E, // 71 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0xF8, 0x7F, // 72 -0x00, 0x00, 0x00, 0xF8, 0x7F, // 73 -0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0xF8, 0x3F, // 74 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x80, 0x03, 0x00, 0x40, 0x04, 0x00, 0x20, 0x18, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, // 75 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, // 76 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x30, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x03, 0x00, 0xC0, 0x00, 0x00, 0x30, 0x00, 0x00, 0xF8, 0x7F, // 77 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x10, 0x00, 0x00, 0x60, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x18, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x7F, // 78 -0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 79 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x10, 0x01, 0x00, 0xE0, // 80 -0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x50, 0x00, 0x08, 0x50, 0x00, 0x10, 0x20, 0x00, 0x20, 0x70, 0x00, 0xC0, 0x4F, // 81 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x06, 0x00, 0x08, 0x1A, 0x00, 0x10, 0x21, 0x00, 0xE0, 0x40, // 82 -0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x90, 0x20, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x42, 0x00, 0x08, 0x42, 0x00, 0x10, 0x22, 0x00, 0x20, 0x1C, // 83 -0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, // 84 -0x00, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x1F, // 85 -0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x18, 0x00, 0x00, 0x60, 0x00, 0x00, 0x18, 0x00, 0x00, 0x07, 0x00, 0xE0, 0x00, 0x00, 0x18, // 86 -0x18, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x03, 0x00, 0x70, 0x00, 0x00, 0x08, 0x00, 0x00, 0x70, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1E, 0x00, 0xE0, 0x01, 0x00, 0x18, // 87 -0x00, 0x40, 0x00, 0x08, 0x20, 0x00, 0x10, 0x10, 0x00, 0x60, 0x0C, 0x00, 0x80, 0x02, 0x00, 0x00, 0x01, 0x00, 0x80, 0x02, 0x00, 0x60, 0x0C, 0x00, 0x10, 0x10, 0x00, 0x08, 0x20, 0x00, 0x00, 0x40, // 88 -0x08, 0x00, 0x00, 0x30, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x7E, 0x00, 0x80, 0x01, 0x00, 0x40, 0x00, 0x00, 0x30, 0x00, 0x00, 0x08, // 89 -0x00, 0x40, 0x00, 0x08, 0x60, 0x00, 0x08, 0x58, 0x00, 0x08, 0x44, 0x00, 0x08, 0x43, 0x00, 0x88, 0x40, 0x00, 0x68, 0x40, 0x00, 0x18, 0x40, 0x00, 0x08, 0x40, // 90 -0x00, 0x00, 0x00, 0xF8, 0xFF, 0x03, 0x08, 0x00, 0x02, 0x08, 0x00, 0x02, // 91 -0x18, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x60, // 92 -0x08, 0x00, 0x02, 0x08, 0x00, 0x02, 0xF8, 0xFF, 0x03, // 93 -0x00, 0x01, 0x00, 0xC0, 0x00, 0x00, 0x30, 0x00, 0x00, 0x08, 0x00, 0x00, 0x30, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x01, // 94 -0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, // 95 -0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x10, // 96 -0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x7F, // 97 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 98 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, // 99 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0xF8, 0x7F, // 100 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x24, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x80, 0x24, 0x00, 0x00, 0x17, // 101 -0x40, 0x00, 0x00, 0xF0, 0x7F, 0x00, 0x48, 0x00, 0x00, 0x48, // 102 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x01, 0x80, 0x20, 0x02, 0x40, 0x40, 0x02, 0x40, 0x40, 0x02, 0x40, 0x40, 0x02, 0x80, 0x20, 0x01, 0xC0, 0xFF, // 103 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x7F, // 104 -0x00, 0x00, 0x00, 0xC8, 0x7F, // 105 -0x00, 0x00, 0x02, 0xC8, 0xFF, 0x01, // 106 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x19, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, // 107 -0x00, 0x00, 0x00, 0xF8, 0x7F, // 108 -0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x7F, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x7F, // 109 -0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x7F, // 110 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 111 -0x00, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 112 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0xC0, 0xFF, 0x03, // 113 -0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, // 114 -0x00, 0x00, 0x00, 0x80, 0x23, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x80, 0x38, // 115 -0x40, 0x00, 0x00, 0xF0, 0x7F, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, // 116 -0x00, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xC0, 0x7F, // 117 -0xC0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x03, 0x00, 0xC0, // 118 -0xC0, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x03, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1F, 0x00, 0xC0, // 119 -0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1B, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1B, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, // 120 -0xC0, 0x01, 0x00, 0x00, 0x06, 0x02, 0x00, 0x38, 0x02, 0x00, 0xE0, 0x01, 0x00, 0x38, 0x00, 0x00, 0x07, 0x00, 0xC0, // 121 -0x40, 0x40, 0x00, 0x40, 0x60, 0x00, 0x40, 0x58, 0x00, 0x40, 0x44, 0x00, 0x40, 0x43, 0x00, 0xC0, 0x40, 0x00, 0x40, 0x40, // 122 -0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0xF0, 0xFB, 0x01, 0x08, 0x00, 0x02, 0x08, 0x00, 0x02, // 123 -0x00, 0x00, 0x00, 0xF8, 0xFF, 0x03, // 124 -0x08, 0x00, 0x02, 0x08, 0x00, 0x02, 0xF0, 0xFB, 0x01, 0x00, 0x04, 0x00, 0x00, 0x04, // 125 -0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, // 126 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x42, 0x00, 0x00, 0x41, 0x00, 0x80, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, // 129 -0x00, 0x01, 0x00, 0xF8, 0x7F, 0x00, 0x80, // 130 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x10, 0x00, 0x00, 0x60, 0x00, 0x00, 0x80, 0x00, 0x00, 0x08, 0x03, 0x00, 0x04, 0x04, 0x00, 0x02, 0x18, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x7F, // 131 -0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x70, 0x04, 0x00, 0x08, 0x04, 0x00, 0x70, 0x04, 0x00, 0x80, 0x07, 0x00, 0x00, 0x9C, 0x01, 0x00, 0x60, 0x02, // 132 -0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x7F, 0x03, 0x00, 0x80, 0x04, // 133 -0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x09, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, // 134 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x50, 0x40, 0x00, 0x48, 0x40, 0x00, 0x80, 0x20, // 135 -0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x50, 0x00, 0x00, 0x48, 0x00, 0x00, 0x80, 0x7F, // 136 -0x40, 0x40, 0x00, 0x40, 0x60, 0x00, 0x40, 0x58, 0x00, 0x50, 0x44, 0x00, 0x48, 0x43, 0x00, 0xC0, 0x40, 0x00, 0x40, 0x40, // 137 -0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x09, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 147 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x50, 0x40, 0x00, 0x48, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 148 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0xC1, 0x01, 0x08, 0x41, 0x02, 0x08, 0x41, 0x00, 0x08, 0x40, // 152 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x24, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x03, 0x40, 0xC4, 0x04, 0x80, 0x24, 0x00, 0x00, 0x17, // 153 -0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x90, 0x20, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x09, 0x42, 0x00, 0x08, 0x42, 0x00, 0x10, 0x22, 0x00, 0x20, 0x1C, // 154 -0x00, 0x00, 0x00, 0x80, 0x23, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x50, 0x44, 0x00, 0x48, 0x44, 0x00, 0x80, 0x38, // 155 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xFF, 0x03, // 161 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x03, 0x40, 0xF0, 0x00, 0x40, 0x4E, 0x00, 0xC0, 0x41, 0x00, 0xB8, 0x20, 0x00, 0x00, 0x11, // 162 -0x00, 0x41, 0x00, 0xE0, 0x31, 0x00, 0x10, 0x2F, 0x00, 0x08, 0x21, 0x00, 0x08, 0x21, 0x00, 0x08, 0x40, 0x00, 0x10, 0x40, 0x00, 0x20, 0x20, // 163 -0x00, 0x00, 0x00, 0x40, 0x0B, 0x00, 0x80, 0x04, 0x00, 0x40, 0x08, 0x00, 0x40, 0x08, 0x00, 0x80, 0x04, 0x00, 0x40, 0x0B, // 164 -0x08, 0x0A, 0x00, 0x10, 0x0A, 0x00, 0x60, 0x0A, 0x00, 0x80, 0x0B, 0x00, 0x00, 0x7E, 0x00, 0x80, 0x0B, 0x00, 0x60, 0x0A, 0x00, 0x10, 0x0A, 0x00, 0x08, 0x0A, // 165 -0x00, 0x00, 0x00, 0xF8, 0xF1, 0x03, // 166 -0x00, 0x86, 0x00, 0x70, 0x09, 0x01, 0xC8, 0x10, 0x02, 0x88, 0x10, 0x02, 0x08, 0x21, 0x02, 0x08, 0x61, 0x02, 0x30, 0xD2, 0x01, 0x00, 0x0C, // 167 -0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, // 168 -0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0xC8, 0x47, 0x00, 0x28, 0x48, 0x00, 0x28, 0x48, 0x00, 0x28, 0x48, 0x00, 0x28, 0x48, 0x00, 0x48, 0x44, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 169 -0xD0, 0x00, 0x00, 0x48, 0x01, 0x00, 0x28, 0x01, 0x00, 0x28, 0x01, 0x00, 0xF0, 0x01, // 170 -0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1B, 0x00, 0x80, 0x20, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1B, 0x00, 0x80, 0x20, // 171 -0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x0F, // 172 -0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, // 173 -0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0xE8, 0x4F, 0x00, 0x28, 0x41, 0x00, 0x28, 0x41, 0x00, 0x28, 0x43, 0x00, 0x28, 0x45, 0x00, 0xC8, 0x48, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 174 -0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, // 175 -0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x48, 0x00, 0x00, 0x48, 0x00, 0x00, 0x30, // 176 -0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x41, 0x00, 0x00, 0x41, 0x00, 0xE0, 0x4F, 0x00, 0x00, 0x41, 0x00, 0x00, 0x41, 0x00, 0x00, 0x41, // 177 -0x10, 0x01, 0x00, 0x88, 0x01, 0x00, 0x48, 0x01, 0x00, 0x48, 0x01, 0x00, 0x30, 0x01, // 178 -0x90, 0x00, 0x00, 0x08, 0x01, 0x00, 0x08, 0x01, 0x00, 0x28, 0x01, 0x00, 0xD8, // 179 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, // 180 -0x00, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xC0, 0x7F, // 181 -0xF0, 0x00, 0x00, 0xF8, 0x00, 0x00, 0xF8, 0x01, 0x00, 0xF8, 0x01, 0x00, 0xF8, 0xFF, 0x03, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0xF8, 0xFF, 0x03, 0x08, // 182 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // 183 -0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, // 184 -0x00, 0x40, 0x00, 0x08, 0x60, 0x00, 0x08, 0x58, 0x00, 0x08, 0x44, 0x00, 0x0A, 0x43, 0x00, 0x89, 0x40, 0x00, 0x68, 0x40, 0x00, 0x18, 0x40, 0x00, 0x08, 0x40, // 185 -0xF0, 0x00, 0x00, 0x08, 0x01, 0x00, 0x08, 0x01, 0x00, 0x08, 0x01, 0x00, 0xF0, // 186 -0x00, 0x40, 0x00, 0x08, 0x60, 0x00, 0x08, 0x58, 0x00, 0x08, 0x44, 0x00, 0x0A, 0x43, 0x00, 0x88, 0x40, 0x00, 0x68, 0x40, 0x00, 0x18, 0x40, 0x00, 0x08, 0x40, // 187 -0x40, 0x40, 0x00, 0x40, 0x60, 0x00, 0x40, 0x58, 0x00, 0x50, 0x44, 0x00, 0x40, 0x43, 0x00, 0xC0, 0x40, 0x00, 0x40, 0x40, // 188 -0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x40, 0x00, 0xF8, 0x31, 0x00, 0x00, 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0x80, 0x00, 0x00, 0x60, 0x44, 0x00, 0x10, 0x62, 0x00, 0x08, 0x52, 0x00, 0x00, 0x52, 0x00, 0x00, 0x4C, // 189 -0x90, 0x00, 0x00, 0x08, 0x01, 0x00, 0x08, 0x41, 0x00, 0x28, 0x21, 0x00, 0xD8, 0x18, 0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0x80, 0x00, 0x00, 0x40, 0x30, 0x00, 0x30, 0x28, 0x00, 0x08, 0x24, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x20, // 190 -0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x10, 0x01, 0x00, 0x08, 0x02, 0x40, 0x07, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0xC0, // 191 -0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x71, 0x04, 0x00, 0x0A, 0x04, 0x00, 0x70, 0x04, 0x00, 0x80, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 192 -0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x70, 0x04, 0x00, 0x0A, 0x04, 0x00, 0x71, 0x04, 0x00, 0x80, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 193 -0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x72, 0x04, 0x00, 0x09, 0x04, 0x00, 0x71, 0x04, 0x00, 0x82, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 194 -0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x72, 0x04, 0x00, 0x09, 0x04, 0x00, 0x72, 0x04, 0x00, 0x81, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 195 -0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x72, 0x04, 0x00, 0x08, 0x04, 0x00, 0x72, 0x04, 0x00, 0x80, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 196 -0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x7E, 0x04, 0x00, 0x0A, 0x04, 0x00, 0x7E, 0x04, 0x00, 0x80, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 197 -0x00, 0x60, 0x00, 0x00, 0x18, 0x00, 0x00, 0x06, 0x00, 0x80, 0x05, 0x00, 0x60, 0x04, 0x00, 0x18, 0x04, 0x00, 0x08, 0x04, 0x00, 0x08, 0x04, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, // 198 -0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x02, 0x08, 0xC0, 0x02, 0x08, 0x40, 0x03, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, // 199 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x09, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x40, // 200 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x09, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x40, // 201 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x09, 0x41, 0x00, 0x09, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x40, // 202 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x08, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x40, // 203 -0x01, 0x00, 0x00, 0xFA, 0x7F, // 204 -0x00, 0x00, 0x00, 0xFA, 0x7F, 0x00, 0x01, // 205 -0x02, 0x00, 0x00, 0xF9, 0x7F, 0x00, 0x01, 0x00, 0x00, 0x02, // 206 -0x02, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x02, // 207 -0x00, 0x02, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x42, 0x00, 0x08, 0x42, 0x00, 0x08, 0x42, 0x00, 0x08, 0x42, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 208 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x10, 0x00, 0x00, 0x60, 0x00, 0x00, 0x82, 0x00, 0x00, 0x01, 0x03, 0x00, 0x02, 0x04, 0x00, 0x01, 0x18, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x7F, // 209 -0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x09, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 210 -0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x09, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 211 -0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x0A, 0x40, 0x00, 0x09, 0x40, 0x00, 0x09, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 212 -0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x0A, 0x40, 0x00, 0x09, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x09, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 213 -0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x08, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 214 -0x00, 0x00, 0x00, 0x40, 0x10, 0x00, 0x80, 0x08, 0x00, 0x00, 0x05, 0x00, 0x00, 0x07, 0x00, 0x00, 0x05, 0x00, 0x80, 0x08, 0x00, 0x40, 0x10, // 215 -0x00, 0x00, 0x00, 0xC0, 0x4F, 0x00, 0x20, 0x30, 0x00, 0x10, 0x30, 0x00, 0x08, 0x4C, 0x00, 0x08, 0x42, 0x00, 0x08, 0x41, 0x00, 0xC8, 0x40, 0x00, 0x30, 0x20, 0x00, 0x30, 0x10, 0x00, 0xC8, 0x0F, // 216 -0x00, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x01, 0x40, 0x00, 0x02, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x1F, // 217 -0x00, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x02, 0x40, 0x00, 0x01, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x1F, // 218 -0x00, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x02, 0x40, 0x00, 0x01, 0x40, 0x00, 0x01, 0x40, 0x00, 0x02, 0x40, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x1F, // 219 -0x00, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x02, 0x40, 0x00, 0x00, 0x40, 0x00, 0x02, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x1F, // 220 -0x08, 0x00, 0x00, 0x30, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x01, 0x00, 0x02, 0x7E, 0x00, 0x81, 0x01, 0x00, 0x40, 0x00, 0x00, 0x30, 0x00, 0x00, 0x08, // 221 -0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x20, 0x10, 0x00, 0x20, 0x10, 0x00, 0x20, 0x10, 0x00, 0x20, 0x10, 0x00, 0x20, 0x10, 0x00, 0x20, 0x10, 0x00, 0x40, 0x08, 0x00, 0x80, 0x07, // 222 -0x00, 0x00, 0x00, 0xE0, 0x7F, 0x00, 0x10, 0x00, 0x00, 0x08, 0x20, 0x00, 0x88, 0x43, 0x00, 0x70, 0x42, 0x00, 0x00, 0x44, 0x00, 0x00, 0x38, // 223 -0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x40, 0x44, 0x00, 0x48, 0x44, 0x00, 0x50, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x7F, // 224 -0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x40, 0x44, 0x00, 0x50, 0x44, 0x00, 0x48, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x7F, // 225 -0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x50, 0x44, 0x00, 0x48, 0x44, 0x00, 0x48, 0x42, 0x00, 0x50, 0x22, 0x00, 0x80, 0x7F, // 226 -0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x50, 0x44, 0x00, 0x48, 0x44, 0x00, 0x50, 0x42, 0x00, 0x48, 0x22, 0x00, 0x80, 0x7F, // 227 -0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x50, 0x44, 0x00, 0x40, 0x44, 0x00, 0x50, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x7F, // 228 -0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x5C, 0x44, 0x00, 0x54, 0x44, 0x00, 0x5C, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x7F, // 229 -0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x3F, 0x00, 0x80, 0x24, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x80, 0x24, 0x00, 0x00, 0x17, // 230 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x02, 0x40, 0xC0, 0x02, 0x40, 0x40, 0x03, 0x80, 0x20, // 231 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x24, 0x00, 0x48, 0x44, 0x00, 0x50, 0x44, 0x00, 0x40, 0x44, 0x00, 0x80, 0x24, 0x00, 0x00, 0x17, // 232 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x24, 0x00, 0x40, 0x44, 0x00, 0x50, 0x44, 0x00, 0x48, 0x44, 0x00, 0x80, 0x24, 0x00, 0x00, 0x17, // 233 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x24, 0x00, 0x50, 0x44, 0x00, 0x48, 0x44, 0x00, 0x48, 0x44, 0x00, 0x90, 0x24, 0x00, 0x00, 0x17, // 234 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x24, 0x00, 0x50, 0x44, 0x00, 0x40, 0x44, 0x00, 0x50, 0x44, 0x00, 0x80, 0x24, 0x00, 0x00, 0x17, // 235 -0x08, 0x00, 0x00, 0xD0, 0x7F, // 236 -0x00, 0x00, 0x00, 0xD0, 0x7F, 0x00, 0x08, // 237 -0x10, 0x00, 0x00, 0xC8, 0x7F, 0x00, 0x08, 0x00, 0x00, 0x10, // 238 -0x10, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x10, // 239 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0xA0, 0x20, 0x00, 0x68, 0x40, 0x00, 0x58, 0x40, 0x00, 0x70, 0x40, 0x00, 0xE8, 0x20, 0x00, 0x00, 0x1F, // 240 -0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x90, 0x00, 0x00, 0x48, 0x00, 0x00, 0x50, 0x00, 0x00, 0x48, 0x00, 0x00, 0x80, 0x7F, // 241 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x48, 0x40, 0x00, 0x50, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 242 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x50, 0x40, 0x00, 0x48, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 243 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x50, 0x40, 0x00, 0x48, 0x40, 0x00, 0x48, 0x40, 0x00, 0x90, 0x20, 0x00, 0x00, 0x1F, // 244 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x50, 0x40, 0x00, 0x48, 0x40, 0x00, 0x50, 0x40, 0x00, 0x88, 0x20, 0x00, 0x00, 0x1F, // 245 -0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x50, 0x40, 0x00, 0x40, 0x40, 0x00, 0x50, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 246 -0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x80, 0x0A, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, // 247 -0x00, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x80, 0x30, 0x00, 0x40, 0x48, 0x00, 0x40, 0x44, 0x00, 0x40, 0x42, 0x00, 0x80, 0x21, 0x00, 0x40, 0x1F, // 248 -0x00, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x40, 0x00, 0x00, 0x20, 0x00, 0xC0, 0x7F, // 249 -0x00, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x10, 0x40, 0x00, 0x08, 0x20, 0x00, 0xC0, 0x7F, // 250 -0x00, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x10, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0xC0, 0x7F, // 251 -0x00, 0x00, 0x00, 0xD0, 0x3F, 0x00, 0x00, 0x40, 0x00, 0x10, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xC0, 0x7F, // 252 -0xC0, 0x01, 0x00, 0x00, 0x06, 0x02, 0x00, 0x38, 0x02, 0x10, 0xE0, 0x01, 0x08, 0x38, 0x00, 0x00, 0x07, 0x00, 0xC0, // 253 -0x00, 0x00, 0x00, 0xF8, 0xFF, 0x03, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 254 -0xC0, 0x01, 0x00, 0x00, 0x06, 0x02, 0x10, 0x38, 0x02, 0x00, 0xE0, 0x01, 0x10, 0x38, 0x00, 0x00, 0x07, 0x00, 0xC0, // 255 + 0x10, // Width: 16 + 0x13, // Height: 19 + 0x20, // First char: 32 + 0xE0, // Number of chars: 224 + // Jump Table: + 0xFF, 0xFF, 0x00, 0x04, // 32 + 0x00, 0x00, 0x08, 0x04, // 33 + 0x00, 0x08, 0x0D, 0x06, // 34 + 0x00, 0x15, 0x1A, 0x0A, // 35 + 0x00, 0x2F, 0x17, 0x09, // 36 + 0x00, 0x46, 0x26, 0x0E, // 37 + 0x00, 0x6C, 0x1D, 0x0B, // 38 + 0x00, 0x89, 0x04, 0x03, // 39 + 0x00, 0x8D, 0x0C, 0x05, // 40 + 0x00, 0x99, 0x0B, 0x05, // 41 + 0x00, 0xA4, 0x0D, 0x06, // 42 + 0x00, 0xB1, 0x17, 0x09, // 43 + 0x00, 0xC8, 0x09, 0x04, // 44 + 0x00, 0xD1, 0x0B, 0x05, // 45 + 0x00, 0xDC, 0x08, 0x04, // 46 + 0x00, 0xE4, 0x0A, 0x05, // 47 + 0x00, 0xEE, 0x17, 0x09, // 48 + 0x01, 0x05, 0x11, 0x07, // 49 + 0x01, 0x16, 0x17, 0x09, // 50 + 0x01, 0x2D, 0x17, 0x09, // 51 + 0x01, 0x44, 0x17, 0x09, // 52 + 0x01, 0x5B, 0x17, 0x09, // 53 + 0x01, 0x72, 0x17, 0x09, // 54 + 0x01, 0x89, 0x16, 0x09, // 55 + 0x01, 0x9F, 0x17, 0x09, // 56 + 0x01, 0xB6, 0x17, 0x09, // 57 + 0x01, 0xCD, 0x05, 0x03, // 58 + 0x01, 0xD2, 0x06, 0x03, // 59 + 0x01, 0xD8, 0x17, 0x09, // 60 + 0x01, 0xEF, 0x17, 0x09, // 61 + 0x02, 0x06, 0x17, 0x09, // 62 + 0x02, 0x1D, 0x16, 0x09, // 63 + 0x02, 0x33, 0x2F, 0x11, // 64 + 0x02, 0x62, 0x1D, 0x0B, // 65 + 0x02, 0x7F, 0x1D, 0x0B, // 66 + 0x02, 0x9C, 0x20, 0x0C, // 67 + 0x02, 0xBC, 0x20, 0x0C, // 68 + 0x02, 0xDC, 0x1D, 0x0B, // 69 + 0x02, 0xF9, 0x19, 0x0A, // 70 + 0x03, 0x12, 0x20, 0x0C, // 71 + 0x03, 0x32, 0x1D, 0x0B, // 72 + 0x03, 0x4F, 0x05, 0x03, // 73 + 0x03, 0x54, 0x14, 0x08, // 74 + 0x03, 0x68, 0x1D, 0x0B, // 75 + 0x03, 0x85, 0x17, 0x09, // 76 + 0x03, 0x9C, 0x23, 0x0D, // 77 + 0x03, 0xBF, 0x1D, 0x0B, // 78 + 0x03, 0xDC, 0x20, 0x0C, // 79 + 0x03, 0xFC, 0x1C, 0x0B, // 80 + 0x04, 0x18, 0x20, 0x0C, // 81 + 0x04, 0x38, 0x1D, 0x0B, // 82 + 0x04, 0x55, 0x1D, 0x0B, // 83 + 0x04, 0x72, 0x19, 0x0A, // 84 + 0x04, 0x8B, 0x1D, 0x0B, // 85 + 0x04, 0xA8, 0x1C, 0x0B, // 86 + 0x04, 0xC4, 0x2B, 0x10, // 87 + 0x04, 0xEF, 0x20, 0x0C, // 88 + 0x05, 0x0F, 0x19, 0x0A, // 89 + 0x05, 0x28, 0x1A, 0x0A, // 90 + 0x05, 0x42, 0x0C, 0x05, // 91 + 0x05, 0x4E, 0x0B, 0x05, // 92 + 0x05, 0x59, 0x09, 0x04, // 93 + 0x05, 0x62, 0x14, 0x08, // 94 + 0x05, 0x76, 0x1B, 0x0A, // 95 + 0x05, 0x91, 0x07, 0x04, // 96 + 0x05, 0x98, 0x17, 0x09, // 97 + 0x05, 0xAF, 0x17, 0x09, // 98 + 0x05, 0xC6, 0x14, 0x08, // 99 + 0x05, 0xDA, 0x17, 0x09, // 100 + 0x05, 0xF1, 0x17, 0x09, // 101 + 0x06, 0x08, 0x0A, 0x05, // 102 + 0x06, 0x12, 0x17, 0x09, // 103 + 0x06, 0x29, 0x14, 0x08, // 104 + 0x06, 0x3D, 0x05, 0x03, // 105 + 0x06, 0x42, 0x06, 0x03, // 106 + 0x06, 0x48, 0x17, 0x09, // 107 + 0x06, 0x5F, 0x05, 0x03, // 108 + 0x06, 0x64, 0x23, 0x0D, // 109 + 0x06, 0x87, 0x14, 0x08, // 110 + 0x06, 0x9B, 0x17, 0x09, // 111 + 0x06, 0xB2, 0x17, 0x09, // 112 + 0x06, 0xC9, 0x18, 0x09, // 113 + 0x06, 0xE1, 0x0D, 0x06, // 114 + 0x06, 0xEE, 0x14, 0x08, // 115 + 0x07, 0x02, 0x0B, 0x05, // 116 + 0x07, 0x0D, 0x14, 0x08, // 117 + 0x07, 0x21, 0x13, 0x08, // 118 + 0x07, 0x34, 0x1F, 0x0C, // 119 + 0x07, 0x53, 0x14, 0x08, // 120 + 0x07, 0x67, 0x13, 0x08, // 121 + 0x07, 0x7A, 0x14, 0x08, // 122 + 0x07, 0x8E, 0x0F, 0x06, // 123 + 0x07, 0x9D, 0x06, 0x03, // 124 + 0x07, 0xA3, 0x0E, 0x06, // 125 + 0x07, 0xB1, 0x17, 0x09, // 126 + 0xFF, 0xFF, 0x00, 0x10, // 127 + 0xFF, 0xFF, 0x00, 0x10, // 128 + 0x07, 0xC8, 0x17, 0x09, // 129 + 0x07, 0xDF, 0x07, 0x04, // 130 + 0x07, 0xE6, 0x1D, 0x0B, // 131 + 0x08, 0x03, 0x1E, 0x0B, // 132 + 0x08, 0x21, 0x1B, 0x0A, // 133 + 0x08, 0x3C, 0x20, 0x0C, // 134 + 0x08, 0x5C, 0x14, 0x08, // 135 + 0x08, 0x70, 0x14, 0x08, // 136 + 0x08, 0x84, 0x14, 0x08, // 137 + 0xFF, 0xFF, 0x00, 0x10, // 138 + 0xFF, 0xFF, 0x00, 0x10, // 139 + 0xFF, 0xFF, 0x00, 0x10, // 140 + 0xFF, 0xFF, 0x00, 0x10, // 141 + 0xFF, 0xFF, 0x00, 0x10, // 142 + 0xFF, 0xFF, 0x00, 0x10, // 143 + 0xFF, 0xFF, 0x00, 0x10, // 144 + 0xFF, 0xFF, 0x00, 0x10, // 145 + 0xFF, 0xFF, 0x00, 0x10, // 146 + 0x08, 0x98, 0x20, 0x0C, // 147 + 0x08, 0xB8, 0x17, 0x09, // 148 + 0xFF, 0xFF, 0x00, 0x10, // 149 + 0xFF, 0xFF, 0x00, 0x10, // 150 + 0xFF, 0xFF, 0x00, 0x10, // 151 + 0x08, 0xCF, 0x1D, 0x0B, // 152 + 0x08, 0xEC, 0x17, 0x09, // 153 + 0x09, 0x03, 0x1D, 0x0B, // 154 + 0x09, 0x20, 0x14, 0x08, // 155 + 0xFF, 0xFF, 0x00, 0x10, // 156 + 0xFF, 0xFF, 0x00, 0x10, // 157 + 0xFF, 0xFF, 0x00, 0x10, // 158 + 0xFF, 0xFF, 0x00, 0x10, // 159 + 0xFF, 0xFF, 0x00, 0x10, // 160 + 0x09, 0x34, 0x09, 0x04, // 161 + 0x09, 0x3D, 0x17, 0x09, // 162 + 0x09, 0x54, 0x17, 0x09, // 163 + 0x09, 0x6B, 0x14, 0x08, // 164 + 0x09, 0x7F, 0x1A, 0x0A, // 165 + 0x09, 0x99, 0x06, 0x03, // 166 + 0x09, 0x9F, 0x17, 0x09, // 167 + 0x09, 0xB6, 0x07, 0x04, // 168 + 0x09, 0xBD, 0x23, 0x0D, // 169 + 0x09, 0xE0, 0x0E, 0x06, // 170 + 0x09, 0xEE, 0x14, 0x08, // 171 + 0x0A, 0x02, 0x17, 0x09, // 172 + 0x0A, 0x19, 0x0B, 0x05, // 173 + 0x0A, 0x24, 0x23, 0x0D, // 174 + 0x0A, 0x47, 0x19, 0x0A, // 175 + 0x0A, 0x60, 0x0D, 0x06, // 176 + 0x0A, 0x6D, 0x17, 0x09, // 177 + 0x0A, 0x84, 0x0E, 0x06, // 178 + 0x0A, 0x92, 0x0D, 0x06, // 179 + 0x0A, 0x9F, 0x0A, 0x05, // 180 + 0x0A, 0xA9, 0x17, 0x09, // 181 + 0x0A, 0xC0, 0x19, 0x0A, // 182 + 0x0A, 0xD9, 0x08, 0x04, // 183 + 0x0A, 0xE1, 0x0C, 0x05, // 184 + 0x0A, 0xED, 0x1A, 0x0A, // 185 + 0x0B, 0x07, 0x0D, 0x06, // 186 + 0x0B, 0x14, 0x1A, 0x0A, // 187 + 0x0B, 0x2E, 0x14, 0x08, // 188 + 0x0B, 0x42, 0x26, 0x0E, // 189 + 0x0B, 0x68, 0x26, 0x0E, // 190 + 0x0B, 0x8E, 0x1A, 0x0A, // 191 + 0x0B, 0xA8, 0x1D, 0x0B, // 192 + 0x0B, 0xC5, 0x1D, 0x0B, // 193 + 0x0B, 0xE2, 0x1D, 0x0B, // 194 + 0x0B, 0xFF, 0x1D, 0x0B, // 195 + 0x0C, 0x1C, 0x1D, 0x0B, // 196 + 0x0C, 0x39, 0x1D, 0x0B, // 197 + 0x0C, 0x56, 0x2C, 0x10, // 198 + 0x0C, 0x82, 0x20, 0x0C, // 199 + 0x0C, 0xA2, 0x1D, 0x0B, // 200 + 0x0C, 0xBF, 0x1D, 0x0B, // 201 + 0x0C, 0xDC, 0x1D, 0x0B, // 202 + 0x0C, 0xF9, 0x1D, 0x0B, // 203 + 0x0D, 0x16, 0x05, 0x03, // 204 + 0x0D, 0x1B, 0x07, 0x04, // 205 + 0x0D, 0x22, 0x0A, 0x05, // 206 + 0x0D, 0x2C, 0x07, 0x04, // 207 + 0x0D, 0x33, 0x20, 0x0C, // 208 + 0x0D, 0x53, 0x1D, 0x0B, // 209 + 0x0D, 0x70, 0x20, 0x0C, // 210 + 0x0D, 0x90, 0x20, 0x0C, // 211 + 0x0D, 0xB0, 0x20, 0x0C, // 212 + 0x0D, 0xD0, 0x20, 0x0C, // 213 + 0x0D, 0xF0, 0x20, 0x0C, // 214 + 0x0E, 0x10, 0x17, 0x09, // 215 + 0x0E, 0x27, 0x20, 0x0C, // 216 + 0x0E, 0x47, 0x1D, 0x0B, // 217 + 0x0E, 0x64, 0x1D, 0x0B, // 218 + 0x0E, 0x81, 0x1D, 0x0B, // 219 + 0x0E, 0x9E, 0x1D, 0x0B, // 220 + 0x0E, 0xBB, 0x19, 0x0A, // 221 + 0x0E, 0xD4, 0x1D, 0x0B, // 222 + 0x0E, 0xF1, 0x17, 0x09, // 223 + 0x0F, 0x08, 0x17, 0x09, // 224 + 0x0F, 0x1F, 0x17, 0x09, // 225 + 0x0F, 0x36, 0x17, 0x09, // 226 + 0x0F, 0x4D, 0x17, 0x09, // 227 + 0x0F, 0x64, 0x17, 0x09, // 228 + 0x0F, 0x7B, 0x17, 0x09, // 229 + 0x0F, 0x92, 0x29, 0x0F, // 230 + 0x0F, 0xBB, 0x14, 0x08, // 231 + 0x0F, 0xCF, 0x17, 0x09, // 232 + 0x0F, 0xE6, 0x17, 0x09, // 233 + 0x0F, 0xFD, 0x17, 0x09, // 234 + 0x10, 0x14, 0x17, 0x09, // 235 + 0x10, 0x2B, 0x05, 0x03, // 236 + 0x10, 0x30, 0x07, 0x04, // 237 + 0x10, 0x37, 0x0A, 0x05, // 238 + 0x10, 0x41, 0x07, 0x04, // 239 + 0x10, 0x48, 0x17, 0x09, // 240 + 0x10, 0x5F, 0x14, 0x08, // 241 + 0x10, 0x73, 0x17, 0x09, // 242 + 0x10, 0x8A, 0x17, 0x09, // 243 + 0x10, 0xA1, 0x17, 0x09, // 244 + 0x10, 0xB8, 0x17, 0x09, // 245 + 0x10, 0xCF, 0x17, 0x09, // 246 + 0x10, 0xE6, 0x17, 0x09, // 247 + 0x10, 0xFD, 0x17, 0x09, // 248 + 0x11, 0x14, 0x14, 0x08, // 249 + 0x11, 0x28, 0x14, 0x08, // 250 + 0x11, 0x3C, 0x14, 0x08, // 251 + 0x11, 0x50, 0x14, 0x08, // 252 + 0x11, 0x64, 0x13, 0x08, // 253 + 0x11, 0x77, 0x17, 0x09, // 254 + 0x11, 0x8E, 0x13, 0x08, // 255 + // Font Data: + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x5F, // 33 + 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, // 34 + 0x80, 0x08, 0x00, 0x80, 0x78, 0x00, 0xC0, 0x0F, 0x00, 0xB8, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x78, 0x00, 0xC0, 0x0F, 0x00, 0xB8, 0x08, 0x00, 0x80, 0x08, // 35 + 0x00, 0x00, 0x00, 0xE0, 0x10, 0x00, 0x10, 0x21, 0x00, 0x08, 0x41, 0x00, 0xFC, 0xFF, 0x00, 0x08, 0x42, 0x00, 0x10, 0x22, 0x00, 0x20, 0x1C, // 36 + 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x08, 0x01, 0x00, 0x08, 0x01, 0x00, 0x08, 0x61, 0x00, 0xF0, 0x18, 0x00, 0x00, 0x06, 0x00, 0xC0, 0x01, 0x00, 0x30, 0x3C, 0x00, 0x08, 0x42, 0x00, 0x00, 0x42, 0x00, 0x00, 0x42, 0x00, 0x00, 0x3C, // 37 + 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x70, 0x22, 0x00, 0x88, 0x41, 0x00, 0x08, 0x43, 0x00, 0x88, 0x44, 0x00, 0x70, 0x28, 0x00, 0x00, 0x10, 0x00, 0x00, 0x28, 0x00, 0x00, 0x44, // 38 + 0x00, 0x00, 0x00, 0x78, // 39 + 0x00, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x70, 0xC0, 0x01, 0x08, 0x00, 0x02, // 40 + 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x70, 0xC0, 0x01, 0x80, 0x3F, // 41 + 0x10, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x38, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x10, // 42 + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, // 43 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, // 44 + 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, // 45 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, // 46 + 0x00, 0x60, 0x00, 0x00, 0x1E, 0x00, 0xE0, 0x01, 0x00, 0x18, // 47 + 0x00, 0x00, 0x00, 0xE0, 0x1F, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0xE0, 0x1F, // 48 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0x00, 0x10, 0x00, 0x00, 0xF8, 0x7F, // 49 + 0x00, 0x00, 0x00, 0x20, 0x40, 0x00, 0x10, 0x60, 0x00, 0x08, 0x50, 0x00, 0x08, 0x48, 0x00, 0x08, 0x44, 0x00, 0x10, 0x43, 0x00, 0xE0, 0x40, // 50 + 0x00, 0x00, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x88, 0x41, 0x00, 0xF0, 0x22, 0x00, 0x00, 0x1C, // 51 + 0x00, 0x0C, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x09, 0x00, 0xC0, 0x08, 0x00, 0x20, 0x08, 0x00, 0x10, 0x08, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x08, // 52 + 0x00, 0x00, 0x00, 0xC0, 0x11, 0x00, 0xB8, 0x20, 0x00, 0x88, 0x40, 0x00, 0x88, 0x40, 0x00, 0x88, 0x40, 0x00, 0x08, 0x21, 0x00, 0x08, 0x1E, // 53 + 0x00, 0x00, 0x00, 0xE0, 0x1F, 0x00, 0x10, 0x21, 0x00, 0x88, 0x40, 0x00, 0x88, 0x40, 0x00, 0x88, 0x40, 0x00, 0x10, 0x21, 0x00, 0x20, 0x1E, // 54 + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x78, 0x00, 0x08, 0x07, 0x00, 0xC8, 0x00, 0x00, 0x28, 0x00, 0x00, 0x18, // 55 + 0x00, 0x00, 0x00, 0x60, 0x1C, 0x00, 0x90, 0x22, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x90, 0x22, 0x00, 0x60, 0x1C, // 56 + 0x00, 0x00, 0x00, 0xE0, 0x11, 0x00, 0x10, 0x22, 0x00, 0x08, 0x44, 0x00, 0x08, 0x44, 0x00, 0x08, 0x44, 0x00, 0x10, 0x22, 0x00, 0xE0, 0x1F, // 57 + 0x00, 0x00, 0x00, 0x40, 0x40, // 58 + 0x00, 0x00, 0x00, 0x40, 0xC0, 0x01, // 59 + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x05, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x40, 0x10, // 60 + 0x00, 0x00, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, // 61 + 0x00, 0x00, 0x00, 0x40, 0x10, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0x00, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, 0x02, // 62 + 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x5C, 0x00, 0x08, 0x02, 0x00, 0x10, 0x01, 0x00, 0xE0, // 63 + 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0xC0, 0x40, 0x00, 0x20, 0x80, 0x00, 0x10, 0x1E, 0x01, 0x10, 0x21, 0x01, 0x88, 0x40, 0x02, 0x48, 0x40, 0x02, 0x48, 0x40, 0x02, 0x48, 0x20, 0x02, 0x88, 0x7C, 0x02, 0xC8, 0x43, 0x02, 0x10, 0x40, 0x02, 0x10, 0x20, 0x01, 0x60, 0x10, 0x01, 0x80, 0x8F, // 64 + 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x70, 0x04, 0x00, 0x08, 0x04, 0x00, 0x70, 0x04, 0x00, 0x80, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 65 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x90, 0x22, 0x00, 0x60, 0x1C, // 66 + 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, // 67 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 68 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x40, // 69 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, // 70 + 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x42, 0x00, 0x08, 0x42, 0x00, 0x10, 0x22, 0x00, 0x20, 0x12, 0x00, 0x00, 0x0E, // 71 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0xF8, 0x7F, // 72 + 0x00, 0x00, 0x00, 0xF8, 0x7F, // 73 + 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0xF8, 0x3F, // 74 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x80, 0x03, 0x00, 0x40, 0x04, 0x00, 0x20, 0x18, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, // 75 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, // 76 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x30, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x03, 0x00, 0xC0, 0x00, 0x00, 0x30, 0x00, 0x00, 0xF8, 0x7F, // 77 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x10, 0x00, 0x00, 0x60, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x18, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x7F, // 78 + 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 79 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x10, 0x01, 0x00, 0xE0, // 80 + 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x50, 0x00, 0x08, 0x50, 0x00, 0x10, 0x20, 0x00, 0x20, 0x70, 0x00, 0xC0, 0x4F, // 81 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x06, 0x00, 0x08, 0x1A, 0x00, 0x10, 0x21, 0x00, 0xE0, 0x40, // 82 + 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x90, 0x20, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x42, 0x00, 0x08, 0x42, 0x00, 0x10, 0x22, 0x00, 0x20, 0x1C, // 83 + 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, // 84 + 0x00, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x1F, // 85 + 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x18, 0x00, 0x00, 0x60, 0x00, 0x00, 0x18, 0x00, 0x00, 0x07, 0x00, 0xE0, 0x00, 0x00, 0x18, // 86 + 0x18, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x03, 0x00, 0x70, 0x00, 0x00, 0x08, 0x00, 0x00, 0x70, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1E, 0x00, 0xE0, 0x01, 0x00, 0x18, // 87 + 0x00, 0x40, 0x00, 0x08, 0x20, 0x00, 0x10, 0x10, 0x00, 0x60, 0x0C, 0x00, 0x80, 0x02, 0x00, 0x00, 0x01, 0x00, 0x80, 0x02, 0x00, 0x60, 0x0C, 0x00, 0x10, 0x10, 0x00, 0x08, 0x20, 0x00, 0x00, 0x40, // 88 + 0x08, 0x00, 0x00, 0x30, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x7E, 0x00, 0x80, 0x01, 0x00, 0x40, 0x00, 0x00, 0x30, 0x00, 0x00, 0x08, // 89 + 0x00, 0x40, 0x00, 0x08, 0x60, 0x00, 0x08, 0x58, 0x00, 0x08, 0x44, 0x00, 0x08, 0x43, 0x00, 0x88, 0x40, 0x00, 0x68, 0x40, 0x00, 0x18, 0x40, 0x00, 0x08, 0x40, // 90 + 0x00, 0x00, 0x00, 0xF8, 0xFF, 0x03, 0x08, 0x00, 0x02, 0x08, 0x00, 0x02, // 91 + 0x18, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x60, // 92 + 0x08, 0x00, 0x02, 0x08, 0x00, 0x02, 0xF8, 0xFF, 0x03, // 93 + 0x00, 0x01, 0x00, 0xC0, 0x00, 0x00, 0x30, 0x00, 0x00, 0x08, 0x00, 0x00, 0x30, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x01, // 94 + 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, // 95 + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x10, // 96 + 0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x7F, // 97 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 98 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, // 99 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0xF8, 0x7F, // 100 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x24, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x80, 0x24, 0x00, 0x00, 0x17, // 101 + 0x40, 0x00, 0x00, 0xF0, 0x7F, 0x00, 0x48, 0x00, 0x00, 0x48, // 102 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x01, 0x80, 0x20, 0x02, 0x40, 0x40, 0x02, 0x40, 0x40, 0x02, 0x40, 0x40, 0x02, 0x80, 0x20, 0x01, 0xC0, 0xFF, // 103 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x7F, // 104 + 0x00, 0x00, 0x00, 0xC8, 0x7F, // 105 + 0x00, 0x00, 0x02, 0xC8, 0xFF, 0x01, // 106 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x19, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, // 107 + 0x00, 0x00, 0x00, 0xF8, 0x7F, // 108 + 0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x7F, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x7F, // 109 + 0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x7F, // 110 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 111 + 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 112 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0xC0, 0xFF, 0x03, // 113 + 0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, // 114 + 0x00, 0x00, 0x00, 0x80, 0x23, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x80, 0x38, // 115 + 0x40, 0x00, 0x00, 0xF0, 0x7F, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, // 116 + 0x00, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xC0, 0x7F, // 117 + 0xC0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x03, 0x00, 0xC0, // 118 + 0xC0, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x03, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1F, 0x00, 0xC0, // 119 + 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1B, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1B, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, // 120 + 0xC0, 0x01, 0x00, 0x00, 0x06, 0x02, 0x00, 0x38, 0x02, 0x00, 0xE0, 0x01, 0x00, 0x38, 0x00, 0x00, 0x07, 0x00, 0xC0, // 121 + 0x40, 0x40, 0x00, 0x40, 0x60, 0x00, 0x40, 0x58, 0x00, 0x40, 0x44, 0x00, 0x40, 0x43, 0x00, 0xC0, 0x40, 0x00, 0x40, 0x40, // 122 + 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0xF0, 0xFB, 0x01, 0x08, 0x00, 0x02, 0x08, 0x00, 0x02, // 123 + 0x00, 0x00, 0x00, 0xF8, 0xFF, 0x03, // 124 + 0x08, 0x00, 0x02, 0x08, 0x00, 0x02, 0xF0, 0xFB, 0x01, 0x00, 0x04, 0x00, 0x00, 0x04, // 125 + 0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, // 126 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x42, 0x00, 0x00, 0x41, 0x00, 0x80, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, // 129 + 0x00, 0x01, 0x00, 0xF8, 0x7F, 0x00, 0x80, // 130 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x10, 0x00, 0x00, 0x60, 0x00, 0x00, 0x80, 0x00, 0x00, 0x08, 0x03, 0x00, 0x04, 0x04, 0x00, 0x02, 0x18, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x7F, // 131 + 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x70, 0x04, 0x00, 0x08, 0x04, 0x00, 0x70, 0x04, 0x00, 0x80, 0x07, 0x00, 0x00, 0x9C, 0x01, 0x00, 0x60, 0x02, // 132 + 0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x7F, 0x03, 0x00, 0x80, 0x04, // 133 + 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x09, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, // 134 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x50, 0x40, 0x00, 0x48, 0x40, 0x00, 0x80, 0x20, // 135 + 0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x50, 0x00, 0x00, 0x48, 0x00, 0x00, 0x80, 0x7F, // 136 + 0x40, 0x40, 0x00, 0x40, 0x60, 0x00, 0x40, 0x58, 0x00, 0x50, 0x44, 0x00, 0x48, 0x43, 0x00, 0xC0, 0x40, 0x00, 0x40, 0x40, // 137 + 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x09, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 147 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x50, 0x40, 0x00, 0x48, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 148 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0xC1, 0x01, 0x08, 0x41, 0x02, 0x08, 0x41, 0x00, 0x08, 0x40, // 152 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x24, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x03, 0x40, 0xC4, 0x04, 0x80, 0x24, 0x00, 0x00, 0x17, // 153 + 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x90, 0x20, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x09, 0x42, 0x00, 0x08, 0x42, 0x00, 0x10, 0x22, 0x00, 0x20, 0x1C, // 154 + 0x00, 0x00, 0x00, 0x80, 0x23, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x50, 0x44, 0x00, 0x48, 0x44, 0x00, 0x80, 0x38, // 155 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xFF, 0x03, // 161 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x03, 0x40, 0xF0, 0x00, 0x40, 0x4E, 0x00, 0xC0, 0x41, 0x00, 0xB8, 0x20, 0x00, 0x00, 0x11, // 162 + 0x00, 0x41, 0x00, 0xE0, 0x31, 0x00, 0x10, 0x2F, 0x00, 0x08, 0x21, 0x00, 0x08, 0x21, 0x00, 0x08, 0x40, 0x00, 0x10, 0x40, 0x00, 0x20, 0x20, // 163 + 0x00, 0x00, 0x00, 0x40, 0x0B, 0x00, 0x80, 0x04, 0x00, 0x40, 0x08, 0x00, 0x40, 0x08, 0x00, 0x80, 0x04, 0x00, 0x40, 0x0B, // 164 + 0x08, 0x0A, 0x00, 0x10, 0x0A, 0x00, 0x60, 0x0A, 0x00, 0x80, 0x0B, 0x00, 0x00, 0x7E, 0x00, 0x80, 0x0B, 0x00, 0x60, 0x0A, 0x00, 0x10, 0x0A, 0x00, 0x08, 0x0A, // 165 + 0x00, 0x00, 0x00, 0xF8, 0xF1, 0x03, // 166 + 0x00, 0x86, 0x00, 0x70, 0x09, 0x01, 0xC8, 0x10, 0x02, 0x88, 0x10, 0x02, 0x08, 0x21, 0x02, 0x08, 0x61, 0x02, 0x30, 0xD2, 0x01, 0x00, 0x0C, // 167 + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, // 168 + 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0xC8, 0x47, 0x00, 0x28, 0x48, 0x00, 0x28, 0x48, 0x00, 0x28, 0x48, 0x00, 0x28, 0x48, 0x00, 0x48, 0x44, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 169 + 0xD0, 0x00, 0x00, 0x48, 0x01, 0x00, 0x28, 0x01, 0x00, 0x28, 0x01, 0x00, 0xF0, 0x01, // 170 + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1B, 0x00, 0x80, 0x20, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1B, 0x00, 0x80, 0x20, // 171 + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x0F, // 172 + 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, // 173 + 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0xE8, 0x4F, 0x00, 0x28, 0x41, 0x00, 0x28, 0x41, 0x00, 0x28, 0x43, 0x00, 0x28, 0x45, 0x00, 0xC8, 0x48, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 174 + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, // 175 + 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x48, 0x00, 0x00, 0x48, 0x00, 0x00, 0x30, // 176 + 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x41, 0x00, 0x00, 0x41, 0x00, 0xE0, 0x4F, 0x00, 0x00, 0x41, 0x00, 0x00, 0x41, 0x00, 0x00, 0x41, // 177 + 0x10, 0x01, 0x00, 0x88, 0x01, 0x00, 0x48, 0x01, 0x00, 0x48, 0x01, 0x00, 0x30, 0x01, // 178 + 0x90, 0x00, 0x00, 0x08, 0x01, 0x00, 0x08, 0x01, 0x00, 0x28, 0x01, 0x00, 0xD8, // 179 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, // 180 + 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xC0, 0x7F, // 181 + 0xF0, 0x00, 0x00, 0xF8, 0x00, 0x00, 0xF8, 0x01, 0x00, 0xF8, 0x01, 0x00, 0xF8, 0xFF, 0x03, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0xF8, 0xFF, 0x03, 0x08, // 182 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // 183 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, // 184 + 0x00, 0x40, 0x00, 0x08, 0x60, 0x00, 0x08, 0x58, 0x00, 0x08, 0x44, 0x00, 0x0A, 0x43, 0x00, 0x89, 0x40, 0x00, 0x68, 0x40, 0x00, 0x18, 0x40, 0x00, 0x08, 0x40, // 185 + 0xF0, 0x00, 0x00, 0x08, 0x01, 0x00, 0x08, 0x01, 0x00, 0x08, 0x01, 0x00, 0xF0, // 186 + 0x00, 0x40, 0x00, 0x08, 0x60, 0x00, 0x08, 0x58, 0x00, 0x08, 0x44, 0x00, 0x0A, 0x43, 0x00, 0x88, 0x40, 0x00, 0x68, 0x40, 0x00, 0x18, 0x40, 0x00, 0x08, 0x40, // 187 + 0x40, 0x40, 0x00, 0x40, 0x60, 0x00, 0x40, 0x58, 0x00, 0x50, 0x44, 0x00, 0x40, 0x43, 0x00, 0xC0, 0x40, 0x00, 0x40, 0x40, // 188 + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x40, 0x00, 0xF8, 0x31, 0x00, 0x00, 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0x80, 0x00, 0x00, 0x60, 0x44, 0x00, 0x10, 0x62, 0x00, 0x08, 0x52, 0x00, 0x00, 0x52, 0x00, 0x00, 0x4C, // 189 + 0x90, 0x00, 0x00, 0x08, 0x01, 0x00, 0x08, 0x41, 0x00, 0x28, 0x21, 0x00, 0xD8, 0x18, 0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0x80, 0x00, 0x00, 0x40, 0x30, 0x00, 0x30, 0x28, 0x00, 0x08, 0x24, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x20, // 190 + 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x10, 0x01, 0x00, 0x08, 0x02, 0x40, 0x07, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0xC0, // 191 + 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x71, 0x04, 0x00, 0x0A, 0x04, 0x00, 0x70, 0x04, 0x00, 0x80, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 192 + 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x70, 0x04, 0x00, 0x0A, 0x04, 0x00, 0x71, 0x04, 0x00, 0x80, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 193 + 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x72, 0x04, 0x00, 0x09, 0x04, 0x00, 0x71, 0x04, 0x00, 0x82, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 194 + 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x72, 0x04, 0x00, 0x09, 0x04, 0x00, 0x72, 0x04, 0x00, 0x81, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 195 + 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x72, 0x04, 0x00, 0x08, 0x04, 0x00, 0x72, 0x04, 0x00, 0x80, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 196 + 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x1C, 0x00, 0x80, 0x07, 0x00, 0x7E, 0x04, 0x00, 0x0A, 0x04, 0x00, 0x7E, 0x04, 0x00, 0x80, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x60, // 197 + 0x00, 0x60, 0x00, 0x00, 0x18, 0x00, 0x00, 0x06, 0x00, 0x80, 0x05, 0x00, 0x60, 0x04, 0x00, 0x18, 0x04, 0x00, 0x08, 0x04, 0x00, 0x08, 0x04, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, // 198 + 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x02, 0x08, 0xC0, 0x02, 0x08, 0x40, 0x03, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, // 199 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x09, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x40, // 200 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x09, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x40, // 201 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x09, 0x41, 0x00, 0x09, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x40, // 202 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x08, 0x41, 0x00, 0x0A, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x41, 0x00, 0x08, 0x40, // 203 + 0x01, 0x00, 0x00, 0xFA, 0x7F, // 204 + 0x00, 0x00, 0x00, 0xFA, 0x7F, 0x00, 0x01, // 205 + 0x02, 0x00, 0x00, 0xF9, 0x7F, 0x00, 0x01, 0x00, 0x00, 0x02, // 206 + 0x02, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x02, // 207 + 0x00, 0x02, 0x00, 0xF8, 0x7F, 0x00, 0x08, 0x42, 0x00, 0x08, 0x42, 0x00, 0x08, 0x42, 0x00, 0x08, 0x42, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 208 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x10, 0x00, 0x00, 0x60, 0x00, 0x00, 0x82, 0x00, 0x00, 0x01, 0x03, 0x00, 0x02, 0x04, 0x00, 0x01, 0x18, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x7F, // 209 + 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x09, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 210 + 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x09, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 211 + 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x0A, 0x40, 0x00, 0x09, 0x40, 0x00, 0x09, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 212 + 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x0A, 0x40, 0x00, 0x09, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x09, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 213 + 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x20, 0x10, 0x00, 0x10, 0x20, 0x00, 0x08, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x08, 0x40, 0x00, 0x0A, 0x40, 0x00, 0x10, 0x20, 0x00, 0x20, 0x10, 0x00, 0xC0, 0x0F, // 214 + 0x00, 0x00, 0x00, 0x40, 0x10, 0x00, 0x80, 0x08, 0x00, 0x00, 0x05, 0x00, 0x00, 0x07, 0x00, 0x00, 0x05, 0x00, 0x80, 0x08, 0x00, 0x40, 0x10, // 215 + 0x00, 0x00, 0x00, 0xC0, 0x4F, 0x00, 0x20, 0x30, 0x00, 0x10, 0x30, 0x00, 0x08, 0x4C, 0x00, 0x08, 0x42, 0x00, 0x08, 0x41, 0x00, 0xC8, 0x40, 0x00, 0x30, 0x20, 0x00, 0x30, 0x10, 0x00, 0xC8, 0x0F, // 216 + 0x00, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x01, 0x40, 0x00, 0x02, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x1F, // 217 + 0x00, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x02, 0x40, 0x00, 0x01, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x1F, // 218 + 0x00, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x02, 0x40, 0x00, 0x01, 0x40, 0x00, 0x01, 0x40, 0x00, 0x02, 0x40, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x1F, // 219 + 0x00, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x02, 0x40, 0x00, 0x00, 0x40, 0x00, 0x02, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xF8, 0x1F, // 220 + 0x08, 0x00, 0x00, 0x30, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x01, 0x00, 0x02, 0x7E, 0x00, 0x81, 0x01, 0x00, 0x40, 0x00, 0x00, 0x30, 0x00, 0x00, 0x08, // 221 + 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x20, 0x10, 0x00, 0x20, 0x10, 0x00, 0x20, 0x10, 0x00, 0x20, 0x10, 0x00, 0x20, 0x10, 0x00, 0x20, 0x10, 0x00, 0x40, 0x08, 0x00, 0x80, 0x07, // 222 + 0x00, 0x00, 0x00, 0xE0, 0x7F, 0x00, 0x10, 0x00, 0x00, 0x08, 0x20, 0x00, 0x88, 0x43, 0x00, 0x70, 0x42, 0x00, 0x00, 0x44, 0x00, 0x00, 0x38, // 223 + 0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x40, 0x44, 0x00, 0x48, 0x44, 0x00, 0x50, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x7F, // 224 + 0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x40, 0x44, 0x00, 0x50, 0x44, 0x00, 0x48, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x7F, // 225 + 0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x50, 0x44, 0x00, 0x48, 0x44, 0x00, 0x48, 0x42, 0x00, 0x50, 0x22, 0x00, 0x80, 0x7F, // 226 + 0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x50, 0x44, 0x00, 0x48, 0x44, 0x00, 0x50, 0x42, 0x00, 0x48, 0x22, 0x00, 0x80, 0x7F, // 227 + 0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x50, 0x44, 0x00, 0x40, 0x44, 0x00, 0x50, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x7F, // 228 + 0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x5C, 0x44, 0x00, 0x54, 0x44, 0x00, 0x5C, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x7F, // 229 + 0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x80, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x42, 0x00, 0x40, 0x22, 0x00, 0x80, 0x3F, 0x00, 0x80, 0x24, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x40, 0x44, 0x00, 0x80, 0x24, 0x00, 0x00, 0x17, // 230 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x02, 0x40, 0xC0, 0x02, 0x40, 0x40, 0x03, 0x80, 0x20, // 231 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x24, 0x00, 0x48, 0x44, 0x00, 0x50, 0x44, 0x00, 0x40, 0x44, 0x00, 0x80, 0x24, 0x00, 0x00, 0x17, // 232 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x24, 0x00, 0x40, 0x44, 0x00, 0x50, 0x44, 0x00, 0x48, 0x44, 0x00, 0x80, 0x24, 0x00, 0x00, 0x17, // 233 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x24, 0x00, 0x50, 0x44, 0x00, 0x48, 0x44, 0x00, 0x48, 0x44, 0x00, 0x90, 0x24, 0x00, 0x00, 0x17, // 234 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x24, 0x00, 0x50, 0x44, 0x00, 0x40, 0x44, 0x00, 0x50, 0x44, 0x00, 0x80, 0x24, 0x00, 0x00, 0x17, // 235 + 0x08, 0x00, 0x00, 0xD0, 0x7F, // 236 + 0x00, 0x00, 0x00, 0xD0, 0x7F, 0x00, 0x08, // 237 + 0x10, 0x00, 0x00, 0xC8, 0x7F, 0x00, 0x08, 0x00, 0x00, 0x10, // 238 + 0x10, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x10, // 239 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0xA0, 0x20, 0x00, 0x68, 0x40, 0x00, 0x58, 0x40, 0x00, 0x70, 0x40, 0x00, 0xE8, 0x20, 0x00, 0x00, 0x1F, // 240 + 0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x90, 0x00, 0x00, 0x48, 0x00, 0x00, 0x50, 0x00, 0x00, 0x48, 0x00, 0x00, 0x80, 0x7F, // 241 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x48, 0x40, 0x00, 0x50, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 242 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x50, 0x40, 0x00, 0x48, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 243 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x50, 0x40, 0x00, 0x48, 0x40, 0x00, 0x48, 0x40, 0x00, 0x90, 0x20, 0x00, 0x00, 0x1F, // 244 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x50, 0x40, 0x00, 0x48, 0x40, 0x00, 0x50, 0x40, 0x00, 0x88, 0x20, 0x00, 0x00, 0x1F, // 245 + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x20, 0x00, 0x50, 0x40, 0x00, 0x40, 0x40, 0x00, 0x50, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 246 + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x80, 0x0A, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, // 247 + 0x00, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x80, 0x30, 0x00, 0x40, 0x48, 0x00, 0x40, 0x44, 0x00, 0x40, 0x42, 0x00, 0x80, 0x21, 0x00, 0x40, 0x1F, // 248 + 0x00, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x40, 0x00, 0x00, 0x20, 0x00, 0xC0, 0x7F, // 249 + 0x00, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x10, 0x40, 0x00, 0x08, 0x20, 0x00, 0xC0, 0x7F, // 250 + 0x00, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x10, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x10, 0x20, 0x00, 0xC0, 0x7F, // 251 + 0x00, 0x00, 0x00, 0xD0, 0x3F, 0x00, 0x00, 0x40, 0x00, 0x10, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0xC0, 0x7F, // 252 + 0xC0, 0x01, 0x00, 0x00, 0x06, 0x02, 0x00, 0x38, 0x02, 0x10, 0xE0, 0x01, 0x08, 0x38, 0x00, 0x00, 0x07, 0x00, 0xC0, // 253 + 0x00, 0x00, 0x00, 0xF8, 0xFF, 0x03, 0x80, 0x20, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x40, 0x40, 0x00, 0x80, 0x20, 0x00, 0x00, 0x1F, // 254 + 0xC0, 0x01, 0x00, 0x00, 0x06, 0x02, 0x10, 0x38, 0x02, 0x00, 0xE0, 0x01, 0x10, 0x38, 0x00, 0x00, 0x07, 0x00, 0xC0, // 255 }; const uint8_t ArialMT_Plain_24_PL[] PROGMEM = { -0x18, // Width: 24 -0x1C, // Height: 28 -0x20, // First char: 32 -0xE0, // Number of chars: 224 -// Jump Table: -0xFF, 0xFF, 0x00, 0x06, // 32 -0x00, 0x00, 0x13, 0x06, // 33 -0x00, 0x13, 0x1A, 0x08, // 34 -0x00, 0x2D, 0x33, 0x0E, // 35 -0x00, 0x60, 0x2F, 0x0D, // 36 -0x00, 0x8F, 0x4F, 0x15, // 37 -0x00, 0xDE, 0x3B, 0x10, // 38 -0x01, 0x19, 0x0A, 0x04, // 39 -0x01, 0x23, 0x1C, 0x08, // 40 -0x01, 0x3F, 0x1B, 0x08, // 41 -0x01, 0x5A, 0x21, 0x0A, // 42 -0x01, 0x7B, 0x32, 0x0E, // 43 -0x01, 0xAD, 0x10, 0x05, // 44 -0x01, 0xBD, 0x1B, 0x08, // 45 -0x01, 0xD8, 0x0F, 0x05, // 46 -0x01, 0xE7, 0x19, 0x08, // 47 -0x02, 0x00, 0x2F, 0x0D, // 48 -0x02, 0x2F, 0x23, 0x0A, // 49 -0x02, 0x52, 0x2F, 0x0D, // 50 -0x02, 0x81, 0x2F, 0x0D, // 51 -0x02, 0xB0, 0x2F, 0x0D, // 52 -0x02, 0xDF, 0x2F, 0x0D, // 53 -0x03, 0x0E, 0x2F, 0x0D, // 54 -0x03, 0x3D, 0x2D, 0x0D, // 55 -0x03, 0x6A, 0x2F, 0x0D, // 56 -0x03, 0x99, 0x2F, 0x0D, // 57 -0x03, 0xC8, 0x0F, 0x05, // 58 -0x03, 0xD7, 0x10, 0x05, // 59 -0x03, 0xE7, 0x2F, 0x0D, // 60 -0x04, 0x16, 0x2F, 0x0D, // 61 -0x04, 0x45, 0x2E, 0x0D, // 62 -0x04, 0x73, 0x2E, 0x0D, // 63 -0x04, 0xA1, 0x5B, 0x18, // 64 -0x04, 0xFC, 0x3B, 0x10, // 65 -0x05, 0x37, 0x3B, 0x10, // 66 -0x05, 0x72, 0x3F, 0x11, // 67 -0x05, 0xB1, 0x3F, 0x11, // 68 -0x05, 0xF0, 0x3B, 0x10, // 69 -0x06, 0x2B, 0x35, 0x0F, // 70 -0x06, 0x60, 0x43, 0x12, // 71 -0x06, 0xA3, 0x3B, 0x10, // 72 -0x06, 0xDE, 0x0F, 0x05, // 73 -0x06, 0xED, 0x27, 0x0B, // 74 -0x07, 0x14, 0x3F, 0x11, // 75 -0x07, 0x53, 0x2F, 0x0D, // 76 -0x07, 0x82, 0x43, 0x12, // 77 -0x07, 0xC5, 0x3B, 0x10, // 78 -0x08, 0x00, 0x47, 0x13, // 79 -0x08, 0x47, 0x3A, 0x10, // 80 -0x08, 0x81, 0x47, 0x13, // 81 -0x08, 0xC8, 0x3F, 0x11, // 82 -0x09, 0x07, 0x3B, 0x10, // 83 -0x09, 0x42, 0x35, 0x0F, // 84 -0x09, 0x77, 0x3B, 0x10, // 85 -0x09, 0xB2, 0x39, 0x10, // 86 -0x09, 0xEB, 0x59, 0x18, // 87 -0x0A, 0x44, 0x3B, 0x10, // 88 -0x0A, 0x7F, 0x3D, 0x11, // 89 -0x0A, 0xBC, 0x37, 0x0F, // 90 -0x0A, 0xF3, 0x14, 0x06, // 91 -0x0B, 0x07, 0x1B, 0x08, // 92 -0x0B, 0x22, 0x18, 0x07, // 93 -0x0B, 0x3A, 0x2A, 0x0C, // 94 -0x0B, 0x64, 0x34, 0x0E, // 95 -0x0B, 0x98, 0x11, 0x06, // 96 -0x0B, 0xA9, 0x2F, 0x0D, // 97 -0x0B, 0xD8, 0x33, 0x0E, // 98 -0x0C, 0x0B, 0x2B, 0x0C, // 99 -0x0C, 0x36, 0x2F, 0x0D, // 100 -0x0C, 0x65, 0x2F, 0x0D, // 101 -0x0C, 0x94, 0x1A, 0x08, // 102 -0x0C, 0xAE, 0x2F, 0x0D, // 103 -0x0C, 0xDD, 0x2F, 0x0D, // 104 -0x0D, 0x0C, 0x0F, 0x05, // 105 -0x0D, 0x1B, 0x10, 0x05, // 106 -0x0D, 0x2B, 0x2F, 0x0D, // 107 -0x0D, 0x5A, 0x0F, 0x05, // 108 -0x0D, 0x69, 0x47, 0x13, // 109 -0x0D, 0xB0, 0x2F, 0x0D, // 110 -0x0D, 0xDF, 0x2F, 0x0D, // 111 -0x0E, 0x0E, 0x33, 0x0E, // 112 -0x0E, 0x41, 0x30, 0x0D, // 113 -0x0E, 0x71, 0x1E, 0x09, // 114 -0x0E, 0x8F, 0x2B, 0x0C, // 115 -0x0E, 0xBA, 0x1B, 0x08, // 116 -0x0E, 0xD5, 0x2F, 0x0D, // 117 -0x0F, 0x04, 0x2A, 0x0C, // 118 -0x0F, 0x2E, 0x42, 0x12, // 119 -0x0F, 0x70, 0x2B, 0x0C, // 120 -0x0F, 0x9B, 0x2A, 0x0C, // 121 -0x0F, 0xC5, 0x2B, 0x0C, // 122 -0x0F, 0xF0, 0x1C, 0x08, // 123 -0x10, 0x0C, 0x10, 0x05, // 124 -0x10, 0x1C, 0x1B, 0x08, // 125 -0x10, 0x37, 0x32, 0x0E, // 126 -0xFF, 0xFF, 0x00, 0x18, // 127 -0xFF, 0xFF, 0x00, 0x18, // 128 -0x10, 0x69, 0x2F, 0x0D, // 129 -0x10, 0x98, 0x16, 0x07, // 130 -0x10, 0xAE, 0x3B, 0x10, // 131 -0x10, 0xE9, 0x40, 0x11, // 132 -0x11, 0x29, 0x34, 0x0E, // 133 -0x11, 0x5D, 0x3F, 0x11, // 134 -0x11, 0x9C, 0x2B, 0x0C, // 135 -0x11, 0xC7, 0x2F, 0x0D, // 136 -0x11, 0xF6, 0x2B, 0x0C, // 137 -0xFF, 0xFF, 0x00, 0x18, // 138 -0xFF, 0xFF, 0x00, 0x18, // 139 -0xFF, 0xFF, 0x00, 0x18, // 140 -0xFF, 0xFF, 0x00, 0x18, // 141 -0xFF, 0xFF, 0x00, 0x18, // 142 -0xFF, 0xFF, 0x00, 0x18, // 143 -0xFF, 0xFF, 0x00, 0x18, // 144 -0xFF, 0xFF, 0x00, 0x18, // 145 -0xFF, 0xFF, 0x00, 0x18, // 146 -0x12, 0x21, 0x47, 0x13, // 147 -0x12, 0x68, 0x2F, 0x0D, // 148 -0xFF, 0xFF, 0x00, 0x18, // 149 -0xFF, 0xFF, 0x00, 0x18, // 150 -0xFF, 0xFF, 0x00, 0x18, // 151 -0x12, 0x97, 0x3B, 0x10, // 152 -0x12, 0xD2, 0x2F, 0x0D, // 153 -0x13, 0x01, 0x3B, 0x10, // 154 -0x13, 0x3C, 0x2B, 0x0C, // 155 -0xFF, 0xFF, 0x00, 0x18, // 156 -0xFF, 0xFF, 0x00, 0x18, // 157 -0xFF, 0xFF, 0x00, 0x18, // 158 -0xFF, 0xFF, 0x00, 0x18, // 159 -0xFF, 0xFF, 0x00, 0x18, // 160 -0x13, 0x67, 0x14, 0x06, // 161 -0x13, 0x7B, 0x2B, 0x0C, // 162 -0x13, 0xA6, 0x2F, 0x0D, // 163 -0x13, 0xD5, 0x33, 0x0E, // 164 -0x14, 0x08, 0x31, 0x0E, // 165 -0x14, 0x39, 0x10, 0x05, // 166 -0x14, 0x49, 0x2F, 0x0D, // 167 -0x14, 0x78, 0x19, 0x08, // 168 -0x14, 0x91, 0x46, 0x13, // 169 -0x14, 0xD7, 0x1A, 0x08, // 170 -0x14, 0xF1, 0x27, 0x0B, // 171 -0x15, 0x18, 0x2F, 0x0D, // 172 -0x15, 0x47, 0x1B, 0x08, // 173 -0x15, 0x62, 0x46, 0x13, // 174 -0x15, 0xA8, 0x31, 0x0E, // 175 -0x15, 0xD9, 0x1E, 0x09, // 176 -0x15, 0xF7, 0x33, 0x0E, // 177 -0x16, 0x2A, 0x1A, 0x08, // 178 -0x16, 0x44, 0x1A, 0x08, // 179 -0x16, 0x5E, 0x19, 0x08, // 180 -0x16, 0x77, 0x2F, 0x0D, // 181 -0x16, 0xA6, 0x31, 0x0E, // 182 -0x16, 0xD7, 0x12, 0x06, // 183 -0x16, 0xE9, 0x18, 0x07, // 184 -0x17, 0x01, 0x37, 0x0F, // 185 -0x17, 0x38, 0x1E, 0x09, // 186 -0x17, 0x56, 0x37, 0x0F, // 187 -0x17, 0x8D, 0x2B, 0x0C, // 188 -0x17, 0xB8, 0x4B, 0x14, // 189 -0x18, 0x03, 0x4B, 0x14, // 190 -0x18, 0x4E, 0x33, 0x0E, // 191 -0x18, 0x81, 0x3B, 0x10, // 192 -0x18, 0xBC, 0x3B, 0x10, // 193 -0x18, 0xF7, 0x3B, 0x10, // 194 -0x19, 0x32, 0x3B, 0x10, // 195 -0x19, 0x6D, 0x3B, 0x10, // 196 -0x19, 0xA8, 0x3B, 0x10, // 197 -0x19, 0xE3, 0x5B, 0x18, // 198 -0x1A, 0x3E, 0x3F, 0x11, // 199 -0x1A, 0x7D, 0x3B, 0x10, // 200 -0x1A, 0xB8, 0x3B, 0x10, // 201 -0x1A, 0xF3, 0x3B, 0x10, // 202 -0x1B, 0x2E, 0x3B, 0x10, // 203 -0x1B, 0x69, 0x11, 0x06, // 204 -0x1B, 0x7A, 0x11, 0x06, // 205 -0x1B, 0x8B, 0x15, 0x07, // 206 -0x1B, 0xA0, 0x15, 0x07, // 207 -0x1B, 0xB5, 0x3F, 0x11, // 208 -0x1B, 0xF4, 0x3B, 0x10, // 209 -0x1C, 0x2F, 0x47, 0x13, // 210 -0x1C, 0x76, 0x47, 0x13, // 211 -0x1C, 0xBD, 0x47, 0x13, // 212 -0x1D, 0x04, 0x47, 0x13, // 213 -0x1D, 0x4B, 0x47, 0x13, // 214 -0x1D, 0x92, 0x2B, 0x0C, // 215 -0x1D, 0xBD, 0x47, 0x13, // 216 -0x1E, 0x04, 0x3B, 0x10, // 217 -0x1E, 0x3F, 0x3B, 0x10, // 218 -0x1E, 0x7A, 0x3B, 0x10, // 219 -0x1E, 0xB5, 0x3B, 0x10, // 220 -0x1E, 0xF0, 0x3D, 0x11, // 221 -0x1F, 0x2D, 0x3A, 0x10, // 222 -0x1F, 0x67, 0x37, 0x0F, // 223 -0x1F, 0x9E, 0x2F, 0x0D, // 224 -0x1F, 0xCD, 0x2F, 0x0D, // 225 -0x1F, 0xFC, 0x2F, 0x0D, // 226 -0x20, 0x2B, 0x2F, 0x0D, // 227 -0x20, 0x5A, 0x2F, 0x0D, // 228 -0x20, 0x89, 0x2F, 0x0D, // 229 -0x20, 0xB8, 0x53, 0x16, // 230 -0x21, 0x0B, 0x2B, 0x0C, // 231 -0x21, 0x36, 0x2F, 0x0D, // 232 -0x21, 0x65, 0x2F, 0x0D, // 233 -0x21, 0x94, 0x2F, 0x0D, // 234 -0x21, 0xC3, 0x2F, 0x0D, // 235 -0x21, 0xF2, 0x11, 0x06, // 236 -0x22, 0x03, 0x11, 0x06, // 237 -0x22, 0x14, 0x15, 0x07, // 238 -0x22, 0x29, 0x15, 0x07, // 239 -0x22, 0x3E, 0x2F, 0x0D, // 240 -0x22, 0x6D, 0x2F, 0x0D, // 241 -0x22, 0x9C, 0x2F, 0x0D, // 242 -0x22, 0xCB, 0x2F, 0x0D, // 243 -0x22, 0xFA, 0x2F, 0x0D, // 244 -0x23, 0x29, 0x2F, 0x0D, // 245 -0x23, 0x58, 0x2F, 0x0D, // 246 -0x23, 0x87, 0x32, 0x0E, // 247 -0x23, 0xB9, 0x33, 0x0E, // 248 -0x23, 0xEC, 0x2F, 0x0D, // 249 -0x24, 0x1B, 0x2F, 0x0D, // 250 -0x24, 0x4A, 0x2F, 0x0D, // 251 -0x24, 0x79, 0x2F, 0x0D, // 252 -0x24, 0xA8, 0x2A, 0x0C, // 253 -0x24, 0xD2, 0x2F, 0x0D, // 254 -0x25, 0x01, 0x2A, 0x0C, // 255 -// Font Data: -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x33, 0x00, 0xE0, 0xFF, 0x33, // 33 -0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xE0, 0x07, // 34 -0x00, 0x0C, 0x03, 0x00, 0x00, 0x0C, 0x33, 0x00, 0x00, 0x0C, 0x3F, 0x00, 0x00, 0xFC, 0x0F, 0x00, 0x80, 0xFF, 0x03, 0x00, 0xE0, 0x0F, 0x03, 0x00, 0x60, 0x0C, 0x33, 0x00, 0x00, 0x0C, 0x3F, 0x00, 0x00, 0xFC, 0x0F, 0x00, 0x80, 0xFF, 0x03, 0x00, 0xE0, 0x0F, 0x03, 0x00, 0x60, 0x0C, 0x03, 0x00, 0x00, 0x0C, 0x03, // 35 -0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x06, 0x00, 0xC0, 0x0F, 0x1E, 0x00, 0xC0, 0x18, 0x1C, 0x00, 0x60, 0x18, 0x38, 0x00, 0x60, 0x30, 0x30, 0x00, 0xF0, 0xFF, 0xFF, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x60, 0x38, 0x00, 0xC0, 0x60, 0x18, 0x00, 0xC0, 0xC1, 0x1F, 0x00, 0x00, 0x81, 0x07, // 36 -0x00, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x20, 0x20, 0x20, 0x00, 0x60, 0x30, 0x38, 0x00, 0xC0, 0x1F, 0x1E, 0x00, 0x80, 0x8F, 0x0F, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x8F, 0x0F, 0x00, 0xC0, 0xC3, 0x1F, 0x00, 0xE0, 0x60, 0x30, 0x00, 0x20, 0x20, 0x20, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0x80, 0x0F, // 37 -0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x80, 0xE3, 0x1C, 0x00, 0xC0, 0x77, 0x38, 0x00, 0xE0, 0x3C, 0x30, 0x00, 0x60, 0x38, 0x30, 0x00, 0x60, 0x78, 0x30, 0x00, 0xE0, 0xEC, 0x38, 0x00, 0xC0, 0x8F, 0x1B, 0x00, 0x80, 0x03, 0x1F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0xC0, 0x38, 0x00, 0x00, 0x00, 0x10, // 38 -0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xE0, 0x07, // 39 -0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0xFE, 0x7F, 0x00, 0x80, 0x0F, 0xF0, 0x01, 0xC0, 0x01, 0x80, 0x03, 0x60, 0x00, 0x00, 0x06, 0x20, 0x00, 0x00, 0x04, // 40 -0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x04, 0x60, 0x00, 0x00, 0x06, 0xC0, 0x01, 0x80, 0x03, 0x80, 0x0F, 0xF0, 0x01, 0x00, 0xFE, 0x7F, 0x00, 0x00, 0xF0, 0x0F, // 41 -0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x80, // 42 -0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xFF, 0x0F, 0x00, 0x00, 0xFF, 0x0F, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, // 43 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x03, 0x00, 0x00, 0xF0, 0x01, // 44 -0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, // 45 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, // 46 -0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x80, 0x3F, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x60, // 47 -0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x80, 0xFF, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x38, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0xFF, 0x0F, 0x00, 0x00, 0xFE, 0x03, // 48 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 49 -0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x30, 0x00, 0xC0, 0x03, 0x38, 0x00, 0xC0, 0x00, 0x3C, 0x00, 0x60, 0x00, 0x36, 0x00, 0x60, 0x00, 0x33, 0x00, 0x60, 0x80, 0x31, 0x00, 0x60, 0xC0, 0x30, 0x00, 0x60, 0x60, 0x30, 0x00, 0xC0, 0x30, 0x30, 0x00, 0xC0, 0x1F, 0x30, 0x00, 0x00, 0x0F, 0x30, // 50 -0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xC0, 0x01, 0x0E, 0x00, 0xC0, 0x00, 0x1C, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0xC0, 0x38, 0x30, 0x00, 0xC0, 0x6F, 0x18, 0x00, 0x80, 0xC7, 0x0F, 0x00, 0x00, 0x80, 0x07, // 51 -0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x3C, 0x03, 0x00, 0x00, 0x0E, 0x03, 0x00, 0x80, 0x07, 0x03, 0x00, 0xC0, 0x01, 0x03, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, // 52 -0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x06, 0x00, 0x80, 0x3F, 0x0E, 0x00, 0xE0, 0x1F, 0x18, 0x00, 0x60, 0x08, 0x30, 0x00, 0x60, 0x0C, 0x30, 0x00, 0x60, 0x0C, 0x30, 0x00, 0x60, 0x0C, 0x30, 0x00, 0x60, 0x0C, 0x30, 0x00, 0x60, 0x18, 0x1C, 0x00, 0x60, 0xF0, 0x0F, 0x00, 0x00, 0xE0, 0x03, // 53 -0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x03, 0x00, 0x80, 0xFF, 0x0F, 0x00, 0xC0, 0x63, 0x1C, 0x00, 0xC0, 0x30, 0x38, 0x00, 0x60, 0x18, 0x30, 0x00, 0x60, 0x18, 0x30, 0x00, 0x60, 0x18, 0x30, 0x00, 0x60, 0x18, 0x30, 0x00, 0xE0, 0x30, 0x18, 0x00, 0xC0, 0xF1, 0x0F, 0x00, 0x80, 0xC1, 0x07, // 54 -0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x3C, 0x00, 0x60, 0x80, 0x3F, 0x00, 0x60, 0xE0, 0x03, 0x00, 0x60, 0x78, 0x00, 0x00, 0x60, 0x0E, 0x00, 0x00, 0x60, 0x03, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x60, // 55 -0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x80, 0xC7, 0x1F, 0x00, 0xC0, 0x6F, 0x18, 0x00, 0xE0, 0x38, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0xE0, 0x38, 0x30, 0x00, 0xC0, 0x6F, 0x18, 0x00, 0x80, 0xC7, 0x1F, 0x00, 0x00, 0x80, 0x07, // 56 -0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x0C, 0x00, 0x80, 0x7F, 0x1C, 0x00, 0xC0, 0x61, 0x38, 0x00, 0x60, 0xC0, 0x30, 0x00, 0x60, 0xC0, 0x30, 0x00, 0x60, 0xC0, 0x30, 0x00, 0x60, 0xC0, 0x30, 0x00, 0x60, 0x60, 0x18, 0x00, 0xC0, 0x31, 0x1E, 0x00, 0x80, 0xFF, 0x0F, 0x00, 0x00, 0xFE, 0x01, // 57 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, // 58 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x30, 0x03, 0x00, 0x06, 0xF0, 0x01, // 59 -0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0xD8, 0x00, 0x00, 0x00, 0xD8, 0x00, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x03, 0x06, // 60 -0x00, 0x00, 0x00, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, // 61 -0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0xD8, 0x00, 0x00, 0x00, 0xD8, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x20, // 62 -0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x60, 0x80, 0x33, 0x00, 0x60, 0xC0, 0x33, 0x00, 0x60, 0xE0, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0xC0, 0x38, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0x00, 0x07, // 63 -0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x1E, 0xF0, 0x00, 0x00, 0x07, 0xC0, 0x01, 0x80, 0xC3, 0x87, 0x01, 0xC0, 0xF1, 0x9F, 0x03, 0xC0, 0x38, 0x18, 0x03, 0xC0, 0x0C, 0x30, 0x03, 0x60, 0x0E, 0x30, 0x06, 0x60, 0x06, 0x30, 0x06, 0x60, 0x06, 0x18, 0x06, 0x60, 0x06, 0x0C, 0x06, 0x60, 0x0C, 0x1E, 0x06, 0x60, 0xF8, 0x3F, 0x06, 0xE0, 0xFE, 0x31, 0x06, 0xC0, 0x0E, 0x30, 0x06, 0xC0, 0x01, 0x18, 0x03, 0x80, 0x03, 0x1C, 0x03, 0x00, 0x07, 0x8F, 0x01, 0x00, 0xFE, 0x87, 0x01, 0x00, 0xF8, 0xC1, 0x00, 0x00, 0x00, 0x40, // 64 -0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x80, 0x8F, 0x01, 0x00, 0xE0, 0x83, 0x01, 0x00, 0x60, 0x80, 0x01, 0x00, 0xE0, 0x83, 0x01, 0x00, 0x80, 0x8F, 0x01, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 65 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0xC0, 0x78, 0x30, 0x00, 0xC0, 0xFF, 0x18, 0x00, 0x80, 0xC7, 0x1F, 0x00, 0x00, 0x80, 0x07, // 66 -0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x03, 0x0F, 0x00, 0x00, 0x02, 0x03, // 67 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x03, 0x0E, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 68 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 69 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, // 70 -0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x18, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x60, 0x30, 0x00, 0x60, 0x60, 0x30, 0x00, 0xE0, 0x60, 0x38, 0x00, 0xC0, 0x60, 0x18, 0x00, 0xC0, 0x61, 0x18, 0x00, 0x80, 0xE3, 0x0F, 0x00, 0x00, 0xE2, 0x0F, // 71 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 72 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 73 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0xE0, 0xFF, 0x1F, 0x00, 0xE0, 0xFF, 0x0F, // 74 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0xE7, 0x01, 0x00, 0x80, 0x83, 0x07, 0x00, 0xC0, 0x01, 0x0F, 0x00, 0xE0, 0x00, 0x1E, 0x00, 0x60, 0x00, 0x38, 0x00, 0x20, 0x00, 0x30, 0x00, 0x00, 0x00, 0x20, // 75 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, // 76 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0x01, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 77 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 78 -0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 79 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0xC0, 0x30, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0x00, 0x0F, // 80 -0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x0C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x18, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x36, 0x00, 0x60, 0x00, 0x36, 0x00, 0xE0, 0x00, 0x3C, 0x00, 0xC0, 0x00, 0x1C, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x3F, 0x00, 0x00, 0xFF, 0x77, 0x00, 0x00, 0xFC, 0x61, // 81 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x70, 0x00, 0x00, 0x60, 0xF0, 0x00, 0x00, 0x60, 0xF0, 0x03, 0x00, 0x60, 0xB0, 0x07, 0x00, 0xE0, 0x18, 0x1F, 0x00, 0xC0, 0x1F, 0x3C, 0x00, 0x80, 0x0F, 0x30, 0x00, 0x00, 0x00, 0x20, // 82 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x0F, 0x00, 0xC0, 0x1F, 0x1C, 0x00, 0xC0, 0x18, 0x18, 0x00, 0x60, 0x38, 0x38, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x70, 0x30, 0x00, 0xC0, 0x60, 0x18, 0x00, 0xC0, 0xE1, 0x18, 0x00, 0x80, 0xC3, 0x0F, 0x00, 0x00, 0x83, 0x07, // 83 -0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, // 84 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x03, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0x03, // 85 -0x20, 0x00, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0xF8, 0x01, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x3E, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x20, // 86 -0x60, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x80, 0xFF, 0x00, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x80, 0x1F, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x80, 0xFF, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x60, // 87 -0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x30, 0x00, 0x60, 0x00, 0x3C, 0x00, 0xE0, 0x01, 0x1E, 0x00, 0xC0, 0x83, 0x07, 0x00, 0x00, 0xCF, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xCF, 0x03, 0x00, 0xC0, 0x03, 0x07, 0x00, 0xE0, 0x01, 0x1E, 0x00, 0x60, 0x00, 0x3C, 0x00, 0x20, 0x00, 0x30, 0x00, 0x00, 0x00, 0x20, // 88 -0x20, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, // 89 -0x00, 0x00, 0x30, 0x00, 0x60, 0x00, 0x38, 0x00, 0x60, 0x00, 0x3C, 0x00, 0x60, 0x00, 0x37, 0x00, 0x60, 0x80, 0x33, 0x00, 0x60, 0xC0, 0x31, 0x00, 0x60, 0xE0, 0x30, 0x00, 0x60, 0x38, 0x30, 0x00, 0x60, 0x1C, 0x30, 0x00, 0x60, 0x0E, 0x30, 0x00, 0x60, 0x07, 0x30, 0x00, 0xE0, 0x01, 0x30, 0x00, 0xE0, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, // 90 -0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0x07, 0x60, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x06, // 91 -0x60, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 92 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x06, 0xE0, 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0x07, // 93 -0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0xC0, 0x07, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x20, // 94 -0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, // 95 -0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x80, // 96 -0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0x00, 0x8C, 0x39, 0x00, 0x00, 0x86, 0x31, 0x00, 0x00, 0x86, 0x31, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x18, 0x00, 0x00, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 97 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x18, 0x0C, 0x00, 0x00, 0x0C, 0x18, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xE0, 0x03, // 98 -0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x18, 0x0C, // 99 -0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0C, 0x18, 0x00, 0x00, 0x18, 0x0C, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 100 -0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xDC, 0x1C, 0x00, 0x00, 0xCE, 0x38, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xCE, 0x38, 0x00, 0x00, 0xDC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xF0, 0x04, // 101 -0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0xC0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x06, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x60, 0x06, // 102 -0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x83, 0x01, 0x00, 0xF8, 0x8F, 0x03, 0x00, 0x1C, 0x1C, 0x07, 0x00, 0x0E, 0x38, 0x06, 0x00, 0x06, 0x30, 0x06, 0x00, 0x06, 0x30, 0x06, 0x00, 0x06, 0x30, 0x06, 0x00, 0x0C, 0x18, 0x07, 0x00, 0x18, 0x8C, 0x03, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0xFE, 0xFF, // 103 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0xF8, 0x3F, // 104 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xFE, 0x3F, 0x00, 0x60, 0xFE, 0x3F, // 105 -0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x60, 0xFE, 0xFF, 0x07, 0x60, 0xFE, 0xFF, 0x03, // 106 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xF0, 0x01, 0x00, 0x00, 0x98, 0x07, 0x00, 0x00, 0x0C, 0x0E, 0x00, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x02, 0x30, 0x00, 0x00, 0x00, 0x20, // 107 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 108 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0xF8, 0x3F, // 109 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0xF8, 0x3F, // 110 -0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 111 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x07, 0x00, 0xFE, 0xFF, 0x07, 0x00, 0x18, 0x0C, 0x00, 0x00, 0x0C, 0x18, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xE0, 0x03, // 112 -0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0C, 0x18, 0x00, 0x00, 0x18, 0x0C, 0x00, 0x00, 0xFE, 0xFF, 0x07, 0x00, 0xFE, 0xFF, 0x07, // 113 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, // 114 -0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0C, 0x00, 0x00, 0x7C, 0x1C, 0x00, 0x00, 0xEE, 0x38, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x31, 0x00, 0x00, 0xC6, 0x31, 0x00, 0x00, 0x8E, 0x39, 0x00, 0x00, 0x9C, 0x1F, 0x00, 0x00, 0x18, 0x0F, // 115 -0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0xC0, 0xFF, 0x1F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, // 116 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0F, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, // 117 -0x00, 0x06, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0xC0, 0x07, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x06, // 118 -0x00, 0x0E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x0E, // 119 -0x00, 0x02, 0x20, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x1E, 0x3C, 0x00, 0x00, 0x38, 0x0E, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x38, 0x0E, 0x00, 0x00, 0x1C, 0x3C, 0x00, 0x00, 0x0E, 0x30, 0x00, 0x00, 0x02, 0x20, // 120 -0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x06, 0x00, 0xF0, 0x01, 0x06, 0x00, 0x80, 0x0F, 0x07, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0xFC, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0xF8, 0x03, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x06, // 121 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x06, 0x3E, 0x00, 0x00, 0x06, 0x37, 0x00, 0x00, 0xC6, 0x33, 0x00, 0x00, 0xE6, 0x30, 0x00, 0x00, 0x76, 0x30, 0x00, 0x00, 0x3E, 0x30, 0x00, 0x00, 0x1E, 0x30, 0x00, 0x00, 0x06, 0x30, // 122 -0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xC0, 0x03, 0x00, 0xC0, 0x7F, 0xFE, 0x03, 0xE0, 0x3F, 0xFC, 0x07, 0x60, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x06, // 123 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x0F, 0xE0, 0xFF, 0xFF, 0x0F, // 124 -0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x06, 0xE0, 0x3F, 0xFC, 0x07, 0xC0, 0x7F, 0xFF, 0x03, 0x00, 0xC0, 0x03, 0x00, 0x00, 0x80, 0x01, // 125 -0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x60, // 126 -0x00, 0x60, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x0C, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, // 129 -0x00, 0x60, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x06, // 130 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x10, 0x3C, 0x00, 0x00, 0x1C, 0x70, 0x00, 0x00, 0x0C, 0xE0, 0x01, 0x00, 0x04, 0x80, 0x03, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 131 -0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x80, 0x8F, 0x01, 0x00, 0xE0, 0x83, 0x01, 0x00, 0x60, 0x80, 0x01, 0x00, 0xE0, 0x83, 0x01, 0x00, 0x80, 0x8F, 0x01, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xB0, 0x03, 0x00, 0x00, 0x00, 0x03, // 132 -0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0x00, 0x8C, 0x39, 0x00, 0x00, 0x86, 0x31, 0x00, 0x00, 0x86, 0x31, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x18, 0x00, 0x00, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0xFF, 0x01, 0x00, 0x00, 0xA0, 0x03, 0x00, 0x00, 0x00, 0x03, // 133 -0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x68, 0x00, 0x30, 0x00, 0x6E, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0x62, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x03, 0x0F, 0x00, 0x00, 0x02, 0x03, // 134 -0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x80, 0x06, 0x30, 0x00, 0xE0, 0x06, 0x30, 0x00, 0x60, 0x06, 0x30, 0x00, 0x20, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x18, 0x0C, // 135 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, 0xE0, 0x06, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x20, 0x0E, 0x00, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0xF8, 0x3F, // 136 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x06, 0x3E, 0x00, 0x00, 0x06, 0x37, 0x00, 0x80, 0xC6, 0x33, 0x00, 0xE0, 0xE6, 0x30, 0x00, 0x60, 0x76, 0x30, 0x00, 0x20, 0x3E, 0x30, 0x00, 0x00, 0x1E, 0x30, 0x00, 0x00, 0x06, 0x30, // 137 -0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x68, 0x00, 0x30, 0x00, 0x6E, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0xE2, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 147 -0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x06, 0x30, 0x00, 0x80, 0x06, 0x30, 0x00, 0xE0, 0x06, 0x30, 0x00, 0x60, 0x0E, 0x38, 0x00, 0x20, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 148 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0xF0, 0x01, 0x60, 0x30, 0xB0, 0x03, 0x60, 0x30, 0x30, 0x03, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 152 -0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xDC, 0x1C, 0x00, 0x00, 0xCE, 0x38, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0xF0, 0x01, 0x00, 0xC6, 0xB0, 0x03, 0x00, 0xCE, 0x38, 0x03, 0x00, 0xDC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xF0, 0x04, // 153 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x0F, 0x00, 0xC0, 0x1F, 0x1C, 0x00, 0xC0, 0x18, 0x18, 0x00, 0x60, 0x38, 0x38, 0x00, 0x60, 0x30, 0x30, 0x00, 0x68, 0x30, 0x30, 0x00, 0x6E, 0x30, 0x30, 0x00, 0x66, 0x30, 0x30, 0x00, 0x62, 0x70, 0x30, 0x00, 0xC0, 0x60, 0x18, 0x00, 0xC0, 0xE1, 0x18, 0x00, 0x80, 0xC3, 0x0F, 0x00, 0x00, 0x83, 0x07, // 154 -0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0C, 0x00, 0x00, 0x7C, 0x1C, 0x00, 0x00, 0xEE, 0x38, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x80, 0xC6, 0x30, 0x00, 0xE0, 0xC6, 0x31, 0x00, 0x60, 0xC6, 0x31, 0x00, 0x20, 0x8E, 0x39, 0x00, 0x00, 0x9C, 0x1F, 0x00, 0x00, 0x18, 0x0F, // 155 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE6, 0xFF, 0x07, 0x00, 0xE6, 0xFF, 0x07, // 161 -0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x9C, 0x07, 0x00, 0x0E, 0x78, 0x00, 0x00, 0x06, 0x3F, 0x00, 0x00, 0xF6, 0x30, 0x00, 0x00, 0x0E, 0x30, 0x00, 0xE0, 0x0D, 0x1C, 0x00, 0x00, 0x1C, 0x0E, 0x00, 0x00, 0x10, 0x06, // 162 -0x00, 0x60, 0x10, 0x00, 0x00, 0x60, 0x38, 0x00, 0x00, 0x7F, 0x1C, 0x00, 0xC0, 0xFF, 0x1F, 0x00, 0xE0, 0xE0, 0x19, 0x00, 0x60, 0x60, 0x18, 0x00, 0x60, 0x60, 0x18, 0x00, 0x60, 0x60, 0x30, 0x00, 0xE0, 0x00, 0x30, 0x00, 0xC0, 0x01, 0x30, 0x00, 0x80, 0x01, 0x38, 0x00, 0x00, 0x00, 0x10, // 163 -0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0xF7, 0x0E, 0x00, 0x00, 0xFE, 0x07, 0x00, 0x00, 0x0C, 0x03, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x0C, 0x03, 0x00, 0x00, 0xFE, 0x07, 0x00, 0x00, 0xF7, 0x0E, 0x00, 0x00, 0x02, 0x04, // 164 -0xE0, 0x60, 0x06, 0x00, 0xC0, 0x61, 0x06, 0x00, 0x80, 0x67, 0x06, 0x00, 0x00, 0x7E, 0x06, 0x00, 0x00, 0x7C, 0x06, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x7C, 0x06, 0x00, 0x00, 0x7E, 0x06, 0x00, 0x80, 0x67, 0x06, 0x00, 0xC0, 0x61, 0x06, 0x00, 0xE0, 0x60, 0x06, 0x00, 0x20, // 165 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x7F, 0xF8, 0x0F, 0xE0, 0x7F, 0xF8, 0x0F, // 166 -0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x80, 0xF3, 0xC1, 0x00, 0xC0, 0x1F, 0xC3, 0x03, 0xE0, 0x0C, 0x07, 0x03, 0x60, 0x1C, 0x06, 0x06, 0x60, 0x18, 0x0C, 0x06, 0x60, 0x30, 0x1C, 0x06, 0xE0, 0x70, 0x38, 0x07, 0xC0, 0xE1, 0xF4, 0x03, 0x80, 0xC1, 0xE7, 0x01, 0x00, 0x80, 0x03, // 167 -0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, // 168 -0x00, 0xF8, 0x00, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0x07, 0x07, 0x00, 0x80, 0x01, 0x0C, 0x00, 0xC0, 0x79, 0x1C, 0x00, 0xC0, 0xFE, 0x19, 0x00, 0x60, 0x86, 0x31, 0x00, 0x60, 0x03, 0x33, 0x00, 0x60, 0x03, 0x33, 0x00, 0x60, 0x03, 0x33, 0x00, 0x60, 0x03, 0x33, 0x00, 0x60, 0x87, 0x33, 0x00, 0xC0, 0x86, 0x19, 0x00, 0xC0, 0x85, 0x1C, 0x00, 0x80, 0x01, 0x0C, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0xF8, // 169 -0x00, 0x00, 0x00, 0x00, 0xC0, 0x1C, 0x00, 0x00, 0xE0, 0x3E, 0x00, 0x00, 0x60, 0x32, 0x00, 0x00, 0x60, 0x32, 0x00, 0x00, 0xE0, 0x3F, 0x00, 0x00, 0xC0, 0x3F, // 170 -0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x78, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x84, 0x10, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x78, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x04, 0x10, // 171 -0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFC, 0x01, // 172 -0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, // 173 -0x00, 0xF8, 0x00, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0x07, 0x07, 0x00, 0x80, 0x01, 0x0C, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0xFE, 0x1B, 0x00, 0x60, 0xFE, 0x33, 0x00, 0x60, 0x66, 0x30, 0x00, 0x60, 0x66, 0x30, 0x00, 0x60, 0xE6, 0x30, 0x00, 0x60, 0xFE, 0x31, 0x00, 0x60, 0x3C, 0x33, 0x00, 0xC0, 0x00, 0x1A, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x01, 0x0C, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0xF8, // 174 -0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, // 175 -0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x80, 0x03, // 176 -0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0xFF, 0x3F, 0x00, 0x00, 0xFF, 0x3F, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, // 177 -0x40, 0x20, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x20, 0x38, 0x00, 0x00, 0x20, 0x2C, 0x00, 0x00, 0x20, 0x26, 0x00, 0x00, 0xE0, 0x23, 0x00, 0x00, 0xC0, 0x21, // 178 -0x40, 0x10, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x20, 0x22, 0x00, 0x00, 0x20, 0x22, 0x00, 0x00, 0xE0, 0x3D, 0x00, 0x00, 0xC0, 0x1D, // 179 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, // 180 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x07, 0x00, 0xFE, 0xFF, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, // 181 -0x00, 0x0F, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0xE0, 0x7F, 0x00, 0x00, 0xE0, 0x7F, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0x07, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0x07, 0x60, 0x00, 0x00, 0x00, 0x60, // 182 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, // 183 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xC0, 0x02, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x01, // 184 -0x00, 0x00, 0x30, 0x00, 0x60, 0x00, 0x38, 0x00, 0x60, 0x00, 0x3C, 0x00, 0x60, 0x00, 0x37, 0x00, 0x60, 0x80, 0x33, 0x00, 0x60, 0xC0, 0x31, 0x00, 0x68, 0xE0, 0x30, 0x00, 0x6E, 0x38, 0x30, 0x00, 0x66, 0x1C, 0x30, 0x00, 0x62, 0x0E, 0x30, 0x00, 0x60, 0x07, 0x30, 0x00, 0xE0, 0x01, 0x30, 0x00, 0xE0, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, // 185 -0x00, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0xE0, 0x38, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0xE0, 0x38, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0x80, 0x0F, // 186 -0x00, 0x00, 0x30, 0x00, 0x60, 0x00, 0x38, 0x00, 0x60, 0x00, 0x3C, 0x00, 0x60, 0x00, 0x37, 0x00, 0x60, 0x80, 0x33, 0x00, 0x60, 0xC0, 0x31, 0x00, 0x6C, 0xE0, 0x30, 0x00, 0x6C, 0x38, 0x30, 0x00, 0x60, 0x1C, 0x30, 0x00, 0x60, 0x0E, 0x30, 0x00, 0x60, 0x07, 0x30, 0x00, 0xE0, 0x01, 0x30, 0x00, 0xE0, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, // 187 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x06, 0x3E, 0x00, 0x00, 0x06, 0x37, 0x00, 0xC0, 0xC6, 0x33, 0x00, 0xC0, 0xE6, 0x30, 0x00, 0x00, 0x76, 0x30, 0x00, 0x00, 0x3E, 0x30, 0x00, 0x00, 0x1E, 0x30, 0x00, 0x00, 0x06, 0x30, // 188 -0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x20, 0x00, 0xE0, 0x3F, 0x30, 0x00, 0xE0, 0x3F, 0x1C, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x4E, 0x20, 0x00, 0x00, 0x67, 0x30, 0x00, 0xC0, 0x21, 0x38, 0x00, 0xE0, 0x20, 0x2C, 0x00, 0x60, 0x20, 0x26, 0x00, 0x00, 0xE0, 0x27, 0x00, 0x00, 0xC0, 0x21, // 189 -0x40, 0x10, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x20, 0x22, 0x20, 0x00, 0x20, 0x22, 0x30, 0x00, 0xE0, 0x3D, 0x38, 0x00, 0xC0, 0x1D, 0x0E, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x0E, 0x0C, 0x00, 0x00, 0x07, 0x0E, 0x00, 0x80, 0x83, 0x0B, 0x00, 0xE0, 0xC0, 0x08, 0x00, 0x60, 0xE0, 0x3F, 0x00, 0x20, 0xE0, 0x3F, 0x00, 0x00, 0x00, 0x08, // 190 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF8, 0x03, 0x00, 0x00, 0x1E, 0x03, 0x00, 0x00, 0x07, 0x07, 0x00, 0xE6, 0x03, 0x06, 0x00, 0xE6, 0x01, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xC0, // 191 -0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x82, 0x8F, 0x01, 0x00, 0xE6, 0x83, 0x01, 0x00, 0x6E, 0x80, 0x01, 0x00, 0xE8, 0x83, 0x01, 0x00, 0x80, 0x8F, 0x01, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 192 -0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x80, 0x8F, 0x01, 0x00, 0xE8, 0x83, 0x01, 0x00, 0x6E, 0x80, 0x01, 0x00, 0xE6, 0x83, 0x01, 0x00, 0x82, 0x8F, 0x01, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 193 -0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x88, 0x8F, 0x01, 0x00, 0xEC, 0x83, 0x01, 0x00, 0x66, 0x80, 0x01, 0x00, 0xE6, 0x83, 0x01, 0x00, 0x8C, 0x8F, 0x01, 0x00, 0x08, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 194 -0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x0C, 0xFE, 0x01, 0x00, 0x8E, 0x8F, 0x01, 0x00, 0xE6, 0x83, 0x01, 0x00, 0x66, 0x80, 0x01, 0x00, 0xEC, 0x83, 0x01, 0x00, 0x8C, 0x8F, 0x01, 0x00, 0x0E, 0xFE, 0x01, 0x00, 0x06, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 195 -0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x8C, 0x8F, 0x01, 0x00, 0xEC, 0x83, 0x01, 0x00, 0x60, 0x80, 0x01, 0x00, 0xE0, 0x83, 0x01, 0x00, 0x8C, 0x8F, 0x01, 0x00, 0x0C, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 196 -0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x9C, 0x8F, 0x01, 0x00, 0xE2, 0x83, 0x01, 0x00, 0x62, 0x80, 0x01, 0x00, 0xE2, 0x83, 0x01, 0x00, 0x9C, 0x8F, 0x01, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 197 -0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0xF0, 0x01, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00, 0x8F, 0x01, 0x00, 0xC0, 0x83, 0x01, 0x00, 0xE0, 0x80, 0x01, 0x00, 0x60, 0x80, 0x01, 0x00, 0x60, 0x80, 0x01, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 198 -0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0x60, 0x00, 0x30, 0x02, 0x60, 0x00, 0x30, 0x02, 0x60, 0x00, 0xF0, 0x02, 0x60, 0x00, 0xB0, 0x03, 0x60, 0x00, 0x30, 0x01, 0x60, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x03, 0x0F, 0x00, 0x00, 0x02, 0x03, // 199 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x62, 0x30, 0x30, 0x00, 0x66, 0x30, 0x30, 0x00, 0x6E, 0x30, 0x30, 0x00, 0x68, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 200 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x68, 0x30, 0x30, 0x00, 0x6E, 0x30, 0x30, 0x00, 0x66, 0x30, 0x30, 0x00, 0x62, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 201 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x68, 0x30, 0x30, 0x00, 0x6C, 0x30, 0x30, 0x00, 0x66, 0x30, 0x30, 0x00, 0x66, 0x30, 0x30, 0x00, 0x6C, 0x30, 0x30, 0x00, 0x68, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 202 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x6C, 0x30, 0x30, 0x00, 0x6C, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x6C, 0x30, 0x30, 0x00, 0x6C, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 203 -0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xE6, 0xFF, 0x3F, 0x00, 0xEE, 0xFF, 0x3F, 0x00, 0x08, // 204 -0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xEE, 0xFF, 0x3F, 0x00, 0xE6, 0xFF, 0x3F, 0x00, 0x02, // 205 -0x08, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0xE6, 0xFF, 0x3F, 0x00, 0xE6, 0xFF, 0x3F, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, // 206 -0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, // 207 -0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x03, 0x0E, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 208 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x8C, 0x03, 0x00, 0x00, 0x0E, 0x0E, 0x00, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x06, 0x70, 0x00, 0x00, 0x0C, 0xE0, 0x01, 0x00, 0x0C, 0x80, 0x03, 0x00, 0x0E, 0x00, 0x0F, 0x00, 0x06, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 209 -0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x62, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0x6E, 0x00, 0x30, 0x00, 0x68, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 210 -0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x60, 0x00, 0x30, 0x00, 0x68, 0x00, 0x30, 0x00, 0x6E, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0x62, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 211 -0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x68, 0x00, 0x30, 0x00, 0x6C, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0x6C, 0x00, 0x30, 0x00, 0xE8, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 212 -0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xCC, 0x00, 0x18, 0x00, 0xEE, 0x00, 0x38, 0x00, 0x66, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0x6C, 0x00, 0x30, 0x00, 0x6C, 0x00, 0x30, 0x00, 0x6E, 0x00, 0x30, 0x00, 0xE6, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 213 -0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x6C, 0x00, 0x30, 0x00, 0x6C, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x6C, 0x00, 0x30, 0x00, 0xEC, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 214 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x8E, 0x03, 0x00, 0x00, 0xDC, 0x01, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0xDC, 0x01, 0x00, 0x00, 0x8E, 0x03, 0x00, 0x00, 0x06, 0x03, // 215 -0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x21, 0x00, 0x00, 0xFF, 0x77, 0x00, 0x80, 0x07, 0x3F, 0x00, 0xC0, 0x01, 0x1E, 0x00, 0xC0, 0x00, 0x1F, 0x00, 0xE0, 0x80, 0x3B, 0x00, 0x60, 0xC0, 0x31, 0x00, 0x60, 0xE0, 0x30, 0x00, 0x60, 0x70, 0x30, 0x00, 0x60, 0x38, 0x30, 0x00, 0x60, 0x1C, 0x30, 0x00, 0xE0, 0x0E, 0x38, 0x00, 0xC0, 0x07, 0x18, 0x00, 0xC0, 0x03, 0x1C, 0x00, 0xE0, 0x07, 0x0F, 0x00, 0x70, 0xFF, 0x07, 0x00, 0x20, 0xFC, 0x01, // 216 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x03, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x02, 0x00, 0x30, 0x00, 0x06, 0x00, 0x30, 0x00, 0x0E, 0x00, 0x30, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0x03, // 217 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x03, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x08, 0x00, 0x30, 0x00, 0x0E, 0x00, 0x30, 0x00, 0x06, 0x00, 0x30, 0x00, 0x02, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0x03, // 218 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x03, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x08, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x06, 0x00, 0x30, 0x00, 0x06, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x08, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0x03, // 219 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x03, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0x03, // 220 -0x20, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x08, 0xF0, 0x3F, 0x00, 0x0E, 0xF0, 0x3F, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x02, 0x1E, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, // 221 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00, 0x86, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xF8, // 222 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x3F, 0x00, 0xC0, 0xFF, 0x3F, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x60, 0x00, 0x08, 0x00, 0x60, 0x00, 0x1C, 0x00, 0x60, 0x00, 0x38, 0x00, 0xE0, 0x78, 0x30, 0x00, 0xC0, 0x7F, 0x30, 0x00, 0x80, 0xC7, 0x30, 0x00, 0x00, 0x80, 0x39, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x0F, // 223 -0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0x00, 0x8C, 0x39, 0x00, 0x20, 0x86, 0x31, 0x00, 0x60, 0x86, 0x31, 0x00, 0xE0, 0xC6, 0x30, 0x00, 0x80, 0xC6, 0x18, 0x00, 0x00, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 224 -0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0x00, 0x8C, 0x39, 0x00, 0x00, 0x86, 0x31, 0x00, 0x80, 0x86, 0x31, 0x00, 0xE0, 0xC6, 0x30, 0x00, 0x60, 0xC6, 0x18, 0x00, 0x20, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 225 -0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0x80, 0x8C, 0x39, 0x00, 0xC0, 0x86, 0x31, 0x00, 0x60, 0x86, 0x31, 0x00, 0x60, 0xC6, 0x30, 0x00, 0xC0, 0xC6, 0x18, 0x00, 0x80, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 226 -0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0xC0, 0x1C, 0x1F, 0x00, 0xE0, 0x8C, 0x39, 0x00, 0x60, 0x86, 0x31, 0x00, 0x60, 0x86, 0x31, 0x00, 0xC0, 0xC6, 0x30, 0x00, 0xC0, 0xC6, 0x18, 0x00, 0xE0, 0xCE, 0x0C, 0x00, 0x60, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 227 -0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0xC0, 0x8C, 0x39, 0x00, 0xC0, 0x86, 0x31, 0x00, 0x00, 0x86, 0x31, 0x00, 0x00, 0xC6, 0x30, 0x00, 0xC0, 0xC6, 0x18, 0x00, 0xC0, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 228 -0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0x00, 0x8C, 0x39, 0x00, 0x70, 0x86, 0x31, 0x00, 0x88, 0x86, 0x31, 0x00, 0x88, 0xC6, 0x30, 0x00, 0x88, 0xC6, 0x18, 0x00, 0x70, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 229 -0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0F, 0x00, 0x00, 0x9C, 0x1F, 0x00, 0x00, 0xCC, 0x39, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0x66, 0x18, 0x00, 0x00, 0x6E, 0x1C, 0x00, 0x00, 0xFC, 0x0F, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xCC, 0x1C, 0x00, 0x00, 0xCE, 0x38, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xCC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xE0, 0x04, // 230 -0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x02, 0x00, 0x06, 0x30, 0x02, 0x00, 0x06, 0xF0, 0x02, 0x00, 0x06, 0xB0, 0x03, 0x00, 0x0E, 0x38, 0x01, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x18, 0x0C, // 231 -0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xDC, 0x1C, 0x00, 0x20, 0xCE, 0x38, 0x00, 0x60, 0xC6, 0x30, 0x00, 0xE0, 0xC6, 0x30, 0x00, 0x80, 0xC6, 0x30, 0x00, 0x00, 0xCE, 0x38, 0x00, 0x00, 0xDC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xF0, 0x04, // 232 -0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xDC, 0x1C, 0x00, 0x00, 0xCE, 0x38, 0x00, 0x80, 0xC6, 0x30, 0x00, 0xE0, 0xC6, 0x30, 0x00, 0x60, 0xC6, 0x30, 0x00, 0x20, 0xCE, 0x38, 0x00, 0x00, 0xDC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xF0, 0x04, // 233 -0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xDC, 0x1C, 0x00, 0x80, 0xCE, 0x38, 0x00, 0xC0, 0xC6, 0x30, 0x00, 0x60, 0xC6, 0x30, 0x00, 0x60, 0xC6, 0x30, 0x00, 0xC0, 0xCE, 0x38, 0x00, 0x80, 0xDC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xF0, 0x04, // 234 -0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xDC, 0x1C, 0x00, 0xC0, 0xCE, 0x38, 0x00, 0xC0, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0xC0, 0xCE, 0x38, 0x00, 0xC0, 0xDC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xF0, 0x04, // 235 -0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x60, 0xFE, 0x3F, 0x00, 0xE0, 0xFE, 0x3F, 0x00, 0x80, // 236 -0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xE0, 0xFE, 0x3F, 0x00, 0x60, 0xFE, 0x3F, 0x00, 0x20, // 237 -0x80, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x60, 0xFE, 0x3F, 0x00, 0x60, 0xFE, 0x3F, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x80, // 238 -0xC0, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xC0, // 239 -0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1D, 0x1C, 0x00, 0xA0, 0x0F, 0x38, 0x00, 0xA0, 0x06, 0x30, 0x00, 0xE0, 0x06, 0x30, 0x00, 0xC0, 0x06, 0x30, 0x00, 0xC0, 0x0F, 0x38, 0x00, 0x20, 0x1F, 0x1C, 0x00, 0x00, 0xFC, 0x0F, 0x00, 0x00, 0xE0, 0x07, // 240 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0xC0, 0xFE, 0x3F, 0x00, 0xE0, 0x18, 0x00, 0x00, 0x60, 0x0C, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0xC0, 0x06, 0x00, 0x00, 0xC0, 0x06, 0x00, 0x00, 0xE0, 0x0E, 0x00, 0x00, 0x60, 0xFC, 0x3F, 0x00, 0x00, 0xF8, 0x3F, // 241 -0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x20, 0x0E, 0x38, 0x00, 0x60, 0x06, 0x30, 0x00, 0xE0, 0x06, 0x30, 0x00, 0x80, 0x06, 0x30, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 242 -0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x80, 0x06, 0x30, 0x00, 0xE0, 0x06, 0x30, 0x00, 0x60, 0x06, 0x30, 0x00, 0x20, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 243 -0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x80, 0x0E, 0x38, 0x00, 0xC0, 0x06, 0x30, 0x00, 0x60, 0x06, 0x30, 0x00, 0x60, 0x06, 0x30, 0x00, 0xC0, 0x0E, 0x38, 0x00, 0x80, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 244 -0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0xC0, 0x1C, 0x1C, 0x00, 0xE0, 0x0E, 0x38, 0x00, 0x60, 0x06, 0x30, 0x00, 0x60, 0x06, 0x30, 0x00, 0xC0, 0x06, 0x30, 0x00, 0xC0, 0x0E, 0x38, 0x00, 0xE0, 0x1C, 0x1C, 0x00, 0x60, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 245 -0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0xC0, 0x0E, 0x38, 0x00, 0xC0, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0xC0, 0x0E, 0x38, 0x00, 0xC0, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 246 -0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0xB6, 0x01, 0x00, 0x00, 0xB6, 0x01, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, // 247 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x67, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x3F, 0x00, 0x00, 0x86, 0x33, 0x00, 0x00, 0xE6, 0x31, 0x00, 0x00, 0x76, 0x30, 0x00, 0x00, 0x3E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xFF, 0x0F, 0x00, 0x00, 0xF3, 0x07, // 248 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0F, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x20, 0x00, 0x38, 0x00, 0x60, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x30, 0x00, 0x80, 0x00, 0x30, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, // 249 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0F, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x80, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x30, 0x00, 0x60, 0x00, 0x18, 0x00, 0x20, 0x00, 0x0C, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, // 250 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0F, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x80, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x18, 0x00, 0x80, 0x00, 0x0C, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, // 251 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0F, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0xC0, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x00, 0x0C, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, // 252 -0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x06, 0x00, 0xF0, 0x01, 0x06, 0x00, 0x80, 0x0F, 0x07, 0x80, 0x00, 0xFE, 0x03, 0xE0, 0x00, 0xFC, 0x00, 0x60, 0xC0, 0x1F, 0x00, 0x20, 0xF8, 0x03, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x06, // 253 -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0x07, 0x00, 0x1C, 0x18, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x03, // 254 -0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x06, 0xC0, 0xF0, 0x01, 0x06, 0xC0, 0x80, 0x0F, 0x07, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0xFC, 0x00, 0xC0, 0xC0, 0x1F, 0x00, 0xC0, 0xF8, 0x03, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x06, // 255 + 0x18, // Width: 24 + 0x1C, // Height: 28 + 0x20, // First char: 32 + 0xE0, // Number of chars: 224 + // Jump Table: + 0xFF, 0xFF, 0x00, 0x06, // 32 + 0x00, 0x00, 0x13, 0x06, // 33 + 0x00, 0x13, 0x1A, 0x08, // 34 + 0x00, 0x2D, 0x33, 0x0E, // 35 + 0x00, 0x60, 0x2F, 0x0D, // 36 + 0x00, 0x8F, 0x4F, 0x15, // 37 + 0x00, 0xDE, 0x3B, 0x10, // 38 + 0x01, 0x19, 0x0A, 0x04, // 39 + 0x01, 0x23, 0x1C, 0x08, // 40 + 0x01, 0x3F, 0x1B, 0x08, // 41 + 0x01, 0x5A, 0x21, 0x0A, // 42 + 0x01, 0x7B, 0x32, 0x0E, // 43 + 0x01, 0xAD, 0x10, 0x05, // 44 + 0x01, 0xBD, 0x1B, 0x08, // 45 + 0x01, 0xD8, 0x0F, 0x05, // 46 + 0x01, 0xE7, 0x19, 0x08, // 47 + 0x02, 0x00, 0x2F, 0x0D, // 48 + 0x02, 0x2F, 0x23, 0x0A, // 49 + 0x02, 0x52, 0x2F, 0x0D, // 50 + 0x02, 0x81, 0x2F, 0x0D, // 51 + 0x02, 0xB0, 0x2F, 0x0D, // 52 + 0x02, 0xDF, 0x2F, 0x0D, // 53 + 0x03, 0x0E, 0x2F, 0x0D, // 54 + 0x03, 0x3D, 0x2D, 0x0D, // 55 + 0x03, 0x6A, 0x2F, 0x0D, // 56 + 0x03, 0x99, 0x2F, 0x0D, // 57 + 0x03, 0xC8, 0x0F, 0x05, // 58 + 0x03, 0xD7, 0x10, 0x05, // 59 + 0x03, 0xE7, 0x2F, 0x0D, // 60 + 0x04, 0x16, 0x2F, 0x0D, // 61 + 0x04, 0x45, 0x2E, 0x0D, // 62 + 0x04, 0x73, 0x2E, 0x0D, // 63 + 0x04, 0xA1, 0x5B, 0x18, // 64 + 0x04, 0xFC, 0x3B, 0x10, // 65 + 0x05, 0x37, 0x3B, 0x10, // 66 + 0x05, 0x72, 0x3F, 0x11, // 67 + 0x05, 0xB1, 0x3F, 0x11, // 68 + 0x05, 0xF0, 0x3B, 0x10, // 69 + 0x06, 0x2B, 0x35, 0x0F, // 70 + 0x06, 0x60, 0x43, 0x12, // 71 + 0x06, 0xA3, 0x3B, 0x10, // 72 + 0x06, 0xDE, 0x0F, 0x05, // 73 + 0x06, 0xED, 0x27, 0x0B, // 74 + 0x07, 0x14, 0x3F, 0x11, // 75 + 0x07, 0x53, 0x2F, 0x0D, // 76 + 0x07, 0x82, 0x43, 0x12, // 77 + 0x07, 0xC5, 0x3B, 0x10, // 78 + 0x08, 0x00, 0x47, 0x13, // 79 + 0x08, 0x47, 0x3A, 0x10, // 80 + 0x08, 0x81, 0x47, 0x13, // 81 + 0x08, 0xC8, 0x3F, 0x11, // 82 + 0x09, 0x07, 0x3B, 0x10, // 83 + 0x09, 0x42, 0x35, 0x0F, // 84 + 0x09, 0x77, 0x3B, 0x10, // 85 + 0x09, 0xB2, 0x39, 0x10, // 86 + 0x09, 0xEB, 0x59, 0x18, // 87 + 0x0A, 0x44, 0x3B, 0x10, // 88 + 0x0A, 0x7F, 0x3D, 0x11, // 89 + 0x0A, 0xBC, 0x37, 0x0F, // 90 + 0x0A, 0xF3, 0x14, 0x06, // 91 + 0x0B, 0x07, 0x1B, 0x08, // 92 + 0x0B, 0x22, 0x18, 0x07, // 93 + 0x0B, 0x3A, 0x2A, 0x0C, // 94 + 0x0B, 0x64, 0x34, 0x0E, // 95 + 0x0B, 0x98, 0x11, 0x06, // 96 + 0x0B, 0xA9, 0x2F, 0x0D, // 97 + 0x0B, 0xD8, 0x33, 0x0E, // 98 + 0x0C, 0x0B, 0x2B, 0x0C, // 99 + 0x0C, 0x36, 0x2F, 0x0D, // 100 + 0x0C, 0x65, 0x2F, 0x0D, // 101 + 0x0C, 0x94, 0x1A, 0x08, // 102 + 0x0C, 0xAE, 0x2F, 0x0D, // 103 + 0x0C, 0xDD, 0x2F, 0x0D, // 104 + 0x0D, 0x0C, 0x0F, 0x05, // 105 + 0x0D, 0x1B, 0x10, 0x05, // 106 + 0x0D, 0x2B, 0x2F, 0x0D, // 107 + 0x0D, 0x5A, 0x0F, 0x05, // 108 + 0x0D, 0x69, 0x47, 0x13, // 109 + 0x0D, 0xB0, 0x2F, 0x0D, // 110 + 0x0D, 0xDF, 0x2F, 0x0D, // 111 + 0x0E, 0x0E, 0x33, 0x0E, // 112 + 0x0E, 0x41, 0x30, 0x0D, // 113 + 0x0E, 0x71, 0x1E, 0x09, // 114 + 0x0E, 0x8F, 0x2B, 0x0C, // 115 + 0x0E, 0xBA, 0x1B, 0x08, // 116 + 0x0E, 0xD5, 0x2F, 0x0D, // 117 + 0x0F, 0x04, 0x2A, 0x0C, // 118 + 0x0F, 0x2E, 0x42, 0x12, // 119 + 0x0F, 0x70, 0x2B, 0x0C, // 120 + 0x0F, 0x9B, 0x2A, 0x0C, // 121 + 0x0F, 0xC5, 0x2B, 0x0C, // 122 + 0x0F, 0xF0, 0x1C, 0x08, // 123 + 0x10, 0x0C, 0x10, 0x05, // 124 + 0x10, 0x1C, 0x1B, 0x08, // 125 + 0x10, 0x37, 0x32, 0x0E, // 126 + 0xFF, 0xFF, 0x00, 0x18, // 127 + 0xFF, 0xFF, 0x00, 0x18, // 128 + 0x10, 0x69, 0x2F, 0x0D, // 129 + 0x10, 0x98, 0x16, 0x07, // 130 + 0x10, 0xAE, 0x3B, 0x10, // 131 + 0x10, 0xE9, 0x40, 0x11, // 132 + 0x11, 0x29, 0x34, 0x0E, // 133 + 0x11, 0x5D, 0x3F, 0x11, // 134 + 0x11, 0x9C, 0x2B, 0x0C, // 135 + 0x11, 0xC7, 0x2F, 0x0D, // 136 + 0x11, 0xF6, 0x2B, 0x0C, // 137 + 0xFF, 0xFF, 0x00, 0x18, // 138 + 0xFF, 0xFF, 0x00, 0x18, // 139 + 0xFF, 0xFF, 0x00, 0x18, // 140 + 0xFF, 0xFF, 0x00, 0x18, // 141 + 0xFF, 0xFF, 0x00, 0x18, // 142 + 0xFF, 0xFF, 0x00, 0x18, // 143 + 0xFF, 0xFF, 0x00, 0x18, // 144 + 0xFF, 0xFF, 0x00, 0x18, // 145 + 0xFF, 0xFF, 0x00, 0x18, // 146 + 0x12, 0x21, 0x47, 0x13, // 147 + 0x12, 0x68, 0x2F, 0x0D, // 148 + 0xFF, 0xFF, 0x00, 0x18, // 149 + 0xFF, 0xFF, 0x00, 0x18, // 150 + 0xFF, 0xFF, 0x00, 0x18, // 151 + 0x12, 0x97, 0x3B, 0x10, // 152 + 0x12, 0xD2, 0x2F, 0x0D, // 153 + 0x13, 0x01, 0x3B, 0x10, // 154 + 0x13, 0x3C, 0x2B, 0x0C, // 155 + 0xFF, 0xFF, 0x00, 0x18, // 156 + 0xFF, 0xFF, 0x00, 0x18, // 157 + 0xFF, 0xFF, 0x00, 0x18, // 158 + 0xFF, 0xFF, 0x00, 0x18, // 159 + 0xFF, 0xFF, 0x00, 0x18, // 160 + 0x13, 0x67, 0x14, 0x06, // 161 + 0x13, 0x7B, 0x2B, 0x0C, // 162 + 0x13, 0xA6, 0x2F, 0x0D, // 163 + 0x13, 0xD5, 0x33, 0x0E, // 164 + 0x14, 0x08, 0x31, 0x0E, // 165 + 0x14, 0x39, 0x10, 0x05, // 166 + 0x14, 0x49, 0x2F, 0x0D, // 167 + 0x14, 0x78, 0x19, 0x08, // 168 + 0x14, 0x91, 0x46, 0x13, // 169 + 0x14, 0xD7, 0x1A, 0x08, // 170 + 0x14, 0xF1, 0x27, 0x0B, // 171 + 0x15, 0x18, 0x2F, 0x0D, // 172 + 0x15, 0x47, 0x1B, 0x08, // 173 + 0x15, 0x62, 0x46, 0x13, // 174 + 0x15, 0xA8, 0x31, 0x0E, // 175 + 0x15, 0xD9, 0x1E, 0x09, // 176 + 0x15, 0xF7, 0x33, 0x0E, // 177 + 0x16, 0x2A, 0x1A, 0x08, // 178 + 0x16, 0x44, 0x1A, 0x08, // 179 + 0x16, 0x5E, 0x19, 0x08, // 180 + 0x16, 0x77, 0x2F, 0x0D, // 181 + 0x16, 0xA6, 0x31, 0x0E, // 182 + 0x16, 0xD7, 0x12, 0x06, // 183 + 0x16, 0xE9, 0x18, 0x07, // 184 + 0x17, 0x01, 0x37, 0x0F, // 185 + 0x17, 0x38, 0x1E, 0x09, // 186 + 0x17, 0x56, 0x37, 0x0F, // 187 + 0x17, 0x8D, 0x2B, 0x0C, // 188 + 0x17, 0xB8, 0x4B, 0x14, // 189 + 0x18, 0x03, 0x4B, 0x14, // 190 + 0x18, 0x4E, 0x33, 0x0E, // 191 + 0x18, 0x81, 0x3B, 0x10, // 192 + 0x18, 0xBC, 0x3B, 0x10, // 193 + 0x18, 0xF7, 0x3B, 0x10, // 194 + 0x19, 0x32, 0x3B, 0x10, // 195 + 0x19, 0x6D, 0x3B, 0x10, // 196 + 0x19, 0xA8, 0x3B, 0x10, // 197 + 0x19, 0xE3, 0x5B, 0x18, // 198 + 0x1A, 0x3E, 0x3F, 0x11, // 199 + 0x1A, 0x7D, 0x3B, 0x10, // 200 + 0x1A, 0xB8, 0x3B, 0x10, // 201 + 0x1A, 0xF3, 0x3B, 0x10, // 202 + 0x1B, 0x2E, 0x3B, 0x10, // 203 + 0x1B, 0x69, 0x11, 0x06, // 204 + 0x1B, 0x7A, 0x11, 0x06, // 205 + 0x1B, 0x8B, 0x15, 0x07, // 206 + 0x1B, 0xA0, 0x15, 0x07, // 207 + 0x1B, 0xB5, 0x3F, 0x11, // 208 + 0x1B, 0xF4, 0x3B, 0x10, // 209 + 0x1C, 0x2F, 0x47, 0x13, // 210 + 0x1C, 0x76, 0x47, 0x13, // 211 + 0x1C, 0xBD, 0x47, 0x13, // 212 + 0x1D, 0x04, 0x47, 0x13, // 213 + 0x1D, 0x4B, 0x47, 0x13, // 214 + 0x1D, 0x92, 0x2B, 0x0C, // 215 + 0x1D, 0xBD, 0x47, 0x13, // 216 + 0x1E, 0x04, 0x3B, 0x10, // 217 + 0x1E, 0x3F, 0x3B, 0x10, // 218 + 0x1E, 0x7A, 0x3B, 0x10, // 219 + 0x1E, 0xB5, 0x3B, 0x10, // 220 + 0x1E, 0xF0, 0x3D, 0x11, // 221 + 0x1F, 0x2D, 0x3A, 0x10, // 222 + 0x1F, 0x67, 0x37, 0x0F, // 223 + 0x1F, 0x9E, 0x2F, 0x0D, // 224 + 0x1F, 0xCD, 0x2F, 0x0D, // 225 + 0x1F, 0xFC, 0x2F, 0x0D, // 226 + 0x20, 0x2B, 0x2F, 0x0D, // 227 + 0x20, 0x5A, 0x2F, 0x0D, // 228 + 0x20, 0x89, 0x2F, 0x0D, // 229 + 0x20, 0xB8, 0x53, 0x16, // 230 + 0x21, 0x0B, 0x2B, 0x0C, // 231 + 0x21, 0x36, 0x2F, 0x0D, // 232 + 0x21, 0x65, 0x2F, 0x0D, // 233 + 0x21, 0x94, 0x2F, 0x0D, // 234 + 0x21, 0xC3, 0x2F, 0x0D, // 235 + 0x21, 0xF2, 0x11, 0x06, // 236 + 0x22, 0x03, 0x11, 0x06, // 237 + 0x22, 0x14, 0x15, 0x07, // 238 + 0x22, 0x29, 0x15, 0x07, // 239 + 0x22, 0x3E, 0x2F, 0x0D, // 240 + 0x22, 0x6D, 0x2F, 0x0D, // 241 + 0x22, 0x9C, 0x2F, 0x0D, // 242 + 0x22, 0xCB, 0x2F, 0x0D, // 243 + 0x22, 0xFA, 0x2F, 0x0D, // 244 + 0x23, 0x29, 0x2F, 0x0D, // 245 + 0x23, 0x58, 0x2F, 0x0D, // 246 + 0x23, 0x87, 0x32, 0x0E, // 247 + 0x23, 0xB9, 0x33, 0x0E, // 248 + 0x23, 0xEC, 0x2F, 0x0D, // 249 + 0x24, 0x1B, 0x2F, 0x0D, // 250 + 0x24, 0x4A, 0x2F, 0x0D, // 251 + 0x24, 0x79, 0x2F, 0x0D, // 252 + 0x24, 0xA8, 0x2A, 0x0C, // 253 + 0x24, 0xD2, 0x2F, 0x0D, // 254 + 0x25, 0x01, 0x2A, 0x0C, // 255 + // Font Data: + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x33, 0x00, 0xE0, 0xFF, 0x33, // 33 + 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xE0, 0x07, // 34 + 0x00, 0x0C, 0x03, 0x00, 0x00, 0x0C, 0x33, 0x00, 0x00, 0x0C, 0x3F, 0x00, 0x00, 0xFC, 0x0F, 0x00, 0x80, 0xFF, 0x03, 0x00, 0xE0, 0x0F, 0x03, 0x00, 0x60, 0x0C, 0x33, 0x00, 0x00, 0x0C, 0x3F, 0x00, 0x00, 0xFC, 0x0F, 0x00, 0x80, 0xFF, 0x03, 0x00, 0xE0, 0x0F, 0x03, 0x00, 0x60, 0x0C, 0x03, 0x00, 0x00, 0x0C, 0x03, // 35 + 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x06, 0x00, 0xC0, 0x0F, 0x1E, 0x00, 0xC0, 0x18, 0x1C, 0x00, 0x60, 0x18, 0x38, 0x00, 0x60, 0x30, 0x30, 0x00, 0xF0, 0xFF, 0xFF, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x60, 0x38, 0x00, 0xC0, 0x60, 0x18, 0x00, 0xC0, 0xC1, 0x1F, 0x00, 0x00, 0x81, 0x07, // 36 + 0x00, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x20, 0x20, 0x20, 0x00, 0x60, 0x30, 0x38, 0x00, 0xC0, 0x1F, 0x1E, 0x00, 0x80, 0x8F, 0x0F, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x8F, 0x0F, 0x00, 0xC0, 0xC3, 0x1F, 0x00, 0xE0, 0x60, 0x30, 0x00, 0x20, 0x20, 0x20, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0x80, 0x0F, // 37 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x80, 0xE3, 0x1C, 0x00, 0xC0, 0x77, 0x38, 0x00, 0xE0, 0x3C, 0x30, 0x00, 0x60, 0x38, 0x30, 0x00, 0x60, 0x78, 0x30, 0x00, 0xE0, 0xEC, 0x38, 0x00, 0xC0, 0x8F, 0x1B, 0x00, 0x80, 0x03, 0x1F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0xC0, 0x38, 0x00, 0x00, 0x00, 0x10, // 38 + 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xE0, 0x07, // 39 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0xFE, 0x7F, 0x00, 0x80, 0x0F, 0xF0, 0x01, 0xC0, 0x01, 0x80, 0x03, 0x60, 0x00, 0x00, 0x06, 0x20, 0x00, 0x00, 0x04, // 40 + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x04, 0x60, 0x00, 0x00, 0x06, 0xC0, 0x01, 0x80, 0x03, 0x80, 0x0F, 0xF0, 0x01, 0x00, 0xFE, 0x7F, 0x00, 0x00, 0xF0, 0x0F, // 41 + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x80, // 42 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xFF, 0x0F, 0x00, 0x00, 0xFF, 0x0F, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, // 43 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x03, 0x00, 0x00, 0xF0, 0x01, // 44 + 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, // 45 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, // 46 + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x80, 0x3F, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x60, // 47 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x80, 0xFF, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x38, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0xFF, 0x0F, 0x00, 0x00, 0xFE, 0x03, // 48 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 49 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x30, 0x00, 0xC0, 0x03, 0x38, 0x00, 0xC0, 0x00, 0x3C, 0x00, 0x60, 0x00, 0x36, 0x00, 0x60, 0x00, 0x33, 0x00, 0x60, 0x80, 0x31, 0x00, 0x60, 0xC0, 0x30, 0x00, 0x60, 0x60, 0x30, 0x00, 0xC0, 0x30, 0x30, 0x00, 0xC0, 0x1F, 0x30, 0x00, 0x00, 0x0F, 0x30, // 50 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xC0, 0x01, 0x0E, 0x00, 0xC0, 0x00, 0x1C, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0xC0, 0x38, 0x30, 0x00, 0xC0, 0x6F, 0x18, 0x00, 0x80, 0xC7, 0x0F, 0x00, 0x00, 0x80, 0x07, // 51 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x3C, 0x03, 0x00, 0x00, 0x0E, 0x03, 0x00, 0x80, 0x07, 0x03, 0x00, 0xC0, 0x01, 0x03, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, // 52 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x06, 0x00, 0x80, 0x3F, 0x0E, 0x00, 0xE0, 0x1F, 0x18, 0x00, 0x60, 0x08, 0x30, 0x00, 0x60, 0x0C, 0x30, 0x00, 0x60, 0x0C, 0x30, 0x00, 0x60, 0x0C, 0x30, 0x00, 0x60, 0x0C, 0x30, 0x00, 0x60, 0x18, 0x1C, 0x00, 0x60, 0xF0, 0x0F, 0x00, 0x00, 0xE0, 0x03, // 53 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x03, 0x00, 0x80, 0xFF, 0x0F, 0x00, 0xC0, 0x63, 0x1C, 0x00, 0xC0, 0x30, 0x38, 0x00, 0x60, 0x18, 0x30, 0x00, 0x60, 0x18, 0x30, 0x00, 0x60, 0x18, 0x30, 0x00, 0x60, 0x18, 0x30, 0x00, 0xE0, 0x30, 0x18, 0x00, 0xC0, 0xF1, 0x0F, 0x00, 0x80, 0xC1, 0x07, // 54 + 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x3C, 0x00, 0x60, 0x80, 0x3F, 0x00, 0x60, 0xE0, 0x03, 0x00, 0x60, 0x78, 0x00, 0x00, 0x60, 0x0E, 0x00, 0x00, 0x60, 0x03, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x60, // 55 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x80, 0xC7, 0x1F, 0x00, 0xC0, 0x6F, 0x18, 0x00, 0xE0, 0x38, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0xE0, 0x38, 0x30, 0x00, 0xC0, 0x6F, 0x18, 0x00, 0x80, 0xC7, 0x1F, 0x00, 0x00, 0x80, 0x07, // 56 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x0C, 0x00, 0x80, 0x7F, 0x1C, 0x00, 0xC0, 0x61, 0x38, 0x00, 0x60, 0xC0, 0x30, 0x00, 0x60, 0xC0, 0x30, 0x00, 0x60, 0xC0, 0x30, 0x00, 0x60, 0xC0, 0x30, 0x00, 0x60, 0x60, 0x18, 0x00, 0xC0, 0x31, 0x1E, 0x00, 0x80, 0xFF, 0x0F, 0x00, 0x00, 0xFE, 0x01, // 57 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, // 58 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x30, 0x03, 0x00, 0x06, 0xF0, 0x01, // 59 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0xD8, 0x00, 0x00, 0x00, 0xD8, 0x00, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x03, 0x06, // 60 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, // 61 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0xD8, 0x00, 0x00, 0x00, 0xD8, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x20, // 62 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x60, 0x80, 0x33, 0x00, 0x60, 0xC0, 0x33, 0x00, 0x60, 0xE0, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0xC0, 0x38, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0x00, 0x07, // 63 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x1E, 0xF0, 0x00, 0x00, 0x07, 0xC0, 0x01, 0x80, 0xC3, 0x87, 0x01, 0xC0, 0xF1, 0x9F, 0x03, 0xC0, 0x38, 0x18, 0x03, 0xC0, 0x0C, 0x30, 0x03, 0x60, 0x0E, 0x30, 0x06, 0x60, 0x06, 0x30, 0x06, 0x60, 0x06, 0x18, 0x06, 0x60, 0x06, 0x0C, 0x06, 0x60, 0x0C, 0x1E, 0x06, 0x60, 0xF8, 0x3F, 0x06, 0xE0, 0xFE, 0x31, 0x06, 0xC0, 0x0E, 0x30, 0x06, 0xC0, 0x01, 0x18, 0x03, 0x80, 0x03, 0x1C, 0x03, 0x00, 0x07, 0x8F, 0x01, 0x00, 0xFE, 0x87, 0x01, 0x00, 0xF8, 0xC1, 0x00, 0x00, 0x00, 0x40, // 64 + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x80, 0x8F, 0x01, 0x00, 0xE0, 0x83, 0x01, 0x00, 0x60, 0x80, 0x01, 0x00, 0xE0, 0x83, 0x01, 0x00, 0x80, 0x8F, 0x01, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 65 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0xC0, 0x78, 0x30, 0x00, 0xC0, 0xFF, 0x18, 0x00, 0x80, 0xC7, 0x1F, 0x00, 0x00, 0x80, 0x07, // 66 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x03, 0x0F, 0x00, 0x00, 0x02, 0x03, // 67 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x03, 0x0E, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 68 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 69 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, // 70 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x18, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x60, 0x30, 0x00, 0x60, 0x60, 0x30, 0x00, 0xE0, 0x60, 0x38, 0x00, 0xC0, 0x60, 0x18, 0x00, 0xC0, 0x61, 0x18, 0x00, 0x80, 0xE3, 0x0F, 0x00, 0x00, 0xE2, 0x0F, // 71 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 72 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 73 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0xE0, 0xFF, 0x1F, 0x00, 0xE0, 0xFF, 0x0F, // 74 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0xE7, 0x01, 0x00, 0x80, 0x83, 0x07, 0x00, 0xC0, 0x01, 0x0F, 0x00, 0xE0, 0x00, 0x1E, 0x00, 0x60, 0x00, 0x38, 0x00, 0x20, 0x00, 0x30, 0x00, 0x00, 0x00, 0x20, // 75 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, // 76 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0x01, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 77 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 78 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 79 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0xC0, 0x30, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0x00, 0x0F, // 80 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x0C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x18, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x36, 0x00, 0x60, 0x00, 0x36, 0x00, 0xE0, 0x00, 0x3C, 0x00, 0xC0, 0x00, 0x1C, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x3F, 0x00, 0x00, 0xFF, 0x77, 0x00, 0x00, 0xFC, 0x61, // 81 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x70, 0x00, 0x00, 0x60, 0xF0, 0x00, 0x00, 0x60, 0xF0, 0x03, 0x00, 0x60, 0xB0, 0x07, 0x00, 0xE0, 0x18, 0x1F, 0x00, 0xC0, 0x1F, 0x3C, 0x00, 0x80, 0x0F, 0x30, 0x00, 0x00, 0x00, 0x20, // 82 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x0F, 0x00, 0xC0, 0x1F, 0x1C, 0x00, 0xC0, 0x18, 0x18, 0x00, 0x60, 0x38, 0x38, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x70, 0x30, 0x00, 0xC0, 0x60, 0x18, 0x00, 0xC0, 0xE1, 0x18, 0x00, 0x80, 0xC3, 0x0F, 0x00, 0x00, 0x83, 0x07, // 83 + 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, // 84 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x03, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0x03, // 85 + 0x20, 0x00, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0xF8, 0x01, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x3E, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x20, // 86 + 0x60, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x80, 0xFF, 0x00, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x80, 0x1F, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x80, 0xFF, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x60, // 87 + 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x30, 0x00, 0x60, 0x00, 0x3C, 0x00, 0xE0, 0x01, 0x1E, 0x00, 0xC0, 0x83, 0x07, 0x00, 0x00, 0xCF, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xCF, 0x03, 0x00, 0xC0, 0x03, 0x07, 0x00, 0xE0, 0x01, 0x1E, 0x00, 0x60, 0x00, 0x3C, 0x00, 0x20, 0x00, 0x30, 0x00, 0x00, 0x00, 0x20, // 88 + 0x20, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, // 89 + 0x00, 0x00, 0x30, 0x00, 0x60, 0x00, 0x38, 0x00, 0x60, 0x00, 0x3C, 0x00, 0x60, 0x00, 0x37, 0x00, 0x60, 0x80, 0x33, 0x00, 0x60, 0xC0, 0x31, 0x00, 0x60, 0xE0, 0x30, 0x00, 0x60, 0x38, 0x30, 0x00, 0x60, 0x1C, 0x30, 0x00, 0x60, 0x0E, 0x30, 0x00, 0x60, 0x07, 0x30, 0x00, 0xE0, 0x01, 0x30, 0x00, 0xE0, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, // 90 + 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0x07, 0x60, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x06, // 91 + 0x60, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 92 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x06, 0xE0, 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0x07, // 93 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0xC0, 0x07, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x20, // 94 + 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, // 95 + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x80, // 96 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0x00, 0x8C, 0x39, 0x00, 0x00, 0x86, 0x31, 0x00, 0x00, 0x86, 0x31, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x18, 0x00, 0x00, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 97 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x18, 0x0C, 0x00, 0x00, 0x0C, 0x18, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xE0, 0x03, // 98 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x18, 0x0C, // 99 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0C, 0x18, 0x00, 0x00, 0x18, 0x0C, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 100 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xDC, 0x1C, 0x00, 0x00, 0xCE, 0x38, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xCE, 0x38, 0x00, 0x00, 0xDC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xF0, 0x04, // 101 + 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0xC0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x06, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x60, 0x06, // 102 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x83, 0x01, 0x00, 0xF8, 0x8F, 0x03, 0x00, 0x1C, 0x1C, 0x07, 0x00, 0x0E, 0x38, 0x06, 0x00, 0x06, 0x30, 0x06, 0x00, 0x06, 0x30, 0x06, 0x00, 0x06, 0x30, 0x06, 0x00, 0x0C, 0x18, 0x07, 0x00, 0x18, 0x8C, 0x03, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0xFE, 0xFF, // 103 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0xF8, 0x3F, // 104 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xFE, 0x3F, 0x00, 0x60, 0xFE, 0x3F, // 105 + 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x60, 0xFE, 0xFF, 0x07, 0x60, 0xFE, 0xFF, 0x03, // 106 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xF0, 0x01, 0x00, 0x00, 0x98, 0x07, 0x00, 0x00, 0x0C, 0x0E, 0x00, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x02, 0x30, 0x00, 0x00, 0x00, 0x20, // 107 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 108 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0xF8, 0x3F, // 109 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0xF8, 0x3F, // 110 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 111 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x07, 0x00, 0xFE, 0xFF, 0x07, 0x00, 0x18, 0x0C, 0x00, 0x00, 0x0C, 0x18, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xE0, 0x03, // 112 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0C, 0x18, 0x00, 0x00, 0x18, 0x0C, 0x00, 0x00, 0xFE, 0xFF, 0x07, 0x00, 0xFE, 0xFF, 0x07, // 113 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, // 114 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0C, 0x00, 0x00, 0x7C, 0x1C, 0x00, 0x00, 0xEE, 0x38, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x31, 0x00, 0x00, 0xC6, 0x31, 0x00, 0x00, 0x8E, 0x39, 0x00, 0x00, 0x9C, 0x1F, 0x00, 0x00, 0x18, 0x0F, // 115 + 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0xC0, 0xFF, 0x1F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, // 116 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0F, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, // 117 + 0x00, 0x06, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0xC0, 0x07, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x06, // 118 + 0x00, 0x0E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x0E, // 119 + 0x00, 0x02, 0x20, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x1E, 0x3C, 0x00, 0x00, 0x38, 0x0E, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x38, 0x0E, 0x00, 0x00, 0x1C, 0x3C, 0x00, 0x00, 0x0E, 0x30, 0x00, 0x00, 0x02, 0x20, // 120 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x06, 0x00, 0xF0, 0x01, 0x06, 0x00, 0x80, 0x0F, 0x07, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0xFC, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0xF8, 0x03, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x06, // 121 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x06, 0x3E, 0x00, 0x00, 0x06, 0x37, 0x00, 0x00, 0xC6, 0x33, 0x00, 0x00, 0xE6, 0x30, 0x00, 0x00, 0x76, 0x30, 0x00, 0x00, 0x3E, 0x30, 0x00, 0x00, 0x1E, 0x30, 0x00, 0x00, 0x06, 0x30, // 122 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xC0, 0x03, 0x00, 0xC0, 0x7F, 0xFE, 0x03, 0xE0, 0x3F, 0xFC, 0x07, 0x60, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x06, // 123 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x0F, 0xE0, 0xFF, 0xFF, 0x0F, // 124 + 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x06, 0xE0, 0x3F, 0xFC, 0x07, 0xC0, 0x7F, 0xFF, 0x03, 0x00, 0xC0, 0x03, 0x00, 0x00, 0x80, 0x01, // 125 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x60, // 126 + 0x00, 0x60, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x0C, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, // 129 + 0x00, 0x60, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x06, // 130 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x10, 0x3C, 0x00, 0x00, 0x1C, 0x70, 0x00, 0x00, 0x0C, 0xE0, 0x01, 0x00, 0x04, 0x80, 0x03, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 131 + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x80, 0x8F, 0x01, 0x00, 0xE0, 0x83, 0x01, 0x00, 0x60, 0x80, 0x01, 0x00, 0xE0, 0x83, 0x01, 0x00, 0x80, 0x8F, 0x01, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xB0, 0x03, 0x00, 0x00, 0x00, 0x03, // 132 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0x00, 0x8C, 0x39, 0x00, 0x00, 0x86, 0x31, 0x00, 0x00, 0x86, 0x31, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x18, 0x00, 0x00, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0xFF, 0x01, 0x00, 0x00, 0xA0, 0x03, 0x00, 0x00, 0x00, 0x03, // 133 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x68, 0x00, 0x30, 0x00, 0x6E, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0x62, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x03, 0x0F, 0x00, 0x00, 0x02, 0x03, // 134 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x80, 0x06, 0x30, 0x00, 0xE0, 0x06, 0x30, 0x00, 0x60, 0x06, 0x30, 0x00, 0x20, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x18, 0x0C, // 135 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, 0xE0, 0x06, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x20, 0x0E, 0x00, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0xF8, 0x3F, // 136 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x06, 0x3E, 0x00, 0x00, 0x06, 0x37, 0x00, 0x80, 0xC6, 0x33, 0x00, 0xE0, 0xE6, 0x30, 0x00, 0x60, 0x76, 0x30, 0x00, 0x20, 0x3E, 0x30, 0x00, 0x00, 0x1E, 0x30, 0x00, 0x00, 0x06, 0x30, // 137 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x68, 0x00, 0x30, 0x00, 0x6E, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0xE2, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 147 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x06, 0x30, 0x00, 0x80, 0x06, 0x30, 0x00, 0xE0, 0x06, 0x30, 0x00, 0x60, 0x0E, 0x38, 0x00, 0x20, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 148 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0xF0, 0x01, 0x60, 0x30, 0xB0, 0x03, 0x60, 0x30, 0x30, 0x03, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 152 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xDC, 0x1C, 0x00, 0x00, 0xCE, 0x38, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0xF0, 0x01, 0x00, 0xC6, 0xB0, 0x03, 0x00, 0xCE, 0x38, 0x03, 0x00, 0xDC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xF0, 0x04, // 153 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x0F, 0x00, 0xC0, 0x1F, 0x1C, 0x00, 0xC0, 0x18, 0x18, 0x00, 0x60, 0x38, 0x38, 0x00, 0x60, 0x30, 0x30, 0x00, 0x68, 0x30, 0x30, 0x00, 0x6E, 0x30, 0x30, 0x00, 0x66, 0x30, 0x30, 0x00, 0x62, 0x70, 0x30, 0x00, 0xC0, 0x60, 0x18, 0x00, 0xC0, 0xE1, 0x18, 0x00, 0x80, 0xC3, 0x0F, 0x00, 0x00, 0x83, 0x07, // 154 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0C, 0x00, 0x00, 0x7C, 0x1C, 0x00, 0x00, 0xEE, 0x38, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x80, 0xC6, 0x30, 0x00, 0xE0, 0xC6, 0x31, 0x00, 0x60, 0xC6, 0x31, 0x00, 0x20, 0x8E, 0x39, 0x00, 0x00, 0x9C, 0x1F, 0x00, 0x00, 0x18, 0x0F, // 155 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE6, 0xFF, 0x07, 0x00, 0xE6, 0xFF, 0x07, // 161 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x9C, 0x07, 0x00, 0x0E, 0x78, 0x00, 0x00, 0x06, 0x3F, 0x00, 0x00, 0xF6, 0x30, 0x00, 0x00, 0x0E, 0x30, 0x00, 0xE0, 0x0D, 0x1C, 0x00, 0x00, 0x1C, 0x0E, 0x00, 0x00, 0x10, 0x06, // 162 + 0x00, 0x60, 0x10, 0x00, 0x00, 0x60, 0x38, 0x00, 0x00, 0x7F, 0x1C, 0x00, 0xC0, 0xFF, 0x1F, 0x00, 0xE0, 0xE0, 0x19, 0x00, 0x60, 0x60, 0x18, 0x00, 0x60, 0x60, 0x18, 0x00, 0x60, 0x60, 0x30, 0x00, 0xE0, 0x00, 0x30, 0x00, 0xC0, 0x01, 0x30, 0x00, 0x80, 0x01, 0x38, 0x00, 0x00, 0x00, 0x10, // 163 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0xF7, 0x0E, 0x00, 0x00, 0xFE, 0x07, 0x00, 0x00, 0x0C, 0x03, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x0C, 0x03, 0x00, 0x00, 0xFE, 0x07, 0x00, 0x00, 0xF7, 0x0E, 0x00, 0x00, 0x02, 0x04, // 164 + 0xE0, 0x60, 0x06, 0x00, 0xC0, 0x61, 0x06, 0x00, 0x80, 0x67, 0x06, 0x00, 0x00, 0x7E, 0x06, 0x00, 0x00, 0x7C, 0x06, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x7C, 0x06, 0x00, 0x00, 0x7E, 0x06, 0x00, 0x80, 0x67, 0x06, 0x00, 0xC0, 0x61, 0x06, 0x00, 0xE0, 0x60, 0x06, 0x00, 0x20, // 165 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x7F, 0xF8, 0x0F, 0xE0, 0x7F, 0xF8, 0x0F, // 166 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x80, 0xF3, 0xC1, 0x00, 0xC0, 0x1F, 0xC3, 0x03, 0xE0, 0x0C, 0x07, 0x03, 0x60, 0x1C, 0x06, 0x06, 0x60, 0x18, 0x0C, 0x06, 0x60, 0x30, 0x1C, 0x06, 0xE0, 0x70, 0x38, 0x07, 0xC0, 0xE1, 0xF4, 0x03, 0x80, 0xC1, 0xE7, 0x01, 0x00, 0x80, 0x03, // 167 + 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, // 168 + 0x00, 0xF8, 0x00, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0x07, 0x07, 0x00, 0x80, 0x01, 0x0C, 0x00, 0xC0, 0x79, 0x1C, 0x00, 0xC0, 0xFE, 0x19, 0x00, 0x60, 0x86, 0x31, 0x00, 0x60, 0x03, 0x33, 0x00, 0x60, 0x03, 0x33, 0x00, 0x60, 0x03, 0x33, 0x00, 0x60, 0x03, 0x33, 0x00, 0x60, 0x87, 0x33, 0x00, 0xC0, 0x86, 0x19, 0x00, 0xC0, 0x85, 0x1C, 0x00, 0x80, 0x01, 0x0C, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0xF8, // 169 + 0x00, 0x00, 0x00, 0x00, 0xC0, 0x1C, 0x00, 0x00, 0xE0, 0x3E, 0x00, 0x00, 0x60, 0x32, 0x00, 0x00, 0x60, 0x32, 0x00, 0x00, 0xE0, 0x3F, 0x00, 0x00, 0xC0, 0x3F, // 170 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x78, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x84, 0x10, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x78, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x04, 0x10, // 171 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFC, 0x01, // 172 + 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, // 173 + 0x00, 0xF8, 0x00, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0x07, 0x07, 0x00, 0x80, 0x01, 0x0C, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0xFE, 0x1B, 0x00, 0x60, 0xFE, 0x33, 0x00, 0x60, 0x66, 0x30, 0x00, 0x60, 0x66, 0x30, 0x00, 0x60, 0xE6, 0x30, 0x00, 0x60, 0xFE, 0x31, 0x00, 0x60, 0x3C, 0x33, 0x00, 0xC0, 0x00, 0x1A, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x01, 0x0C, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0xF8, // 174 + 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, // 175 + 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x80, 0x03, // 176 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0xFF, 0x3F, 0x00, 0x00, 0xFF, 0x3F, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x60, 0x30, // 177 + 0x40, 0x20, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x20, 0x38, 0x00, 0x00, 0x20, 0x2C, 0x00, 0x00, 0x20, 0x26, 0x00, 0x00, 0xE0, 0x23, 0x00, 0x00, 0xC0, 0x21, // 178 + 0x40, 0x10, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x20, 0x22, 0x00, 0x00, 0x20, 0x22, 0x00, 0x00, 0xE0, 0x3D, 0x00, 0x00, 0xC0, 0x1D, // 179 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, // 180 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x07, 0x00, 0xFE, 0xFF, 0x07, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, // 181 + 0x00, 0x0F, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0xE0, 0x7F, 0x00, 0x00, 0xE0, 0x7F, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0x07, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0x07, 0x60, 0x00, 0x00, 0x00, 0x60, // 182 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, // 183 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xC0, 0x02, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x01, // 184 + 0x00, 0x00, 0x30, 0x00, 0x60, 0x00, 0x38, 0x00, 0x60, 0x00, 0x3C, 0x00, 0x60, 0x00, 0x37, 0x00, 0x60, 0x80, 0x33, 0x00, 0x60, 0xC0, 0x31, 0x00, 0x68, 0xE0, 0x30, 0x00, 0x6E, 0x38, 0x30, 0x00, 0x66, 0x1C, 0x30, 0x00, 0x62, 0x0E, 0x30, 0x00, 0x60, 0x07, 0x30, 0x00, 0xE0, 0x01, 0x30, 0x00, 0xE0, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, // 185 + 0x00, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0xE0, 0x38, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0xE0, 0x38, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0x80, 0x0F, // 186 + 0x00, 0x00, 0x30, 0x00, 0x60, 0x00, 0x38, 0x00, 0x60, 0x00, 0x3C, 0x00, 0x60, 0x00, 0x37, 0x00, 0x60, 0x80, 0x33, 0x00, 0x60, 0xC0, 0x31, 0x00, 0x6C, 0xE0, 0x30, 0x00, 0x6C, 0x38, 0x30, 0x00, 0x60, 0x1C, 0x30, 0x00, 0x60, 0x0E, 0x30, 0x00, 0x60, 0x07, 0x30, 0x00, 0xE0, 0x01, 0x30, 0x00, 0xE0, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, // 187 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x06, 0x3E, 0x00, 0x00, 0x06, 0x37, 0x00, 0xC0, 0xC6, 0x33, 0x00, 0xC0, 0xE6, 0x30, 0x00, 0x00, 0x76, 0x30, 0x00, 0x00, 0x3E, 0x30, 0x00, 0x00, 0x1E, 0x30, 0x00, 0x00, 0x06, 0x30, // 188 + 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x20, 0x00, 0xE0, 0x3F, 0x30, 0x00, 0xE0, 0x3F, 0x1C, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x4E, 0x20, 0x00, 0x00, 0x67, 0x30, 0x00, 0xC0, 0x21, 0x38, 0x00, 0xE0, 0x20, 0x2C, 0x00, 0x60, 0x20, 0x26, 0x00, 0x00, 0xE0, 0x27, 0x00, 0x00, 0xC0, 0x21, // 189 + 0x40, 0x10, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x20, 0x22, 0x20, 0x00, 0x20, 0x22, 0x30, 0x00, 0xE0, 0x3D, 0x38, 0x00, 0xC0, 0x1D, 0x0E, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x0E, 0x0C, 0x00, 0x00, 0x07, 0x0E, 0x00, 0x80, 0x83, 0x0B, 0x00, 0xE0, 0xC0, 0x08, 0x00, 0x60, 0xE0, 0x3F, 0x00, 0x20, 0xE0, 0x3F, 0x00, 0x00, 0x00, 0x08, // 190 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF8, 0x03, 0x00, 0x00, 0x1E, 0x03, 0x00, 0x00, 0x07, 0x07, 0x00, 0xE6, 0x03, 0x06, 0x00, 0xE6, 0x01, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0xC0, // 191 + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x82, 0x8F, 0x01, 0x00, 0xE6, 0x83, 0x01, 0x00, 0x6E, 0x80, 0x01, 0x00, 0xE8, 0x83, 0x01, 0x00, 0x80, 0x8F, 0x01, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 192 + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x80, 0x8F, 0x01, 0x00, 0xE8, 0x83, 0x01, 0x00, 0x6E, 0x80, 0x01, 0x00, 0xE6, 0x83, 0x01, 0x00, 0x82, 0x8F, 0x01, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 193 + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x88, 0x8F, 0x01, 0x00, 0xEC, 0x83, 0x01, 0x00, 0x66, 0x80, 0x01, 0x00, 0xE6, 0x83, 0x01, 0x00, 0x8C, 0x8F, 0x01, 0x00, 0x08, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 194 + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x0C, 0xFE, 0x01, 0x00, 0x8E, 0x8F, 0x01, 0x00, 0xE6, 0x83, 0x01, 0x00, 0x66, 0x80, 0x01, 0x00, 0xEC, 0x83, 0x01, 0x00, 0x8C, 0x8F, 0x01, 0x00, 0x0E, 0xFE, 0x01, 0x00, 0x06, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 195 + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x8C, 0x8F, 0x01, 0x00, 0xEC, 0x83, 0x01, 0x00, 0x60, 0x80, 0x01, 0x00, 0xE0, 0x83, 0x01, 0x00, 0x8C, 0x8F, 0x01, 0x00, 0x0C, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 196 + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x9C, 0x8F, 0x01, 0x00, 0xE2, 0x83, 0x01, 0x00, 0x62, 0x80, 0x01, 0x00, 0xE2, 0x83, 0x01, 0x00, 0x9C, 0x8F, 0x01, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x30, // 197 + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0xF0, 0x01, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00, 0x8F, 0x01, 0x00, 0xC0, 0x83, 0x01, 0x00, 0xE0, 0x80, 0x01, 0x00, 0x60, 0x80, 0x01, 0x00, 0x60, 0x80, 0x01, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 198 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0x60, 0x00, 0x30, 0x02, 0x60, 0x00, 0x30, 0x02, 0x60, 0x00, 0xF0, 0x02, 0x60, 0x00, 0xB0, 0x03, 0x60, 0x00, 0x30, 0x01, 0x60, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x03, 0x0F, 0x00, 0x00, 0x02, 0x03, // 199 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x62, 0x30, 0x30, 0x00, 0x66, 0x30, 0x30, 0x00, 0x6E, 0x30, 0x30, 0x00, 0x68, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 200 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x68, 0x30, 0x30, 0x00, 0x6E, 0x30, 0x30, 0x00, 0x66, 0x30, 0x30, 0x00, 0x62, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 201 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x68, 0x30, 0x30, 0x00, 0x6C, 0x30, 0x30, 0x00, 0x66, 0x30, 0x30, 0x00, 0x66, 0x30, 0x30, 0x00, 0x6C, 0x30, 0x30, 0x00, 0x68, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 202 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x6C, 0x30, 0x30, 0x00, 0x6C, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x6C, 0x30, 0x30, 0x00, 0x6C, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, // 203 + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xE6, 0xFF, 0x3F, 0x00, 0xEE, 0xFF, 0x3F, 0x00, 0x08, // 204 + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xEE, 0xFF, 0x3F, 0x00, 0xE6, 0xFF, 0x3F, 0x00, 0x02, // 205 + 0x08, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0xE6, 0xFF, 0x3F, 0x00, 0xE6, 0xFF, 0x3F, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, // 206 + 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, // 207 + 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x30, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x03, 0x0E, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 208 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x8C, 0x03, 0x00, 0x00, 0x0E, 0x0E, 0x00, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x06, 0x70, 0x00, 0x00, 0x0C, 0xE0, 0x01, 0x00, 0x0C, 0x80, 0x03, 0x00, 0x0E, 0x00, 0x0F, 0x00, 0x06, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, // 209 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x62, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0x6E, 0x00, 0x30, 0x00, 0x68, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 210 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x60, 0x00, 0x30, 0x00, 0x68, 0x00, 0x30, 0x00, 0x6E, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0x62, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 211 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x68, 0x00, 0x30, 0x00, 0x6C, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0x6C, 0x00, 0x30, 0x00, 0xE8, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 212 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xCC, 0x00, 0x18, 0x00, 0xEE, 0x00, 0x38, 0x00, 0x66, 0x00, 0x30, 0x00, 0x66, 0x00, 0x30, 0x00, 0x6C, 0x00, 0x30, 0x00, 0x6C, 0x00, 0x30, 0x00, 0x6E, 0x00, 0x30, 0x00, 0xE6, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 213 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x80, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xE0, 0x00, 0x38, 0x00, 0x6C, 0x00, 0x30, 0x00, 0x6C, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x6C, 0x00, 0x30, 0x00, 0xEC, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x01, 0x1C, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, // 214 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x8E, 0x03, 0x00, 0x00, 0xDC, 0x01, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0xDC, 0x01, 0x00, 0x00, 0x8E, 0x03, 0x00, 0x00, 0x06, 0x03, // 215 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x21, 0x00, 0x00, 0xFF, 0x77, 0x00, 0x80, 0x07, 0x3F, 0x00, 0xC0, 0x01, 0x1E, 0x00, 0xC0, 0x00, 0x1F, 0x00, 0xE0, 0x80, 0x3B, 0x00, 0x60, 0xC0, 0x31, 0x00, 0x60, 0xE0, 0x30, 0x00, 0x60, 0x70, 0x30, 0x00, 0x60, 0x38, 0x30, 0x00, 0x60, 0x1C, 0x30, 0x00, 0xE0, 0x0E, 0x38, 0x00, 0xC0, 0x07, 0x18, 0x00, 0xC0, 0x03, 0x1C, 0x00, 0xE0, 0x07, 0x0F, 0x00, 0x70, 0xFF, 0x07, 0x00, 0x20, 0xFC, 0x01, // 216 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x03, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x02, 0x00, 0x30, 0x00, 0x06, 0x00, 0x30, 0x00, 0x0E, 0x00, 0x30, 0x00, 0x08, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0x03, // 217 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x03, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x08, 0x00, 0x30, 0x00, 0x0E, 0x00, 0x30, 0x00, 0x06, 0x00, 0x30, 0x00, 0x02, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0x03, // 218 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x03, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x08, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x06, 0x00, 0x30, 0x00, 0x06, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x08, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0x03, // 219 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x03, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0x03, // 220 + 0x20, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x08, 0xF0, 0x3F, 0x00, 0x0E, 0xF0, 0x3F, 0x00, 0x06, 0x3C, 0x00, 0x00, 0x02, 0x1E, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, // 221 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0xE0, 0xFF, 0x3F, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00, 0x86, 0x03, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 0xF8, // 222 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x3F, 0x00, 0xC0, 0xFF, 0x3F, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x60, 0x00, 0x08, 0x00, 0x60, 0x00, 0x1C, 0x00, 0x60, 0x00, 0x38, 0x00, 0xE0, 0x78, 0x30, 0x00, 0xC0, 0x7F, 0x30, 0x00, 0x80, 0xC7, 0x30, 0x00, 0x00, 0x80, 0x39, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x0F, // 223 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0x00, 0x8C, 0x39, 0x00, 0x20, 0x86, 0x31, 0x00, 0x60, 0x86, 0x31, 0x00, 0xE0, 0xC6, 0x30, 0x00, 0x80, 0xC6, 0x18, 0x00, 0x00, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 224 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0x00, 0x8C, 0x39, 0x00, 0x00, 0x86, 0x31, 0x00, 0x80, 0x86, 0x31, 0x00, 0xE0, 0xC6, 0x30, 0x00, 0x60, 0xC6, 0x18, 0x00, 0x20, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 225 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0x80, 0x8C, 0x39, 0x00, 0xC0, 0x86, 0x31, 0x00, 0x60, 0x86, 0x31, 0x00, 0x60, 0xC6, 0x30, 0x00, 0xC0, 0xC6, 0x18, 0x00, 0x80, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 226 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0xC0, 0x1C, 0x1F, 0x00, 0xE0, 0x8C, 0x39, 0x00, 0x60, 0x86, 0x31, 0x00, 0x60, 0x86, 0x31, 0x00, 0xC0, 0xC6, 0x30, 0x00, 0xC0, 0xC6, 0x18, 0x00, 0xE0, 0xCE, 0x0C, 0x00, 0x60, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 227 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0xC0, 0x8C, 0x39, 0x00, 0xC0, 0x86, 0x31, 0x00, 0x00, 0x86, 0x31, 0x00, 0x00, 0xC6, 0x30, 0x00, 0xC0, 0xC6, 0x18, 0x00, 0xC0, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 228 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E, 0x00, 0x00, 0x1C, 0x1F, 0x00, 0x00, 0x8C, 0x39, 0x00, 0x70, 0x86, 0x31, 0x00, 0x88, 0x86, 0x31, 0x00, 0x88, 0xC6, 0x30, 0x00, 0x88, 0xC6, 0x18, 0x00, 0x70, 0xCE, 0x0C, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x20, // 229 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0F, 0x00, 0x00, 0x9C, 0x1F, 0x00, 0x00, 0xCC, 0x39, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0x66, 0x18, 0x00, 0x00, 0x6E, 0x1C, 0x00, 0x00, 0xFC, 0x0F, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xCC, 0x1C, 0x00, 0x00, 0xCE, 0x38, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xCC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xE0, 0x04, // 230 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x02, 0x00, 0x06, 0x30, 0x02, 0x00, 0x06, 0xF0, 0x02, 0x00, 0x06, 0xB0, 0x03, 0x00, 0x0E, 0x38, 0x01, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x18, 0x0C, // 231 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xDC, 0x1C, 0x00, 0x20, 0xCE, 0x38, 0x00, 0x60, 0xC6, 0x30, 0x00, 0xE0, 0xC6, 0x30, 0x00, 0x80, 0xC6, 0x30, 0x00, 0x00, 0xCE, 0x38, 0x00, 0x00, 0xDC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xF0, 0x04, // 232 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xDC, 0x1C, 0x00, 0x00, 0xCE, 0x38, 0x00, 0x80, 0xC6, 0x30, 0x00, 0xE0, 0xC6, 0x30, 0x00, 0x60, 0xC6, 0x30, 0x00, 0x20, 0xCE, 0x38, 0x00, 0x00, 0xDC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xF0, 0x04, // 233 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xDC, 0x1C, 0x00, 0x80, 0xCE, 0x38, 0x00, 0xC0, 0xC6, 0x30, 0x00, 0x60, 0xC6, 0x30, 0x00, 0x60, 0xC6, 0x30, 0x00, 0xC0, 0xCE, 0x38, 0x00, 0x80, 0xDC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xF0, 0x04, // 234 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xDC, 0x1C, 0x00, 0xC0, 0xCE, 0x38, 0x00, 0xC0, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0x00, 0xC6, 0x30, 0x00, 0xC0, 0xCE, 0x38, 0x00, 0xC0, 0xDC, 0x18, 0x00, 0x00, 0xF8, 0x0C, 0x00, 0x00, 0xF0, 0x04, // 235 + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x60, 0xFE, 0x3F, 0x00, 0xE0, 0xFE, 0x3F, 0x00, 0x80, // 236 + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xE0, 0xFE, 0x3F, 0x00, 0x60, 0xFE, 0x3F, 0x00, 0x20, // 237 + 0x80, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x60, 0xFE, 0x3F, 0x00, 0x60, 0xFE, 0x3F, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x80, // 238 + 0xC0, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xC0, // 239 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1D, 0x1C, 0x00, 0xA0, 0x0F, 0x38, 0x00, 0xA0, 0x06, 0x30, 0x00, 0xE0, 0x06, 0x30, 0x00, 0xC0, 0x06, 0x30, 0x00, 0xC0, 0x0F, 0x38, 0x00, 0x20, 0x1F, 0x1C, 0x00, 0x00, 0xFC, 0x0F, 0x00, 0x00, 0xE0, 0x07, // 240 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0xC0, 0xFE, 0x3F, 0x00, 0xE0, 0x18, 0x00, 0x00, 0x60, 0x0C, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0xC0, 0x06, 0x00, 0x00, 0xC0, 0x06, 0x00, 0x00, 0xE0, 0x0E, 0x00, 0x00, 0x60, 0xFC, 0x3F, 0x00, 0x00, 0xF8, 0x3F, // 241 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x20, 0x0E, 0x38, 0x00, 0x60, 0x06, 0x30, 0x00, 0xE0, 0x06, 0x30, 0x00, 0x80, 0x06, 0x30, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 242 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x80, 0x06, 0x30, 0x00, 0xE0, 0x06, 0x30, 0x00, 0x60, 0x06, 0x30, 0x00, 0x20, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 243 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x80, 0x0E, 0x38, 0x00, 0xC0, 0x06, 0x30, 0x00, 0x60, 0x06, 0x30, 0x00, 0x60, 0x06, 0x30, 0x00, 0xC0, 0x0E, 0x38, 0x00, 0x80, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 244 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0xC0, 0x1C, 0x1C, 0x00, 0xE0, 0x0E, 0x38, 0x00, 0x60, 0x06, 0x30, 0x00, 0x60, 0x06, 0x30, 0x00, 0xC0, 0x06, 0x30, 0x00, 0xC0, 0x0E, 0x38, 0x00, 0xE0, 0x1C, 0x1C, 0x00, 0x60, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 245 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0xC0, 0x0E, 0x38, 0x00, 0xC0, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0xC0, 0x0E, 0x38, 0x00, 0xC0, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x07, // 246 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0xB6, 0x01, 0x00, 0x00, 0xB6, 0x01, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, // 247 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x67, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x0E, 0x3F, 0x00, 0x00, 0x86, 0x33, 0x00, 0x00, 0xE6, 0x31, 0x00, 0x00, 0x76, 0x30, 0x00, 0x00, 0x3E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xFF, 0x0F, 0x00, 0x00, 0xF3, 0x07, // 248 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0F, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x20, 0x00, 0x38, 0x00, 0x60, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x30, 0x00, 0x80, 0x00, 0x30, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, // 249 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0F, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x80, 0x00, 0x30, 0x00, 0xE0, 0x00, 0x30, 0x00, 0x60, 0x00, 0x18, 0x00, 0x20, 0x00, 0x0C, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, // 250 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0F, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x80, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0x60, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x18, 0x00, 0x80, 0x00, 0x0C, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, // 251 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0F, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0xC0, 0x00, 0x38, 0x00, 0xC0, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x18, 0x00, 0xC0, 0x00, 0x0C, 0x00, 0x00, 0xFE, 0x3F, 0x00, 0x00, 0xFE, 0x3F, // 252 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x06, 0x00, 0xF0, 0x01, 0x06, 0x00, 0x80, 0x0F, 0x07, 0x80, 0x00, 0xFE, 0x03, 0xE0, 0x00, 0xFC, 0x00, 0x60, 0xC0, 0x1F, 0x00, 0x20, 0xF8, 0x03, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x06, // 253 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0x07, 0x00, 0x1C, 0x18, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x06, 0x30, 0x00, 0x00, 0x0E, 0x38, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0x03, // 254 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x06, 0xC0, 0xF0, 0x01, 0x06, 0xC0, 0x80, 0x0F, 0x07, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0xFC, 0x00, 0xC0, 0xC0, 0x1F, 0x00, 0xC0, 0xF8, 0x03, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x06, // 255 }; \ No newline at end of file From 1c827f5512538617aad4b2d1c7faacb867dbad89 Mon Sep 17 00:00:00 2001 From: Rick Mark Date: Wed, 26 Feb 2025 21:01:34 -0800 Subject: [PATCH 212/381] DevContainers: Include meshtasticd dependencies (#5699) * Include meshtasticd dependencies * Remove device-ui checkin * Add trunk rules matching other Dockerfiles --------- Co-authored-by: vidplace7 --- .devcontainer/Dockerfile | 9 ++++++--- bin/build-native.sh | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 62f0b7ead..d599f447f 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,9 +1,10 @@ +# trunk-ignore-all(terrascan/AC_DOCKER_0002): Known terrascan issue +# trunk-ignore-all(hadolint/DL3008): Do not pin apt package versions +# trunk-ignore-all(hadolint/DL3013): Do not pin pip package versions FROM mcr.microsoft.com/devcontainers/cpp:1-debian-12 USER root -# trunk-ignore(terrascan/AC_DOCKER_0002): Known terrascan issue -# trunk-ignore(hadolint/DL3008): Use latest version of packages RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ && apt-get -y install --no-install-recommends \ ca-certificates \ @@ -27,9 +28,11 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ hwdata \ gpg \ gnupg2 \ + libusb-1.0-0-dev \ + libi2c-dev \ && apt-get clean && rm -rf /var/lib/apt/lists/* -RUN pipx install platformio==6.1.15 +RUN pipx install platformio COPY 99-platformio-udev.rules /etc/udev/rules.d/99-platformio-udev.rules diff --git a/bin/build-native.sh b/bin/build-native.sh index cda77b064..c6b1434dd 100755 --- a/bin/build-native.sh +++ b/bin/build-native.sh @@ -24,7 +24,7 @@ mkdir -p $OUTDIR/ rm -r $OUTDIR/* || true # Important to pull latest version of libs into all device flavors, otherwise some devices might be stale -platformio pkg update --environment native || platformioFailed +pio pkg update --environment native || platformioFailed pio run --environment native || platformioFailed cp .pio/build/native/program "$OUTDIR/meshtasticd_linux_$(uname -m)" cp bin/native-install.* $OUTDIR From b46bf1638552a28b3d9a0d8250330d7cf5bae584 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 27 Feb 2025 13:49:59 +0800 Subject: [PATCH 213/381] Upgrade trunk (#6160) Co-authored-by: vidplace7 <1779290+vidplace7@users.noreply.github.com> --- .trunk/trunk.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index becd6f55f..f35554a72 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -9,10 +9,10 @@ plugins: lint: enabled: - prettier@3.5.2 - - trufflehog@3.88.12 + - trufflehog@3.88.13 - yamllint@1.35.1 - bandit@1.8.3 - - checkov@3.2.373 + - checkov@3.2.377 - terrascan@1.19.9 - trivy@0.59.1 - taplo@0.9.3 From 088fce7d11d257e00e26459df7874125208fc366 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 1 Mar 2025 05:09:59 -0600 Subject: [PATCH 214/381] [create-pull-request] automated change (#6181) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/admin.pb.cpp | 2 + src/mesh/generated/meshtastic/admin.pb.h | 26 ++++++ .../generated/meshtastic/device_ui.pb.cpp | 6 ++ src/mesh/generated/meshtastic/device_ui.pb.h | 66 +++++++++++++- .../generated/meshtastic/deviceonly.pb.cpp | 6 ++ src/mesh/generated/meshtastic/deviceonly.pb.h | 88 ++++++++++++++++--- src/mesh/generated/meshtastic/localonly.pb.h | 2 +- .../generated/meshtastic/module_config.pb.cpp | 4 +- .../generated/meshtastic/module_config.pb.h | 6 +- 10 files changed, 185 insertions(+), 23 deletions(-) diff --git a/protobufs b/protobufs index e2790151f..2a3a67f04 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit e2790151f058c0e885863a15eea0b4e4edf4aaaa +Subproject commit 2a3a67f0431926dc3f32a8b216d264daab09b9bf diff --git a/src/mesh/generated/meshtastic/admin.pb.cpp b/src/mesh/generated/meshtastic/admin.pb.cpp index 7ce3c74ce..2e527f669 100644 --- a/src/mesh/generated/meshtastic/admin.pb.cpp +++ b/src/mesh/generated/meshtastic/admin.pb.cpp @@ -20,3 +20,5 @@ PB_BIND(meshtastic_NodeRemoteHardwarePinsResponse, meshtastic_NodeRemoteHardware + + diff --git a/src/mesh/generated/meshtastic/admin.pb.h b/src/mesh/generated/meshtastic/admin.pb.h index d9b8de384..02d50127e 100644 --- a/src/mesh/generated/meshtastic/admin.pb.h +++ b/src/mesh/generated/meshtastic/admin.pb.h @@ -70,6 +70,13 @@ typedef enum _meshtastic_AdminMessage_ModuleConfigType { meshtastic_AdminMessage_ModuleConfigType_PAXCOUNTER_CONFIG = 12 } meshtastic_AdminMessage_ModuleConfigType; +typedef enum _meshtastic_AdminMessage_BackupLocation { + /* Backup to the internal flash */ + meshtastic_AdminMessage_BackupLocation_FLASH = 0, + /* Backup to the SD card */ + meshtastic_AdminMessage_BackupLocation_SD = 1 +} meshtastic_AdminMessage_BackupLocation; + /* Struct definitions */ /* Parameters for setting up Meshtastic for ameteur radio usage */ typedef struct _meshtastic_HamParameters { @@ -145,6 +152,12 @@ typedef struct _meshtastic_AdminMessage { char delete_file_request[201]; /* Set zero and offset for scale chips */ uint32_t set_scale; + /* Backup the node's preferences */ + meshtastic_AdminMessage_BackupLocation backup_preferences; + /* Restore the node's preferences */ + meshtastic_AdminMessage_BackupLocation restore_preferences; + /* Remove backups of the node's preferences */ + meshtastic_AdminMessage_BackupLocation remove_backup_preferences; /* Set the owner for this node */ meshtastic_User set_owner; /* Set channels (using the new API). @@ -226,8 +239,15 @@ extern "C" { #define _meshtastic_AdminMessage_ModuleConfigType_MAX meshtastic_AdminMessage_ModuleConfigType_PAXCOUNTER_CONFIG #define _meshtastic_AdminMessage_ModuleConfigType_ARRAYSIZE ((meshtastic_AdminMessage_ModuleConfigType)(meshtastic_AdminMessage_ModuleConfigType_PAXCOUNTER_CONFIG+1)) +#define _meshtastic_AdminMessage_BackupLocation_MIN meshtastic_AdminMessage_BackupLocation_FLASH +#define _meshtastic_AdminMessage_BackupLocation_MAX meshtastic_AdminMessage_BackupLocation_SD +#define _meshtastic_AdminMessage_BackupLocation_ARRAYSIZE ((meshtastic_AdminMessage_BackupLocation)(meshtastic_AdminMessage_BackupLocation_SD+1)) + #define meshtastic_AdminMessage_payload_variant_get_config_request_ENUMTYPE meshtastic_AdminMessage_ConfigType #define meshtastic_AdminMessage_payload_variant_get_module_config_request_ENUMTYPE meshtastic_AdminMessage_ModuleConfigType +#define meshtastic_AdminMessage_payload_variant_backup_preferences_ENUMTYPE meshtastic_AdminMessage_BackupLocation +#define meshtastic_AdminMessage_payload_variant_restore_preferences_ENUMTYPE meshtastic_AdminMessage_BackupLocation +#define meshtastic_AdminMessage_payload_variant_remove_backup_preferences_ENUMTYPE meshtastic_AdminMessage_BackupLocation @@ -268,6 +288,9 @@ extern "C" { #define meshtastic_AdminMessage_enter_dfu_mode_request_tag 21 #define meshtastic_AdminMessage_delete_file_request_tag 22 #define meshtastic_AdminMessage_set_scale_tag 23 +#define meshtastic_AdminMessage_backup_preferences_tag 24 +#define meshtastic_AdminMessage_restore_preferences_tag 25 +#define meshtastic_AdminMessage_remove_backup_preferences_tag 26 #define meshtastic_AdminMessage_set_owner_tag 32 #define meshtastic_AdminMessage_set_channel_tag 33 #define meshtastic_AdminMessage_set_config_tag 34 @@ -320,6 +343,9 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,get_node_remote_hardware_pin X(a, STATIC, ONEOF, BOOL, (payload_variant,enter_dfu_mode_request,enter_dfu_mode_request), 21) \ X(a, STATIC, ONEOF, STRING, (payload_variant,delete_file_request,delete_file_request), 22) \ X(a, STATIC, ONEOF, UINT32, (payload_variant,set_scale,set_scale), 23) \ +X(a, STATIC, ONEOF, UENUM, (payload_variant,backup_preferences,backup_preferences), 24) \ +X(a, STATIC, ONEOF, UENUM, (payload_variant,restore_preferences,restore_preferences), 25) \ +X(a, STATIC, ONEOF, UENUM, (payload_variant,remove_backup_preferences,remove_backup_preferences), 26) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_owner,set_owner), 32) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_channel,set_channel), 33) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_config,set_config), 34) \ diff --git a/src/mesh/generated/meshtastic/device_ui.pb.cpp b/src/mesh/generated/meshtastic/device_ui.pb.cpp index 3a9e28725..4bb3cc66c 100644 --- a/src/mesh/generated/meshtastic/device_ui.pb.cpp +++ b/src/mesh/generated/meshtastic/device_ui.pb.cpp @@ -15,6 +15,12 @@ PB_BIND(meshtastic_NodeFilter, meshtastic_NodeFilter, AUTO) PB_BIND(meshtastic_NodeHighlight, meshtastic_NodeHighlight, AUTO) +PB_BIND(meshtastic_GeoPoint, meshtastic_GeoPoint, AUTO) + + +PB_BIND(meshtastic_Map, meshtastic_Map, AUTO) + + diff --git a/src/mesh/generated/meshtastic/device_ui.pb.h b/src/mesh/generated/meshtastic/device_ui.pb.h index f090b5b4f..8cfc0b8cd 100644 --- a/src/mesh/generated/meshtastic/device_ui.pb.h +++ b/src/mesh/generated/meshtastic/device_ui.pb.h @@ -90,6 +90,25 @@ typedef struct _meshtastic_NodeHighlight { char node_name[16]; } meshtastic_NodeHighlight; +typedef struct _meshtastic_GeoPoint { + /* Zoom level */ + int8_t zoom; + /* Coordinate: latitude */ + int32_t latitude; + /* Coordinate: longitude */ + int32_t longitude; +} meshtastic_GeoPoint; + +typedef struct _meshtastic_Map { + /* Home coordinates */ + bool has_home; + meshtastic_GeoPoint home; + /* Map tile style */ + char style[20]; + /* Map scroll follows GPS */ + bool follow_gps; +} meshtastic_Map; + typedef PB_BYTES_ARRAY_T(16) meshtastic_DeviceUIConfig_calibration_data_t; typedef struct _meshtastic_DeviceUIConfig { /* A version integer used to invalidate saved files when we make incompatible changes. */ @@ -118,6 +137,9 @@ typedef struct _meshtastic_DeviceUIConfig { meshtastic_NodeHighlight node_highlight; /* 8 integers for screen calibration data */ meshtastic_DeviceUIConfig_calibration_data_t calibration_data; + /* Map related data */ + bool has_map_data; + meshtastic_Map map_data; } meshtastic_DeviceUIConfig; @@ -140,13 +162,19 @@ extern "C" { + + /* Initializer values for message structs */ -#define meshtastic_DeviceUIConfig_init_default {0, 0, 0, 0, 0, 0, _meshtastic_Theme_MIN, 0, 0, 0, _meshtastic_Language_MIN, false, meshtastic_NodeFilter_init_default, false, meshtastic_NodeHighlight_init_default, {0, {0}}} +#define meshtastic_DeviceUIConfig_init_default {0, 0, 0, 0, 0, 0, _meshtastic_Theme_MIN, 0, 0, 0, _meshtastic_Language_MIN, false, meshtastic_NodeFilter_init_default, false, meshtastic_NodeHighlight_init_default, {0, {0}}, false, meshtastic_Map_init_default} #define meshtastic_NodeFilter_init_default {0, 0, 0, 0, 0, "", 0} #define meshtastic_NodeHighlight_init_default {0, 0, 0, 0, ""} -#define meshtastic_DeviceUIConfig_init_zero {0, 0, 0, 0, 0, 0, _meshtastic_Theme_MIN, 0, 0, 0, _meshtastic_Language_MIN, false, meshtastic_NodeFilter_init_zero, false, meshtastic_NodeHighlight_init_zero, {0, {0}}} +#define meshtastic_GeoPoint_init_default {0, 0, 0} +#define meshtastic_Map_init_default {false, meshtastic_GeoPoint_init_default, "", 0} +#define meshtastic_DeviceUIConfig_init_zero {0, 0, 0, 0, 0, 0, _meshtastic_Theme_MIN, 0, 0, 0, _meshtastic_Language_MIN, false, meshtastic_NodeFilter_init_zero, false, meshtastic_NodeHighlight_init_zero, {0, {0}}, false, meshtastic_Map_init_zero} #define meshtastic_NodeFilter_init_zero {0, 0, 0, 0, 0, "", 0} #define meshtastic_NodeHighlight_init_zero {0, 0, 0, 0, ""} +#define meshtastic_GeoPoint_init_zero {0, 0, 0} +#define meshtastic_Map_init_zero {false, meshtastic_GeoPoint_init_zero, "", 0} /* Field tags (for use in manual encoding/decoding) */ #define meshtastic_NodeFilter_unknown_switch_tag 1 @@ -161,6 +189,12 @@ extern "C" { #define meshtastic_NodeHighlight_telemetry_switch_tag 3 #define meshtastic_NodeHighlight_iaq_switch_tag 4 #define meshtastic_NodeHighlight_node_name_tag 5 +#define meshtastic_GeoPoint_zoom_tag 1 +#define meshtastic_GeoPoint_latitude_tag 2 +#define meshtastic_GeoPoint_longitude_tag 3 +#define meshtastic_Map_home_tag 1 +#define meshtastic_Map_style_tag 2 +#define meshtastic_Map_follow_gps_tag 3 #define meshtastic_DeviceUIConfig_version_tag 1 #define meshtastic_DeviceUIConfig_screen_brightness_tag 2 #define meshtastic_DeviceUIConfig_screen_timeout_tag 3 @@ -175,6 +209,7 @@ extern "C" { #define meshtastic_DeviceUIConfig_node_filter_tag 12 #define meshtastic_DeviceUIConfig_node_highlight_tag 13 #define meshtastic_DeviceUIConfig_calibration_data_tag 14 +#define meshtastic_DeviceUIConfig_map_data_tag 15 /* Struct field encoding specification for nanopb */ #define meshtastic_DeviceUIConfig_FIELDLIST(X, a) \ @@ -191,11 +226,13 @@ X(a, STATIC, SINGULAR, UINT32, ring_tone_id, 10) \ X(a, STATIC, SINGULAR, UENUM, language, 11) \ X(a, STATIC, OPTIONAL, MESSAGE, node_filter, 12) \ X(a, STATIC, OPTIONAL, MESSAGE, node_highlight, 13) \ -X(a, STATIC, SINGULAR, BYTES, calibration_data, 14) +X(a, STATIC, SINGULAR, BYTES, calibration_data, 14) \ +X(a, STATIC, OPTIONAL, MESSAGE, map_data, 15) #define meshtastic_DeviceUIConfig_CALLBACK NULL #define meshtastic_DeviceUIConfig_DEFAULT NULL #define meshtastic_DeviceUIConfig_node_filter_MSGTYPE meshtastic_NodeFilter #define meshtastic_DeviceUIConfig_node_highlight_MSGTYPE meshtastic_NodeHighlight +#define meshtastic_DeviceUIConfig_map_data_MSGTYPE meshtastic_Map #define meshtastic_NodeFilter_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, BOOL, unknown_switch, 1) \ @@ -217,18 +254,39 @@ X(a, STATIC, SINGULAR, STRING, node_name, 5) #define meshtastic_NodeHighlight_CALLBACK NULL #define meshtastic_NodeHighlight_DEFAULT NULL +#define meshtastic_GeoPoint_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, INT32, zoom, 1) \ +X(a, STATIC, SINGULAR, INT32, latitude, 2) \ +X(a, STATIC, SINGULAR, INT32, longitude, 3) +#define meshtastic_GeoPoint_CALLBACK NULL +#define meshtastic_GeoPoint_DEFAULT NULL + +#define meshtastic_Map_FIELDLIST(X, a) \ +X(a, STATIC, OPTIONAL, MESSAGE, home, 1) \ +X(a, STATIC, SINGULAR, STRING, style, 2) \ +X(a, STATIC, SINGULAR, BOOL, follow_gps, 3) +#define meshtastic_Map_CALLBACK NULL +#define meshtastic_Map_DEFAULT NULL +#define meshtastic_Map_home_MSGTYPE meshtastic_GeoPoint + extern const pb_msgdesc_t meshtastic_DeviceUIConfig_msg; extern const pb_msgdesc_t meshtastic_NodeFilter_msg; extern const pb_msgdesc_t meshtastic_NodeHighlight_msg; +extern const pb_msgdesc_t meshtastic_GeoPoint_msg; +extern const pb_msgdesc_t meshtastic_Map_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ #define meshtastic_DeviceUIConfig_fields &meshtastic_DeviceUIConfig_msg #define meshtastic_NodeFilter_fields &meshtastic_NodeFilter_msg #define meshtastic_NodeHighlight_fields &meshtastic_NodeHighlight_msg +#define meshtastic_GeoPoint_fields &meshtastic_GeoPoint_msg +#define meshtastic_Map_fields &meshtastic_Map_msg /* Maximum encoded size of messages (where known) */ #define MESHTASTIC_MESHTASTIC_DEVICE_UI_PB_H_MAX_SIZE meshtastic_DeviceUIConfig_size -#define meshtastic_DeviceUIConfig_size 128 +#define meshtastic_DeviceUIConfig_size 188 +#define meshtastic_GeoPoint_size 33 +#define meshtastic_Map_size 58 #define meshtastic_NodeFilter_size 47 #define meshtastic_NodeHighlight_size 25 diff --git a/src/mesh/generated/meshtastic/deviceonly.pb.cpp b/src/mesh/generated/meshtastic/deviceonly.pb.cpp index aa020467a..5a9695702 100644 --- a/src/mesh/generated/meshtastic/deviceonly.pb.cpp +++ b/src/mesh/generated/meshtastic/deviceonly.pb.cpp @@ -18,7 +18,13 @@ PB_BIND(meshtastic_NodeInfoLite, meshtastic_NodeInfoLite, AUTO) PB_BIND(meshtastic_DeviceState, meshtastic_DeviceState, 2) +PB_BIND(meshtastic_NodeDatabase, meshtastic_NodeDatabase, AUTO) + + PB_BIND(meshtastic_ChannelFile, meshtastic_ChannelFile, 2) +PB_BIND(meshtastic_BackupPreferences, meshtastic_BackupPreferences, 2) + + diff --git a/src/mesh/generated/meshtastic/deviceonly.pb.h b/src/mesh/generated/meshtastic/deviceonly.pb.h index 4fda082e3..83563a9fc 100644 --- a/src/mesh/generated/meshtastic/deviceonly.pb.h +++ b/src/mesh/generated/meshtastic/deviceonly.pb.h @@ -9,6 +9,7 @@ #include "meshtastic/mesh.pb.h" #include "meshtastic/telemetry.pb.h" #include "meshtastic/config.pb.h" +#include "meshtastic/localonly.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. @@ -133,10 +134,17 @@ typedef struct _meshtastic_DeviceState { /* The mesh's nodes with their available gpio pins for RemoteHardware module */ pb_size_t node_remote_hardware_pins_count; meshtastic_NodeRemoteHardwarePin node_remote_hardware_pins[12]; - /* New lite version of NodeDB to decrease memory footprint */ - std::vector node_db_lite; } meshtastic_DeviceState; +typedef struct _meshtastic_NodeDatabase { + /* A version integer used to invalidate old save files when we make + incompatible changes This integer is set at build time and is private to + NodeDB.cpp in the device code. */ + uint32_t version; + /* New lite version of NodeDB to decrease memory footprint */ + std::vector nodes; +} meshtastic_NodeDatabase; + /* The on-disk saved channels */ typedef struct _meshtastic_ChannelFile { /* The channels our node knows about */ @@ -148,6 +156,26 @@ typedef struct _meshtastic_ChannelFile { uint32_t version; } meshtastic_ChannelFile; +/* The on-disk backup of the node's preferences */ +typedef struct _meshtastic_BackupPreferences { + /* The version of the backup */ + uint32_t version; + /* The timestamp of the backup (if node has time) */ + uint32_t timestamp; + /* The node's configuration */ + bool has_config; + meshtastic_LocalConfig config; + /* The node's module configuration */ + bool has_module_config; + meshtastic_LocalModuleConfig module_config; + /* The node's channels */ + bool has_channels; + meshtastic_ChannelFile channels; + /* The node's user (owner) information */ + bool has_owner; + meshtastic_User owner; +} meshtastic_BackupPreferences; + #ifdef __cplusplus extern "C" { @@ -157,13 +185,17 @@ extern "C" { #define meshtastic_PositionLite_init_default {0, 0, 0, 0, _meshtastic_Position_LocSource_MIN} #define meshtastic_UserLite_init_default {{0}, "", "", _meshtastic_HardwareModel_MIN, 0, _meshtastic_Config_DeviceConfig_Role_MIN, {0, {0}}} #define meshtastic_NodeInfoLite_init_default {0, false, meshtastic_UserLite_init_default, false, meshtastic_PositionLite_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0, 0, false, 0, 0, 0, 0} -#define meshtastic_DeviceState_init_default {false, meshtastic_MyNodeInfo_init_default, false, meshtastic_User_init_default, 0, {meshtastic_MeshPacket_init_default}, false, meshtastic_MeshPacket_init_default, 0, 0, 0, false, meshtastic_MeshPacket_init_default, 0, {meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default}, {0}} +#define meshtastic_DeviceState_init_default {false, meshtastic_MyNodeInfo_init_default, false, meshtastic_User_init_default, 0, {meshtastic_MeshPacket_init_default}, false, meshtastic_MeshPacket_init_default, 0, 0, 0, false, meshtastic_MeshPacket_init_default, 0, {meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default}} +#define meshtastic_NodeDatabase_init_default {0, {0}} #define meshtastic_ChannelFile_init_default {0, {meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default}, 0} +#define meshtastic_BackupPreferences_init_default {0, 0, false, meshtastic_LocalConfig_init_default, false, meshtastic_LocalModuleConfig_init_default, false, meshtastic_ChannelFile_init_default, false, meshtastic_User_init_default} #define meshtastic_PositionLite_init_zero {0, 0, 0, 0, _meshtastic_Position_LocSource_MIN} #define meshtastic_UserLite_init_zero {{0}, "", "", _meshtastic_HardwareModel_MIN, 0, _meshtastic_Config_DeviceConfig_Role_MIN, {0, {0}}} #define meshtastic_NodeInfoLite_init_zero {0, false, meshtastic_UserLite_init_zero, false, meshtastic_PositionLite_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0, 0, false, 0, 0, 0, 0} -#define meshtastic_DeviceState_init_zero {false, meshtastic_MyNodeInfo_init_zero, false, meshtastic_User_init_zero, 0, {meshtastic_MeshPacket_init_zero}, false, meshtastic_MeshPacket_init_zero, 0, 0, 0, false, meshtastic_MeshPacket_init_zero, 0, {meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero}, {0}} +#define meshtastic_DeviceState_init_zero {false, meshtastic_MyNodeInfo_init_zero, false, meshtastic_User_init_zero, 0, {meshtastic_MeshPacket_init_zero}, false, meshtastic_MeshPacket_init_zero, 0, 0, 0, false, meshtastic_MeshPacket_init_zero, 0, {meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero}} +#define meshtastic_NodeDatabase_init_zero {0, {0}} #define meshtastic_ChannelFile_init_zero {0, {meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero}, 0} +#define meshtastic_BackupPreferences_init_zero {0, 0, false, meshtastic_LocalConfig_init_zero, false, meshtastic_LocalModuleConfig_init_zero, false, meshtastic_ChannelFile_init_zero, false, meshtastic_User_init_zero} /* Field tags (for use in manual encoding/decoding) */ #define meshtastic_PositionLite_latitude_i_tag 1 @@ -199,9 +231,16 @@ extern "C" { #define meshtastic_DeviceState_did_gps_reset_tag 11 #define meshtastic_DeviceState_rx_waypoint_tag 12 #define meshtastic_DeviceState_node_remote_hardware_pins_tag 13 -#define meshtastic_DeviceState_node_db_lite_tag 14 +#define meshtastic_NodeDatabase_version_tag 1 +#define meshtastic_NodeDatabase_nodes_tag 2 #define meshtastic_ChannelFile_channels_tag 1 #define meshtastic_ChannelFile_version_tag 2 +#define meshtastic_BackupPreferences_version_tag 1 +#define meshtastic_BackupPreferences_timestamp_tag 2 +#define meshtastic_BackupPreferences_config_tag 3 +#define meshtastic_BackupPreferences_module_config_tag 4 +#define meshtastic_BackupPreferences_channels_tag 5 +#define meshtastic_BackupPreferences_owner_tag 6 /* Struct field encoding specification for nanopb */ #define meshtastic_PositionLite_FIELDLIST(X, a) \ @@ -252,10 +291,8 @@ X(a, STATIC, SINGULAR, UINT32, version, 8) \ X(a, STATIC, SINGULAR, BOOL, no_save, 9) \ X(a, STATIC, SINGULAR, BOOL, did_gps_reset, 11) \ X(a, STATIC, OPTIONAL, MESSAGE, rx_waypoint, 12) \ -X(a, STATIC, REPEATED, MESSAGE, node_remote_hardware_pins, 13) \ -X(a, CALLBACK, REPEATED, MESSAGE, node_db_lite, 14) -extern bool meshtastic_DeviceState_callback(pb_istream_t *istream, pb_ostream_t *ostream, const pb_field_t *field); -#define meshtastic_DeviceState_CALLBACK meshtastic_DeviceState_callback +X(a, STATIC, REPEATED, MESSAGE, node_remote_hardware_pins, 13) +#define meshtastic_DeviceState_CALLBACK NULL #define meshtastic_DeviceState_DEFAULT NULL #define meshtastic_DeviceState_my_node_MSGTYPE meshtastic_MyNodeInfo #define meshtastic_DeviceState_owner_MSGTYPE meshtastic_User @@ -263,7 +300,14 @@ extern bool meshtastic_DeviceState_callback(pb_istream_t *istream, pb_ostream_t #define meshtastic_DeviceState_rx_text_message_MSGTYPE meshtastic_MeshPacket #define meshtastic_DeviceState_rx_waypoint_MSGTYPE meshtastic_MeshPacket #define meshtastic_DeviceState_node_remote_hardware_pins_MSGTYPE meshtastic_NodeRemoteHardwarePin -#define meshtastic_DeviceState_node_db_lite_MSGTYPE meshtastic_NodeInfoLite + +#define meshtastic_NodeDatabase_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, UINT32, version, 1) \ +X(a, CALLBACK, REPEATED, MESSAGE, nodes, 2) +extern bool meshtastic_NodeDatabase_callback(pb_istream_t *istream, pb_ostream_t *ostream, const pb_field_t *field); +#define meshtastic_NodeDatabase_CALLBACK meshtastic_NodeDatabase_callback +#define meshtastic_NodeDatabase_DEFAULT NULL +#define meshtastic_NodeDatabase_nodes_MSGTYPE meshtastic_NodeInfoLite #define meshtastic_ChannelFile_FIELDLIST(X, a) \ X(a, STATIC, REPEATED, MESSAGE, channels, 1) \ @@ -272,23 +316,43 @@ X(a, STATIC, SINGULAR, UINT32, version, 2) #define meshtastic_ChannelFile_DEFAULT NULL #define meshtastic_ChannelFile_channels_MSGTYPE meshtastic_Channel +#define meshtastic_BackupPreferences_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, UINT32, version, 1) \ +X(a, STATIC, SINGULAR, FIXED32, timestamp, 2) \ +X(a, STATIC, OPTIONAL, MESSAGE, config, 3) \ +X(a, STATIC, OPTIONAL, MESSAGE, module_config, 4) \ +X(a, STATIC, OPTIONAL, MESSAGE, channels, 5) \ +X(a, STATIC, OPTIONAL, MESSAGE, owner, 6) +#define meshtastic_BackupPreferences_CALLBACK NULL +#define meshtastic_BackupPreferences_DEFAULT NULL +#define meshtastic_BackupPreferences_config_MSGTYPE meshtastic_LocalConfig +#define meshtastic_BackupPreferences_module_config_MSGTYPE meshtastic_LocalModuleConfig +#define meshtastic_BackupPreferences_channels_MSGTYPE meshtastic_ChannelFile +#define meshtastic_BackupPreferences_owner_MSGTYPE meshtastic_User + extern const pb_msgdesc_t meshtastic_PositionLite_msg; extern const pb_msgdesc_t meshtastic_UserLite_msg; extern const pb_msgdesc_t meshtastic_NodeInfoLite_msg; extern const pb_msgdesc_t meshtastic_DeviceState_msg; +extern const pb_msgdesc_t meshtastic_NodeDatabase_msg; extern const pb_msgdesc_t meshtastic_ChannelFile_msg; +extern const pb_msgdesc_t meshtastic_BackupPreferences_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ #define meshtastic_PositionLite_fields &meshtastic_PositionLite_msg #define meshtastic_UserLite_fields &meshtastic_UserLite_msg #define meshtastic_NodeInfoLite_fields &meshtastic_NodeInfoLite_msg #define meshtastic_DeviceState_fields &meshtastic_DeviceState_msg +#define meshtastic_NodeDatabase_fields &meshtastic_NodeDatabase_msg #define meshtastic_ChannelFile_fields &meshtastic_ChannelFile_msg +#define meshtastic_BackupPreferences_fields &meshtastic_BackupPreferences_msg /* Maximum encoded size of messages (where known) */ -/* meshtastic_DeviceState_size depends on runtime parameters */ -#define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_ChannelFile_size +/* meshtastic_NodeDatabase_size depends on runtime parameters */ +#define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_BackupPreferences_size +#define meshtastic_BackupPreferences_size 2263 #define meshtastic_ChannelFile_size 718 +#define meshtastic_DeviceState_size 1720 #define meshtastic_NodeInfoLite_size 188 #define meshtastic_PositionLite_size 28 #define meshtastic_UserLite_size 96 diff --git a/src/mesh/generated/meshtastic/localonly.pb.h b/src/mesh/generated/meshtastic/localonly.pb.h index 7a6712bf0..6a59b8eb0 100644 --- a/src/mesh/generated/meshtastic/localonly.pb.h +++ b/src/mesh/generated/meshtastic/localonly.pb.h @@ -188,7 +188,7 @@ extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg; /* Maximum encoded size of messages (where known) */ #define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalConfig_size #define meshtastic_LocalConfig_size 743 -#define meshtastic_LocalModuleConfig_size 699 +#define meshtastic_LocalModuleConfig_size 667 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/module_config.pb.cpp b/src/mesh/generated/meshtastic/module_config.pb.cpp index 9843f0e91..f262df6a3 100644 --- a/src/mesh/generated/meshtastic/module_config.pb.cpp +++ b/src/mesh/generated/meshtastic/module_config.pb.cpp @@ -6,10 +6,10 @@ #error Regenerate this file with the current version of nanopb generator. #endif -PB_BIND(meshtastic_ModuleConfig, meshtastic_ModuleConfig, 2) +PB_BIND(meshtastic_ModuleConfig, meshtastic_ModuleConfig, AUTO) -PB_BIND(meshtastic_ModuleConfig_MQTTConfig, meshtastic_ModuleConfig_MQTTConfig, 2) +PB_BIND(meshtastic_ModuleConfig_MQTTConfig, meshtastic_ModuleConfig_MQTTConfig, AUTO) PB_BIND(meshtastic_ModuleConfig_MapReportSettings, meshtastic_ModuleConfig_MapReportSettings, AUTO) diff --git a/src/mesh/generated/meshtastic/module_config.pb.h b/src/mesh/generated/meshtastic/module_config.pb.h index 848b010d3..d5031cb89 100644 --- a/src/mesh/generated/meshtastic/module_config.pb.h +++ b/src/mesh/generated/meshtastic/module_config.pb.h @@ -126,7 +126,7 @@ typedef struct _meshtastic_ModuleConfig_MQTTConfig { /* MQTT password to use (most useful for a custom MQTT server). If using a custom server, this will be honoured even if empty. If using the default server, this will only be honoured if set, otherwise the device will use the default password */ - char password[64]; + char password[32]; /* Whether to send encrypted or decrypted packets to MQTT. This parameter is only honoured if you also set server (the default official mqtt.meshtastic.org server can handle encrypted packets) @@ -887,7 +887,7 @@ extern const pb_msgdesc_t meshtastic_RemoteHardwarePin_msg; #define meshtastic_ModuleConfig_CannedMessageConfig_size 49 #define meshtastic_ModuleConfig_DetectionSensorConfig_size 44 #define meshtastic_ModuleConfig_ExternalNotificationConfig_size 42 -#define meshtastic_ModuleConfig_MQTTConfig_size 254 +#define meshtastic_ModuleConfig_MQTTConfig_size 222 #define meshtastic_ModuleConfig_MapReportSettings_size 12 #define meshtastic_ModuleConfig_NeighborInfoConfig_size 10 #define meshtastic_ModuleConfig_PaxcounterConfig_size 30 @@ -896,7 +896,7 @@ extern const pb_msgdesc_t meshtastic_RemoteHardwarePin_msg; #define meshtastic_ModuleConfig_SerialConfig_size 28 #define meshtastic_ModuleConfig_StoreForwardConfig_size 24 #define meshtastic_ModuleConfig_TelemetryConfig_size 46 -#define meshtastic_ModuleConfig_size 257 +#define meshtastic_ModuleConfig_size 225 #define meshtastic_RemoteHardwarePin_size 21 #ifdef __cplusplus From 99d3e5eb708a7223b37ce84e43fb27e79bc70087 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 1 Mar 2025 06:18:33 -0600 Subject: [PATCH 215/381] 2.6 changes (#5806) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 2.6 protos * [create-pull-request] automated change (#5789) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Hello world support for UDP broadcasts over the LAN on ESP32 (#5779) * UDP local area network meshing on ESP32 * Logs * Comment * Update UdpMulticastThread.h * Changes * Only use router->send * Make NodeDatabase (and file) independent of DeviceState (#5813) * Make NodeDatabase (and file) independent of DeviceState * 70 * Remove logging statement no longer needed * Explicitly set CAD symbols, improve slot time calculation and adjust CW size accordingly (#5772) * File system persistence fixes * [create-pull-request] automated change (#6000) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Update ref * Back to 80 * [create-pull-request] automated change (#6002) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * 2.6 <- Next hop router (#6005) * Initial version of NextHopRouter * Set original hop limit in header flags * Short-circuit to FloodingRouter for broadcasts * If packet traveled 1 hop, set `relay_node` as `next_hop` for the original transmitter * Set last byte to 0xFF if it ended at 0x00 As per an idea of @S5NC * Also update next-hop based on received DM for us * temp * Add 1 retransmission for intermediate hops when using NextHopRouter * Add next_hop and relayed_by in PacketHistory for setting next-hop and handle flooding fallback * Update protos, store multiple relayers * Remove next-hop update logic from NeighborInfoModule * Fix retransmissions * Improve ACKs for repeated packets and responses * Stop retransmission even if there's not relay node * Revert perhapsRebroadcast() * Remove relayer if we cancel a transmission * Better checking for fallback to flooding * Fix newlines in traceroute print logs * Stop retransmission for original packet * Use relayID * Also when want_ack is set, we should try to retransmit * Fix cppcheck error * Fix 'router' not in scope error * Fix another cppcheck error * Check for hop_limit and also update next hop when `hop_start == hop_limit` on ACK Also check for broadcast in `getNextHop()` * Formatting and correct NUM_RETRANSMISSIONS * Update protos * Start retransmissions in NextHopRouter if ReliableRouter didn't do it * Handle repeated/fallback to flooding packets properly First check if it's not still in the TxQueue * Guard against clients setting `next_hop`/`relay_node` * Don't cancel relay if we were the assigned next-hop * Replies (e.g. tapback emoji) are also a valid confirmation of receipt --------- Co-authored-by: GUVWAF Co-authored-by: Thomas Göttgens Co-authored-by: Tom Fifield Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com> * fix "native" compiler errors/warnings NodeDB.h * fancy T-Deck / SenseCAP Indicator / unPhone / PICOmputer-S3 TFT screen (#3259) * lib update: light theme * fix merge issue * lib update: home buttons + button try-fix * lib update: icon color fix * lib update: fix instability/crash on notification * update lib: timezone * timezone label * lib update: fix set owner * fix spiLock in RadioLibInterface * add picomputer tft build * picomputer build * fix compiler error std::find() * fix merge * lib update: theme runtime config * lib update: packet logger + T-Deck Plus * lib update: mesh detector * lib update: fix brightness & trackball crash * try-fix less paranoia * sensecap indicator updates * lib update: indicator fix * lib update: statistic & some fixes * lib-update: other T-Deck touch driver * use custom touch driver for Indicator * lower tft task prio * prepare LVGL ST7789 driver * lib update: try-fix audio * Drop received packets from self * Additional decoded packet ignores * Honor flip & color for Heltec T114 and T190 (#4786) * Honor TFT_MESH color if defined for Heltec T114 or T190 * Temporary: point lib_deps at fork of Heltec's ST7789 library For demo only, until ST7789 is merged * Update lib_deps; tidy preprocessor logic * Download debian files after firmware zip * set title for protobufs bump PR (#4792) * set title for version bump PR (#4791) * Enable Dependabot * chore: trunk fmt * fix dependabot syntax (#4795) * fix dependabot syntax * Update dependabot.yml * Update dependabot.yml * Bump peter-evans/create-pull-request from 6 to 7 in /.github/workflows (#4797) * Bump docker/build-push-action from 5 to 6 in /.github/workflows (#4800) * Actions: Semgrep Images have moved from returntocorp to semgrep (#4774) https://hub.docker.com/r/returntocorp/semgrep notes: "We've moved! Official Docker images for Semgrep now available at semgrep/semgrep." Patch updates our CI workflow for these images. Co-authored-by: Ben Meadors * Bump meshtestic from `31ee3d9` to `37245b3` (#4799) Bumps [meshtestic](https://github.com/meshtastic/meshTestic) from `31ee3d9` to `37245b3`. - [Commits](https://github.com/meshtastic/meshTestic/compare/31ee3d90c8bef61e835c3271be2c7cda8c4a5cc2...37245b3d612a9272f546bbb092837bafdad46bc2) --- updated-dependencies: - dependency-name: meshtestic dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [create-pull-request] automated change (#4789) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Bump pnpm/action-setup from 2 to 4 in /.github/workflows (#4798) Bumps [pnpm/action-setup](https://github.com/pnpm/action-setup) from 2 to 4. - [Release notes](https://github.com/pnpm/action-setup/releases) - [Commits](https://github.com/pnpm/action-setup/compare/v2...v4) --- updated-dependencies: - dependency-name: pnpm/action-setup dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Raspberry Pico2 - needs protos * Re-order doDeepSleep (#4802) Make sure PMU sleep takes place before I2C ends * [create-pull-request] automated change * heltec-wireless-bridge requires Proto PR first * feat: trigger class update when protobufs are changed * meshtastic/ is a test suite; protobufs/ contains protobufs; * Update platform-native to pick up portduino crash fix (#4807) * Hopefully extract and commit to meshtastic.github.io * CI fixes * [Board] DIY "t-energy-s3_e22" (#4782) * New variant "t-energy-s3_e22" - Lilygo T-Energy-S3 - NanoVHF "Mesh-v1.06-TTGO-T18" board - Ebyte E22 Series * add board_level = extra * Update variant.h --------- Co-authored-by: Thomas Göttgens Co-authored-by: Tom Fifield * Consolidate variant build steps (#4806) * poc: consolidate variant build steps * use build-variant action * only checkout once and clean up after run * Revert "Consolidate variant build steps (#4806)" (#4816) This reverts commit 9f8d86cb25febfb86c57f395549b7deb82458065. * Make Ublox code more readable (#4727) * Simplify Ublox code Ublox comes in a myriad of versions and settings. Presently our configuration code does a lot of branching based on versions being or not being present. This patch adds version detection earlier in the piece and branches on the set gnssModel instead to create separate setup methods for Ublox 6, Ublox 7/8/9, and Ublox10. Additionally, adds a macro to make the code much shorter and more readable. * Make trunk happy * Make trunk happy --------- Co-authored-by: Ben Meadors * Consider the LoRa header when checking packet length * Minor fix (#4666) * Minor fixes It turns out setting a map value with the index notation causes an lookup that can be avoided with emplace. Apply this to one line in the StoreForward module. Fix also Cppcheck-determined highly minor performance increase by passing gpiochipname as a const reference :) The amount of cycles used on this laptop while learning about these callouts from cppcheck is unlikely to ever be more than the cycles saved by the fixes ;) * Update PortduinoGlue.cpp * Revert "Update classes on protobufs update" (#4824) * Revert "Update classes on protobufs update" * remove quotes to fix trunk. --------- Co-authored-by: Tom Fifield * Implement optional second I2C bus for NRF52840 Enabled at compile-time if WIRE_INFERFACES_COUNT defined as 2 * Add I2C bus to Heltec T114 header pins SDA: P0.13 SCL: P0.16 Uses bus 1, leaving bus 0 routed to the unpopulated footprint for the RTC (general future-proofing) * Tidier macros * Swap SDA and SCL SDA=P0.16, SCL=P0.13 * Refactor and consolidate time window logic (#4826) * Refactor and consolidate windowing logic * Trunk * Fixes * More * Fix braces and remove unused now variables. There was a brace in src/mesh/RadioLibInterface.cpp that was breaking compile on some architectures. Additionally, there were some brace errors in src/modules/Telemetry/AirQualityTelemetry.cpp src/modules/Telemetry/EnvironmentTelemetry.cpp src/mesh/wifi/WiFiAPClient.cpp Move throttle include in WifiAPClient.cpp to top. Add Default.h to sleep.cpp rest of files just remove unused now variables. * Remove a couple more meows --------- Co-authored-by: Tom Fifield * Rename message length headers and set payload max to 255 (#4827) * Rename message length headers and set payload max to 255 * Add MESHTASTIC_PKC_OVERHEAD * compare to MESHTASTIC_HEADER_LENGTH --------- Co-authored-by: Thomas Göttgens * Check for null before printing debug (#4835) * fix merge * try-fix crash * lib update: fix neighbors * fix GPIO0 mode after I2S audio * lib update: audio fix * lib update: fixes and improvements * extra * added ILI9342 (from master) * device-ui persistency * review update * fix request, add handled * fix merge issue * fix merge issue * remove newline * remove newlines from debug log * playing with locks; but needs more testing * diy mesh-tab initial files * board definition for mesh-tab (not yet used) * use DISPLAY_SET_RESOLUTION to avoid hw dependency in code * no telemetry for Indicator * 16MB partition for Indicator * 8MB partition for Indicator * stability: add SPI lock before saving via littleFS * dummy for config transfer (#5154) * update indicator (due to compile and linker errors) * remove faulty partition line * fix missing include * update indicator board * update mesh-tab ILI9143 TFT * fix naming * mesh-tab targets * try: disable duplicate locks * fix nodeDB erase loop when free mem returns invalid value (0, -1). * upgrade toolchain for nrf52 to gcc 9.3.1 * try-fix (workaround) T-Deck audio crash * update mesh-tab tft configs * set T-Deck audio to unused 48 (mem mclk) * swap mclk to gpio 21 * update meshtab voltage divider * update mesh-tab ini * Fixed the issue that indicator device uploads via rp2040 serial port in some cases. * Fixed the issue that the touch I2C address definition was not effective. * Fixed the issue that the wifi configuration saved to RAM did not take effect. * rotation fix; added ST7789 3.2" display * dreamcatcher: assign GPIO44 to audio mclk * mesh-tab touch updates * add mesh-tab powersave as default * fix DIO1 wakeup * mesh-tab: enable alert message menu * Streamline board definitions for first tech preview. (#5390) * Streamline board definitions for first tech preview. TBD: Indicator Support * add point-of-checkin * use board/unphone.json --------- Co-authored-by: mverch67 * fix native targets * add RadioLib debugging options for (T-Deck) * fix T-Deck build * fix native tft targets for rpi * remove wrong debug defines * t-deck-tft button is handled in device-ui * disable default lightsleep for indicator * Windows Support - Trunk and Platformio (#5397) * Add support for GPG * Add usb device support * Add trunk.io to devcontainer * Trunk things * trunk fmt * formatting * fix trivy/DS002, checkov/CKV_DOCKER_3 * hide docker extension popup * fix trivy/DS026, checkov/CKV_DOCKER_2 * fix radioLib warnings for T-Deck target * wake screen with button only * use custom touch driver * define wake button for unphone * use board definition for mesh-tab * mesh-tab rotation upside-down * update platform native * use MESH_TAB hardware model definition * radioLib update (fix crash/assert) * reference seeed indicator fix commit arduino-esp32 * Remove unneeded file change :) * disable serial module and tcp socket api for standalone devices (#5591) * disable serial module and tcp socket api for standalone devices * just disable webserver, leave wifi available * disable socket api * mesh-tab: lower I2C touch frequency * log error when packet queue is full * add more locking for shared SPI devices (#5595) * add more locking for shared SPI devices * call initSPI before the lock is used * remove old one * don't double lock * Add missing unlock * More missing unlocks * Add locks to SafeFile, remove from `readcb`, introduce some LockGuards * fix lock in setupSDCard() * pull radiolib trunk with SPI-CS fixes * change ContentHandler to Constructor type locks, where applicable --------- Co-authored-by: mverch67 Co-authored-by: GUVWAF Co-authored-by: Manuel <71137295+mverch67@users.noreply.github.com> * T-Deck: revert back to lovyanGFX touch driver * T-Deck: increase allocated PSRAM by 50% * mesh-tab: streamline target definitions * update RadioLib 7.1.2 * mesh-tab: fix touch rotation 4.0 inch display * Mesh-Tab platformio: 4.0inch: increase SPI frequency to max * mesh-tab: fix rotation for 3.5 IPS capacitive display * mesh-tab: fix rotation for 3.2 IPS capacitive display * restructure device-ui library into sub-directories * preparations for generic DisplayDriverFactory * T-Deck: increase LVGL memory size * update lib * trunk fmt --------- Signed-off-by: dependabot[bot] Co-authored-by: Ben Meadors Co-authored-by: todd-herbert Co-authored-by: Jason Murray <15822260+scruplelesswizard@users.noreply.github.com> Co-authored-by: Jason Murray Co-authored-by: Tom Fifield Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> Co-authored-by: Thomas Göttgens Co-authored-by: Jonathan Bennett Co-authored-by: Austin Co-authored-by: virgil Co-authored-by: Mark Trevor Birss Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com> Co-authored-by: GUVWAF * Version this * Update platformio.ini (#6006) * tested higher speed and it works * Un-extra * Add -tft environments to the ci matrix * Exclude unphone tft for now. Something is wonky * fixed Indicator touch issue (causing IO expander issues), added more RAM * update lib * fixed Indicator touch issue (causing IO expander issues), added more RAM (#6013) * increase T-Deck PSRAM to avoid too early out-of-memory when messages fill up the storage * update device-ui lib * Fix T-Deck SD card detection (#6023) * increase T-Deck PSRAM to avoid too early out-of-memory when messages fill up the storage * fix SDCard for T-Deck; allow SPI frequency config * meshtasticd: Add X11 480x480 preset (#6020) * Littlefs per device * 2.6 update * [create-pull-request] automated change (#6037) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * InkHUD UI for E-Ink (#6034) * Decouple ButtonThread from sleep.cpp Reorganize sleep observables. Don't call ButtonThread methods inside doLightSleep. Instead, handle in class with new lightsleep Observables. * InkHUD: initial commit (WIP) Publicly discloses the current work in progress. Not ready for use. * feat: battery icon * chore: implement meshtastic/firmware #5454 Clean up some inline functions * feat: menu & settings for "jump to applet" * Remove the beforeRender pattern It hugely complicates things. If we can achieve acceptable performance without it, so much the better. * Remove previous Map Applet Needs re-implementation to work without the beforeRender pattern * refactor: reimplement map applet Doesn't require own position Doesn't require the beforeRender pattern to precalculate; now all-at-once in render Lays groundwork for fixed-size map with custom background image * feat: autoshow Allow user to select which applets (if any) should be automatically brought to foreground when they have new data to display * refactor: tidy-up applet constructors misc. jobs including: - consistent naming - move initializer-list-only constructors to header - give derived applets unique identifiers for MeshModule and OSThread logging * hotfix: autoshow always uses FAST update In future, it *will* often use FAST, but this will be controlled by a WindowManager component which has not yet been written. Hotfixed, in case anybody is attempting to use this development version on their deployed devices. * refactor: bringToForeground no longer requests FAST update In situations where an applet has moved to foreground because of user input, requestUpdate can be manually called, to upgrade to FAST refresh. More permanent solution for #23e1dfc * refactor: extract string storage from ThreadedMessageApplet Separates the code responsible for storing the limited message history, which was previously part of the ThreadedMessageApplet. We're now also using this code to store the "most recent message". Previously, this was stored in the `InkHUD::settings` struct, which was much less space-efficient. We're also now storing the latest DM, laying the foundation for an applet to display only DMs, which will complement the threaded message applet. * fix: text wrapping Attempts to fix a disparity between `Applet::printWrapped` and `Applet::getWrappedTextHeight`, which would occasionally cause a ThreadedMessageApplet message to render "too short", overlapping other text. * fix: purge old constructor This one slipped through the last commit.. * feat: DM Applet Useful in combination with the ThreadedMessageApplets, which don't show DMs * fix: applets shouldn't handle events while deactivated Only one or two applets were actually doing this, but I'm making a habit of having all applets return early from their event handling methods (as good practice), even if those methods are disabled elsewhere (e.g. not observing observable, return false from wantPacket) * refactor: allow requesting update without requesting autoshow Some applets may want to redraw, if they are displayed, but not feel the information is worth being brought to foreground for. Example: ActiveNodesApplet, when purging old nodes from list. * feat: custom "Recently Active" duration Allows users to tailor how long nodes will appear in the "Recents" applets, to suit the activity level of their mesh. * refactor: rename some applets * fix: autoshow * fix: getWrappedTextHeight Remove the "simulate" option from printWrapped; too hard to keep inline with genuine printing (because of AdafruitGFX Fonts' xAdvance, mabye?). Instead of simulating, we printWrapped as normal, and discard pixel output by setting crop. Both methods are similarly inefficient, apparently. * fix: text wrapping in ThreadedMessageApplet Wrong arguments were passed to Applet::printWrapped * feat: notifications for text messages Only shown if current applet does not already display the same info. Autoshow takes priority over notifications, if both would be used to display the same info. * feat: optimize FAST vs FULL updates New UpdateMediator class counts the number of each update type, and suggets which one to use, if the code doesn't already have an explicit prefence. Also performs "maintenance refreshes" unprovoked if display is not given an opportunity to before a FULL refresh through organic use. * chore: update todo list * fix: rare lock-up of buttons * refactor: backlight Replaces the initial proof-of-concept frontlight code for T-Echo Presses less than 5 seconds momentarily illuminate the display Presses longer than 5 seconds latch the light, requiring another tap to disable If user has previously removed the T-Echo's capacitive touch button (some DIY projects), the light is controlled by the on-screen menu. This fallback is used by all T-Echo devices, until a press of the capacitive touch button is detected. * feat: change tile with aux button Applied to VM-E290. Working as is, but a refactor of WindowManager::render is expected shortly, which will also tidy code from this push. * fix: specify out-of-the-box tile assignments Prevents placeholder applet showing on initial boot, for devices which use a mult-tile layout by default (VM-E290) * fix: verify settings version when loading * fix: wrong settings version * refactor: remove unimplemented argument from requestUpdate Specified whether or not to update "async", however the implementation was slightly broken, Applet::requestUpdate is only handled next time WindowManager::runOnce is called. This didn't allow code to actually await an update, which was misleading. * refactor: renaming Applet::render becomes Applet::onRender. Tile::displayedApplet becomes Tile::assignedApplet. New onRender method name allows us to move some of the pre and post render code from WindowManager into new Applet::render method, which will call onRender for us. * refactor: rendering Bit of a tidy-up. No intended change in behavior. * fix: optimize refresh times Shorter wait between retrying update if display was previously busy. Set anticipated update durations closer to observed values. No signifacant performance increase, but does decrease the amount of polling required. * feat: blocking update for E-Ink Option to wait for display update to complete before proceeding. Important when shutting down the device. * refactor: allow system applets to lock rendering Temporarily prevents other applets from rendering. * feat: boot and shutdown screens * feat: BluetoothStatus Adds a meshtastic::Status object which exposes the state of the Bluetooth connection. Intends to allow decoupling of UI code. * feat: Bluetooth pairing screen * fix: InkHUD defaults not honored * fix: random Bluetooth pin for NicheGraphics UIs * chore: button interrupts tested * fix: emoji reactions show as blank messages * fix: autoshow and notification triggered by outgoing message * feat: save InkHUD data before reboot Implemented with a new Observable. Previously, config and a few recent messages were saved on shutdown. These were lost if the device rebooted, for example when firmware settings were changed by a client. Now, the InkHUD config and recent messages saved on reboot, the same as during an intentional shutdown. * feat: imperial distances Controlled by the config.display.units setting * fix: hide features which are not yet implemented * refactor: faster rendering Previously, only tiles which requested update were re-rendered. Affected tiles had their region blanked before render, pixel by pixel. Benchmarking revealed that it is significantly faster to memset the framebuffer and redraw all tiles. * refactor: tile ownership Tiles and Applets now maintain a reciprocal link, which is enforced by asserts. Less confusing than the old situation, where an applet and a tile may disagree on their relationship. Empty tiles are now identified by a nullptr *Applet, instead of by having the placeholderApplet assigned. * fix: notifications and battery when menu open Do render notifications in front of menu; don't render battery icon in front of menu. * fix: simpler defaults Don't expose new users to multiplexed applets straight away: make them enable the feature for themselves. * fix: Inputs::TwoButton interrupts, when only one button in use * fix: ensure display update is complete when ESP32 enters light sleep Many panels power down automatically, but some require active intervention from us. If light sleep (ESP32) occurs during a display update, these panels could potentially remain powered on, applying voltage the pixels for an extended period of time, and potentially damaging the display. * fix: honor per-variant user tile limit Set as the default value for InkHUD::settings.userTiles.maxCount in nicheGraphics.h * feat: initial InkHUD support for Wireless Paper v1.1 and VM-E213 * refactor: Heard and Recents Applets Tidier code, significant speed boost. Possibly no noticable change in responsiveness, but rendering now spends much less time blocking execution, which is important for correction functioning of the other firmware components. * refactor: use a common pio base config Easier to make any future PlatformIO config changes * feat: tips Show information that we think the user might find helpful. Some info shown first boot only. Other info shown when / if relevant. * fix: text wrapping for '\n' Previously, the newline was honored, but the adojining word was not printed. * Decouple ButtonThread from sleep.cpp Reorganize sleep observables. Don't call ButtonThread methods inside doLightSleep. Instead, handle in class with new lightsleep Observables. * feat: BluetoothStatus Adds a meshtastic::Status object which exposes the state of the Bluetooth connection. Intends to allow decoupling of UI code. * feat: observable for reboot * refactor: Heltec VM-E290 installDefaultConfig * fix: random Bluetooth pin for NicheGraphics UIs * update device-ui: fix touch/crash issue while light sleep * Collect inkhud * fix: InkHUD shouldn't nag about timezone (#6040) * Guard eink drivers w/ MESHTASTIC_INCLUDE_NICHE_GRAPHICS * Case sensitive perhaps? * More case-sensitivity instances * Moar * RTC * Yet another case issue! * Sigh... * MUI: BT programming mode (#6046) * allow BT connection with disabled MUI * Update device-ui --------- Co-authored-by: Ben Meadors * MUI: fix nag timeout, disable BT programming mode for native (#6052) * allow BT connection with disabled MUI * Update device-ui * MUI: fix nag timeout default and remove programming mode for native --------- Co-authored-by: Ben Meadors * remove debuglog leftover * Wireless Paper: remove stray board_level = extra (#6060) Makes sure the InkHUD version gets build into the release zip * Fixed persistence stragglers from NodeDB / Device State divorce (#6059) * Increase `MAX_THREADS` for InkHUD variants with WiFi (#6064) * Licensed usage compliance (#6047) * Prevent psk and legacy admin channel on licensed mode * Move it * Consolidate warning strings * More holes * Device UI submodule bump * Prevent licensed users from rebroadcasting unlicensed traffic (#6068) * Prevent licensed users from rebroadcasting unlicensed traffic * Added method and enum to make user license status more clear * MUI: move UI initialization out of main.cpp and adding lightsleep observer + mutex (#6078) * added device-ui to lightSleep observers for handling graceful sleep; refactoring main.cpp * bump lib version * Update device-ui * unPhone TFT: include into build, enable SD card, increase PSRAM (#6082) * unPhone-tft: include into build, enable SD card, increase assigned PSRAM * lib update * Backup / migrate pub private keys when upgrading to new files in 2.6 (#6096) * Save a backup of pub/private keys before factory reset * Fix licensed mode warning * Unlock spi on else file doesn't exist * Update device-ui * Update protos and device-ui * [create-pull-request] automated change (#6129) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Proto * [create-pull-request] automated change (#6131) * Proto update for backup * [create-pull-request] automated change (#6133) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Update protobufs * Space * [create-pull-request] automated change (#6144) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Protos * [create-pull-request] automated change (#6152) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> * Updeet * device-ui lib update * fix channel OK button * device-lib update: fix settings panel -> no scrolling * device-ui lib: last minute update * defined(SENSECAP_INDICATOR) * MUI hot-fix pub/priv keys * MUI hot-fix username dialog * MUI: BT programming mode button * Update protobufs --------- Signed-off-by: dependabot[bot] Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Co-authored-by: GUVWAF Co-authored-by: Thomas Göttgens Co-authored-by: Tom Fifield Co-authored-by: mverch67 Co-authored-by: Manuel <71137295+mverch67@users.noreply.github.com> Co-authored-by: todd-herbert Co-authored-by: Jason Murray <15822260+scruplelesswizard@users.noreply.github.com> Co-authored-by: Jason Murray Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jonathan Bennett Co-authored-by: Austin Co-authored-by: virgil Co-authored-by: Mark Trevor Birss Co-authored-by: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com> Co-authored-by: rcarteraz --- .gitmodules | 3 + arch/esp32/esp32.ini | 1 + arch/rp2xx0/rp2040.ini | 1 + bin/build-esp32.sh | 6 +- bin/config.d/MUI/X11_480x480.yaml | 4 + bin/generate_ci_matrix.py | 7 +- lib/device-ui | 1 + src/BluetoothStatus.h | 105 ++ src/ButtonThread.cpp | 28 + src/ButtonThread.h | 14 + src/FSCommon.cpp | 7 +- src/Status.h | 1 + .../Drivers/Backlight/LatchingBacklight.cpp | 110 ++ .../Drivers/Backlight/LatchingBacklight.h | 50 + .../niche/Drivers/EInk/DEPG0154BNS800.cpp | 1 + .../niche/Drivers/EInk/DEPG0154BNS800.h | 34 + .../niche/Drivers/EInk/DEPG0290BNS800.cpp | 120 ++ .../niche/Drivers/EInk/DEPG0290BNS800.h | 42 + src/graphics/niche/Drivers/EInk/EInk.cpp | 70 + src/graphics/niche/Drivers/EInk/EInk.h | 56 + .../niche/Drivers/EInk/GDEY0154D67.cpp | 61 + src/graphics/niche/Drivers/EInk/GDEY0154D67.h | 42 + .../niche/Drivers/EInk/LCMEN2R13EFC1.cpp | 301 +++++ .../niche/Drivers/EInk/LCMEN2R13EFC1.h | 68 + src/graphics/niche/Drivers/EInk/README.md | 82 ++ src/graphics/niche/Drivers/EInk/SSD16XX.cpp | 227 ++++ src/graphics/niche/Drivers/EInk/SSD16XX.h | 62 + src/graphics/niche/Drivers/README.md | 3 + src/graphics/niche/FlashData.h | 140 ++ src/graphics/niche/Fonts/FreeSans6pt7b.h | 129 ++ .../niche/Fonts/FreeSans6pt8bCyrillic.h | 302 +++++ src/graphics/niche/Fonts/README.md | 4 + src/graphics/niche/InkHUD/Applet.cpp | 843 ++++++++++++ src/graphics/niche/InkHUD/Applet.h | 234 ++++ src/graphics/niche/InkHUD/AppletFont.cpp | 208 +++ src/graphics/niche/InkHUD/AppletFont.h | 59 + .../InkHUD/Applets/Bases/Map/MapApplet.cpp | 429 +++++++ .../InkHUD/Applets/Bases/Map/MapApplet.h | 66 + .../Applets/Bases/NodeList/NodeListApplet.cpp | 283 +++++ .../Applets/Bases/NodeList/NodeListApplet.h | 71 ++ .../BasicExample/BasicExampleApplet.cpp | 14 + .../BasicExample/BasicExampleApplet.h | 36 + .../NewMsgExample/NewMsgExampleApplet.cpp | 54 + .../NewMsgExample/NewMsgExampleApplet.h | 61 + .../System/BatteryIcon/BatteryIconApplet.cpp | 107 ++ .../System/BatteryIcon/BatteryIconApplet.h | 41 + .../InkHUD/Applets/System/Logo/LogoApplet.cpp | 108 ++ .../InkHUD/Applets/System/Logo/LogoApplet.h | 47 + .../InkHUD/Applets/System/Menu/MenuAction.h | 38 + .../InkHUD/Applets/System/Menu/MenuApplet.cpp | 612 +++++++++ .../InkHUD/Applets/System/Menu/MenuApplet.h | 60 + .../InkHUD/Applets/System/Menu/MenuItem.h | 47 + .../InkHUD/Applets/System/Menu/MenuPage.h | 30 + .../System/Notification/Notification.h | 40 + .../Notification/NotificationApplet.cpp | 219 ++++ .../System/Notification/NotificationApplet.h | 49 + .../Applets/System/Pairing/PairingApplet.cpp | 96 ++ .../Applets/System/Pairing/PairingApplet.h | 43 + .../System/Placeholder/PlaceholderApplet.cpp | 21 + .../System/Placeholder/PlaceholderApplet.h | 30 + .../InkHUD/Applets/System/Tips/TipsApplet.cpp | 234 ++++ .../InkHUD/Applets/System/Tips/TipsApplet.h | 52 + .../User/AllMessage/AllMessageApplet.cpp | 133 ++ .../User/AllMessage/AllMessageApplet.h | 49 + .../niche/InkHUD/Applets/User/DM/DMApplet.cpp | 126 ++ .../niche/InkHUD/Applets/User/DM/DMApplet.h | 49 + .../InkHUD/Applets/User/Heard/HeardApplet.cpp | 123 ++ .../InkHUD/Applets/User/Heard/HeardApplet.h | 35 + .../User/Positions/PositionsApplet.cpp | 110 ++ .../Applets/User/Positions/PositionsApplet.h | 43 + .../User/RecentsList/RecentsListApplet.cpp | 150 +++ .../User/RecentsList/RecentsListApplet.h | 52 + .../ThreadedMessage/ThreadedMessageApplet.cpp | 270 ++++ .../ThreadedMessage/ThreadedMessageApplet.h | 63 + src/graphics/niche/InkHUD/MessageStore.cpp | 139 ++ src/graphics/niche/InkHUD/MessageStore.h | 47 + src/graphics/niche/InkHUD/Persistence.cpp | 59 + src/graphics/niche/InkHUD/Persistence.h | 123 ++ .../niche/InkHUD/PlatformioConfig.ini | 10 + src/graphics/niche/InkHUD/README.md | 12 + src/graphics/niche/InkHUD/Tile.cpp | 237 ++++ src/graphics/niche/InkHUD/Tile.h | 62 + src/graphics/niche/InkHUD/Types.h | 62 + src/graphics/niche/InkHUD/UpdateMediator.cpp | 151 +++ src/graphics/niche/InkHUD/UpdateMediator.h | 45 + src/graphics/niche/InkHUD/WindowManager.cpp | 1128 +++++++++++++++++ src/graphics/niche/InkHUD/WindowManager.h | 177 +++ src/graphics/niche/Inputs/README.md | 7 + src/graphics/niche/Inputs/TwoButton.cpp | 272 ++++ src/graphics/niche/Inputs/TwoButton.h | 103 ++ src/graphics/niche/README.md | 15 + src/graphics/tftSetup.cpp | 126 ++ src/main.cpp | 62 +- src/main.h | 6 + src/mesh/Channels.cpp | 29 + src/mesh/Channels.h | 2 + src/mesh/FloodingRouter.cpp | 48 +- src/mesh/FloodingRouter.h | 16 +- src/mesh/LR11x0Interface.cpp | 9 +- src/mesh/MeshPacketQueue.cpp | 13 + src/mesh/MeshPacketQueue.h | 3 + src/mesh/MeshService.cpp | 4 +- src/mesh/MeshTypes.h | 5 + src/mesh/NextHopRouter.cpp | 272 ++++ src/mesh/NextHopRouter.h | 151 +++ src/mesh/NodeDB.cpp | 188 ++- src/mesh/NodeDB.h | 43 +- src/mesh/PacketHistory.cpp | 88 +- src/mesh/PacketHistory.h | 27 +- src/mesh/PhoneAPI.cpp | 1 + src/mesh/RadioInterface.cpp | 31 +- src/mesh/RadioInterface.h | 23 +- src/mesh/RadioLibInterface.cpp | 9 + src/mesh/RadioLibInterface.h | 3 + src/mesh/ReliableRouter.cpp | 129 +- src/mesh/ReliableRouter.h | 95 +- src/mesh/Router.cpp | 19 +- src/mesh/Router.h | 6 +- src/mesh/SX126xInterface.cpp | 9 +- src/mesh/SX128xInterface.cpp | 9 +- src/mesh/api/PacketAPI.cpp | 127 ++ src/mesh/api/PacketAPI.h | 38 + src/mesh/mesh-pb-constants.h | 2 - src/mesh/udp/UdpMulticastThread.h | 70 + src/mesh/wifi/WiFiAPClient.cpp | 8 +- src/modules/AdminModule.cpp | 31 +- src/modules/AdminModule.h | 3 + src/modules/RoutingModule.cpp | 5 + src/modules/TraceRouteModule.cpp | 3 +- src/nimble/NimbleBluetooth.cpp | 10 +- src/platform/nrf52/NRF52Bluetooth.cpp | 30 +- src/platform/portduino/SimRadio.cpp | 6 + src/platform/portduino/SimRadio.h | 3 + src/shutdown.h | 2 + src/sleep.cpp | 31 +- src/sleep.h | 14 +- .../heltec_vision_master_e213/nicheGraphics.h | 115 ++ .../heltec_vision_master_e213/platformio.ini | 21 + variants/heltec_vision_master_e213/variant.h | 1 - .../heltec_vision_master_e290/nicheGraphics.h | 129 ++ .../heltec_vision_master_e290/platformio.ini | 23 + variants/heltec_vision_master_e290/variant.h | 1 - .../heltec_wireless_paper/nicheGraphics.h | 111 ++ variants/heltec_wireless_paper/platformio.ini | 22 + variants/heltec_wireless_paper/variant.h | 1 - variants/mesh-tab/platformio.ini | 1 + variants/picomputer-s3/platformio.ini | 49 +- variants/portduino/platformio.ini | 76 +- variants/portduino/variant.h | 2 + .../seeed-sensecap-indicator/platformio.ini | 54 + variants/seeed-sensecap-indicator/variant.h | 2 + variants/t-deck/platformio.ini | 62 +- variants/t-deck/variant.h | 9 +- variants/t-echo/nicheGraphics.h | 126 ++ variants/t-echo/platformio.ini | 27 +- variants/t-echo/variant.h | 2 - variants/unphone/platformio.ini | 60 +- variants/unphone/variant.h | 3 +- version.properties | 4 +- 159 files changed, 12449 insertions(+), 427 deletions(-) create mode 100644 bin/config.d/MUI/X11_480x480.yaml create mode 160000 lib/device-ui create mode 100644 src/BluetoothStatus.h create mode 100644 src/graphics/niche/Drivers/Backlight/LatchingBacklight.cpp create mode 100644 src/graphics/niche/Drivers/Backlight/LatchingBacklight.h create mode 100644 src/graphics/niche/Drivers/EInk/DEPG0154BNS800.cpp create mode 100644 src/graphics/niche/Drivers/EInk/DEPG0154BNS800.h create mode 100644 src/graphics/niche/Drivers/EInk/DEPG0290BNS800.cpp create mode 100644 src/graphics/niche/Drivers/EInk/DEPG0290BNS800.h create mode 100644 src/graphics/niche/Drivers/EInk/EInk.cpp create mode 100644 src/graphics/niche/Drivers/EInk/EInk.h create mode 100644 src/graphics/niche/Drivers/EInk/GDEY0154D67.cpp create mode 100644 src/graphics/niche/Drivers/EInk/GDEY0154D67.h create mode 100644 src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.cpp create mode 100644 src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.h create mode 100644 src/graphics/niche/Drivers/EInk/README.md create mode 100644 src/graphics/niche/Drivers/EInk/SSD16XX.cpp create mode 100644 src/graphics/niche/Drivers/EInk/SSD16XX.h create mode 100644 src/graphics/niche/Drivers/README.md create mode 100644 src/graphics/niche/FlashData.h create mode 100644 src/graphics/niche/Fonts/FreeSans6pt7b.h create mode 100644 src/graphics/niche/Fonts/FreeSans6pt8bCyrillic.h create mode 100644 src/graphics/niche/Fonts/README.md create mode 100644 src/graphics/niche/InkHUD/Applet.cpp create mode 100644 src/graphics/niche/InkHUD/Applet.h create mode 100644 src/graphics/niche/InkHUD/AppletFont.cpp create mode 100644 src/graphics/niche/InkHUD/AppletFont.h create mode 100644 src/graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.cpp create mode 100644 src/graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.h create mode 100644 src/graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.cpp create mode 100644 src/graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.h create mode 100644 src/graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.cpp create mode 100644 src/graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.h create mode 100644 src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.cpp create mode 100644 src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h create mode 100644 src/graphics/niche/InkHUD/Applets/System/BatteryIcon/BatteryIconApplet.cpp create mode 100644 src/graphics/niche/InkHUD/Applets/System/BatteryIcon/BatteryIconApplet.h create mode 100644 src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp create mode 100644 src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.h create mode 100644 src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h create mode 100644 src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp create mode 100644 src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.h create mode 100644 src/graphics/niche/InkHUD/Applets/System/Menu/MenuItem.h create mode 100644 src/graphics/niche/InkHUD/Applets/System/Menu/MenuPage.h create mode 100644 src/graphics/niche/InkHUD/Applets/System/Notification/Notification.h create mode 100644 src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.cpp create mode 100644 src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.h create mode 100644 src/graphics/niche/InkHUD/Applets/System/Pairing/PairingApplet.cpp create mode 100644 src/graphics/niche/InkHUD/Applets/System/Pairing/PairingApplet.h create mode 100644 src/graphics/niche/InkHUD/Applets/System/Placeholder/PlaceholderApplet.cpp create mode 100644 src/graphics/niche/InkHUD/Applets/System/Placeholder/PlaceholderApplet.h create mode 100644 src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.cpp create mode 100644 src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.h create mode 100644 src/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.cpp create mode 100644 src/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.h create mode 100644 src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.cpp create mode 100644 src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.h create mode 100644 src/graphics/niche/InkHUD/Applets/User/Heard/HeardApplet.cpp create mode 100644 src/graphics/niche/InkHUD/Applets/User/Heard/HeardApplet.h create mode 100644 src/graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.cpp create mode 100644 src/graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.h create mode 100644 src/graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.cpp create mode 100644 src/graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h create mode 100644 src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.cpp create mode 100644 src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h create mode 100644 src/graphics/niche/InkHUD/MessageStore.cpp create mode 100644 src/graphics/niche/InkHUD/MessageStore.h create mode 100644 src/graphics/niche/InkHUD/Persistence.cpp create mode 100644 src/graphics/niche/InkHUD/Persistence.h create mode 100644 src/graphics/niche/InkHUD/PlatformioConfig.ini create mode 100644 src/graphics/niche/InkHUD/README.md create mode 100644 src/graphics/niche/InkHUD/Tile.cpp create mode 100644 src/graphics/niche/InkHUD/Tile.h create mode 100644 src/graphics/niche/InkHUD/Types.h create mode 100644 src/graphics/niche/InkHUD/UpdateMediator.cpp create mode 100644 src/graphics/niche/InkHUD/UpdateMediator.h create mode 100644 src/graphics/niche/InkHUD/WindowManager.cpp create mode 100644 src/graphics/niche/InkHUD/WindowManager.h create mode 100644 src/graphics/niche/Inputs/README.md create mode 100644 src/graphics/niche/Inputs/TwoButton.cpp create mode 100644 src/graphics/niche/Inputs/TwoButton.h create mode 100644 src/graphics/niche/README.md create mode 100644 src/graphics/tftSetup.cpp create mode 100644 src/mesh/NextHopRouter.cpp create mode 100644 src/mesh/NextHopRouter.h create mode 100644 src/mesh/api/PacketAPI.cpp create mode 100644 src/mesh/api/PacketAPI.h create mode 100644 src/mesh/udp/UdpMulticastThread.h create mode 100644 variants/heltec_vision_master_e213/nicheGraphics.h create mode 100644 variants/heltec_vision_master_e290/nicheGraphics.h create mode 100644 variants/heltec_wireless_paper/nicheGraphics.h create mode 100644 variants/t-echo/nicheGraphics.h diff --git a/.gitmodules b/.gitmodules index 7c54ad513..964204476 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,9 @@ [submodule "protobufs"] path = protobufs url = https://github.com/meshtastic/protobufs.git +[submodule "lib/device-ui"] + path = lib/device-ui + url = https://github.com/meshtastic/device-ui.git [submodule "meshtestic"] path = meshtestic url = https://github.com/meshtastic/meshTestic diff --git a/arch/esp32/esp32.ini b/arch/esp32/esp32.ini index e02e3ed85..256781ba1 100644 --- a/arch/esp32/esp32.ini +++ b/arch/esp32/esp32.ini @@ -37,6 +37,7 @@ build_flags = -DLIBPAX_ARDUINO -DLIBPAX_WIFI -DLIBPAX_BLE + -DHAS_UDP_MULTICAST=1 ;-DDEBUG_HEAP lib_deps = diff --git a/arch/rp2xx0/rp2040.ini b/arch/rp2xx0/rp2040.ini index 5cfa678d5..74644800d 100644 --- a/arch/rp2xx0/rp2040.ini +++ b/arch/rp2xx0/rp2040.ini @@ -18,6 +18,7 @@ build_src_filter = lib_ignore = BluetoothOTA + lvgl lib_deps = ${arduino_base.lib_deps} diff --git a/bin/build-esp32.sh b/bin/build-esp32.sh index f8d808ced..a0635e997 100755 --- a/bin/build-esp32.sh +++ b/bin/build-esp32.sh @@ -35,11 +35,11 @@ cp $SRCBIN $OUTDIR/$basename-update.bin echo "Building Filesystem for ESP32 targets" pio run --environment $1 -t buildfs -cp .pio/build/$1/littlefs.bin $OUTDIR/littlefswebui-$VERSION.bin +cp .pio/build/$1/littlefs.bin $OUTDIR/littlefswebui-$1-$VERSION.bin # Remove webserver files from the filesystem and rebuild ls -l data/static # Diagnostic list of files rm -rf data/static pio run --environment $1 -t buildfs -cp .pio/build/$1/littlefs.bin $OUTDIR/littlefs-$VERSION.bin +cp .pio/build/$1/littlefs.bin $OUTDIR/littlefs-$1-$VERSION.bin cp bin/device-install.* $OUTDIR -cp bin/device-update.* $OUTDIR +cp bin/device-update.* $OUTDIR \ No newline at end of file diff --git a/bin/config.d/MUI/X11_480x480.yaml b/bin/config.d/MUI/X11_480x480.yaml new file mode 100644 index 000000000..7bdf50453 --- /dev/null +++ b/bin/config.d/MUI/X11_480x480.yaml @@ -0,0 +1,4 @@ +Display: + Panel: X11 + Width: 480 + Height: 480 \ No newline at end of file diff --git a/bin/generate_ci_matrix.py b/bin/generate_ci_matrix.py index 4d8759ecc..7513ccff5 100755 --- a/bin/generate_ci_matrix.py +++ b/bin/generate_ci_matrix.py @@ -35,6 +35,11 @@ for subdir, dirs, files in os.walk(rootdir): outlist.append(section) else: outlist.append(section) + # Add the TFT variants if the base variant is selected + elif section.replace("-tft", "") in outlist and config[config[c].name].get("board_level") != "extra": + outlist.append(section) + elif section.replace("-inkhud", "") in outlist and config[config[c].name].get("board_level") != "extra": + outlist.append(section) if "board_check" in config[config[c].name]: if (config[config[c].name]["board_check"] == "true") & ( "check" in options @@ -43,4 +48,4 @@ for subdir, dirs, files in os.walk(rootdir): if ("quick" in options) & (len(outlist) > 3): print(json.dumps(random.sample(outlist, 3))) else: - print(json.dumps(outlist)) + print(json.dumps(outlist)) \ No newline at end of file diff --git a/lib/device-ui b/lib/device-ui new file mode 160000 index 000000000..5c6156d2a --- /dev/null +++ b/lib/device-ui @@ -0,0 +1 @@ +Subproject commit 5c6156d2aa10d62cca3e57ffc117b934ef2fbffe diff --git a/src/BluetoothStatus.h b/src/BluetoothStatus.h new file mode 100644 index 000000000..e29139001 --- /dev/null +++ b/src/BluetoothStatus.h @@ -0,0 +1,105 @@ +#pragma once +#include "Status.h" +#include "assert.h" +#include "configuration.h" +#include "meshUtils.h" +#include + +namespace meshtastic +{ + +// Describes the state of the Bluetooth connection +// Allows display to handle pairing events without each UI needing to explicitly hook the Bluefruit / NimBLE code +class BluetoothStatus : public Status +{ + public: + enum class ConnectionState { + DISCONNECTED, + PAIRING, + CONNECTED, + }; + + private: + CallbackObserver statusObserver = + CallbackObserver(this, &BluetoothStatus::updateStatus); + + ConnectionState state = ConnectionState::DISCONNECTED; + std::string passkey; // Stored as string, because Bluefruit allows passkeys with a leading zero + + public: + BluetoothStatus() { statusType = STATUS_TYPE_BLUETOOTH; } + + // New BluetoothStatus: connected or disconnected + BluetoothStatus(ConnectionState state) + { + assert(state != ConnectionState::PAIRING); // If pairing, use constructor which specifies passkey + statusType = STATUS_TYPE_BLUETOOTH; + this->state = state; + } + + // New BluetoothStatus: pairing, with passkey + BluetoothStatus(std::string passkey) : Status() + { + statusType = STATUS_TYPE_BLUETOOTH; + this->state = ConnectionState::PAIRING; + this->passkey = passkey; + } + + ConnectionState getConnectionState() const { return this->state; } + + std::string getPasskey() const + { + assert(state == ConnectionState::PAIRING); + return this->passkey; + } + + void observe(Observable *source) { statusObserver.observe(source); } + + bool matches(const BluetoothStatus *newStatus) const + { + if (this->state == newStatus->getConnectionState()) { + // Same state: CONNECTED / DISCONNECTED + if (this->state != ConnectionState::PAIRING) + return true; + // Same state: PAIRING, and passkey matches + else if (this->getPasskey() == newStatus->getPasskey()) + return true; + } + + return false; + } + + int updateStatus(const BluetoothStatus *newStatus) + { + // Has the status changed? + if (!matches(newStatus)) { + // Copy the members + state = newStatus->getConnectionState(); + if (state == ConnectionState::PAIRING) + passkey = newStatus->getPasskey(); + + // Tell anyone interested that we have an update + onNewStatus.notifyObservers(this); + + // Debug only: + switch (state) { + case ConnectionState::PAIRING: + LOG_DEBUG("BluetoothStatus PAIRING, key=%s", passkey.c_str()); + break; + case ConnectionState::CONNECTED: + LOG_DEBUG("BluetoothStatus CONNECTED"); + break; + + case ConnectionState::DISCONNECTED: + LOG_DEBUG("BluetoothStatus DISCONNECTED"); + break; + } + } + + return 0; + } +}; + +} // namespace meshtastic + +extern meshtastic::BluetoothStatus *bluetoothStatus; \ No newline at end of file diff --git a/src/ButtonThread.cpp b/src/ButtonThread.cpp index 5175a2680..ec0bc5fc2 100644 --- a/src/ButtonThread.cpp +++ b/src/ButtonThread.cpp @@ -11,6 +11,7 @@ #include "main.h" #include "modules/ExternalNotificationModule.h" #include "power.h" +#include "sleep.h" #ifdef ARCH_PORTDUINO #include "platform/portduino/PortduinoGlue.h" #endif @@ -99,6 +100,13 @@ ButtonThread::ButtonThread() : OSThread("Button") userButtonTouch.attachLongPressStart(touchPressedLongStart); // Better handling with longpress than click? #endif +#ifdef ARCH_ESP32 + // Register callbacks for before and after lightsleep + // Used to detach and reattach interrupts + lsObserver.observe(¬ifyLightSleep); + lsEndObserver.observe(¬ifyLightSleepEnd); +#endif + attachButtonInterrupts(); #endif } @@ -320,6 +328,26 @@ void ButtonThread::detachButtonInterrupts() #endif } +#ifdef ARCH_ESP32 + +// Detach our class' interrupts before lightsleep +// Allows sleep.cpp to configure its own interrupts, which wake the device on user-button press +int ButtonThread::beforeLightSleep(void *unused) +{ + detachButtonInterrupts(); + return 0; // Indicates success +} + +// Reconfigure our interrupts +// Our class' interrupts were disconnected during sleep, to allow the user button to wake the device from sleep +int ButtonThread::afterLightSleep(esp_sleep_wakeup_cause_t cause) +{ + attachButtonInterrupts(); + return 0; // Indicates success +} + +#endif + /** * Watch a GPIO and if we get an IRQ, wake the main thread. * Use to add wake on button press diff --git a/src/ButtonThread.h b/src/ButtonThread.h index a01a1718f..54b833d03 100644 --- a/src/ButtonThread.h +++ b/src/ButtonThread.h @@ -37,6 +37,12 @@ class ButtonThread : public concurrency::OSThread void detachButtonInterrupts(); void storeClickCount(); + // Disconnect and reconnect interrupts for light sleep +#ifdef ARCH_ESP32 + int beforeLightSleep(void *unused); + int afterLightSleep(esp_sleep_wakeup_cause_t cause); +#endif + private: #if defined(BUTTON_PIN) || defined(ARCH_PORTDUINO) || defined(USERPREFS_BUTTON_PIN) static OneButton userButton; // Static - accessed from an interrupt @@ -48,6 +54,14 @@ class ButtonThread : public concurrency::OSThread OneButton userButtonTouch; #endif +#ifdef ARCH_ESP32 + // Get notified when lightsleep begins and ends + CallbackObserver lsObserver = + CallbackObserver(this, &ButtonThread::beforeLightSleep); + CallbackObserver lsEndObserver = + CallbackObserver(this, &ButtonThread::afterLightSleep); +#endif + // set during IRQ static volatile ButtonEventType btnEvent; diff --git a/src/FSCommon.cpp b/src/FSCommon.cpp index 461c72c26..31fe69c93 100644 --- a/src/FSCommon.cpp +++ b/src/FSCommon.cpp @@ -23,6 +23,10 @@ SPIClass SPI1(HSPI); #define SDHandler SPI #endif +#ifndef SD_SPI_FREQUENCY +#define SD_SPI_FREQUENCY 4000000U +#endif + #endif // HAS_SDCARD #if defined(ARCH_STM32WL) @@ -361,8 +365,7 @@ void setupSDCard() #ifdef HAS_SDCARD concurrency::LockGuard g(spiLock); SDHandler.begin(SPI_SCK, SPI_MISO, SPI_MOSI); - - if (!SD.begin(SDCARD_CS, SDHandler)) { + if (!SD.begin(SDCARD_CS, SDHandler, SD_SPI_FREQUENCY)) { LOG_DEBUG("No SD_MMC card detected"); return; } diff --git a/src/Status.h b/src/Status.h index 65f3a252f..59d443ab7 100644 --- a/src/Status.h +++ b/src/Status.h @@ -7,6 +7,7 @@ #define STATUS_TYPE_POWER 1 #define STATUS_TYPE_GPS 2 #define STATUS_TYPE_NODE 3 +#define STATUS_TYPE_BLUETOOTH 4 namespace meshtastic { diff --git a/src/graphics/niche/Drivers/Backlight/LatchingBacklight.cpp b/src/graphics/niche/Drivers/Backlight/LatchingBacklight.cpp new file mode 100644 index 000000000..7e4f0b709 --- /dev/null +++ b/src/graphics/niche/Drivers/Backlight/LatchingBacklight.cpp @@ -0,0 +1,110 @@ +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +#include "./LatchingBacklight.h" + +#include "assert.h" + +#include "sleep.h" + +using namespace NicheGraphics::Drivers; + +// Private constructor +// Called by getInstance +LatchingBacklight::LatchingBacklight() +{ + // Attach the deep sleep callback + deepSleepObserver.observe(¬ifyDeepSleep); +} + +// Get access to (or create) the singleton instance of this class +LatchingBacklight *LatchingBacklight::getInstance() +{ + // Instantiate the class the first time this method is called + static LatchingBacklight *const singletonInstance = new LatchingBacklight; + + return singletonInstance; +} + +// Which pin controls the backlight? +// Is the light active HIGH (default) or active LOW? +void LatchingBacklight::setPin(uint8_t pin, bool activeWhen) +{ + this->pin = pin; + this->logicActive = activeWhen; + + pinMode(pin, OUTPUT); + off(); // Explicit off seem required by T-Echo? +} + +// Called when device is shutting down +// Ensures the backlight is off +int LatchingBacklight::beforeDeepSleep(void *unused) +{ + // We shouldn't need to guard the block like this + // Contingency for: + // - settings corruption: settings.optionalMenuItems.backlight guards backlight code in MenuApplet + // - improper use in the future + if (pin != (uint8_t)-1) { + off(); + pinMode(pin, INPUT); // High impedence - unnecessary? + } else + LOG_WARN("LatchingBacklight instantiated, but pin not set"); + return 0; // Continue with deep sleep +} + +// Turn the backlight on *temporarily* +// This should be used for momentary illumination, such as while a button is held +// The effect on the backlight is the same; peek and latch are separated to simplify short vs long press button handling +void LatchingBacklight::peek() +{ + assert(pin != (uint8_t)-1); + digitalWrite(pin, logicActive); // On + on = true; + latched = false; +} + +// Turn the backlight on, and keep it on +// This should be used when the backlight should remain active, even after user input ends +// e.g. when enabled via the menu +// The effect on the backlight is the same; peek and latch are separated to simplify short vs long press button handling +void LatchingBacklight::latch() +{ + assert(pin != (uint8_t)-1); + + // Blink if moving from peek to latch + // Indicates to user that the transition has taken place + if (on && !latched) { + digitalWrite(pin, !logicActive); // Off + delay(25); + digitalWrite(pin, logicActive); // On + delay(25); + digitalWrite(pin, !logicActive); // Off + delay(25); + } + + digitalWrite(pin, logicActive); // On + on = true; + latched = true; +} + +// Turn the backlight off +// Suitable for ending both peek and latch +void LatchingBacklight::off() +{ + assert(pin != (uint8_t)-1); + digitalWrite(pin, !logicActive); // Off + on = false; + latched = false; +} + +bool LatchingBacklight::isOn() +{ + return on; +} + +bool LatchingBacklight::isLatched() +{ + return latched; +} + +#endif diff --git a/src/graphics/niche/Drivers/Backlight/LatchingBacklight.h b/src/graphics/niche/Drivers/Backlight/LatchingBacklight.h new file mode 100644 index 000000000..0097cae4c --- /dev/null +++ b/src/graphics/niche/Drivers/Backlight/LatchingBacklight.h @@ -0,0 +1,50 @@ +/* + + Singleton class + On-demand control of a display's backlight, connected to a GPIO + Initial use case is control of T-Echo's frontlight, via the capacitive touch button + + - momentary on + - latched on + +*/ + +#pragma once + +#include "configuration.h" + +#include "Observer.h" + +namespace NicheGraphics::Drivers +{ + +class LatchingBacklight +{ + public: + static LatchingBacklight *getInstance(); // Create or get the singleton instance + void setPin(uint8_t pin, bool activeWhen = HIGH); + + int beforeDeepSleep(void *unused); // Callback for auto-shutoff + + void peek(); // Backlight on temporarily, e.g. while button held + void latch(); // Backlight on permanently, e.g. toggled via menu + void off(); // Backlight off. Suitable for both peek and latch + + bool isOn(); // Either peek or latch + bool isLatched(); + + private: + LatchingBacklight(); // Constructor made private: force use of getInstance + + // Get notified when the system is shutting down + CallbackObserver deepSleepObserver = + CallbackObserver(this, &LatchingBacklight::beforeDeepSleep); + + uint8_t pin = (uint8_t)-1; + bool logicActive = HIGH; // Is light active HIGH or active LOW + + bool on = false; // Is light on (either peek or latched) + bool latched = false; // Is light latched on +}; + +} // namespace NicheGraphics::Drivers \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/DEPG0154BNS800.cpp b/src/graphics/niche/Drivers/EInk/DEPG0154BNS800.cpp new file mode 100644 index 000000000..b8715ed1d --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/DEPG0154BNS800.cpp @@ -0,0 +1 @@ +#include "./DEPG0154BNS800.h" \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/DEPG0154BNS800.h b/src/graphics/niche/Drivers/EInk/DEPG0154BNS800.h new file mode 100644 index 000000000..62d42ef57 --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/DEPG0154BNS800.h @@ -0,0 +1,34 @@ +/* + +E-Ink display driver + - DEPG0154BNS800 + - Manufacturer: DKE + - Size: 1.54 inch + - Resolution: 152px x 152px + - Flex connector marking: FPC7525 + +*/ + +#pragma once + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS +#include "configuration.h" + +#include "./SSD16XX.h" + +namespace NicheGraphics::Drivers +{ +class DEPG0154BNS800 : public SSD16XX +{ + // Display properties + private: + static constexpr uint32_t width = 152; + static constexpr uint32_t height = 152; + static constexpr UpdateTypes supported = (UpdateTypes)(FULL); + + public: + DEPG0154BNS800() : SSD16XX(width, height, supported, 1) {} // Note: left edge of this display is offset by 1 byte +}; + +} // namespace NicheGraphics::Drivers +#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/DEPG0290BNS800.cpp b/src/graphics/niche/Drivers/EInk/DEPG0290BNS800.cpp new file mode 100644 index 000000000..5f3a05670 --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/DEPG0290BNS800.cpp @@ -0,0 +1,120 @@ +#include "./DEPG0290BNS800.h" + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +using namespace NicheGraphics::Drivers; + +// Describes the operation performed when a "fast refresh" is performed +// Source: custom, with DEPG0150BNS810 as a reference +static const uint8_t LUT_FAST[] = { + // 1 2 3 4 + 0x40, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // B2B (Existing black pixels) + 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // B2W (New white pixels) + 0x00, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // W2B (New black pixels) + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // W2W (Existing white pixels) + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // VCOM + + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 1. Tap existing black pixels back into place + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 2. Move new pixels + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 3. New pixels, and also existing black pixels + 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, // 4. All pixels, then cooldown + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, +}; + +// How strongly the pixels are pulled and pushed +void DEPG0290BNS800::configVoltages() +{ + switch (updateType) { + case FAST: + // Listed as "typical" in datasheet + sendCommand(0x04); + sendData(0x41); // VSH1 15V + sendData(0x00); // VSH2 NA + sendData(0x32); // VSL -15V + break; + + case FULL: + default: + // From OTP memory + break; + } +} + +// Load settings about how the pixels are moved from old state to new state during a refresh +// - manually specified, +// - or with stored values from displays OTP memory +void DEPG0290BNS800::configWaveform() +{ + switch (updateType) { + case FAST: + sendCommand(0x3C); // Border waveform: + sendData(0x60); // Actively hold screen border during update + + sendCommand(0x32); // Write LUT register from MCU: + sendData(LUT_FAST, sizeof(LUT_FAST)); // (describes operation for a FAST refresh) + break; + + case FULL: + default: + // From OTP memory + break; + } +} + +// Describes the sequence of events performed by the displays controller IC during a refresh +// Includes "power up", "load settings from memory", "update the pixels", etc +void DEPG0290BNS800::configUpdateSequence() +{ + switch (updateType) { + case FAST: + sendCommand(0x22); // Set "update sequence" + sendData(0xCF); // Differential, use manually loaded waveform + break; + + case FULL: + default: + sendCommand(0x22); // Set "update sequence" + sendData(0xF7); // Non-differential, load waveform from OTP + break; + } +} + +// Once the refresh operation has been started, +// begin periodically polling the display to check for completion, using the normal Meshtastic threading code +// Only used when refresh is "async" +void DEPG0290BNS800::detachFromUpdate() +{ + switch (updateType) { + case FAST: + return beginPolling(50, 450); // At least 450ms for fast refresh + case FULL: + default: + return beginPolling(100, 3000); // At least 3 seconds for full refresh + } +} + +// For this display, we do not need to re-write the new image. +// We're overriding SSD16XX::finalizeUpdate to make this small optimization. +// The display does also work just fine with the generic SSD16XX method, though. +void DEPG0290BNS800::finalizeUpdate() +{ + // Put a copy of the image into the "old memory". + // Used with differential refreshes (e.g. FAST update), to determine which px need to move, and which can remain in place + // We need to keep the "old memory" up to date, because don't know whether next refresh will be FULL or FAST etc. + if (updateType != FULL) { + // writeNewImage(); // Not required for this display + writeOldImage(); + sendCommand(0x7F); // Terminate image write without update + wait(); + } +} +#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/DEPG0290BNS800.h b/src/graphics/niche/Drivers/EInk/DEPG0290BNS800.h new file mode 100644 index 000000000..72062e0d6 --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/DEPG0290BNS800.h @@ -0,0 +1,42 @@ +/* + +E-Ink display driver + - DEPG0290BNS800 + - Manufacturer: DKE + - Size: 2.9 inch + - Resolution: 128px x 296px + - Flex connector marking: FPC-7519 rev.b + +*/ + +#pragma once + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +#include "configuration.h" + +#include "./SSD16XX.h" + +namespace NicheGraphics::Drivers +{ +class DEPG0290BNS800 : public SSD16XX +{ + // Display properties + private: + static constexpr uint32_t width = 128; + static constexpr uint32_t height = 296; + static constexpr UpdateTypes supported = (UpdateTypes)(FULL | FAST); + + public: + DEPG0290BNS800() : SSD16XX(width, height, supported, 1) {} // Note: left edge of this display is offset by 1 byte + + protected: + void configVoltages() override; + void configWaveform() override; + void configUpdateSequence() override; + void detachFromUpdate() override; + void finalizeUpdate() override; // Only overriden for a slight optimization +}; + +} // namespace NicheGraphics::Drivers +#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/EInk.cpp b/src/graphics/niche/Drivers/EInk/EInk.cpp new file mode 100644 index 000000000..0abe20bf9 --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/EInk.cpp @@ -0,0 +1,70 @@ +#include "./EInk.h" + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +using namespace NicheGraphics::Drivers; + +// Separate from EInk::begin method, as derived class constructors can probably supply these parameters as constants +EInk::EInk(uint16_t width, uint16_t height, UpdateTypes supported) + : concurrency::OSThread("E-Ink Driver"), width(width), height(height), supportedUpdateTypes(supported) +{ + OSThread::disable(); +} + +// Used by NicheGraphics implementations to check if a display supports a specific refresh operation. +// Whether or the update type is supported is specified in the constructor +bool EInk::supports(UpdateTypes type) +{ + // The EInkUpdateTypes enum assigns each type a unique bit. We are checking if that bit is set. + if (supportedUpdateTypes & type) + return true; + else + return false; +} + +// Begins using the OSThread to detect when a display update is complete +// This allows the refresh operation to run "asynchronously". +// Rather than blocking execution waiting for the update to complete, we are periodically checking the hardware's BUSY pin +// The expectedDuration argument allows us to delay the start of this checking, if we know "roughly" how long an update takes. +// Potentially, a display without hardware BUSY could rely entirely on "expectedDuration", +// provided its isUpdateDone() override always returns true. +void EInk::beginPolling(uint32_t interval, uint32_t expectedDuration) +{ + updateRunning = true; + updateBegunAt = millis(); + pollingInterval = interval; + + // To minimize load, we can choose to delay polling for a few seconds, if we know roughly how long the update will take + // By default, expectedDuration is 0, and we'll start polling immediately + OSThread::setIntervalFromNow(expectedDuration); + OSThread::enabled = true; +} + +// Meshtastic's pseudo-threading layer +// We're using this as a timer, to periodically check if an update is complete +// This is what allows us to update the display asynchronously +int32_t EInk::runOnce() +{ + if (!isUpdateDone()) + return pollingInterval; // Poll again in a few ms + + // If update done: + finalizeUpdate(); // Any post-update code: power down panel hardware, hibernate, etc + updateRunning = false; // Change what we report via EInk::busy() + return disable(); // Stop polling +} + +// Wait for an in progress update to complete before continuing +// Run a normal (async) update first, *then* call await +void EInk::await() +{ + // Stop our concurrency thread + OSThread::disable(); + + // Sit and block until the update is complete + while (updateRunning) { + runOnce(); + yield(); + } +} +#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/EInk.h b/src/graphics/niche/Drivers/EInk/EInk.h new file mode 100644 index 000000000..1fbc25a14 --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/EInk.h @@ -0,0 +1,56 @@ +/* + + Base class for E-Ink display drivers + +*/ + +#pragma once + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS +#include "configuration.h" + +#include "concurrency/OSThread.h" +#include + +namespace NicheGraphics::Drivers +{ + +class EInk : private concurrency::OSThread +{ + public: + // Different possible operations used to update an E-Ink display + // Some displays will not support all operations + // Each value needs a unique bit. In some cases, we might set more than one bit (e.g. EInk::supportedUpdateType) + enum UpdateTypes : uint8_t { + UNSPECIFIED = 0, + FULL = 1 << 0, + FAST = 1 << 1, + }; + + EInk(uint16_t width, uint16_t height, UpdateTypes supported); + virtual void begin(SPIClass *spi, uint8_t pin_dc, uint8_t pin_cs, uint8_t pin_busy, uint8_t pin_rst = -1) = 0; + virtual void update(uint8_t *imageData, UpdateTypes type) = 0; // Change the display image + void await(); // Wait for an in-progress update to complete before proceeding + bool supports(UpdateTypes type); // Can display perfom a certain update type + bool busy() { return updateRunning; } // Display able to update right now? + + const uint16_t width; // Public so that NicheGraphics implementations can access. Safe because const. + const uint16_t height; + + protected: + void beginPolling(uint32_t interval, uint32_t expectedDuration); // Begin checking repeatedly if update finished + virtual bool isUpdateDone() = 0; // Check once if update finished + virtual void finalizeUpdate() {} // Run any post-update code + + private: + int32_t runOnce() override; // Repeated checking if update finished + + const UpdateTypes supportedUpdateTypes; // Capabilities of a derived display class + bool updateRunning = false; // see EInk::busy() + uint32_t updateBegunAt; // For initial pause before polling for update completion + uint32_t pollingInterval; // How often to check if update complete (ms) +}; + +} // namespace NicheGraphics::Drivers + +#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/GDEY0154D67.cpp b/src/graphics/niche/Drivers/EInk/GDEY0154D67.cpp new file mode 100644 index 000000000..bfc5ac681 --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/GDEY0154D67.cpp @@ -0,0 +1,61 @@ +#include "./GDEY0154D67.h" + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +using namespace NicheGraphics::Drivers; + +// Map the display controller IC's output to the conected panel +void GDEY0154D67::configScanning() +{ + // "Driver output control" + sendCommand(0x01); + sendData(0xC7); + sendData(0x00); + sendData(0x00); + + // To-do: delete this method? + // Values set here might be redundant: C7, 00, 00 seems to be default +} + +// Specify which information is used to control the sequence of voltages applied to move the pixels +// - For this display, configUpdateSequence() specifies that a suitable LUT will be loaded from +// the controller IC's OTP memory, when the update procedure begins. +void GDEY0154D67::configWaveform() +{ + sendCommand(0x3C); // Border waveform: + sendData(0x05); // Screen border should follow LUT1 waveform (actively drive pixels white) + + sendCommand(0x18); // Temperature sensor: + sendData(0x80); // Use internal temperature sensor to select an appropriate refresh waveform +} + +void GDEY0154D67::configUpdateSequence() +{ + switch (updateType) { + case FAST: + sendCommand(0x22); // Set "update sequence" + sendData(0xFF); // Will load LUT from OTP memory, Display mode 2 "differential refresh" + break; + + case FULL: + default: + sendCommand(0x22); // Set "update sequence" + sendData(0xF7); // Will load LUT from OTP memory + break; + } +} + +// Once the refresh operation has been started, +// begin periodically polling the display to check for completion, using the normal Meshtastic threading code +// Only used when refresh is "async" +void GDEY0154D67::detachFromUpdate() +{ + switch (updateType) { + case FAST: + return beginPolling(50, 500); // At least 500ms for fast refresh + case FULL: + default: + return beginPolling(100, 2000); // At least 2 seconds for full refresh + } +} +#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/GDEY0154D67.h b/src/graphics/niche/Drivers/EInk/GDEY0154D67.h new file mode 100644 index 000000000..fc4d93d12 --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/GDEY0154D67.h @@ -0,0 +1,42 @@ +/* + +E-Ink display driver + - GDEY0154D67 + - Manufacturer: Goodisplay + - Size: 1.54 inch + - Resolution: 200px x 200px + - Flex connector marking: FPC-B001 + +*/ + +#pragma once + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +#include "configuration.h" + +#include "./SSD16XX.h" + +namespace NicheGraphics::Drivers +{ +class GDEY0154D67 : public SSD16XX +{ + // Display properties + private: + static constexpr uint32_t width = 200; + static constexpr uint32_t height = 200; + static constexpr UpdateTypes supported = (UpdateTypes)(FULL | FAST); + + public: + GDEY0154D67() : SSD16XX(width, height, supported) {} + + protected: + virtual void configScanning() override; + virtual void configWaveform() override; + virtual void configUpdateSequence() override; + void detachFromUpdate() override; +}; + +} // namespace NicheGraphics::Drivers + +#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.cpp b/src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.cpp new file mode 100644 index 000000000..c54769fc2 --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.cpp @@ -0,0 +1,301 @@ +#include "./LCMEN2R13EFC1.h" + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +#include + +using namespace NicheGraphics::Drivers; + +// Look up table: fast refresh, common electrode +static const uint8_t LUT_FAST_VCOMDC[] = { + 0x01, 0x06, 0x03, 0x02, 0x01, 0x01, 0x01, // + 0x01, 0x06, 0x02, 0x01, 0x01, 0x01, 0x01, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // +}; + +// Look up table: fast refresh, pixels which remain white +static const uint8_t LUT_FAST_WW[] = { + 0x01, 0x06, 0x03, 0x02, 0x81, 0x01, 0x01, // + 0x01, 0x06, 0x02, 0x01, 0x01, 0x01, 0x01, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // +}; + +// Look up table: fast refresh, pixel which change from black to white +static const uint8_t LUT_FAST_BW[] = { + 0x01, 0x86, 0x83, 0x82, 0x81, 0x01, 0x01, // + 0x01, 0x86, 0x82, 0x01, 0x01, 0x01, 0x01, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // +}; + +// Look up table: fash refresh, pixels which change from white to black +static const uint8_t LUT_FAST_WB[] = { + 0x01, 0x46, 0x42, 0x01, 0x01, 0x01, 0x01, // + 0x01, 0x46, 0x42, 0x01, 0x01, 0x01, 0x01, // + 0x01, 0x46, 0x43, 0x02, 0x01, 0x01, 0x01, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // +}; + +// Look up table: fash refresh, pixels which remain black +static const uint8_t LUT_FAST_BB[] = { + 0x01, 0x06, 0x03, 0x42, 0x41, 0x01, 0x01, // + 0x01, 0x06, 0x02, 0x01, 0x01, 0x01, 0x01, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // +}; + +LCMEN213EFC1::LCMEN213EFC1() : EInk(width, height, supported) +{ + // Pre-calculate size of the image buffer, for convenience + + // Determine the X dimension of the image buffer, in bytes. + // Along rows, pixels are stored 8 per byte. + // Not all display widths are divisible by 8. Need to make sure bytecount accommodates padding for these. + bufferRowSize = ((width - 1) / 8) + 1; + + // Total size of image buffer, in bytes. + bufferSize = bufferRowSize * height; +} + +void LCMEN213EFC1::begin(SPIClass *spi, uint8_t pin_dc, uint8_t pin_cs, uint8_t pin_busy, uint8_t pin_rst) +{ + this->spi = spi; + this->pin_dc = pin_dc; + this->pin_cs = pin_cs; + this->pin_busy = pin_busy; + this->pin_rst = pin_rst; + + pinMode(pin_dc, OUTPUT); + pinMode(pin_cs, OUTPUT); + pinMode(pin_busy, INPUT); + + // Reset is active low, hold high + pinMode(pin_rst, INPUT_PULLUP); + + reset(); +} + +void LCMEN213EFC1::update(uint8_t *imageData, UpdateTypes type) +{ + this->updateType = type; + this->buffer = imageData; + + reset(); + + // Config + if (updateType == FULL) + configFull(); + else + configFast(); + + // Transfer image data + if (updateType == FULL) { + writeNewImage(); + writeOldImage(); + } else { + writeNewImage(); + } + + sendCommand(0x04); // Power on the panel voltage + wait(); + + sendCommand(0x12); // Begin executing the update + + // Let the update run async, on display hardware. Base class will poll completion, then finalize. + // For a blocking update, call await after update + detachFromUpdate(); +} + +void LCMEN213EFC1::wait() +{ + // Busy when LOW + while (digitalRead(pin_busy) == LOW) + yield(); +} + +void LCMEN213EFC1::reset() +{ + pinMode(pin_rst, OUTPUT); + digitalWrite(pin_rst, LOW); + delay(10); + pinMode(pin_rst, INPUT_PULLUP); + wait(); + + sendCommand(0x12); + wait(); +} + +void LCMEN213EFC1::sendCommand(const uint8_t command) +{ + spi->beginTransaction(spiSettings); + digitalWrite(pin_dc, LOW); // DC pin low indicates command + digitalWrite(pin_cs, LOW); + spi->transfer(command); + digitalWrite(pin_cs, HIGH); + digitalWrite(pin_dc, HIGH); + spi->endTransaction(); +} + +void LCMEN213EFC1::sendData(uint8_t data) +{ + // spi->beginTransaction(spiSettings); + // digitalWrite(pin_dc, HIGH); // DC pin HIGH indicates data, instead of command + // digitalWrite(pin_cs, LOW); + // spi->transfer(data); + // digitalWrite(pin_cs, HIGH); + // digitalWrite(pin_dc, HIGH); + // spi->endTransaction(); + sendData(&data, 1); +} + +void LCMEN213EFC1::sendData(const uint8_t *data, uint32_t size) +{ + spi->beginTransaction(spiSettings); + digitalWrite(pin_dc, HIGH); // DC pin HIGH indicates data, instead of command + digitalWrite(pin_cs, LOW); + + // Platform-specific SPI command + // Mothballing. This display model is only used by Heltec Wireless Paper (ESP32) +#if defined(ARCH_ESP32) + spi->transferBytes(data, NULL, size); // NULL for a "write only" transfer +#elif defined(ARCH_NRF52) + spi->transfer(data, NULL, size); // NULL for a "write only" transfer +#else +#error Not implemented yet? Feel free to add other platforms here. +#endif + + digitalWrite(pin_cs, HIGH); + digitalWrite(pin_dc, HIGH); + spi->endTransaction(); +} + +void LCMEN213EFC1::configFull() +{ + sendCommand(0x00); // Panel setting register + sendData(0b11 << 6 // Display resolution + | 1 << 4 // B&W only + | 1 << 3 // Vertical scan direction + | 1 << 2 // Horizontal scan direction + | 1 << 1 // Shutdown: no + | 1 << 0 // Reset: no + ); + + sendCommand(0x50); // VCOM and data interval setting register + sendData(0b10 << 6 // Border driven white + | 0b11 << 4 // Invert image colors: no + | 0b0111 << 0 // Interval between VCOM on and image data (default) + ); +} + +void LCMEN213EFC1::configFast() +{ + sendCommand(0x00); // Panel setting register + sendData(0b11 << 6 // Display resolution + | 1 << 5 // LUT from registers (set below) + | 1 << 4 // B&W only + | 1 << 3 // Vertical scan direction + | 1 << 2 // Horizontal scan direction + | 1 << 1 // Shutdown: no + | 1 << 0 // Reset: no + ); + + sendCommand(0x50); // VCOM and data interval setting register + sendData(0b11 << 6 // Border floating + | 0b01 << 4 // Invert image colors: no + | 0b0111 << 0 // Interval between VCOM on and image data (default) + ); + + // Load the various LUTs + sendCommand(0x20); // VCOM + sendData(LUT_FAST_VCOMDC, sizeof(LUT_FAST_VCOMDC)); + + sendCommand(0x21); // White -> White + sendData(LUT_FAST_WW, sizeof(LUT_FAST_WW)); + + sendCommand(0x22); // Black -> White + sendData(LUT_FAST_BW, sizeof(LUT_FAST_BW)); + + sendCommand(0x23); // White -> Black + sendData(LUT_FAST_WB, sizeof(LUT_FAST_WB)); + + sendCommand(0x24); // Black -> Black + sendData(LUT_FAST_BB, sizeof(LUT_FAST_BB)); +} + +void LCMEN213EFC1::writeNewImage() +{ + sendCommand(0x13); + sendData(buffer, bufferSize); +} + +void LCMEN213EFC1::writeOldImage() +{ + sendCommand(0x10); + sendData(buffer, bufferSize); +} + +void LCMEN213EFC1::detachFromUpdate() +{ + // To save power / cycles, displays can choose to specify an "expected duration" for various refresh types + // If we know a full-refresh takes at least 4 seconds, we can delay polling until 3 seconds have passed + // If not implemented, we'll just poll right from the get-go + switch (updateType) { + case FULL: + EInk::beginPolling(10, 3650); + break; + case FAST: + EInk::beginPolling(10, 720); + break; + default: + assert(false); + } +} + +bool LCMEN213EFC1::isUpdateDone() +{ + // Busy when LOW + if (digitalRead(pin_busy) == LOW) + return false; + else + return true; +} + +void LCMEN213EFC1::finalizeUpdate() +{ + // Power off the panel voltages + sendCommand(0x02); + wait(); + + // Put a copy of the image into the "old memory". + // Used with differential refreshes (e.g. FAST update), to determine which px need to move, and which can remain in place + // We need to keep the "old memory" up to date, because don't know whether next refresh will be FULL or FAST etc. + if (updateType != FULL) { + writeOldImage(); + wait(); + } +} + +#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.h b/src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.h new file mode 100644 index 000000000..5c801c014 --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.h @@ -0,0 +1,68 @@ +/* + +E-Ink display driver + - LCMEN213EFC1 + - Manufacturer: Wisevast + - Size: 2.13 inch + - Resolution: 122px x 250px + - Flex connector marking: HINK-E0213A162-FPC-A0 (Hidden, printed on back-side) + +Note: this display uses an uncommon controller IC, Fitipower JD79656. +It is implemented as a "one-off", directly inheriting the EInk base class, unlike SSD16XX displays. + +*/ + +#pragma once + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +#include "configuration.h" + +#include "./EInk.h" + +namespace NicheGraphics::Drivers +{ + +class LCMEN213EFC1 : public EInk +{ + // Display properties + private: + static constexpr uint32_t width = 122; + static constexpr uint32_t height = 250; + static constexpr UpdateTypes supported = (UpdateTypes)(FULL | FAST); + + public: + LCMEN213EFC1(); + void begin(SPIClass *spi, uint8_t pin_dc, uint8_t pin_cs, uint8_t pin_busy, uint8_t pin_rst); + void update(uint8_t *imageData, UpdateTypes type) override; + + protected: + void wait(); + void reset(); + void sendCommand(const uint8_t command); + void sendData(const uint8_t data); + void sendData(const uint8_t *data, uint32_t size); + void configFull(); // Configure display for FULL refresh + void configFast(); // Configure display for FAST refresh + void writeNewImage(); + void writeOldImage(); + + void detachFromUpdate(); + bool isUpdateDone(); + void finalizeUpdate(); + + protected: + uint8_t bufferOffsetX; // In bytes. Panel x=0 does not always align with controller x=0. Quirky internal wiring? + uint8_t bufferRowSize; // In bytes. Rows store 8 pixels per byte. Rounded up to fit (e.g. 122px would require 16 bytes) + uint32_t bufferSize; // In bytes. Rows * Columns + uint8_t *buffer; + UpdateTypes updateType; + + uint8_t pin_dc, pin_cs, pin_busy, pin_rst; + SPIClass *spi; + SPISettings spiSettings = SPISettings(6000000, MSBFIRST, SPI_MODE0); +}; + +} // namespace NicheGraphics::Drivers + +#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/README.md b/src/graphics/niche/Drivers/EInk/README.md new file mode 100644 index 000000000..ffe21e507 --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/README.md @@ -0,0 +1,82 @@ +# NicheGraphics - E-Ink Driver + +A driver for E-Ink SPI displays. Suitable for re-use by various NicheGraphics UIs. + +Your UI should use the class `NicheGraphics::Drivers::EInk` . +When you set up a hardware variant, you will use one of specific display model classes, which extend the EInk class. + +An example setup might look like this: + +```cpp +void setupNicheGraphics() +{ + using namespace NicheGraphics; + + // An imaginary UI + YourCustomUI *yourUI = new YourCustomUI(); + + // Setup SPI + SPIClass *hspi = new SPIClass(HSPI); + hspi->begin(PIN_EINK_SCLK, -1, PIN_EINK_MOSI, PIN_EINK_CS); + + // Setup Enk driver + Drivers::EInk *driver = new Drivers::DEPG0290BNS800; + driver->begin(hspi, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY); + + // Pass the driver to your UI + YourUI::driver = driver; +} +``` + +## Methods + +### `update(uint8_t *imageData, UpdateTypes type, bool async=true)` + +Update the image on the display + +- _`imageData`_ to draw to the display. +- _`type`_ which type of update to perform. + - `FULL` + - `FAST` + - (Other custom types may be possible) +- _`async`_ whether to wait for update to complete, or continue code execution + +The imageData is a 1-bit image. X-Pixels are 8-per byte, with the MSB being the leftmost pixel. This was not an InkHUD design decision; it is the raw format accepted by the E-Ink display controllers ICs. + +_To-do: add a helper method to `InkHUD::Drivers::EInk` to do this arithmetic for you._ + +```cpp +uint16_t w = driver::width(); +uint16_t h = driver::height(); + +uint8_t image[ (w/8) * h ]; // X pixels are 8-per-byte + +image[0] |= (1 << 7); // Set pixel x=0, y=0 +image[0] |= (1 << 0); // Set pixel x=7, y=0 +image[1] |= (1 << 7); // Set pixel x=8, y=0 + +uint8_t x = 12; +uint8_t y = 2; +uint8_t yBytes = y * (w/8); +uint8_t xBytes = x / 8; +uint8_t xBits = (7-x) % 8; +image[yByte + xByte] |= (1 << xBits); // Set pixel x=12, y=2 +``` + +### `supports(UpdateTypes type)` + +Check if display supports a specific update type. `true` if supported. + +- _`type`_ type to check + +### `busy()` + +Check if display is already performing an `update()`. `true` if already updating. + +### `width()` + +Width of the display, in pixels. Note: most displays are portait. Your UI will need to implement rotation in software. + +### `height()` + +Height of the display, in pixels. Note: most displays are portrait. Your UI will need to implement rotation in software. diff --git a/src/graphics/niche/Drivers/EInk/SSD16XX.cpp b/src/graphics/niche/Drivers/EInk/SSD16XX.cpp new file mode 100644 index 000000000..d58e5b37a --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/SSD16XX.cpp @@ -0,0 +1,227 @@ +#include "./SSD16XX.h" + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS +using namespace NicheGraphics::Drivers; + +SSD16XX::SSD16XX(uint16_t width, uint16_t height, UpdateTypes supported, uint8_t bufferOffsetX) + : EInk(width, height, supported), bufferOffsetX(bufferOffsetX) +{ + // Pre-calculate size of the image buffer, for convenience + + // Determine the X dimension of the image buffer, in bytes. + // Along rows, pixels are stored 8 per byte. + // Not all display widths are divisible by 8. Need to make sure bytecount accommodates padding for these. + bufferRowSize = ((width - 1) / 8) + 1; + + // Total size of image buffer, in bytes. + bufferSize = bufferRowSize * height; +} + +void SSD16XX::begin(SPIClass *spi, uint8_t pin_dc, uint8_t pin_cs, uint8_t pin_busy, uint8_t pin_rst) +{ + this->spi = spi; + this->pin_dc = pin_dc; + this->pin_cs = pin_cs; + this->pin_busy = pin_busy; + this->pin_rst = pin_rst; + + pinMode(pin_dc, OUTPUT); + pinMode(pin_cs, OUTPUT); + pinMode(pin_busy, INPUT); + + // If using a reset pin, hold high + // Reset is active low for solmon systech ICs + if (pin_rst != 0xFF) + pinMode(pin_rst, INPUT_PULLUP); + + reset(); +} + +void SSD16XX::wait() +{ + // Busy when HIGH + while (digitalRead(pin_busy) == HIGH) + yield(); +} + +void SSD16XX::reset() +{ + // Check if reset pin is defined + if (pin_rst != 0xFF) { + pinMode(pin_rst, OUTPUT); + digitalWrite(pin_rst, LOW); + delay(50); + pinMode(pin_rst, INPUT_PULLUP); + wait(); + } + + sendCommand(0x12); + wait(); +} + +void SSD16XX::sendCommand(const uint8_t command) +{ + spi->beginTransaction(spiSettings); + digitalWrite(pin_dc, LOW); // DC pin low indicates command + digitalWrite(pin_cs, LOW); + spi->transfer(command); + digitalWrite(pin_cs, HIGH); + digitalWrite(pin_dc, HIGH); + spi->endTransaction(); +} + +void SSD16XX::sendData(uint8_t data) +{ + // spi->beginTransaction(spiSettings); + // digitalWrite(pin_dc, HIGH); // DC pin HIGH indicates data, instead of command + // digitalWrite(pin_cs, LOW); + // spi->transfer(data); + // digitalWrite(pin_cs, HIGH); + // digitalWrite(pin_dc, HIGH); + // spi->endTransaction(); + sendData(&data, 1); +} + +void SSD16XX::sendData(const uint8_t *data, uint32_t size) +{ + spi->beginTransaction(spiSettings); + digitalWrite(pin_dc, HIGH); // DC pin HIGH indicates data, instead of command + digitalWrite(pin_cs, LOW); + + // Platform-specific SPI command +#if defined(ARCH_ESP32) + spi->transferBytes(data, NULL, size); // NULL for a "write only" transfer +#elif defined(ARCH_NRF52) + spi->transfer(data, NULL, size); // NULL for a "write only" transfer +#else +#error Not implemented yet? Feel free to add other platforms here. +#endif + + digitalWrite(pin_cs, HIGH); + digitalWrite(pin_dc, HIGH); + spi->endTransaction(); +} + +void SSD16XX::configFullscreen() +{ + // Placing this code in a separate method because it's probably pretty consistent between displays + // Should make it tidier to override SSD16XX::configure + + // Define the boundaries of the "fullscreen" region, for the controller IC + static const uint16_t sx = bufferOffsetX; // Notice the offset + static const uint16_t sy = 0; + static const uint16_t ex = bufferRowSize + bufferOffsetX - 1; // End is "max index", not "count". Minus 1 handles this + static const uint16_t ey = height; + + // Split into bytes + static const uint8_t sy1 = sy & 0xFF; + static const uint8_t sy2 = (sy >> 8) & 0xFF; + static const uint8_t ey1 = ey & 0xFF; + static const uint8_t ey2 = (ey >> 8) & 0xFF; + + // Data entry mode - Left to Right, Top to Bottom + sendCommand(0x11); + sendData(0x03); + + // Select controller IC memory region to display a fullscreen image + sendCommand(0x44); // Memory X start - end + sendData(sx); + sendData(ex); + sendCommand(0x45); // Memory Y start - end + sendData(sy1); + sendData(sy2); + sendData(ey1); + sendData(ey2); + + // Place the cursor at the start of this memory region, ready to send image data x=0 y=0 + sendCommand(0x4E); // Memory cursor X + sendData(sx); + sendCommand(0x4F); // Memory cursor y + sendData(sy1); + sendData(sy2); +} + +void SSD16XX::update(uint8_t *imageData, UpdateTypes type) +{ + this->updateType = type; + this->buffer = imageData; + + reset(); + + configFullscreen(); + configScanning(); // Virtual, unused by base class + configVoltages(); // Virtual, unused by base class + configWaveform(); // Virtual, unused by base class + wait(); + + if (updateType == FULL) { + writeNewImage(); + writeOldImage(); + } else { + writeNewImage(); + } + + configUpdateSequence(); + sendCommand(0x20); // Begin executing the update + + // Let the update run async, on display hardware. Base class will poll completion, then finalize. + // For a blocking update, call await after update + detachFromUpdate(); +} + +// Send SPI commands for controller IC to begin executing the refresh operation +void SSD16XX::configUpdateSequence() +{ + switch (updateType) { + default: + sendCommand(0x22); // Set "update sequence" + sendData(0xF7); // Non-differential, load waveform from OTP + break; + } +} + +void SSD16XX::writeNewImage() +{ + sendCommand(0x24); + sendData(buffer, bufferSize); +} + +void SSD16XX::writeOldImage() +{ + sendCommand(0x26); + sendData(buffer, bufferSize); +} + +void SSD16XX::detachFromUpdate() +{ + // To save power / cycles, displays can choose to specify an "expected duration" for various refresh types + // If we know a full-refresh takes at least 4 seconds, we can delay polling until 3 seconds have passed + // If not implemented, we'll just poll right from the get-go + switch (updateType) { + default: + EInk::beginPolling(100, 0); + } +} + +bool SSD16XX::isUpdateDone() +{ + // Busy when HIGH + if (digitalRead(pin_busy) == HIGH) + return false; + else + return true; +} + +void SSD16XX::finalizeUpdate() +{ + // Put a copy of the image into the "old memory". + // Used with differential refreshes (e.g. FAST update), to determine which px need to move, and which can remain in place + // We need to keep the "old memory" up to date, because don't know whether next refresh will be FULL or FAST etc. + if (updateType != FULL) { + writeNewImage(); // Only required by some controller variants. Todo: Override just for GDEY0154D678? + writeOldImage(); + sendCommand(0x7F); // Terminate image write without update + wait(); + } +} +#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/SSD16XX.h b/src/graphics/niche/Drivers/EInk/SSD16XX.h new file mode 100644 index 000000000..f9077f188 --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/SSD16XX.h @@ -0,0 +1,62 @@ +/* + +E-Ink base class for displays based on SSD16XX + +Most (but not all) SPI E-Ink displays use this family of controller IC. +Implementing new SSD16XX displays should be fairly painless. +See DEPG0154BNS800 and DEPG0290BNS800 for examples. + +*/ + +#pragma once + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +#include "configuration.h" + +#include "./EInk.h" + +namespace NicheGraphics::Drivers +{ + +class SSD16XX : public EInk +{ + public: + SSD16XX(uint16_t width, uint16_t height, UpdateTypes supported, uint8_t bufferOffsetX = 0); + virtual void begin(SPIClass *spi, uint8_t pin_dc, uint8_t pin_cs, uint8_t pin_busy, uint8_t pin_rst = -1); + virtual void update(uint8_t *imageData, UpdateTypes type) override; + + protected: + virtual void wait(); + virtual void reset(); + virtual void sendCommand(const uint8_t command); + virtual void sendData(const uint8_t data); + virtual void sendData(const uint8_t *data, uint32_t size); + virtual void configFullscreen(); // Select memory region on controller IC + virtual void configScanning() {} // Optional. First & last gates, scan direction, etc + virtual void configVoltages() {} // Optional. Manual panel voltages, soft-start, etc + virtual void configWaveform() {} // Optional. LUT, panel border, temperature sensor, etc + virtual void configUpdateSequence(); // Tell controller IC which operations to run + + virtual void writeNewImage(); + virtual void writeOldImage(); + + virtual void detachFromUpdate(); + virtual bool isUpdateDone() override; + virtual void finalizeUpdate() override; + + protected: + uint8_t bufferOffsetX; // In bytes. Panel x=0 does not always align with controller x=0. Quirky internal wiring? + uint8_t bufferRowSize; // In bytes. Rows store 8 pixels per byte. Rounded up to fit (e.g. 122px would require 16 bytes) + uint32_t bufferSize; // In bytes. Rows * Columns + uint8_t *buffer; + UpdateTypes updateType; + + uint8_t pin_dc, pin_cs, pin_busy, pin_rst; + SPIClass *spi; + SPISettings spiSettings = SPISettings(4000000, MSBFIRST, SPI_MODE0); +}; + +} // namespace NicheGraphics::Drivers + +#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/niche/Drivers/README.md b/src/graphics/niche/Drivers/README.md new file mode 100644 index 000000000..566558658 --- /dev/null +++ b/src/graphics/niche/Drivers/README.md @@ -0,0 +1,3 @@ +# NicheGraphics - Drivers + +Common drivers which can be used by various NicheGrapihcs UIs diff --git a/src/graphics/niche/FlashData.h b/src/graphics/niche/FlashData.h new file mode 100644 index 000000000..4a436d387 --- /dev/null +++ b/src/graphics/niche/FlashData.h @@ -0,0 +1,140 @@ +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +/* + +Re-usable NicheGraphics tool + +Save settings / data to flash, without use of the Meshtastic Protobufs +Avoid bloating everyone's protobuf code for our one-off UI implementations + +*/ + +#pragma once + +#include "configuration.h" + +#include "SafeFile.h" + +namespace NicheGraphics +{ + +template class FlashData +{ + private: + static std::string getFilename(const char *label) + { + std::string filename; + filename += "/NicheGraphics"; + filename += "/"; + filename += label; + filename += ".data"; + + return filename; + } + + static uint32_t getHash(T *data) + { + uint32_t hash = 0; + + // Sum all bytes of the image buffer together + for (uint32_t i = 0; i < sizeof(T); i++) + hash ^= ((uint8_t *)data)[i] + 1; + + return hash; + } + + public: + static bool load(T *data, const char *label) + { + // Set false if we run into issues + bool okay = true; + + // Get a filename based on the label + std::string filename = getFilename(label); + +#ifdef FSCom + + // Check that the file *does* actually exist + if (!FSCom.exists(filename.c_str())) { + LOG_WARN("'%s' not found. Using default values", filename.c_str()); + okay = false; + return okay; + } + + // Open the file + auto f = FSCom.open(filename.c_str(), FILE_O_READ); + + // If opened, start reading + if (f) { + LOG_INFO("Loading NicheGraphics data '%s'", filename.c_str()); + + // Create an object which will received data from flash + // We read here first, so we can verify the checksum, without committing to overwriting the *data object + // Allows us to retain any defaults that might be set after we declared *data, but before loading settings, + // in case the flash values are corrupt + T flashData; + + // Read the actual data + f.readBytes((char *)&flashData, sizeof(T)); + + // Read the hash + uint32_t savedHash = 0; + f.readBytes((char *)&savedHash, sizeof(savedHash)); + + // Calculate hash of the loaded data, then compare with the saved hash + // If hash looks good, copy the values to the main data object + uint32_t calculatedHash = getHash(&flashData); + if (savedHash != calculatedHash) { + LOG_WARN("'%s' is corrupt (hash mismatch). Using default values", filename.c_str()); + okay = false; + } else + *data = flashData; + + f.close(); + } else { + LOG_ERROR("Could not open / read %s", filename.c_str()); + okay = false; + } +#else + LOG_ERROR("Filesystem not implemented"); + state = LoadFileState::NO_FILESYSTEM; + okay = false; +#endif + return okay; + } + + // Save module's custom data (settings?) to flash. Does use protobufs + static void save(T *data, const char *label) + { + // Get a filename based on the label + std::string filename = getFilename(label); + +#ifdef FSCom + FSCom.mkdir("/NicheGraphics"); + + auto f = SafeFile(filename.c_str(), true); // "true": full atomic. Write new data to temp file, then rename. + + LOG_INFO("Saving %s", filename.c_str()); + + // Calculate a hash of the data + uint32_t hash = getHash(data); + + f.write((uint8_t *)data, sizeof(T)); // Write the actualy data + f.write((uint8_t *)&hash, sizeof(hash)); // Append the hash + + // f.flush(); + + bool writeSucceeded = f.close(); + + if (!writeSucceeded) { + LOG_ERROR("Can't write data!"); + } +#else + LOG_ERROR("ERROR: Filesystem not implemented\n"); +#endif + } +}; + +} // namespace NicheGraphics + +#endif \ No newline at end of file diff --git a/src/graphics/niche/Fonts/FreeSans6pt7b.h b/src/graphics/niche/Fonts/FreeSans6pt7b.h new file mode 100644 index 000000000..c5bcc32c4 --- /dev/null +++ b/src/graphics/niche/Fonts/FreeSans6pt7b.h @@ -0,0 +1,129 @@ +#pragma once + +const uint8_t FreeSans6pt7bBitmaps[] PROGMEM = { + 0xAA, 0xA8, 0xC0, 0xF6, 0xA0, 0x24, 0x51, 0xF9, 0x42, 0x9F, 0x92, 0x28, 0x10, 0xE5, 0x55, 0x50, 0xE1, 0x65, 0x55, 0xE1, 0x00, + 0x71, 0x24, 0x89, 0x22, 0x50, 0x74, 0x02, 0x70, 0xA4, 0x49, 0x11, 0xC0, 0x70, 0x91, 0x23, 0x86, 0x12, 0xA2, 0x4E, 0xF4, 0xE0, + 0x5A, 0xAA, 0x94, 0x89, 0x12, 0x49, 0x29, 0x00, 0x27, 0x50, 0x21, 0x3E, 0x42, 0x00, 0xE0, 0xC0, 0x80, 0x24, 0xA4, 0xA4, 0x80, + 0x74, 0xE3, 0x18, 0xC6, 0x33, 0x70, 0x27, 0x92, 0x49, 0x20, 0x79, 0x10, 0x41, 0x08, 0xC6, 0x10, 0xFC, 0x79, 0x30, 0x43, 0x18, + 0x10, 0x71, 0x78, 0x08, 0x61, 0x8A, 0x49, 0x2F, 0xC2, 0x08, 0x7D, 0x04, 0x1E, 0x44, 0x10, 0x51, 0x78, 0x74, 0x61, 0xE8, 0xC6, + 0x31, 0x70, 0xF8, 0x44, 0x22, 0x11, 0x08, 0x40, 0x39, 0x34, 0x53, 0x39, 0x1C, 0x51, 0x38, 0x39, 0x3C, 0x71, 0x4C, 0xF0, 0x53, + 0x78, 0x82, 0x87, 0x01, 0xF1, 0x83, 0x04, 0xF8, 0x3E, 0x07, 0x06, 0x36, 0x40, 0x74, 0x42, 0x11, 0x10, 0x80, 0x20, 0x0F, 0x86, + 0x19, 0x9A, 0xA4, 0xD9, 0x13, 0x22, 0x56, 0xDA, 0x6E, 0x60, 0x06, 0x00, 0x3C, 0x00, 0x18, 0x18, 0x3C, 0x24, 0x24, 0x7E, 0x42, + 0x42, 0xC3, 0xFA, 0x18, 0x61, 0xFA, 0x18, 0x61, 0xFC, 0x3E, 0x63, 0x40, 0x40, 0xC0, 0x40, 0x41, 0x63, 0x3E, 0xF9, 0x0A, 0x1C, + 0x18, 0x30, 0x61, 0xC2, 0xF8, 0xFE, 0x08, 0x20, 0xFE, 0x08, 0x20, 0xFC, 0xFE, 0x08, 0x20, 0xFA, 0x08, 0x20, 0x80, 0x1E, 0x61, + 0x40, 0x40, 0xC7, 0x41, 0x41, 0x63, 0x1D, 0x83, 0x06, 0x0C, 0x1F, 0xF0, 0x60, 0xC1, 0x82, 0xFF, 0x80, 0x08, 0x42, 0x10, 0x87, + 0x29, 0x70, 0x85, 0x12, 0x45, 0x0D, 0x13, 0x22, 0x42, 0x86, 0x84, 0x21, 0x08, 0x42, 0x10, 0xF8, 0xC3, 0xC3, 0xC3, 0xA5, 0xA5, + 0xA5, 0x99, 0x99, 0x99, 0x83, 0x86, 0x8D, 0x19, 0x33, 0x62, 0xC3, 0x86, 0x1E, 0x31, 0x90, 0x68, 0x1C, 0x0A, 0x05, 0x06, 0xC6, + 0x1E, 0x00, 0xFA, 0x18, 0x61, 0xFA, 0x08, 0x20, 0x80, 0x1E, 0x31, 0x90, 0x68, 0x1C, 0x0A, 0x05, 0x06, 0xC6, 0x1F, 0x00, 0x00, + 0xFD, 0x0E, 0x1C, 0x2F, 0x90, 0xA1, 0x42, 0x86, 0x7A, 0x18, 0x30, 0x78, 0x38, 0x61, 0x78, 0xFE, 0x20, 0x40, 0x81, 0x02, 0x04, + 0x08, 0x10, 0x83, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xE2, 0x78, 0xC2, 0x42, 0x42, 0x64, 0x24, 0x24, 0x38, 0x18, 0x18, 0xC4, 0x28, + 0xCD, 0x29, 0x25, 0x24, 0xA4, 0x52, 0x8C, 0x61, 0x8C, 0x31, 0x80, 0x42, 0x66, 0x24, 0x18, 0x18, 0x18, 0x24, 0x46, 0x42, 0xC3, + 0x42, 0x24, 0x34, 0x18, 0x08, 0x08, 0x08, 0x08, 0x7E, 0x0C, 0x30, 0x41, 0x06, 0x18, 0x20, 0xFE, 0xEA, 0xAA, 0xAB, 0x92, 0x24, + 0x89, 0x20, 0xE9, 0x24, 0x92, 0x49, 0x70, 0x46, 0xA9, 0x10, 0xFE, 0x40, 0x79, 0x20, 0x4F, 0xC6, 0x37, 0x40, 0x84, 0x3D, 0x18, + 0xC6, 0x31, 0xF0, 0x39, 0x3C, 0x20, 0xC1, 0x33, 0x80, 0x04, 0x13, 0xD3, 0xC6, 0x1C, 0x53, 0x3C, 0x39, 0x38, 0x7F, 0x81, 0x13, + 0x80, 0x6B, 0xA4, 0x92, 0x40, 0x35, 0x3C, 0x61, 0xC5, 0x33, 0x41, 0x4D, 0xE0, 0x84, 0x3D, 0x38, 0xC6, 0x31, 0x88, 0xBF, 0x80, + 0x45, 0x55, 0x57, 0x84, 0x25, 0x4E, 0x52, 0xD2, 0x88, 0xFF, 0x80, 0xF7, 0x99, 0x91, 0x91, 0x91, 0x91, 0x91, 0xF4, 0x63, 0x18, + 0xC6, 0x20, 0x39, 0x3C, 0x61, 0xC5, 0x33, 0x80, 0xF4, 0x63, 0x18, 0xC7, 0xD0, 0x80, 0x3D, 0x3C, 0x61, 0xC5, 0x37, 0x41, 0x04, + 0xF2, 0x49, 0x20, 0x79, 0x24, 0x1C, 0x0B, 0x27, 0x80, 0x5D, 0x24, 0x93, 0x8C, 0x63, 0x18, 0xCF, 0xA0, 0x85, 0x24, 0x92, 0x30, + 0xC3, 0x00, 0x89, 0x2C, 0x96, 0x4A, 0xA5, 0x61, 0x30, 0x98, 0x49, 0x23, 0x08, 0x31, 0x2C, 0x80, 0x89, 0x24, 0x94, 0x50, 0xC2, + 0x08, 0x21, 0x00, 0x78, 0x44, 0x46, 0x23, 0xE0, 0x6A, 0xAA, 0xA9, 0xFF, 0xE0, 0x95, 0x55, 0x56, 0x66, 0x60}; + +const GFXglyph FreeSans6pt7bGlyphs[] PROGMEM = {{0, 0, 0, 3, 0, 1}, // 0x20 ' ' + {0, 2, 9, 4, 1, -8}, // 0x21 '!' + {3, 4, 3, 4, 0, -8}, // 0x22 '"' + {5, 7, 8, 7, 0, -7}, // 0x23 '#' + {12, 6, 11, 7, 0, -9}, // 0x24 '$' + {21, 10, 9, 11, 0, -8}, // 0x25 '%' + {33, 7, 9, 8, 1, -8}, // 0x26 '&' + {41, 1, 3, 2, 1, -8}, // 0x27 ''' + {42, 2, 11, 4, 1, -8}, // 0x28 '(' + {45, 3, 11, 4, 0, -8}, // 0x29 ')' + {50, 4, 3, 5, 0, -8}, // 0x2A '*' + {52, 5, 5, 7, 1, -4}, // 0x2B '+' + {56, 1, 3, 3, 1, 0}, // 0x2C ',' + {57, 2, 1, 4, 1, -3}, // 0x2D '-' + {58, 1, 1, 3, 1, 0}, // 0x2E '.' + {59, 3, 9, 3, 0, -8}, // 0x2F '/' + {63, 5, 9, 7, 1, -8}, // 0x30 '0' + {69, 3, 9, 7, 1, -8}, // 0x31 '1' + {73, 6, 9, 7, 0, -8}, // 0x32 '2' + {80, 6, 9, 7, 0, -8}, // 0x33 '3' + {87, 6, 9, 7, 0, -8}, // 0x34 '4' + {94, 6, 9, 7, 0, -8}, // 0x35 '5' + {101, 5, 9, 7, 1, -8}, // 0x36 '6' + {107, 5, 9, 7, 1, -8}, // 0x37 '7' + {113, 6, 9, 7, 0, -8}, // 0x38 '8' + {120, 6, 9, 7, 0, -8}, // 0x39 '9' + {127, 1, 7, 3, 1, -6}, // 0x3A ':' + {128, 1, 8, 3, 1, -5}, // 0x3B ';' + {129, 5, 6, 7, 1, -5}, // 0x3C '<' + {133, 5, 3, 7, 1, -3}, // 0x3D '=' + {135, 5, 6, 7, 1, -5}, // 0x3E '>' + {139, 5, 9, 7, 1, -8}, // 0x3F '?' + {145, 11, 11, 12, 0, -8}, // 0x40 '@' + {161, 8, 9, 8, 0, -8}, // 0x41 'A' + {170, 6, 9, 8, 1, -8}, // 0x42 'B' + {177, 8, 9, 9, 0, -8}, // 0x43 'C' + {186, 7, 9, 8, 1, -8}, // 0x44 'D' + {194, 6, 9, 8, 1, -8}, // 0x45 'E' + {201, 6, 9, 7, 1, -8}, // 0x46 'F' + {208, 8, 9, 9, 0, -8}, // 0x47 'G' + {217, 7, 9, 9, 1, -8}, // 0x48 'H' + {225, 1, 9, 3, 1, -8}, // 0x49 'I' + {227, 5, 9, 6, 0, -8}, // 0x4A 'J' + {233, 7, 9, 8, 1, -8}, // 0x4B 'K' + {241, 5, 9, 7, 1, -8}, // 0x4C 'L' + {247, 8, 9, 10, 1, -8}, // 0x4D 'M' + {256, 7, 9, 9, 1, -8}, // 0x4E 'N' + {264, 9, 9, 9, 0, -8}, // 0x4F 'O' + {275, 6, 9, 8, 1, -8}, // 0x50 'P' + {282, 9, 10, 9, 0, -8}, // 0x51 'Q' + {294, 7, 9, 9, 1, -8}, // 0x52 'R' + {302, 6, 9, 8, 1, -8}, // 0x53 'S' + {309, 7, 9, 8, 0, -8}, // 0x54 'T' + {317, 7, 9, 9, 1, -8}, // 0x55 'U' + {325, 8, 9, 8, 0, -8}, // 0x56 'V' + {334, 11, 9, 11, 0, -8}, // 0x57 'W' + {347, 8, 9, 8, 0, -8}, // 0x58 'X' + {356, 8, 9, 8, 0, -8}, // 0x59 'Y' + {365, 7, 9, 7, 0, -8}, // 0x5A 'Z' + {373, 2, 12, 3, 1, -8}, // 0x5B '[' + {376, 3, 9, 3, 0, -8}, // 0x5C '\' + {380, 3, 12, 3, 0, -8}, // 0x5D ']' + {385, 4, 5, 6, 1, -8}, // 0x5E '^' + {388, 7, 1, 7, 0, 2}, // 0x5F '_' + {389, 3, 1, 3, 0, -8}, // 0x60 '`' + {390, 6, 7, 7, 0, -6}, // 0x61 'a' + {396, 5, 9, 7, 1, -8}, // 0x62 'b' + {402, 6, 7, 6, 0, -6}, // 0x63 'c' + {408, 6, 9, 7, 0, -8}, // 0x64 'd' + {415, 6, 7, 6, 0, -6}, // 0x65 'e' + {421, 3, 9, 3, 0, -8}, // 0x66 'f' + {425, 6, 10, 7, 0, -6}, // 0x67 'g' + {433, 5, 9, 6, 1, -8}, // 0x68 'h' + {439, 1, 9, 3, 1, -8}, // 0x69 'i' + {441, 2, 12, 3, 0, -8}, // 0x6A 'j' + {444, 5, 9, 6, 1, -8}, // 0x6B 'k' + {450, 1, 9, 3, 1, -8}, // 0x6C 'l' + {452, 8, 7, 10, 1, -6}, // 0x6D 'm' + {459, 5, 7, 6, 1, -6}, // 0x6E 'n' + {464, 6, 7, 6, 0, -6}, // 0x6F 'o' + {470, 5, 9, 7, 1, -6}, // 0x70 'p' + {476, 6, 9, 7, 0, -6}, // 0x71 'q' + {483, 3, 7, 4, 1, -6}, // 0x72 'r' + {486, 6, 7, 6, 0, -6}, // 0x73 's' + {492, 3, 8, 3, 0, -7}, // 0x74 't' + {495, 5, 7, 6, 1, -6}, // 0x75 'u' + {500, 6, 7, 6, 0, -6}, // 0x76 'v' + {506, 9, 7, 9, 0, -6}, // 0x77 'w' + {514, 6, 7, 6, 0, -6}, // 0x78 'x' + {520, 6, 10, 6, 0, -6}, // 0x79 'y' + {528, 5, 7, 6, 0, -6}, // 0x7A 'z' + {533, 2, 12, 4, 1, -8}, // 0x7B '{' + {536, 1, 11, 3, 1, -8}, // 0x7C '|' + {538, 2, 12, 4, 1, -8}, // 0x7D '}' + {541, 6, 2, 6, 0, -4}}; // 0x7E '~' + +const GFXfont FreeSans6pt7b PROGMEM = {(uint8_t *)FreeSans6pt7bBitmaps, (GFXglyph *)FreeSans6pt7bGlyphs, 0x20, 0x7E, 14}; + +// Approx. 1215 bytes diff --git a/src/graphics/niche/Fonts/FreeSans6pt8bCyrillic.h b/src/graphics/niche/Fonts/FreeSans6pt8bCyrillic.h new file mode 100644 index 000000000..49f03d4e1 --- /dev/null +++ b/src/graphics/niche/Fonts/FreeSans6pt8bCyrillic.h @@ -0,0 +1,302 @@ +/* + +Uses Windows-1251 encoding to map translingual Cyrillic characters to range between (uint8_t)127 and (uint8_t)255 +https://en.wikipedia.org/wiki/Windows-1251 + +Cyrillic characters present to the firmware as UTF8. +A Niche Graphics implementation needs to identify these, and subsitute the appropriate Windows-1251 char value. + +*/ + +#pragma once + +const uint8_t FreeSans6pt8bCyrillicBitmaps[] PROGMEM = { + 0xFF, 0xA0, 0xC0, 0xFF, 0xA0, 0xC0, 0xB6, 0x80, 0x24, 0x51, 0xF9, 0x42, 0x9F, 0x92, 0x28, 0x31, 0x75, 0x54, 0x78, 0x79, 0x75, + 0x7C, 0x41, 0x00, 0x01, 0x1C, 0x49, 0x22, 0x50, 0x74, 0x02, 0x60, 0xA4, 0x49, 0x11, 0xC0, 0x21, 0x44, 0x94, 0x62, 0x59, 0xE2, + 0xF4, 0xE0, 0x6A, 0xAA, 0x90, 0x48, 0x92, 0x49, 0x4A, 0x00, 0x5D, 0x40, 0x21, 0x09, 0xF2, 0x10, 0xE0, 0xC0, 0x80, 0x25, 0x25, + 0x24, 0x26, 0xA3, 0x18, 0xC6, 0x31, 0xF0, 0x27, 0x92, 0x49, 0x20, 0x11, 0xB4, 0x41, 0x0C, 0xC6, 0x10, 0xFC, 0x26, 0xA2, 0x13, + 0x04, 0x31, 0xF0, 0x08, 0x61, 0x8A, 0x49, 0x2F, 0xC2, 0x08, 0xFF, 0xE1, 0x4D, 0x84, 0x31, 0xF0, 0x26, 0xE3, 0x0F, 0x46, 0x31, + 0xF0, 0xFF, 0xC4, 0x22, 0x11, 0x08, 0x40, 0x11, 0xA4, 0x51, 0x39, 0x1C, 0x51, 0x78, 0x11, 0xA4, 0x71, 0x45, 0xF0, 0x51, 0x78, + 0xC0, 0x30, 0xC0, 0x36, 0x1F, 0x20, 0xE0, 0x80, 0xF8, 0x3E, 0xC1, 0xC2, 0xE8, 0x00, 0x74, 0x62, 0x11, 0x10, 0x80, 0x20, 0x0F, + 0x06, 0x18, 0x81, 0xA7, 0xD4, 0x93, 0x22, 0x64, 0x4A, 0x7E, 0x60, 0x06, 0x00, 0x3C, 0x00, 0x18, 0x18, 0x1C, 0x24, 0x24, 0x7E, + 0x42, 0x42, 0xC3, 0xFA, 0x38, 0x61, 0xFA, 0x18, 0x61, 0xFC, 0x38, 0x8A, 0x0C, 0x08, 0x10, 0x20, 0xE3, 0x7C, 0xF9, 0x1A, 0x1C, + 0x18, 0x30, 0x60, 0xC2, 0xF8, 0xFE, 0x08, 0x20, 0xFE, 0x08, 0x20, 0xFC, 0xFE, 0x08, 0x20, 0xFA, 0x08, 0x20, 0x80, 0x3C, 0x46, + 0x82, 0x80, 0x8F, 0x81, 0x83, 0xC3, 0x7D, 0x83, 0x06, 0x0C, 0x1F, 0xF0, 0x60, 0xC1, 0x82, 0xFF, 0x80, 0x08, 0x42, 0x10, 0x86, + 0x31, 0x78, 0x87, 0x1A, 0x65, 0x8F, 0x1A, 0x22, 0x42, 0x86, 0x84, 0x21, 0x08, 0x42, 0x10, 0xF8, 0xC3, 0xC3, 0xC3, 0xA5, 0xA5, + 0xA5, 0x99, 0x99, 0x99, 0x83, 0x87, 0x8D, 0x19, 0x32, 0x62, 0xC3, 0x86, 0x1E, 0x11, 0x90, 0x48, 0x1C, 0x0A, 0x05, 0x06, 0xC2, + 0x3E, 0x00, 0xFA, 0x18, 0x61, 0xFE, 0x08, 0x20, 0x80, 0x1E, 0x11, 0x90, 0x48, 0x1C, 0x0A, 0x05, 0x06, 0xC6, 0x3F, 0x00, 0xFD, + 0x0E, 0x0C, 0x1F, 0xD0, 0xA0, 0xC1, 0x82, 0x7A, 0x18, 0x70, 0x78, 0x38, 0x61, 0x7C, 0xFE, 0x20, 0x40, 0x81, 0x02, 0x04, 0x08, + 0x10, 0x83, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC3, 0x7C, 0xC3, 0x42, 0x42, 0x26, 0x24, 0x24, 0x14, 0x18, 0x18, 0xC4, 0x28, 0xC5, + 0x39, 0xA5, 0x24, 0xA4, 0x52, 0x8C, 0x71, 0x8C, 0x30, 0x80, 0x87, 0x34, 0x8C, 0x30, 0xC4, 0xB3, 0x84, 0xC3, 0x42, 0x26, 0x24, + 0x18, 0x18, 0x08, 0x08, 0x08, 0x7E, 0x0C, 0x10, 0x41, 0x06, 0x08, 0x20, 0xFE, 0xEA, 0xAA, 0xAB, 0x92, 0x24, 0x89, 0x20, 0xED, + 0xB6, 0xDB, 0x6D, 0xF0, 0x46, 0xAA, 0x90, 0xFC, 0x90, 0xFC, 0x4F, 0x98, 0xFC, 0x84, 0x21, 0xF8, 0xC6, 0x31, 0xF0, 0x79, 0x18, + 0x20, 0x45, 0xE0, 0x04, 0x10, 0x5F, 0xC6, 0x18, 0x51, 0x7C, 0xFC, 0x7F, 0x08, 0xF8, 0x29, 0x74, 0x92, 0x40, 0x7D, 0x18, 0x61, + 0x45, 0xF0, 0x52, 0x30, 0x84, 0x21, 0xF8, 0xC6, 0x31, 0x88, 0xDF, 0x80, 0x51, 0x55, 0x56, 0x84, 0x21, 0x2A, 0x72, 0x92, 0x98, + 0xFF, 0x80, 0xFF, 0x99, 0x99, 0x99, 0x99, 0x99, 0xFC, 0x63, 0x18, 0xC4, 0x79, 0x18, 0x71, 0x45, 0xE0, 0xFC, 0x63, 0x18, 0xFA, + 0x10, 0x80, 0x7D, 0x18, 0x61, 0x45, 0xF0, 0x41, 0x04, 0xF2, 0x49, 0x00, 0x79, 0x07, 0x02, 0xCD, 0xE0, 0x4B, 0xA4, 0x93, 0x8C, + 0x63, 0x18, 0xFC, 0xCD, 0x24, 0x94, 0x30, 0xC0, 0x99, 0x59, 0x55, 0x56, 0x66, 0x26, 0x96, 0x66, 0x99, 0xCA, 0x52, 0x63, 0x18, + 0x84, 0x40, 0x78, 0xC4, 0x44, 0x7C, 0x6A, 0xAA, 0xA9, 0xFF, 0xF0, 0xC9, 0x24, 0x4A, 0x49, 0x40, 0xE8, 0xC0, 0xFE, 0x18, 0x61, + 0x86, 0x18, 0x61, 0xFC, 0xFC, 0x08, 0x04, 0x02, 0x01, 0xF0, 0x8C, 0x46, 0x23, 0x11, 0x80, 0xC0, 0xC0, 0x10, 0x8F, 0xE0, 0x82, + 0x08, 0x20, 0x82, 0x08, 0x00, 0x64, 0x0F, 0x88, 0x88, 0x80, 0x3D, 0x0C, 0x2E, 0xF9, 0x04, 0x0F, 0x7C, 0x08, 0x81, 0x10, 0x22, + 0x04, 0x7C, 0x88, 0x51, 0x0A, 0x21, 0x87, 0xC0, 0x84, 0x10, 0x82, 0x10, 0x42, 0x0F, 0xFD, 0x08, 0xA1, 0x0C, 0x23, 0x87, 0xC0, + 0x10, 0x88, 0xE6, 0xB3, 0x8C, 0x28, 0x92, 0x28, 0xC0, 0xFC, 0x08, 0x04, 0x02, 0x01, 0xF0, 0x8C, 0x46, 0x23, 0x11, 0x80, 0x83, + 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC1, 0xFE, 0x20, 0x40, 0x43, 0xC4, 0x1F, 0x45, 0x14, 0x51, 0x44, 0x11, 0x80, 0x78, 0x24, 0x13, + 0xC9, 0x14, 0x8E, 0x7C, 0x88, 0x44, 0x3F, 0xD1, 0x38, 0x8C, 0x78, 0x60, 0x9A, 0xCC, 0xA9, 0x43, 0xC4, 0x1F, 0x45, 0x14, 0x51, + 0x44, 0x8C, 0x63, 0x18, 0xFC, 0x80, 0x24, 0x33, 0x0A, 0x36, 0x45, 0x8E, 0x0C, 0x10, 0x60, 0x80, 0x70, 0x22, 0x95, 0xA8, 0xC4, + 0x23, 0x10, 0x08, 0x42, 0x10, 0x86, 0x31, 0x78, 0x07, 0xF8, 0x20, 0x82, 0x08, 0x20, 0x82, 0x00, 0x28, 0x0F, 0xE0, 0x82, 0x0F, + 0xE0, 0x82, 0x0F, 0xC0, 0x38, 0x8A, 0x0C, 0x0F, 0x90, 0x20, 0xE3, 0x7C, 0x51, 0x55, 0x56, 0xA1, 0x24, 0x92, 0x49, 0x00, 0xFF, + 0x80, 0xDF, 0x80, 0x27, 0xC9, 0x24, 0x8A, 0x28, 0xA2, 0x8B, 0xF8, 0x20, 0x80, 0x28, 0xA0, 0x1E, 0x47, 0xFC, 0x11, 0x78, 0x88, + 0x44, 0x32, 0x59, 0xDA, 0xCD, 0x66, 0x6B, 0x32, 0x89, 0x80, 0x79, 0x1F, 0x30, 0x45, 0xE0, 0x7A, 0x18, 0x70, 0x78, 0x38, 0x61, + 0x7C, 0x79, 0x07, 0x02, 0xCD, 0xE0, 0xB4, 0x24, 0x92, 0x40, 0x18, 0x18, 0x3C, 0x24, 0x24, 0x7E, 0x42, 0x42, 0xC3, 0xFE, 0x08, + 0x20, 0xFE, 0x18, 0x61, 0xFC, 0xFA, 0x38, 0x61, 0xFA, 0x18, 0x61, 0xFC, 0xFE, 0x08, 0x20, 0x82, 0x08, 0x20, 0x80, 0x1F, 0x08, + 0x84, 0x42, 0x21, 0x10, 0x88, 0x44, 0x42, 0xFF, 0xC0, 0x60, 0x20, 0xFE, 0x08, 0x20, 0xFE, 0x08, 0x20, 0xFC, 0x88, 0xA4, 0x9A, + 0x87, 0xC1, 0xC1, 0xF1, 0xAD, 0x92, 0x88, 0x80, 0x7A, 0x18, 0x41, 0x38, 0x18, 0x61, 0x7C, 0x87, 0x0E, 0x2C, 0x59, 0x34, 0x68, + 0xE1, 0xC2, 0x28, 0x22, 0x1C, 0x38, 0xB1, 0x64, 0xD1, 0xA3, 0x87, 0x08, 0x8E, 0x6B, 0x38, 0xC2, 0x89, 0x22, 0x8C, 0x3E, 0x44, + 0x89, 0x12, 0x24, 0x58, 0xA1, 0xC2, 0xC3, 0xC3, 0xC3, 0xA5, 0xA5, 0xA5, 0x99, 0x99, 0x99, 0x83, 0x06, 0x0C, 0x1F, 0xF0, 0x60, + 0xC1, 0x82, 0x3C, 0x46, 0x83, 0x81, 0x81, 0x81, 0x81, 0xC2, 0x7C, 0xFF, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC1, 0x82, 0xFA, 0x18, + 0x61, 0xFE, 0x08, 0x20, 0x80, 0x38, 0x8A, 0x0C, 0x08, 0x10, 0x20, 0xE3, 0x7C, 0xFE, 0x20, 0x40, 0x81, 0x02, 0x04, 0x08, 0x10, + 0xC2, 0x8D, 0x91, 0x63, 0x83, 0x04, 0x18, 0x20, 0x08, 0x1E, 0x32, 0xD1, 0x38, 0x8C, 0x4F, 0x2C, 0xFC, 0x08, 0x00, 0x87, 0x34, + 0x8C, 0x30, 0xC4, 0xB3, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xFF, 0x01, 0x01, 0x8E, 0x38, 0xE3, 0x8D, 0xF0, + 0xC3, 0x0C, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0xFF, 0x99, 0x4C, 0xA6, 0x53, 0x29, 0x94, 0xCA, 0x65, 0x32, 0xFF, + 0x80, 0x40, 0x20, 0xF0, 0x04, 0x01, 0x00, 0x40, 0x1F, 0x84, 0x21, 0x0C, 0x42, 0x1F, 0x00, 0x81, 0xC0, 0xE0, 0x70, 0x3F, 0xDC, + 0x2E, 0x17, 0x0B, 0xF9, 0x80, 0x82, 0x08, 0x20, 0xFE, 0x18, 0x61, 0xF8, 0x79, 0x8A, 0x18, 0x13, 0xE0, 0x60, 0xC2, 0x7C, 0x87, + 0x26, 0x39, 0x06, 0x41, 0xF0, 0x64, 0x19, 0x06, 0x63, 0x8F, 0x80, 0x7E, 0x18, 0x61, 0x7C, 0xD6, 0x71, 0x84, 0x79, 0x11, 0xD9, + 0xCD, 0xD0, 0x0D, 0xC4, 0x1E, 0x47, 0x1C, 0x51, 0x78, 0xF4, 0xBD, 0x29, 0xF8, 0xF8, 0x88, 0x88, 0x3C, 0x48, 0x91, 0x22, 0x5F, + 0xE0, 0x80, 0x79, 0x1F, 0xF0, 0x45, 0xE0, 0x92, 0x54, 0x38, 0x3C, 0x56, 0x93, 0x78, 0x23, 0x82, 0xCD, 0xE0, 0x9C, 0xEB, 0x5C, + 0xC4, 0x70, 0x27, 0x3A, 0xD7, 0x31, 0x9A, 0xCC, 0xA9, 0x7A, 0x52, 0x94, 0xE4, 0x8F, 0x3D, 0x6D, 0xA6, 0x90, 0x8C, 0x7F, 0x18, + 0xC4, 0x79, 0x1C, 0x71, 0x45, 0xE0, 0xFC, 0x63, 0x18, 0xC4, 0xFC, 0x63, 0x18, 0xFA, 0x10, 0x80, 0x79, 0x1C, 0x30, 0x45, 0xE0, + 0xF9, 0x08, 0x42, 0x10, 0x8A, 0x56, 0xA3, 0x10, 0x8C, 0x40, 0x04, 0x01, 0x07, 0xF9, 0x31, 0xC4, 0x71, 0x14, 0xC5, 0xFE, 0x04, + 0x01, 0x00, 0x40, 0x4B, 0x8C, 0x65, 0xE4, 0x8A, 0x28, 0xA2, 0x8B, 0xF0, 0x40, 0x99, 0x97, 0x11, 0x96, 0x59, 0x65, 0x97, 0xF0, + 0x95, 0x2A, 0x54, 0xA9, 0x5F, 0xC0, 0x80, 0xF0, 0x20, 0x78, 0x91, 0x23, 0xC0, 0x86, 0x1F, 0x63, 0x8F, 0xD0, 0x84, 0x3D, 0x18, + 0xF8, 0xF4, 0xDE, 0x19, 0xF8, 0x9E, 0xA2, 0xE1, 0xA1, 0xA2, 0x9E, 0xFC, 0x7E, 0xD4, 0xC4, +}; + +const GFXglyph FreeSans6pt8bCyrillicGlyphs[] PROGMEM = { + {0, 0, 0, 3, 0, 0}, // 0x20 ' ' + {3, 2, 9, 3, 1, -8}, // 0x21 '!' + {6, 3, 3, 4, 1, -8}, // 0x22 '"' + {8, 7, 8, 7, 0, -7}, // 0x23 '#' + {15, 6, 11, 7, 0, -8}, // 0x24 '$' + {24, 10, 9, 11, 0, -8}, // 0x25 '%' + {36, 6, 9, 8, 1, -8}, // 0x26 '&' + {43, 1, 3, 2, 1, -8}, // 0x27 ''' + {44, 2, 10, 4, 1, -7}, // 0x28 '(' + {47, 3, 11, 4, 0, -7}, // 0x29 ')' + {52, 3, 4, 5, 1, -8}, // 0x2A '*' + {54, 5, 6, 7, 1, -5}, // 0x2B '+' + {58, 1, 3, 3, 1, 0}, // 0x2C ',' + {59, 2, 1, 4, 1, -3}, // 0x2D '-' + {60, 1, 1, 3, 1, 0}, // 0x2E '.' + {61, 3, 8, 3, 0, -7}, // 0x2F '/' + {64, 5, 9, 7, 1, -8}, // 0x30 '0' + {70, 3, 9, 7, 1, -8}, // 0x31 '1' + {74, 6, 9, 7, 0, -8}, // 0x32 '2' + {81, 5, 9, 7, 1, -8}, // 0x33 '3' + {87, 6, 9, 7, 0, -8}, // 0x34 '4' + {94, 5, 9, 7, 1, -8}, // 0x35 '5' + {100, 5, 9, 7, 1, -8}, // 0x36 '6' + {106, 5, 9, 7, 1, -8}, // 0x37 '7' + {112, 6, 9, 7, 0, -8}, // 0x38 '8' + {119, 6, 9, 7, 0, -8}, // 0x39 '9' + {126, 2, 6, 3, 1, -5}, // 0x3A ':' + {128, 2, 8, 3, 1, -5}, // 0x3B ';' + {130, 5, 5, 7, 1, -4}, // 0x3C '<' + {134, 5, 3, 7, 1, -3}, // 0x3D '=' + {136, 5, 5, 7, 1, -4}, // 0x3E '>' + {140, 5, 9, 7, 1, -8}, // 0x3F '?' + {146, 11, 11, 12, 0, -8}, // 0x40 '@' + {162, 8, 9, 8, 0, -8}, // 0x41 'A' + {171, 6, 9, 8, 1, -8}, // 0x42 'B' + {178, 7, 9, 9, 1, -8}, // 0x43 'C' + {186, 7, 9, 9, 1, -8}, // 0x44 'D' + {194, 6, 9, 8, 1, -8}, // 0x45 'E' + {201, 6, 9, 7, 1, -8}, // 0x46 'F' + {208, 8, 9, 9, 1, -8}, // 0x47 'G' + {217, 7, 9, 9, 1, -8}, // 0x48 'H' + {225, 1, 9, 3, 1, -8}, // 0x49 'I' + {227, 5, 9, 6, 0, -8}, // 0x4A 'J' + {233, 7, 9, 8, 1, -8}, // 0x4B 'K' + {241, 5, 9, 7, 1, -8}, // 0x4C 'L' + {247, 8, 9, 10, 1, -8}, // 0x4D 'M' + {256, 7, 9, 9, 1, -8}, // 0x4E 'N' + {264, 9, 9, 9, 0, -8}, // 0x4F 'O' + {275, 6, 9, 8, 1, -8}, // 0x50 'P' + {282, 9, 9, 9, 0, -8}, // 0x51 'Q' + {293, 7, 9, 9, 1, -8}, // 0x52 'R' + {301, 6, 9, 8, 1, -8}, // 0x53 'S' + {308, 7, 9, 7, 0, -8}, // 0x54 'T' + {316, 7, 9, 9, 1, -8}, // 0x55 'U' + {324, 8, 9, 8, 0, -8}, // 0x56 'V' + {333, 11, 9, 11, 0, -8}, // 0x57 'W' + {346, 6, 9, 8, 1, -8}, // 0x58 'X' + {353, 8, 9, 8, 0, -8}, // 0x59 'Y' + {362, 7, 9, 7, 0, -8}, // 0x5A 'Z' + {370, 2, 12, 3, 1, -8}, // 0x5B '[' + {373, 3, 9, 3, 0, -8}, // 0x5C '\' + {377, 3, 12, 3, 0, -8}, // 0x5D ']' + {382, 4, 5, 6, 1, -8}, // 0x5E '^' + {385, 6, 1, 7, 0, 2}, // 0x5F '_' + {386, 2, 2, 4, 1, -8}, // 0x60 '`' + {387, 5, 6, 7, 1, -5}, // 0x61 'a' + {391, 5, 9, 7, 1, -8}, // 0x62 'b' + {397, 6, 6, 6, 0, -5}, // 0x63 'c' + {402, 6, 9, 7, 0, -8}, // 0x64 'd' + {409, 5, 6, 7, 1, -5}, // 0x65 'e' + {413, 3, 9, 3, 0, -8}, // 0x66 'f' + {417, 6, 9, 7, 0, -5}, // 0x67 'g' + {424, 5, 9, 7, 1, -8}, // 0x68 'h' + {430, 1, 9, 3, 1, -8}, // 0x69 'i' + {432, 2, 12, 3, 0, -8}, // 0x6A 'j' + {435, 5, 9, 6, 1, -8}, // 0x6B 'k' + {441, 1, 9, 3, 1, -8}, // 0x6C 'l' + {443, 8, 6, 10, 1, -5}, // 0x6D 'm' + {449, 5, 6, 7, 1, -5}, // 0x6E 'n' + {453, 6, 6, 7, 0, -5}, // 0x6F 'o' + {458, 5, 9, 7, 1, -5}, // 0x70 'p' + {464, 6, 9, 7, 0, -5}, // 0x71 'q' + {471, 3, 6, 4, 1, -5}, // 0x72 'r' + {474, 6, 6, 6, 0, -5}, // 0x73 's' + {479, 3, 8, 3, 0, -7}, // 0x74 't' + {482, 5, 6, 7, 1, -5}, // 0x75 'u' + {486, 6, 6, 6, 0, -5}, // 0x76 'v' + {491, 8, 6, 9, 0, -5}, // 0x77 'w' + {497, 4, 6, 6, 1, -5}, // 0x78 'x' + {500, 5, 9, 6, 0, -5}, // 0x79 'y' + {506, 5, 6, 6, 0, -5}, // 0x7A 'z' + {510, 2, 12, 4, 1, -8}, // 0x7B '{' + {513, 1, 12, 3, 1, -8}, // 0x7C '|' + {515, 3, 12, 4, 0, -8}, // 0x7D '}' + {520, 5, 2, 7, 1, -4}, // 0x7E '~' + {522, 6, 9, 8, 1, -8}, // + {529, 9, 11, 9, 0, -8}, // + {542, 6, 11, 7, 1, -10}, // + {551, 0, 0, 8, 0, 0}, // + {551, 4, 9, 5, 1, -8}, // + {556, 0, 0, 8, 0, 0}, // + {556, 0, 0, 8, 0, 0}, // + {556, 0, 0, 8, 0, 0}, // + {556, 0, 0, 8, 0, 0}, // + {556, 6, 8, 8, 1, -7}, // + {562, 0, 0, 8, 0, 0}, // + {562, 11, 9, 13, 1, -8}, // + {575, 0, 0, 8, 0, 0}, // + {575, 11, 9, 12, 1, -8}, // + {588, 6, 11, 8, 1, -10}, // + {597, 9, 9, 9, 0, -8}, // + {608, 7, 11, 9, 1, -8}, // + {618, 6, 11, 7, 0, -8}, // + {627, 0, 0, 8, 0, 0}, // + {627, 0, 0, 8, 0, 0}, // + {627, 0, 0, 8, 0, 0}, // + {627, 0, 0, 8, 0, 0}, // + {627, 0, 0, 8, 0, 0}, // + {627, 0, 0, 8, 0, 0}, // + {627, 0, 0, 8, 0, 0}, // + {627, 0, 0, 8, 0, 0}, // + {627, 0, 0, 8, 0, 0}, // + {627, 9, 6, 10, 0, -5}, // + {634, 0, 0, 8, 0, 0}, // + {634, 9, 6, 10, 1, -5}, // + {641, 4, 8, 6, 1, -7}, // + {645, 6, 9, 7, 0, -8}, // + {652, 5, 7, 7, 1, -5}, // + {657, 0, 0, 8, 0, 0}, // + {657, 7, 11, 7, 0, -10}, // + {667, 5, 11, 6, 0, -7}, // + {674, 5, 9, 6, 0, -8}, // + {680, 0, 0, 8, 0, 0}, // + {680, 6, 10, 7, 1, -9}, // + {688, 0, 0, 8, 0, 0}, // + {688, 0, 0, 8, 0, 0}, // + {688, 6, 11, 8, 1, -10}, // + {697, 7, 9, 9, 1, -8}, // + {705, 0, 0, 8, 0, 0}, // + {705, 0, 0, 8, 0, 0}, // + {705, 2, 12, 3, 0, -8}, // + {708, 0, 0, 8, 0, 0}, // + {708, 0, 0, 8, 0, 0}, // + {708, 3, 11, 3, 0, -10}, // + {713, 0, 0, 8, 0, 0}, // + {713, 0, 0, 8, 0, 0}, // + {713, 1, 9, 3, 1, -8}, // + {715, 1, 9, 3, 1, -8}, // + {717, 3, 8, 5, 1, -7}, // + {720, 6, 9, 7, 1, -5}, // + {727, 0, 0, 8, 0, 0}, // + {727, 0, 0, 8, 0, 0}, // + {727, 6, 9, 7, 0, -8}, // + {734, 9, 9, 11, 1, -8}, // + {745, 6, 6, 6, 0, -5}, // + {750, 0, 0, 8, 0, 0}, // + {750, 0, 0, 8, 0, 0}, // + {750, 6, 9, 8, 1, -8}, // + {757, 6, 6, 6, 0, -5}, // + {762, 3, 9, 3, 0, -8}, // + {766, 8, 9, 8, 0, -8}, // + {775, 6, 9, 8, 1, -8}, // + {782, 6, 9, 8, 1, -8}, // + {789, 6, 9, 7, 1, -8}, // + {796, 9, 11, 10, 0, -8}, // + {809, 6, 9, 8, 1, -8}, // + {816, 9, 9, 11, 1, -8}, // + {827, 6, 9, 8, 1, -8}, // + {834, 7, 9, 9, 1, -8}, // + {842, 7, 11, 9, 1, -10}, // + {852, 6, 9, 8, 1, -8}, // + {859, 7, 9, 8, 0, -8}, // + {867, 8, 9, 10, 1, -8}, // + {876, 7, 9, 9, 1, -8}, // + {884, 8, 9, 10, 1, -8}, // + {893, 7, 9, 9, 1, -8}, // + {901, 6, 9, 8, 1, -8}, // + {908, 7, 9, 9, 1, -8}, // + {916, 7, 9, 7, 0, -8}, // + {924, 7, 9, 7, 0, -8}, // + {932, 9, 9, 10, 1, -8}, // + {943, 6, 9, 8, 1, -8}, // + {950, 8, 11, 9, 1, -8}, // + {961, 6, 9, 8, 1, -8}, // + {968, 8, 9, 10, 1, -8}, // + {977, 9, 11, 10, 1, -8}, // + {990, 10, 9, 10, 0, -8}, // + {1002, 9, 9, 10, 1, -8}, // + {1013, 6, 9, 8, 1, -8}, // + {1020, 7, 9, 9, 1, -8}, // + {1028, 10, 9, 12, 1, -8}, // + {1040, 6, 9, 8, 1, -8}, // + {1047, 6, 6, 7, 0, -5}, // + {1052, 6, 9, 7, 0, -8}, // + {1059, 5, 6, 6, 1, -5}, // + {1063, 4, 6, 5, 1, -5}, // + {1066, 7, 7, 7, 0, -5}, // + {1073, 6, 6, 7, 0, -5}, // + {1078, 8, 6, 9, 1, -5}, // + {1084, 6, 6, 6, 0, -5}, // + {1089, 5, 6, 7, 1, -5}, // + {1093, 5, 8, 7, 1, -7}, // + {1098, 4, 6, 6, 1, -5}, // + {1101, 5, 6, 6, 0, -5}, // + {1105, 6, 6, 7, 1, -5}, // + {1110, 5, 6, 7, 1, -5}, // + {1114, 6, 6, 7, 0, -5}, // + {1119, 5, 6, 7, 1, -5}, // + {1123, 5, 9, 7, 1, -5}, // + {1129, 6, 6, 6, 0, -5}, // + {1134, 5, 6, 5, 0, -5}, // + {1138, 5, 9, 6, 0, -5}, // + {1144, 10, 11, 10, 0, -7}, // + {1158, 5, 6, 6, 0, -5}, // + {1162, 6, 7, 7, 1, -5}, // + {1168, 4, 6, 6, 1, -5}, // + {1171, 6, 6, 8, 1, -5}, // + {1176, 7, 7, 9, 1, -5}, // + {1183, 7, 6, 8, 0, -5}, // + {1189, 6, 6, 8, 1, -5}, // + {1194, 5, 6, 6, 1, -5}, // + {1198, 5, 6, 6, 1, -5}, // + {1202, 8, 6, 9, 1, -5}, // + {1208, 5, 6, 7, 1, -5} // +}; + +const GFXfont FreeSans6pt8bCyrillic PROGMEM = {(uint8_t *)FreeSans6pt8bCyrillicBitmaps, (GFXglyph *)FreeSans6pt8bCyrillicGlyphs, + 0x20, 0xFF, 16}; diff --git a/src/graphics/niche/Fonts/README.md b/src/graphics/niche/Fonts/README.md new file mode 100644 index 000000000..e79927786 --- /dev/null +++ b/src/graphics/niche/Fonts/README.md @@ -0,0 +1,4 @@ +# NicheGraphics - Fonts + +A common area to store fonts which might be reused by different Niche Graphics UIs +In future, we may want to separate these by library (AdafruitGFX, u8g2, etc) diff --git a/src/graphics/niche/InkHUD/Applet.cpp b/src/graphics/niche/InkHUD/Applet.cpp new file mode 100644 index 000000000..ebd0acc78 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applet.cpp @@ -0,0 +1,843 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./Applet.h" + +#include "RTC.h" + +using namespace NicheGraphics; + +InkHUD::AppletFont InkHUD::Applet::fontLarge; // General purpose font. Set by setDefaultFonts +InkHUD::AppletFont InkHUD::Applet::fontSmall; // General purpose font. Set by setDefaultFonts +constexpr float InkHUD::Applet::LOGO_ASPECT_RATIO; // Ratio of the Meshtastic logo + +InkHUD::Applet::Applet() : GFX(0, 0) +{ + // GFX is given initial dimensions of 0 + // The width and height will change dynamically, depending on Applet tiling + // If you're getting a "divide by zero error", consider it an assert: + // WindowManager should be the only one controlling the rendering +} + +// The raw pixel output generated by AdafruitGFX drawing +// Hand off to the applet's tile, which will in-turn pass to the window manager +void InkHUD::Applet::drawPixel(int16_t x, int16_t y, uint16_t color) +{ + // Only render pixels if they fall within user's cropped region + if (x >= cropLeft && x < (cropLeft + cropWidth) && y >= cropTop && y < (cropTop + cropHeight)) + assignedTile->handleAppletPixel(x, y, (Color)color); +} + +// Sets which tile the applet renders for +// Pixel output is passed to tile during render() +// This should only be called by Tile::assignApplet +void InkHUD::Applet::setTile(Tile *t) +{ + // If we're setting (not clearing), make sure the link is "reciprocal" + if (t) + assert(t->getAssignedApplet() == this); + + assignedTile = t; +} + +// Which tile will the applet render() to? +InkHUD::Tile *InkHUD::Applet::getTile() +{ + return assignedTile; +} + +void InkHUD::Applet::render() +{ + assert(assignedTile); // Ensure that we have a tile + assert(assignedTile->getAssignedApplet() == this); // Ensure that we have a reciprocal link with the tile + + wantRender = false; // Clear the flag set by requestUpdate + wantAutoshow = false; // If we're rendering now, it means our request was considered. It may or may not have been granted. + wantUpdateType = Drivers::EInk::UpdateTypes::UNSPECIFIED; // Our requested type has been considered by now. Tidy up. + + updateDimensions(); + resetDrawingSpace(); + onRender(); // Derived applet's drawing takes place here + + // If our tile is (or was) highlighted, to indicate a change in focus + if (Tile::highlightTarget == assignedTile) { + // Draw the highlight + if (!Tile::highlightShown) { + drawRect(0, 0, width(), height(), BLACK); + Tile::startHighlightTimeout(); + Tile::highlightShown = true; + } + + // Clear the highlight + else { + Tile::cancelHighlightTimeout(); + Tile::highlightShown = false; + Tile::highlightTarget = nullptr; + } + } +} + +// Does the applet want to render now? +// Checks whether the applet called requestUpdate() recently, in response to an event +bool InkHUD::Applet::wantsToRender() +{ + return wantRender; +} + +// Does the applet want to be moved to foreground before next render, to show new data? +// User specifies whether an applet has permission for this, using the on-screen menu +bool InkHUD::Applet::wantsToAutoshow() +{ + return wantAutoshow; +} + +// Which technique would this applet prefer that the display use to change the image? +Drivers::EInk::UpdateTypes InkHUD::Applet::wantsUpdateType() +{ + return wantUpdateType; +} + +// Get size of the applet's drawing space from its tile +void InkHUD::Applet::updateDimensions() +{ + assert(assignedTile); + WIDTH = assignedTile->getWidth(); + HEIGHT = assignedTile->getHeight(); + _width = WIDTH; + _height = HEIGHT; +} + +// Ensure that render() always starts with the same initial drawing config +void InkHUD::Applet::resetDrawingSpace() +{ + resetCrop(); // Allow pixel from any region of the applet to draw + setTextColor(BLACK); // Reset text params + setCursor(0, 0); + setTextWrap(false); + setFont(AppletFont()); // Restore the default AdafruitGFX font +} + +// Tell the window manager that we want to render now +// Applets should internally listen for events they are interested in, via MeshModule, CallbackObserver etc +// When an applet decides it has heard something important, and wants to redraw, it calls this method +// Once the window manager has given other applets a chance to process whatever event we just detected, +// it will run Applet::render(), which may draw our applet to screen, if it is shown (forgeround) +void InkHUD::Applet::requestUpdate(Drivers::EInk::UpdateTypes type) +{ + wantRender = true; + wantUpdateType = type; + WindowManager::getInstance()->requestUpdate(); +} + +// Ask window manager to move this applet to foreground at start of next render +// Users select which applets have permission for this using the on-screen menu +void InkHUD::Applet::requestAutoshow() +{ + wantAutoshow = true; +} + +// Called when an Applet begins running +// Active applets are considered "enabled" +// They should now listen for events, and request their own updates +// They may also be force rendered by the window manager at any time +// Applets can be activated at run-time through the on-screen menu +void InkHUD::Applet::activate() +{ + onActivate(); // Call derived class' handler + active = true; +} + +// Called when an Applet stop running +// Inactive applets are considered "disabled" +// They should not listen for events, process data +// They will not be rendered +// Applets can be deactivated at run-time through the on-screen menu +void InkHUD::Applet::deactivate() +{ + // If applet is still in foreground, run its onBackground code first + if (isForeground()) + sendToBackground(); + + // If applet is active, run its onDeactivate code first + if (isActive()) + onDeactivate(); // Derived class' handler + active = false; +} + +// Is the Applet running? +// Note: active / inactive is not related to background / foreground +// An inactive applet is *fully* disabled +bool InkHUD::Applet::isActive() +{ + return active; +} + +// Begin showing the Applet +// It will be rendered immediately to whichever tile it is assigned +// The window manager will also now honor requestUpdate() calls from this applet +void InkHUD::Applet::bringToForeground() +{ + if (!foreground) { + foreground = true; + onForeground(); // Run derived applet class' handler + } + + requestUpdate(); +} + +// Stop showing the Applet +// Calls to requestUpdate() will no longer be honored +// When one applet moves to background, another should move to foreground +void InkHUD::Applet::sendToBackground() +{ + if (foreground) { + foreground = false; + onBackground(); // Run derived applet class' handler + } +} + +// Is the applet currently displayed on a tile +bool InkHUD::Applet::isForeground() +{ + return foreground; +} + +// Limit drawing to a certain region of the applet +// Pixels outside this region will be discarded +void InkHUD::Applet::setCrop(int16_t left, int16_t top, uint16_t width, uint16_t height) +{ + cropLeft = left; + cropTop = top; + cropWidth = width; + cropHeight = height; +} + +// Allow drawing to any region of the Applet +// Reverses Applet::setCrop +void InkHUD::Applet::resetCrop() +{ + setCrop(0, 0, width(), height()); +} + +// Convert relative width to absolute width, in px +// X(0) is 0 +// X(0.5) is width() / 2 +// X(1) is width() +uint16_t InkHUD::Applet::X(float f) +{ + return width() * f; +} + +// Convert relative hight to absolute height, in px +// Y(0) is 0 +// Y(0.5) is height() / 2 +// Y(1) is height() +uint16_t InkHUD::Applet::Y(float f) +{ + return height() * f; +} + +// Print text, specifying the position of any edge / corner of the textbox +void InkHUD::Applet::printAt(int16_t x, int16_t y, const char *text, HorizontalAlignment ha, VerticalAlignment va) +{ + printAt(x, y, std::string(text), ha, va); +} + +// Print text, specifying the position of any edge / corner of the textbox +void InkHUD::Applet::printAt(int16_t x, int16_t y, std::string text, HorizontalAlignment ha, VerticalAlignment va) +{ + // Custom font + // - set with AppletFont::addSubstitution + // - find certain UTF8 chars + // - replace with glpyh from custom font (or suitable ASCII addSubstitution?) + getFont().applySubstitutions(&text); + + // We do still have to run getTextBounds to find the width + int16_t textOffsetX, textOffsetY; + uint16_t textWidth, textHeight; + getTextBounds(text.c_str(), 0, 0, &textOffsetX, &textOffsetY, &textWidth, &textHeight); + + int16_t cursorX = 0; + int16_t cursorY = 0; + + switch (ha) { + case LEFT: + cursorX = x - textOffsetX; + break; + case CENTER: + cursorX = (x - textOffsetX) - (textWidth / 2); + break; + case RIGHT: + cursorX = (x - textOffsetX) - textWidth; + break; + } + + // We're using a fixed line height (getFontDimensions), rather than sizing to text (getTextBounds) + // Note: the FontDimensions values for this are unsigned + + switch (va) { + case TOP: + cursorY = y + currentFont.heightAboveCursor(); + break; + case MIDDLE: + cursorY = (y + currentFont.heightAboveCursor()) - (currentFont.lineHeight() / 2); + break; + case BOTTOM: + cursorY = (y + currentFont.heightAboveCursor()) - currentFont.lineHeight(); + break; + } + + setCursor(cursorX, cursorY); + print(text.c_str()); +} + +// Set which font should be used for subsequent drawing +// This is AppletFont type, which is a wrapper for AdfruitGFX font, with some precalculated dimension data +void InkHUD::Applet::setFont(AppletFont f) +{ + GFX::setFont(f.gfxFont); + currentFont = f; +} + +// Get which font is currently being used for drawing +// This is AppletFont type, which is a wrapper for AdfruitGFX font, with some precalculated dimension data +InkHUD::AppletFont InkHUD::Applet::getFont() +{ + return currentFont; +} + +// Set two general-purpose fonts, which are reused by many applets +// Applets are also permitted to use other fonts, if they can justify the flash usage +void InkHUD::Applet::setDefaultFonts(AppletFont large, AppletFont small) +{ + Applet::fontSmall = small; + Applet::fontLarge = large; +} + +// Gets rendered width of a string +// Wrapper for getTextBounds +uint16_t InkHUD::Applet::getTextWidth(const char *text) +{ + + // We do still have to run getTextBounds to find the width + int16_t textOffsetX, textOffsetY; + uint16_t textWidth, textHeight; + getTextBounds(text, 0, 0, &textOffsetX, &textOffsetY, &textWidth, &textHeight); + + return textWidth; +} + +// Gets rendered width of a string +// Wrappe for getTextBounds +uint16_t InkHUD::Applet::getTextWidth(std::string text) +{ + getFont().applySubstitutions(&text); + + return getTextWidth(text.c_str()); +} + +// Evaluate SNR and RSSI to qualify signal strength at one of four discrete levels +// Roughly comparable to values used by the iOS app; +// I didn't actually go look up the code, just fit to a sample graphic I have of the iOS signal indicator +InkHUD::SignalStrength InkHUD::Applet::getSignalStrength(float snr, float rssi) +{ + uint8_t score = 0; + + // Give a score for the SNR + if (snr > -17.5) + score += 2; + else if (snr > -26.0) + score += 1; + + // Give a score for the RSSI + if (rssi > -115.0) + score += 3; + else if (rssi > -120.0) + score += 2; + else if (rssi > -126.0) + score += 1; + + // Combine scores, then give a result + if (score >= 5) + return SIGNAL_GOOD; + else if (score >= 4) + return SIGNAL_FAIR; + else if (score > 0) + return SIGNAL_BAD; + else + return SIGNAL_NONE; +} + +// Apply the standard "node id" formatting to a nodenum int: !0123abdc +std::string InkHUD::Applet::hexifyNodeNum(NodeNum num) +{ + // Not found in nodeDB, show a hex nodeid instead + char nodeIdHex[10]; + sprintf(nodeIdHex, "!%0x", num); // Convert to the typical "fixed width hex with !" format + return std::string(nodeIdHex); +} + +void InkHUD::Applet::printWrapped(int16_t left, int16_t top, uint16_t width, std::string text) +{ + // Custom font glyphs + // - set with AppletFont::addSubstitution + // - find certain UTF8 chars + // - replace with glpyh from custom font (or suitable ASCII addSubstitution?) + getFont().applySubstitutions(&text); + + // Place the AdafruitGFX cursor to suit our "top" coord + setCursor(left, top + getFont().heightAboveCursor()); + + // How wide a space character is + // Used when simulating print, for dimensioning + // Works around issues where getTextDimensions() doesn't account for whitespace + const uint8_t wSp = getFont().widthBetweenWords(); + + // Move through our text, character by character + uint16_t wordStart = 0; + for (uint16_t i = 0; i < text.length(); i++) { + + // Found: end of word (split by spaces or newline) + // Also handles end of string + if (text[i] == ' ' || text[i] == '\n' || i == text.length() - 1) { + // Isolate this word + uint16_t wordLength = (i - wordStart) + 1; // Plus one. Imagine: "a". End - Start is 0, but length is 1 + std::string word = text.substr(wordStart, wordLength); + wordStart = i + 1; // Next word starts *after* the space + + // If word is terminated by a newline char, don't actually print it. + // We'll manually add a new line later + if (word.back() == '\n') + word.pop_back(); + + // Measure the word, in px + int16_t l, t; + uint16_t w, h; + getTextBounds(word.c_str(), getCursorX(), getCursorY(), &l, &t, &w, &h); + + // Word is short + if (w < width) { + // Word fits on current line + if ((l + w + wSp) < left + width) + print(word.c_str()); + + // Word doesn't fit on current line + else { + setCursor(left, getCursorY() + getFont().lineHeight()); // Newline + print(word.c_str()); + } + } + + // Word is really long + // (wider than applet) + else { + // Horribly inefficient: + // Rather than working directly with the glyph sizes, + // we're going to run everything through getTextBounds as a c-string of length 1 + // This is because AdafruitGFX has special internal handling for their legacy 6x8 font, + // which would be a pain to add manually here. + // These super-long strings probably don't come up often so we can maybe tolerate this. + + // Todo: rewrite making use of AdafruitGFX native text wrapping + char cstr[] = {0, 0}; + int16_t l, t; + uint16_t w, h; + for (uint16_t c = 0; c < word.length(); c++) { + // Shove next char into a c string + cstr[0] = word[c]; + getTextBounds(cstr, getCursorX(), getCursorY(), &l, &t, &w, &h); + + // Manual newline, if next character will spill beyond screen edge + if ((l + w) > left + width) + setCursor(left, getCursorY() + getFont().lineHeight()); + + // Print next character + print(word[c]); + } + } + } + + // If word was terminated by a newline char, manually add the new line now + if (text[i] == '\n') { + setCursor(left, getCursorY() + getFont().lineHeight()); // Manual newline + wordStart = i + 1; // New word begins after the newline. Otherwise print will add an *extra* line + } + } +} + +// Simulate running printWrapped, to determine how tall the block of text will be. +// This is a wasteful way of handling things. Maybe some way to optimize in future? +uint32_t InkHUD::Applet::getWrappedTextHeight(int16_t left, uint16_t width, std::string text) +{ + // Cache the current crop region + int16_t cL = cropLeft; + int16_t cT = cropTop; + uint16_t cW = cropWidth; + uint16_t cH = cropHeight; + + setCrop(-1, -1, 0, 0); // Set crop to temporarily discard all pixels + printWrapped(left, 0, width, text); // Simulate only - no pixels drawn + + // Restore previous crop region + cropLeft = cL; + cropTop = cT; + cropWidth = cW; + cropHeight = cH; + + // Note: printWrapped() offsets the initial cursor position by heightAboveCursor() val, + // so we need to account for that when determining the height + return (getCursorY() + getFont().heightBelowCursor()); +} + +// Fill a region with sparse diagonal lines, to create a pseudo-translucent fill +void InkHUD::Applet::hatchRegion(int16_t x, int16_t y, uint16_t w, uint16_t h, uint8_t spacing, Color color) +{ + // Cache the currently cropped region + int16_t oldCropL = cropLeft; + int16_t oldCropT = cropTop; + uint16_t oldCropW = cropWidth; + uint16_t oldCropH = cropHeight; + + setCrop(x, y, w, h); + + // Draw lines starting along the top edge, every few px + for (int16_t ix = x; ix < x + w; ix += spacing) { + for (int16_t i = 0; i < w || i < h; i++) { + drawPixel(ix + i, y + i, color); + } + } + + // Draw lines starting along the left edge, every few px + for (int16_t iy = y; iy < y + h; iy += spacing) { + for (int16_t i = 0; i < w || i < h; i++) { + drawPixel(x + i, iy + i, color); + } + } + + // Restore any previous crop + // If none was set, this will clear + cropLeft = oldCropL; + cropTop = oldCropT; + cropWidth = oldCropW; + cropHeight = oldCropH; +} + +// Get a human readable time representation of an epoch time (seconds since 1970) +// If time is invalid, this will be an empty string +std::string InkHUD::Applet::getTimeString(uint32_t epochSeconds) +{ +#ifdef BUILD_EPOCH + constexpr uint32_t validAfterEpoch = BUILD_EPOCH - (SEC_PER_DAY * 30 * 6); // 6 Months prior to build +#else + constexpr uint32_t validAfterEpoch = 1727740800 - (SEC_PER_DAY * 30 * 6); // 6 Months prior to October 1, 2024 12:00:00 AM GMT +#endif + + uint32_t epochNow = getValidTime(RTCQuality::RTCQualityDevice, true); + + int32_t daysAgo = (epochNow - epochSeconds) / SEC_PER_DAY; + int32_t hoursAgo = (epochNow - epochSeconds) / SEC_PER_HOUR; + + // Times are invalid: rtc is much older than when code was built + // Don't give any human readable string + if (epochNow <= validAfterEpoch) { + LOG_DEBUG("RTC prior to buildtime"); + return ""; + } + + // Times are invalid: argument time is significantly ahead of RTC + // Don't give any human readable string + if (daysAgo < -2) { + LOG_DEBUG("RTC in future"); + return ""; + } + + // Times are probably invalid: more than 6 months ago + if (daysAgo > 6 * 30) { + LOG_DEBUG("RTC val > 6 months old"); + return ""; + } + + if (daysAgo > 1) + return to_string(daysAgo) + " days ago"; + + else if (hoursAgo > 18) + return "Yesterday"; + + else { + + uint32_t hms = epochSeconds % SEC_PER_DAY; + hms = (hms + SEC_PER_DAY) % SEC_PER_DAY; + + // Tear apart hms into h:m + uint32_t hour = hms / SEC_PER_HOUR; + uint32_t min = (hms % SEC_PER_HOUR) / SEC_PER_MIN; + + // Format the clock string + char clockStr[11]; + sprintf(clockStr, "%u:%02u %s", (hour % 12 == 0 ? 12 : hour % 12), min, hour > 11 ? "PM" : "AM"); + + return clockStr; + } +} + +// If no argument specified, get time string for the current RTC time +std::string InkHUD::Applet::getTimeString() +{ + return getTimeString(getValidTime(RTCQuality::RTCQualityDevice, true)); +} + +// Calculate how many nodes have been seen within our preferred window of activity +// This period is set by user, via the menu +// Todo: optimize to calculate once only per WindowManager::render +uint16_t InkHUD::Applet::getActiveNodeCount() +{ + // Don't even try to count nodes if RTC isn't set + // The last heard values in nodedb will be incomprehensible + if (getRTCQuality() == RTCQualityNone) + return 0; + + uint16_t count = 0; + + // For each node in db + for (uint16_t i = 0; i < nodeDB->getNumMeshNodes(); i++) { + meshtastic_NodeInfoLite *node = nodeDB->getMeshNodeByIndex(i); + + // Check if heard recently, and not our own node + if (sinceLastSeen(node) < settings.recentlyActiveSeconds && node->num != nodeDB->getNodeNum()) + count++; + } + + return count; +} + +// Get an abbreviated, human readable, distance string +// Honors config.display.units, to offer both metric and imperial +std::string InkHUD::Applet::localizeDistance(uint32_t meters) +{ + constexpr float FEET_PER_METER = 3.28084; + constexpr uint16_t FEET_PER_MILE = 5280; + + // Resulting string + std::string localized; + + // Imeperial + if (config.display.units == meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL) { + uint32_t feet = meters * FEET_PER_METER; + // Distant (miles, rounded) + if (feet > FEET_PER_MILE / 2) { + localized += to_string((uint32_t)roundf(feet / FEET_PER_MILE)); + localized += "mi"; + } + // Nearby (feet) + else { + localized += to_string(feet); + localized += "ft"; + } + } + + // Metric + else { + // Distant (kilometers, rounded) + if (meters >= 500) { + localized += to_string((uint32_t)roundf(meters / 1000.0)); + localized += "km"; + } + // Nearby (meters) + else { + localized += to_string(meters); + localized += "m"; + } + } + + return localized; +} + +void InkHUD::Applet::printThick(int16_t xCenter, int16_t yCenter, std::string text, uint8_t thicknessX, uint8_t thicknessY) +{ + // How many times to draw along x axis + int16_t xStart; + int16_t xEnd; + switch (thicknessX) { + case 0: + assert(false); + case 1: + xStart = xCenter; + xEnd = xCenter; + break; + case 2: + xStart = xCenter; + xEnd = xCenter + 1; + break; + default: + xStart = xCenter - (thicknessX / 2); + xEnd = xCenter + (thicknessX / 2); + } + + // How many times to draw along Y axis + int16_t yStart; + int16_t yEnd; + switch (thicknessY) { + case 0: + assert(false); + case 1: + yStart = yCenter; + yEnd = yCenter; + break; + case 2: + yStart = yCenter; + yEnd = yCenter + 1; + break; + default: + yStart = yCenter - (thicknessY / 2); + yEnd = yCenter + (thicknessY / 2); + } + + // Print multiple times, overlapping + for (int16_t x = xStart; x <= xEnd; x++) { + for (int16_t y = yStart; y <= yEnd; y++) { + printAt(x, y, text, CENTER, MIDDLE); + } + } +} + +// Allow this applet to suppress notifications +// Asked before a notification is shown via the NotificationApplet +// An applet might want to suppress a notification if the applet itself already displays this info +// Example: AllMessageApplet should not approve notifications for messages, if it is in foreground +bool InkHUD::Applet::approveNotification(InkHUD::Notification &n) +{ + // By default, no objection + return true; +} + +// Draw the standard header, used by most Applets +void InkHUD::Applet::drawHeader(std::string text) +{ + setFont(fontSmall); + + // Y position for divider + // - between header text and messages + constexpr int16_t padDivH = 2; + const int16_t headerDivY = padDivH + fontSmall.lineHeight() + padDivH - 1; + + // Print header + printAt(0, padDivH, text); + + // Divider + // - below header text: separates message + // - above header text: separates other applets + for (int16_t x = 0; x < width(); x += 2) { + drawPixel(x, 0, BLACK); + drawPixel(x, headerDivY, BLACK); // Dotted 50% + } +} + +// Get the height of the standard applet header +// This will vary, depending on font +// Applets use this value to avoid drawing overtop the header +uint16_t InkHUD::Applet::getHeaderHeight() +{ + // Y position for divider + // - between header text and messages + constexpr int16_t padDivH = 2; + const int16_t headerDivY = padDivH + fontSmall.lineHeight() + padDivH - 1; + + return headerDivY + 1; // "Plus one": height is always one more than Y position +} + +// "Scale to fit": width of Meshtastic logo to fit given region, maintaining aspect ratio +uint16_t InkHUD::Applet::getLogoWidth(uint16_t limitWidth, uint16_t limitHeight) +{ + // Determine whether we're limited by width or height + // Makes sure we draw the logo as large as possible, within the specified region, + // while still maintaining correct aspect ratio + if (limitWidth > limitHeight * LOGO_ASPECT_RATIO) + return limitHeight * LOGO_ASPECT_RATIO; + else + return limitWidth; +} + +// "Scale to fit": height of Meshtastic logo to fit given region, maintaining aspect ratio +uint16_t InkHUD::Applet::getLogoHeight(uint16_t limitWidth, uint16_t limitHeight) +{ + // Determine whether we're limited by width or height + // Makes sure we draw the logo as large as possible, within the specified region, + // while still maintaining correct aspect ratio + if (limitHeight > limitWidth / LOGO_ASPECT_RATIO) + return limitWidth / LOGO_ASPECT_RATIO; + else + return limitHeight; +} + +// Draw a scalable Meshtastic logo +// Make sure to provide dimensions which have the correct aspect ratio (~2) +// Three paths, drawn thick using quads, with one corner "radiused" +void InkHUD::Applet::drawLogo(int16_t centerX, int16_t centerY, uint16_t width, uint16_t height) +{ + struct Point { + int x; + int y; + }; + typedef Point Distance; + + int16_t logoTh = width * 0.068; // Thickness scales with width. Measured from logo at meshtastic.org. + int16_t logoL = centerX - (width / 2) + (logoTh / 2); + int16_t logoT = centerY - (height / 2) + (logoTh / 2); + int16_t logoW = width - logoTh; + int16_t logoH = height - logoTh; + int16_t logoR = logoL + logoW - 1; + int16_t logoB = logoT + logoH - 1; + + // Points for paths (a, b, and c) + Point a1 = {map(0, 0, 3, logoL, logoR), logoB}; + Point a2 = {map(1, 0, 3, logoL, logoR), logoT}; + Point b1 = {map(1, 0, 3, logoL, logoR), logoB}; + Point b2 = {map(2, 0, 3, logoL, logoR), logoT}; + Point c1 = {map(2, 0, 3, logoL, logoR), logoT}; + Point c2 = {map(3, 0, 3, logoL, logoR), logoB}; + + // Find right-angle to the path + // Used to thicken the single pixel paths + Distance deltaA = {abs(a2.x - a1.x), abs(a2.y - a1.y)}; + float angle = tanh((float)deltaA.y / deltaA.x); + + // Distance {at right angle from the paths), which will give corners for our "quads" + // The distance is unsigned. We will vary the signedness of the x and y components to suit the path and corner + Distance fromPath; + fromPath.x = cos(radians(90) - angle) * logoTh * 0.5; + fromPath.y = sin(radians(90) - angle) * logoTh * 0.5; + + // Make the path thick: path a becomes quad a + Point aq1{a1.x - fromPath.x, a1.y - fromPath.y}; + Point aq2{a2.x - fromPath.x, a2.y - fromPath.y}; + Point aq3{a2.x + fromPath.x, a2.y + fromPath.y}; + Point aq4{a1.x + fromPath.x, a1.y + fromPath.y}; + fillTriangle(aq1.x, aq1.y, aq2.x, aq2.y, aq3.x, aq3.y, BLACK); + fillTriangle(aq1.x, aq1.y, aq3.x, aq3.y, aq4.x, aq4.y, BLACK); + + // Make the path thick: path b becomes quad b + Point bq1{b1.x - fromPath.x, b1.y - fromPath.y}; + Point bq2{b2.x - fromPath.x, b2.y - fromPath.y}; + Point bq3{b2.x + fromPath.x, b2.y + fromPath.y}; + Point bq4{b1.x + fromPath.x, b1.y + fromPath.y}; + fillTriangle(bq1.x, bq1.y, bq2.x, bq2.y, bq3.x, bq3.y, BLACK); + fillTriangle(bq1.x, bq1.y, bq3.x, bq3.y, bq4.x, bq4.y, BLACK); + + // Make the path hick: path c becomes quad c + Point cq1{c1.x - fromPath.x, c1.y + fromPath.y}; + Point cq2{c2.x - fromPath.x, c2.y + fromPath.y}; + Point cq3{c2.x + fromPath.x, c2.y - fromPath.y}; + Point cq4{c1.x + fromPath.x, c1.y - fromPath.y}; + fillTriangle(cq1.x, cq1.y, cq2.x, cq2.y, cq3.x, cq3.y, BLACK); + fillTriangle(cq1.x, cq1.y, cq3.x, cq3.y, cq4.x, cq4.y, BLACK); + + // Radius the intersection of quad b and quad c + // Don't attempt if logo is tiny + if (logoTh > 3) { + // The radius for the cap *should* be the same as logoTh, but it's not, due to accumulated rounding + // We get better results just rederiving it + int16_t capRad = sqrt(pow(fromPath.x, 2) + pow(fromPath.y, 2)); + fillCircle(b2.x, b2.y, capRad, BLACK); + } +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applet.h b/src/graphics/niche/InkHUD/Applet.h new file mode 100644 index 000000000..30c1bdcdc --- /dev/null +++ b/src/graphics/niche/InkHUD/Applet.h @@ -0,0 +1,234 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + + Base class for InkHUD applets + Must be overriden + + An applet is one "program" which may show info on the display. + + =================================== + Preliminary notes, for the curious + =================================== + + (This info to be streamlined, and moved to a more official documentation) + + User Applets vs System Applets + ------------------------------- + + There are either "User Applets", or "System Applets". + This concept is only for our understanding; as far at the code is concerned, both are just "Applets" + + User applets are the "normal" applets. + User applets are applets like "AllMessageApplet", or "MapApplet". + User applets may be enabled / disabled by user, via the on-screen menu. + Incorporating new UserApplets is easy: just add them during setupNicheGraphics + If a UserApplet is not added during setupNicheGraphics, it will not be built. + The set of available UserApplets is allowed to vary from device to device. + + + Examples of system applets include "NotificationApplet" and "MenuApplet". + For their own reasons, system applets each require some amount of special handling. + + Drawing + -------- + + *All* drawing must be performed by an Applet. + Applets implement the onRender() method, where all drawing takes place. + Applets are told how wide and tall they are, and are expected to draw to suit this size. + When an applet draws, it uses co-ordinates in "Applet Space": between 0 and applet width/height. + + Event-driven rendering + ----------------------- + + Applets don't render unless something on the display needs to change. + An applet is expected to determine for itself when it has new info to display. + It should interact with the firmware via the MeshModule API, via Observables, etc. + Please don't directly add hooks throughout the existing firmware code. + + When an applet decides it would like to update the display, it should call requestUpdate() + The WindowManager will shortly call the onRender() method for all affected applets + + An Applet may be unexpectedly asked to render at any point in time. + + Applets should cache their data, but not their pixel output: they should re-render when onRender runs. + An Applet's dimensions are not know until onRender is called, so pre-rendering of UI elements is prohibited. + + Tiles + ----- + + Applets are assigned to "Tiles". + Assigning an applet to a tile creates a reciprocal link between the two. + When an applet renders, it passes pixels to its tile. + The tile translates these to the correct position, to be placed into the fullscreen framebuffer. + User applets don't get to choose their own tile; the multiplexing is handled by the WindowManager. + System applets might do strange things though. + + Foreground and Background + ------------------------- + + The user can cycle between applets by short-pressing the user button. + Any applets which are currently displayed on the display are "foreground". + When the user button is short pressed, and an applet is hidden, it becomes "background". + + Although the WindowManager will not render background applets, they should still collect data, + so they are ready to display when they are brought to foreground again. + Even if they are in background, Applets should still request updates when an event affects them, + as the user may have given them permission to "autoshow"; bringing themselves foreground automatically + + Applets can implement the onForeground and onBackground methods to handle this change in state. + They can also check their state by calling isForeground() at any time. + + Active and Inactive + ------------------- + + The user can select which applets are available, using the onscreen applet selection menu. + Applets which are enabled in this menu are "active"; otherwise they are "inactive". + + An inactive applet is expected not collect data; not to consume resources. + Applets are activated at boot, or when enabled via the menu. + They are deactivated at shutdown, or when disabled via the menu. + + Applets can implement the onActivation and onDeactivation methods to handle this change in state. + +*/ + +#pragma once + +#include "configuration.h" + +#include + +#include "./AppletFont.h" +#include "./Applets/System/Notification/Notification.h" +#include "./Tile.h" +#include "./Types.h" +#include "./WindowManager.h" +#include "graphics/niche/Drivers/EInk/EInk.h" + +namespace NicheGraphics::InkHUD +{ + +using NicheGraphics::Drivers::EInk; +using std::to_string; + +class Tile; +class WindowManager; + +class Applet : public GFX +{ + public: + Applet(); + + void setTile(Tile *t); // Applets draw via a tile (for multiplexing) + Tile *getTile(); + + void render(); + bool wantsToRender(); // Check whether applet wants to render + bool wantsToAutoshow(); // Check whether applets wants to become foreground, to show new data, if permitted + Drivers::EInk::UpdateTypes wantsUpdateType(); // Check which display update type the applet would prefer + void updateDimensions(); // Get current size from tile + void resetDrawingSpace(); // Makes sure every render starts with same parameters + + // Change the applet's state + + void activate(); + void deactivate(); + void bringToForeground(); + void sendToBackground(); + + // Info about applet's state + + bool isActive(); + bool isForeground(); + + // Allow derived applets to handle changes in state + + virtual void onRender() = 0; // All drawing happens here + virtual void onActivate() {} + virtual void onDeactivate() {} + virtual void onForeground() {} + virtual void onBackground() {} + virtual void onShutdown() {} + virtual void onButtonShortPress() {} // For use by System Applets only + virtual void onButtonLongPress() {} // For use by System Applets only + virtual void onLockAvailable() {} // For use by System Applets only + + virtual bool approveNotification(Notification &n); // Allow an applet to veto a notification + + static void setDefaultFonts(AppletFont large, AppletFont small); // Set the general purpose fonts + static uint16_t getHeaderHeight(); // How tall is the "standard" applet header + + const char *name = nullptr; // Shown in applet selection menu + + protected: + // Place a single pixel. All drawing methods output through here + void drawPixel(int16_t x, int16_t y, uint16_t color) override; + + // Tell WindowManager to update display + void requestUpdate(EInk::UpdateTypes type = EInk::UpdateTypes::UNSPECIFIED); + + // Ask for applet to be moved to foreground + void requestAutoshow(); + + uint16_t X(float f); // Map applet width, mapped from 0 to 1.0 + uint16_t Y(float f); // Map applet height, mapped from 0 to 1.0 + void setCrop(int16_t left, int16_t top, uint16_t width, uint16_t height); // Ignore pixels drawn outside a certain region + void resetCrop(); // Removes setCrop() + + void setFont(AppletFont f); + AppletFont getFont(); + + uint16_t getTextWidth(std::string text); + uint16_t getTextWidth(const char *text); + + void printAt(int16_t x, int16_t y, const char *text, HorizontalAlignment ha = LEFT, VerticalAlignment va = TOP); + void printAt(int16_t x, int16_t y, std::string text, HorizontalAlignment ha = LEFT, VerticalAlignment va = TOP); + void printThick(int16_t xCenter, int16_t yCenter, std::string text, uint8_t thicknessX, uint8_t thicknessY); + + // Print text, with per-word line wrapping + void printWrapped(int16_t left, int16_t top, uint16_t width, std::string text); + uint32_t getWrappedTextHeight(int16_t left, uint16_t width, std::string text); + + void hatchRegion(int16_t x, int16_t y, uint16_t w, uint16_t h, uint8_t spacing, Color color); // Fill with sparse lines + void drawHeader(std::string text); // Draw the standard applet header + + static constexpr float LOGO_ASPECT_RATIO = 1.9; // Width:Height for drawing the Meshtastic logo + uint16_t getLogoWidth(uint16_t limitWidth, uint16_t limitHeight); // Size Meshtastic logo to fit within region + uint16_t getLogoHeight(uint16_t limitWidth, uint16_t limitHeight); // Size Meshtastic logo to fit within region + void drawLogo(int16_t centerX, int16_t centerY, uint16_t width, uint16_t height); // Draw the meshtastic logo + + std::string hexifyNodeNum(NodeNum num); + SignalStrength getSignalStrength(float snr, float rssi); // Interpret SNR and RSSI, as an easy to understand value + std::string getTimeString(uint32_t epochSeconds); // Human readable + std::string getTimeString(); // Current time, human readable + uint16_t getActiveNodeCount(); // Duration determined by user, in onscreen menu + std::string localizeDistance(uint32_t meters); // Human readable distance, imperial or metric + + static AppletFont fontSmall, fontLarge; // General purpose fonts, used cross-applet + + private: + Tile *assignedTile = nullptr; // Rendered pixels are fed into a Tile object, which translates them, then passes to WM + bool active = false; // Has the user enabled this applet (at run-time)? + bool foreground = false; // Is the applet currently drawn on a tile? + + bool wantRender = false; // In some situations, checked by WindowManager when updating, to skip unneeded redrawing. + bool wantAutoshow = false; // Does the applet have new data it would like to display in foreground? + NicheGraphics::Drivers::EInk::UpdateTypes wantUpdateType = + NicheGraphics::Drivers::EInk::UpdateTypes::UNSPECIFIED; // Which update method we'd prefer when redrawing the display + + using GFX::setFont; // Make sure derived classes use AppletFont instead of AdafruitGFX fonts directly + using GFX::setRotation; // Block setRotation calls. Rotation is handled globally by WindowManager. + + AppletFont currentFont; // As passed to setFont + + // As set by setCrop + int16_t cropLeft; + int16_t cropTop; + uint16_t cropWidth; + uint16_t cropHeight; +}; + +}; // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/AppletFont.cpp b/src/graphics/niche/InkHUD/AppletFont.cpp new file mode 100644 index 000000000..bee9d33e6 --- /dev/null +++ b/src/graphics/niche/InkHUD/AppletFont.cpp @@ -0,0 +1,208 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./AppletFont.h" + +using namespace NicheGraphics; + +InkHUD::AppletFont::AppletFont() +{ + // Default constructor uses the in-built AdafruitGFX font +} + +InkHUD::AppletFont::AppletFont(const GFXfont &adafruitGFXFont) : gfxFont(&adafruitGFXFont) +{ + // AdafruitGFX fonts are drawn relative to a "cursor line"; + // they print as if the glyphs resting on the line of piece of ruled paper. + // The glyphs also each have a different height. + + // To simplify drawing, we will scan the entire font now, and determine an appropriate height for a line of text + // We also need to know where that "cursor line" sits inside this "line height"; + // we need this additional info in order to align text by top-left, bottom-right, etc + + // AdafruitGFX fonts do declare a line-height, but this seems to include a certain amount of padding, + // which we'd rather not deal with. If we want padding, we'll add it manually. + + // Scan each glyph in the AdafruitGFX font + for (uint16_t i = 0; i <= (gfxFont->last - gfxFont->first); i++) { + uint8_t glyphHeight = gfxFont->glyph[i].height; // Height of glyph + this->height = max(this->height, glyphHeight); // Store if it's a new max + + // Calculate how far the glyph rises the cursor line + // Store if new max value + // Caution: signed and unsigned types + int8_t glyphAscender = 0 - gfxFont->glyph[i].yOffset; + if (glyphAscender > 0) + this->ascenderHeight = max(this->ascenderHeight, (uint8_t)glyphAscender); + } + + // Determine how far characters may hang "below the line" + descenderHeight = height - ascenderHeight; + + // Find how far the cursor advances when we "print" a space character + spaceCharWidth = gfxFont->glyph[(uint8_t)' ' - gfxFont->first].xAdvance; +} + +uint8_t InkHUD::AppletFont::lineHeight() +{ + return this->height; +} + +// AdafruitGFX fonts print characters so that they nicely on an imaginary line (think: ruled paper). +// This value is the height of the font, above that imaginary line. +// Used to calculate the true height of the font +uint8_t InkHUD::AppletFont::heightAboveCursor() +{ + return this->ascenderHeight; +} + +// AdafruitGFX fonts print characters so that they nicely on an imaginary line (think: ruled paper). +// This value is the height of the font, below that imaginary line. +// Used to calculate the true height of the font +uint8_t InkHUD::AppletFont::heightBelowCursor() +{ + return this->descenderHeight; +} + +// Width of the space character +// Used with Applet::printWrapped +uint8_t InkHUD::AppletFont::widthBetweenWords() +{ + return this->spaceCharWidth; +} + +// Add to the list of substituted glyphs +// This "find and replace" operation will be run before text is printed +// Used to swap out UTF8 special characters, either with a custom font, or with a suitable ASCII approximation +void InkHUD::AppletFont::addSubstitution(const char *from, const char *to) +{ + substitutions.push_back({.from = from, .to = to}); +} + +// Run all registered subtitutions on a string +// Used to swap out UTF8 special chars +void InkHUD::AppletFont::applySubstitutions(std::string *text) +{ + // For each substitution + for (Substitution s : substitutions) { + + // Find and replace + // - search for Substitution::from + // - replace with Subsitution::to + size_t i = text->find(s.from); + while (i != std::string::npos) { + text->replace(i, strlen(s.from), s.to); + i = text->find(s.from, i); // Continue looking from last position + } + } +} + +// Apply a set of substitutions which remap UTF8 for a Windows-1251 font +// Windows-1251 is an 8-bit character encoding, designed to cover languages that use the Cyrillic script +void InkHUD::AppletFont::addSubstitutionsWin1251() +{ + addSubstitution("Ђ", "\x80"); + addSubstitution("Ѓ", "\x81"); + addSubstitution("Ñ“", "\x83"); + addSubstitution("€", "\x88"); + addSubstitution("Љ", "\x8A"); + addSubstitution("Њ", "\x8C"); + addSubstitution("ÐŒ", "\x8D"); + addSubstitution("Ћ", "\x8E"); + addSubstitution("Ð", "\x8F"); + + addSubstitution("Ñ’", "\x90"); + addSubstitution("Ñ™", "\x9A"); + addSubstitution("Ñš", "\x9C"); + addSubstitution("Ñœ", "\x9D"); + addSubstitution("Ñ›", "\x9E"); + addSubstitution("ÑŸ", "\x9F"); + + addSubstitution("ÐŽ", "\xA1"); + addSubstitution("Ñž", "\xA2"); + addSubstitution("Ј", "\xA3"); + addSubstitution("Ò", "\xA5"); + addSubstitution("Ð", "\xA8"); + addSubstitution("Є", "\xAA"); + addSubstitution("Ї", "\xAF"); + + addSubstitution("І", "\xB2"); + addSubstitution("Ñ–", "\xB3"); + addSubstitution("Ò‘", "\xB4"); + addSubstitution("Ñ‘", "\xB8"); + addSubstitution("â„–", "\xB9"); + addSubstitution("Ñ”", "\xBA"); + addSubstitution("ј", "\xBC"); + addSubstitution("Ð…", "\xBD"); + addSubstitution("Ñ•", "\xBE"); + addSubstitution("Ñ—", "\xBF"); + + addSubstitution("Ð", "\xC0"); + addSubstitution("Б", "\xC1"); + addSubstitution("Ð’", "\xC2"); + addSubstitution("Г", "\xC3"); + addSubstitution("Д", "\xC4"); + addSubstitution("Е", "\xC5"); + addSubstitution("Ж", "\xC6"); + addSubstitution("З", "\xC7"); + addSubstitution("И", "\xC8"); + addSubstitution("Й", "\xC9"); + addSubstitution("К", "\xCA"); + addSubstitution("Л", "\xCB"); + addSubstitution("М", "\xCC"); + addSubstitution("Ð", "\xCD"); + addSubstitution("О", "\xCE"); + addSubstitution("П", "\xCF"); + + addSubstitution("Р", "\xD0"); + addSubstitution("С", "\xD1"); + addSubstitution("Т", "\xD2"); + addSubstitution("У", "\xD3"); + addSubstitution("Ф", "\xD4"); + addSubstitution("Ð¥", "\xD5"); + addSubstitution("Ц", "\xD6"); + addSubstitution("Ч", "\xD7"); + addSubstitution("Ш", "\xD8"); + addSubstitution("Щ", "\xD9"); + addSubstitution("Ъ", "\xDA"); + addSubstitution("Ы", "\xDB"); + addSubstitution("Ь", "\xDC"); + addSubstitution("Э", "\xDD"); + addSubstitution("Ю", "\xDE"); + addSubstitution("Я", "\xDF"); + + addSubstitution("а", "\xE0"); + addSubstitution("б", "\xE1"); + addSubstitution("в", "\xE2"); + addSubstitution("г", "\xE3"); + addSubstitution("д", "\xE4"); + addSubstitution("е", "\xE5"); + addSubstitution("ж", "\xE6"); + addSubstitution("з", "\xE7"); + addSubstitution("и", "\xE8"); + addSubstitution("й", "\xE9"); + addSubstitution("к", "\xEA"); + addSubstitution("л", "\xEB"); + addSubstitution("м", "\xEC"); + addSubstitution("н", "\xED"); + addSubstitution("о", "\xEE"); + addSubstitution("п", "\xEF"); + + addSubstitution("Ñ€", "\xF0"); + addSubstitution("Ñ", "\xF1"); + addSubstitution("Ñ‚", "\xF2"); + addSubstitution("у", "\xF3"); + addSubstitution("Ñ„", "\xF4"); + addSubstitution("Ñ…", "\xF5"); + addSubstitution("ц", "\xF6"); + addSubstitution("ч", "\xF7"); + addSubstitution("ш", "\xF8"); + addSubstitution("щ", "\xF9"); + addSubstitution("ÑŠ", "\xFA"); + addSubstitution("Ñ‹", "\xFB"); + addSubstitution("ÑŒ", "\xFC"); + addSubstitution("Ñ", "\xFD"); + addSubstitution("ÑŽ", "\xFE"); + addSubstitution("Ñ", "\xFF"); +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/AppletFont.h b/src/graphics/niche/InkHUD/AppletFont.h new file mode 100644 index 000000000..89f901c94 --- /dev/null +++ b/src/graphics/niche/InkHUD/AppletFont.h @@ -0,0 +1,59 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + + Wrapper class for an AdafruitGFX font + Pre-calculates some font dimension info which InkHUD uses repeatedly + + Also contains an optional set of "substitutions". + These can be used to detect special UTF8 chars, and replace occurrences with a remapped char val to suit a custom font + These can also be used to swap UTF8 chars for a suitable ASCII substitution (e.g. German ö -> oe, etc) + +*/ + +#pragma once + +#include "configuration.h" + +#include + +namespace NicheGraphics::InkHUD +{ + +// An AdafruitGFX font, bundled with precalculated dimensions which are used frequently by InkHUD +class AppletFont +{ + public: + AppletFont(); + AppletFont(const GFXfont &adafruitGFXFont); + uint8_t lineHeight(); + uint8_t heightAboveCursor(); + uint8_t heightBelowCursor(); + uint8_t widthBetweenWords(); + + void applySubstitutions(std::string *text); // Run all char-substitution operations, prior to printing + void addSubstitution(const char *from, const char *to); // Register a find-replace action, for remapping UTF8 chars + void addSubstitutionsWin1251(); // Cyrillic fonts: remap UTF8 values to their Win-1251 equivalent + // Todo: Polish font + + const GFXfont *gfxFont = NULL; // Default value: in-built AdafruitGFX font + + private: + uint8_t height = 8; // Default value: in-built AdafruitGFX font + uint8_t ascenderHeight = 0; // Default value: in-built AdafruitGFX font + uint8_t descenderHeight = 8; // Default value: in-built AdafruitGFX font + uint8_t spaceCharWidth = 8; // Default value: in-built AdafruitGFX font + + // One pair of find-replace values, for substituting or remapping UTF8 chars + struct Substitution { + const char *from; + const char *to; + }; + + // List of all character substitutions to run, prior to printing a string + std::vector substitutions; +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.cpp b/src/graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.cpp new file mode 100644 index 000000000..21f404349 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.cpp @@ -0,0 +1,429 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./MapApplet.h" + +using namespace NicheGraphics; + +void InkHUD::MapApplet::onRender() +{ + setFont(fontSmall); + + // Abort if no markers to render + if (!enoughMarkers()) { + printAt(X(0.5), Y(0.5) - (getFont().lineHeight() / 2), "Node positions", CENTER, MIDDLE); + printAt(X(0.5), Y(0.5) + (getFont().lineHeight() / 2), "will appear here", CENTER, MIDDLE); + return; + } + + // Find center of map + // - latitude and longitude + // - will be placed at X(0.5), Y(0.5) + getMapCenter(&latCenter, &lngCenter); + + // Calculate North+East distance of each node to map center + // - which nodes to use controlled by virtual shouldDrawNode method + calculateAllMarkers(); + + // Set the region shown on the map + // - default: fit all nodes, plus padding + // - maybe overriden by derived applet + getMapSize(&widthMeters, &heightMeters); + + // Set the metersToPx conversion value + calculateMapScale(); + + // Special marker for own node + meshtastic_NodeInfoLite *ourNode = nodeDB->getMeshNode(nodeDB->getNodeNum()); + if (ourNode && nodeDB->hasValidPosition(ourNode)) + drawLabeledMarker(ourNode); + + // Draw all markers + for (Marker m : markers) { + int16_t x = X(0.5) + (m.eastMeters * metersToPx); + int16_t y = Y(0.5) - (m.northMeters * metersToPx); + + // Cross Size + constexpr uint16_t csMin = 5; + constexpr uint16_t csMax = 12; + + // Too many hops away + if (m.hasHopsAway && m.hopsAway > config.lora.hop_limit) // Too many mops + printAt(x, y, "!", CENTER, MIDDLE); + else if (!m.hasHopsAway) // Unknown hops + drawCross(x, y, csMin); + else // The fewer hops, the larger the cross + drawCross(x, y, map(m.hopsAway, 0, config.lora.hop_limit, csMax, csMin)); + } +} + +// Find the center point, in the middle of all node positions +// Calculated values are written to the *lat and *long pointer args +// - Finds the "mean lat long" +// - Calculates furthest nodes from "mean lat long" +// - Place map center directly between these furthest nodes + +void InkHUD::MapApplet::getMapCenter(float *lat, float *lng) +{ + // Find mean lat long coords + // ============================ + // - assigning X, Y and Z values to position on Earth's surface in 3D space, relative to center of planet + // - averages the x, y and z coords + // - uses tan to find angles for lat / long degrees + // - longitude: triangle formed by x and y (on plane of the equator) + // - latitude: triangle formed by z (north south), + // and the line along plane of equator which stetches from earth's axis to where point xyz intersects planet's surface + + // Working totals, averaged after nodeDB processed + uint32_t positionCount = 0; + float xAvg = 0; + float yAvg = 0; + float zAvg = 0; + + // For each node in db + for (uint32_t i = 0; i < nodeDB->getNumMeshNodes(); i++) { + meshtastic_NodeInfoLite *node = nodeDB->getMeshNodeByIndex(i); + + // Skip if no position + if (!nodeDB->hasValidPosition(node)) + continue; + + // Skip if derived applet doesn't want to show this node on the map + if (!shouldDrawNode(node)) + continue; + + // Latitude and Longitude of node, in radians + float latRad = node->position.latitude_i * (1e-7) * DEG_TO_RAD; + float lngRad = node->position.longitude_i * (1e-7) * DEG_TO_RAD; + + // Convert to cartesian points, with center of earth at 0, 0, 0 + // Exact distance from center is irrelevant, as we're only interested in the vector + float x = cos(latRad) * cos(lngRad); + float y = cos(latRad) * sin(lngRad); + float z = sin(latRad); + + // To find mean values shortly + xAvg += x; + yAvg += y; + zAvg += z; + positionCount++; + } + + // All NodeDB processed, find mean values + xAvg /= positionCount; + yAvg /= positionCount; + zAvg /= positionCount; + + // Longitude from cartesian coords + // (Angle from 3D coords describing a point of globe's surface) + /* + UK + /-------\ + (Top View) /- -\ + /- (You) -\ + /- . -\ + /- . X -\ + Asia - ... - USA + \- Y -/ + \- -/ + \- -/ + \- -/ + \- -----/ + Pacific + + */ + + *lng = atan2(yAvg, xAvg) * RAD_TO_DEG; + + // Latitude from cartesian cooods + // (Angle from 3D coords describing a point on the globe's surface) + // As latitude increases, distance from the Earth's north-south axis out to our surface point decreases. + // Means we need to first find the hypotenuse which becomes base of our triangle in the second step + /* + UK North + /-------\ (Front View) /-------\ + (Top View) /- -\ /- -\ + /- (You) -\ /-(You) -\ + /- /. -\ /- . -\ + /- √X²+Y²/ . X -\ /- Z . -\ + Asia - /... - USA - ..... - + \- Y -/ \- √X²+Y² -/ + \- -/ \- -/ + \- -/ \- -/ + \- -/ \- -/ + \- -----/ \- -----/ + Pacific South + */ + + float hypotenuse = sqrt((xAvg * xAvg) + (yAvg * yAvg)); // Distance from globe's north-south axis to surface intersect + *lat = atan2(zAvg, hypotenuse) * RAD_TO_DEG; + + // ---------------------------------------------- + // This has given us the "mean position" + // This will be a position *somewhere* near the center of our nodes. + // What we actually want is to place our center so that our outermost nodes end up on the border of our map. + // The only real use of our "mean position" is to give us a reference frame: + // which direction is east, and which is west. + //------------------------------------------------ + + // Find furthest nodes from "mean lat long" + // ======================================== + + float northernmost = latCenter; + float southernmost = latCenter; + float easternmost = lngCenter; + float westernmost = lngCenter; + + for (uint8_t i = 0; i < nodeDB->getNumMeshNodes(); i++) { + meshtastic_NodeInfoLite *node = nodeDB->getMeshNodeByIndex(i); + + // Skip if no position + if (!nodeDB->hasValidPosition(node)) + continue; + + // Skip if derived applet doesn't want to show this node on the map + if (!shouldDrawNode(node)) + continue; + + // Check for a new top or bottom latitude + float lat = node->position.latitude_i * 1e-7; + northernmost = max(northernmost, lat); + southernmost = min(southernmost, lat); + + // Longitude is trickier + float lng = node->position.longitude_i * 1e-7; + float degEastward = fmod(((lng - lngCenter) + 360), 360); // Degrees travelled east from lngCenter to reach node + float degWestward = abs(fmod(((lng - lngCenter) - 360), 360)); // Degrees travelled west from lngCenter to reach node + if (degEastward < degWestward) + easternmost = max(easternmost, lngCenter + degEastward); + else + westernmost = min(westernmost, lngCenter - degWestward); + } + + // Todo: check for issues with map spans >180 deg. MQTT only.. + latCenter = (northernmost + southernmost) / 2; + lngCenter = (westernmost + easternmost) / 2; + + // In case our new center is west of -180, or east of +180, for some reason + lngCenter = fmod(lngCenter, 180); +} + +// Size of map in meters +// Grown to fit the nodes furthest from map center +// Overridable if derived applet wants a custom map size (fixed size?) +void InkHUD::MapApplet::getMapSize(uint32_t *widthMeters, uint32_t *heightMeters) +{ + // Reset the value + *widthMeters = 0; + *heightMeters = 0; + + // Find the greatest distance horizontally and vertically from map center + for (Marker m : markers) { + *widthMeters = max(*widthMeters, (uint32_t)abs(m.eastMeters) * 2); + *heightMeters = max(*heightMeters, (uint32_t)abs(m.northMeters) * 2); + } + + // Add padding + *widthMeters *= 1.1; + *heightMeters *= 1.1; +} + +// Convert and store info we need for drawing a marker +// Lat / long to "meters relative to map center", for position on screen +// Info about hopsAway, for marker size +InkHUD::MapApplet::Marker InkHUD::MapApplet::calculateMarker(float lat, float lng, bool hasHopsAway, uint8_t hopsAway) +{ + assert(lat != 0 || lng != 0); // Not null island. Applets should check this before calling. + + // Bearing and distance from map center to node + float distanceFromCenter = GeoCoord::latLongToMeter(latCenter, lngCenter, lat, lng); + float bearingFromCenter = GeoCoord::bearing(latCenter, lngCenter, lat, lng); // in radians + + // Split into meters north and meters east components (signed) + // - signedness of cos / sin automatically sets negative if south or west + float northMeters = cos(bearingFromCenter) * distanceFromCenter; + float eastMeters = sin(bearingFromCenter) * distanceFromCenter; + + // Store this as a new marker + Marker m; + m.eastMeters = eastMeters; + m.northMeters = northMeters; + m.hasHopsAway = hasHopsAway; + m.hopsAway = hopsAway; + return m; +} + +// Draw a marker on the map for a node, with a shortname label, and backing box +void InkHUD::MapApplet::drawLabeledMarker(meshtastic_NodeInfoLite *node) +{ + // Find x and y position based on node's position in nodeDB + assert(nodeDB->hasValidPosition(node)); + Marker m = calculateMarker(node->position.latitude_i * 1e-7, // Lat, converted from Meshtastic's internal int32 style + node->position.longitude_i * 1e-7, // Long, convered from Meshtastic's internal int32 style + node->has_hops_away, // Is the hopsAway number valid + node->hops_away // Hops away + ); + + // Convert to pixel coords + int16_t markerX = X(0.5) + (m.eastMeters * metersToPx); + int16_t markerY = Y(0.5) - (m.northMeters * metersToPx); + + constexpr uint16_t paddingH = 2; + constexpr uint16_t paddingW = 4; + uint16_t paddingInnerW = 2; // Zero'd out if no text + constexpr uint16_t markerSizeMax = 12; // Size of cross (if marker uses a cross) + constexpr uint16_t markerSizeMin = 5; + + int16_t textX; + int16_t textY; + uint16_t textW; + uint16_t textH; + int16_t labelX; + int16_t labelY; + uint16_t labelW; + uint16_t labelH; + uint8_t markerSize; + + bool tooManyHops = node->hops_away > config.lora.hop_limit; + bool isOurNode = node->num == nodeDB->getNodeNum(); + bool unknownHops = !node->has_hops_away && !isOurNode; + + // We will draw a left or right hand variant, to place text towards screen center + // Hopfully avoid text spilling off screen + // Most values are the same, regardless of left-right handedness + + // Pick emblem style + if (tooManyHops) + markerSize = getTextWidth("!"); + else if (unknownHops) + markerSize = markerSizeMin; + else + markerSize = map(node->hops_away, 0, config.lora.hop_limit, markerSizeMax, markerSizeMin); + + // Common dimensions (left or right variant) + textW = getTextWidth(node->user.short_name); + if (textW == 0) + paddingInnerW = 0; // If no text, no padding for text + textH = fontSmall.lineHeight(); + labelH = paddingH + max((int16_t)(textH), (int16_t)markerSize) + paddingH; + labelY = markerY - (labelH / 2); + textY = markerY; + labelW = paddingW + markerSize + paddingInnerW + textW + paddingW; // Width is same whether right or left hand variant + + // Left-side variant + if (markerX < width() / 2) { + labelX = markerX - (markerSize / 2) - paddingW; + textX = labelX + paddingW + markerSize + paddingInnerW; + } + + // Right-side variant + else { + labelX = markerX - (markerSize / 2) - paddingInnerW - textW - paddingW; + textX = labelX + paddingW; + } + + // Backing box + fillRect(labelX, labelY, labelW, labelH, WHITE); + drawRect(labelX, labelY, labelW, labelH, BLACK); + + // Short name + printAt(textX, textY, node->user.short_name, LEFT, MIDDLE); + + // If the label is for our own node, + // fade it by overdrawing partially with white + if (node == nodeDB->getMeshNode(nodeDB->getNodeNum())) + hatchRegion(labelX, labelY, labelW, labelH, 2, WHITE); + + // Draw the marker emblem + // - after the fading, because hatching (own node) can align with cross and make it look weird + if (tooManyHops) + printAt(markerX, markerY, "!", CENTER, MIDDLE); + else + drawCross(markerX, markerY, markerSize); // The fewer the hops, the larger the marker. Also handles unknownHops +} + +// Check if we actually have enough nodes which would be shown on the map +// Need at least two, to draw a sensible map +bool InkHUD::MapApplet::enoughMarkers() +{ + uint8_t count = 0; + for (uint8_t i = 0; i < nodeDB->getNumMeshNodes(); i++) { + meshtastic_NodeInfoLite *node = nodeDB->getMeshNodeByIndex(i); + + // Count nodes + if (nodeDB->hasValidPosition(node) && shouldDrawNode(node)) + count++; + + // We need to find two + if (count == 2) + return true; // Two nodes is enough for a sensible map + } + + return false; // No nodes would be drawn (or just the one, uselessly at 0,0) +} + +// Calculate how far north and east of map center each node is +// Derived applets can control which nodes to calculate (and later, draw) by overriding MapApplet::shouldDrawNode +void InkHUD::MapApplet::calculateAllMarkers() +{ + // Clear old markers + markers.clear(); + + // For each node in db + for (uint32_t i = 0; i < nodeDB->getNumMeshNodes(); i++) { + meshtastic_NodeInfoLite *node = nodeDB->getMeshNodeByIndex(i); + + // Skip if no position + if (!nodeDB->hasValidPosition(node)) + continue; + + // Skip if derived applet doesn't want to show this node on the map + if (!shouldDrawNode(node)) + continue; + + // Skip if our own node + // - special handling in render() + if (node->num == nodeDB->getNodeNum()) + continue; + + // Calculate marker and store it + markers.push_back( + calculateMarker(node->position.latitude_i * 1e-7, // Lat, converted from Meshtastic's internal int32 style + node->position.longitude_i * 1e-7, // Long, convered from Meshtastic's internal int32 style + node->has_hops_away, // Is the hopsAway number valid + node->hops_away // Hops away + )); + } +} + +// Determine the conversion factor between metres, and pixels on screen +// May be overriden by derived applet, if custom scale required (fixed map size?) +void InkHUD::MapApplet::calculateMapScale() +{ + // Aspect ratio of map and screen + // - larger = wide, smaller = tall + // - used to set scale, so that widest map dimension fits in applet + float mapAspectRatio = (float)widthMeters / heightMeters; + float appletAspectRatio = (float)width() / height(); + + // "Shrink to fit" + // Scale the map so that the largest dimension is fully displayed + // Because aspect ratio will be maintained, the other dimension will appear "padded" + if (mapAspectRatio > appletAspectRatio) + metersToPx = (float)width() / widthMeters; // Too wide for applet. Constrain to fit width. + else + metersToPx = (float)height() / heightMeters; // Too tall for applet. Constrain to fit height. +} + +// Draw an x, centered on a specific point +// Most markers will draw with this method +void InkHUD::MapApplet::drawCross(int16_t x, int16_t y, uint8_t size) +{ + int16_t x0 = x - (size / 2); + int16_t y0 = y - (size / 2); + int16_t x1 = x0 + size - 1; + int16_t y1 = y0 + size - 1; + drawLine(x0, y0, x1, y1, BLACK); + drawLine(x0, y1, x1, y0, BLACK); +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.h b/src/graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.h new file mode 100644 index 000000000..fd5245631 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.h @@ -0,0 +1,66 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +Base class for Applets which show nodes on a map + +Plots position of for a selection of nodes, with north facing up. +Size of cross represents hops away. +Our own node is identified with a faded label. + +The base applet doesn't handle any events; this is left to the derived applets. + +*/ + +#pragma once + +#include "configuration.h" + +#include "graphics/niche/InkHUD/Applet.h" + +#include "MeshModule.h" +#include "gps/GeoCoord.h" + +namespace NicheGraphics::InkHUD +{ + +class MapApplet : public Applet +{ + public: + void onRender() override; + + protected: + virtual bool shouldDrawNode(meshtastic_NodeInfoLite *node) { return true; } // Allow derived applets to filter the nodes + virtual void getMapCenter(float *lat, float *lng); + virtual void getMapSize(uint32_t *widthMeters, uint32_t *heightMeters); + + bool enoughMarkers(); // Anything to draw? + void drawLabeledMarker(meshtastic_NodeInfoLite *node); // Highlight a specific marker + + private: + // Position of markers to be drawn, relative to map center + // HopsAway info used to determine marker size + struct Marker { + float eastMeters = 0; // Meters east of mapCenter. Negative if west. + float northMeters = 0; // Meters north of mapCenter. Negative if south. + bool hasHopsAway = false; + uint8_t hopsAway = 0; + }; + + Marker calculateMarker(float lat, float lng, bool hasHopsAway, uint8_t hopsAway); + void calculateAllMarkers(); + void calculateMapScale(); // Conversion factor for meters to pixels + void drawCross(int16_t x, int16_t y, uint8_t size); // Draw the X used for most markers + + float metersToPx = 0; // Conversion factor for meters to pixels + float latCenter = 0; // Map center: latitude + float lngCenter = 0; // Map center: longitude + + std::list markers; + uint32_t widthMeters = 0; // Map width: meters + uint32_t heightMeters = 0; // Map height: meters +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.cpp b/src/graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.cpp new file mode 100644 index 000000000..5d60e6800 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.cpp @@ -0,0 +1,283 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "RTC.h" + +#include "GeoCoord.h" +#include "NodeDB.h" + +#include "./NodeListApplet.h" + +using namespace NicheGraphics; + +InkHUD::NodeListApplet::NodeListApplet(const char *name) : MeshModule(name) +{ + // We only need to be promiscuous in order to hear NodeInfo, apparently. See NodeInfoModule + // For all other packets, we manually reimplement isPromiscuous=false in wantPacket + MeshModule::isPromiscuous = true; +} + +// Do we want to process this packet with handleReceived()? +bool InkHUD::NodeListApplet::wantPacket(const meshtastic_MeshPacket *p) +{ + // Only interested if: + return isActive() // Applet is active + && !isFromUs(p) // Packet is incoming (not outgoing) + && (isToUs(p) || isBroadcast(p->to) || // Either: intended for us, + p->decoded.portnum == meshtastic_PortNum_NODEINFO_APP); // or nodeinfo + + // Note: special handling of NodeInfo is to match NodeInfoModule + // To match the behavior seen in the client apps: + // - NodeInfoModule's ProtoBufModule base is "promiscuous" + // - All other activity is *not* promiscuous + // To achieve this, our MeshModule *is* promiscious, and we're manually reimplementing non-promiscuous behavior here, + // to match the code in MeshModule::callModules +} + +// MeshModule packets arrive here +// Extract the info and pass it to the derived applet +// Derived applet will store the CardInfo and perform any required sorting of the CardInfo collection +// Derived applet might also need to keep other tallies (active nodes count?) +ProcessMessage InkHUD::NodeListApplet::handleReceived(const meshtastic_MeshPacket &mp) +{ + // Abort if applet fully deactivated + // Already handled by wantPacket in this case, but good practice for all applets, as some *do* require this early return + if (!isActive()) + return ProcessMessage::CONTINUE; + + // Assemble info: from this event + CardInfo c; + c.nodeNum = mp.from; + c.signal = getSignalStrength(mp.rx_snr, mp.rx_rssi); + + // Assemble info: from nodeDB (needed to detect changes) + meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(c.nodeNum); + meshtastic_NodeInfoLite *ourNode = nodeDB->getMeshNode(nodeDB->getNodeNum()); + if (node) { + if (node->has_hops_away) + c.hopsAway = node->hops_away; + + if (nodeDB->hasValidPosition(node) && nodeDB->hasValidPosition(ourNode)) { + // Get lat and long as float + // Meshtastic stores these as integers internally + float ourLat = ourNode->position.latitude_i * 1e-7; + float ourLong = ourNode->position.longitude_i * 1e-7; + float theirLat = node->position.latitude_i * 1e-7; + float theirLong = node->position.longitude_i * 1e-7; + + c.distanceMeters = (int32_t)GeoCoord::latLongToMeter(theirLat, theirLong, ourLat, ourLong); + } + } + + // Pass to the derived applet + // Derived applet is responsible for requesting update, if justified + // That request will eventually trigger our class' onRender method + handleParsed(c); + + return ProcessMessage::CONTINUE; // Let others look at this message also if they want +} + +// Maximum number of cards we may ever need to render, in our tallest layout config +// May be slightly in excess of the true value: header not accounted for +uint8_t InkHUD::NodeListApplet::maxCards() +{ + // Cache result. Shouldn't change during execution + static uint8_t cards = 0; + + if (!cards) { + const uint16_t height = Tile::maxDisplayDimension(); + + // Use a loop instead of arithmetic, because it's easier for my brain to follow + // Add cards one by one, until the latest card (without margin) extends below screen + + uint16_t y = cardH; // First card: no margin above + cards = 1; + + while (y < height) { + y += cardMarginH; + y += cardH; + cards++; + } + } + + return cards; +} + +// Draw using info which derived applet placed into NodeListApplet::cards for us +void InkHUD::NodeListApplet::onRender() +{ + + // ================================ + // Draw the standard applet header + // ================================ + + drawHeader(getHeaderText()); // Ask derived applet for the title + + // Dimensions of the header + int16_t headerDivY = getHeaderHeight() - 1; + constexpr uint16_t padDivH = 2; + + // ======================== + // Draw the main node list + // ======================== + + // const uint8_t cardMarginH = fontSmall.lineHeight() / 2; // Gap between cards + // const uint16_t cardH = fontLarge.lineHeight() + fontSmall.lineHeight() + cardMarginH; + + // Imaginary vertical line dividing left-side and right-side info + // Long-name will crop here + const uint16_t dividerX = (width() - 1) - getTextWidth("X Hops"); + + // Y value (top) of the current card. Increases as we draw. + uint16_t cardTopY = headerDivY + padDivH; + + // -- Each node in list -- + for (auto card = cards.begin(); card != cards.end(); ++card) { + + // Gather info + // ======================================== + NodeNum &nodeNum = card->nodeNum; + SignalStrength &signal = card->signal; + std::string longName; // handled below + std::string shortName; // handled below + std::string distance; // handled below; + uint8_t &hopsAway = card->hopsAway; + + meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(nodeNum); + + // -- Shortname -- + // use "?" if unknown + if (node && node->has_user) + shortName = node->user.short_name; + else + shortName = "?"; + + // -- Longname -- + // use node id if unknown + if (node && node->has_user) + longName = node->user.long_name; // Found in nodeDB + else { + // Not found in nodeDB, show a hex nodeid instead + longName = hexifyNodeNum(nodeNum); + } + + // -- Distance -- + if (card->distanceMeters != CardInfo::DISTANCE_UNKNOWN) + distance = localizeDistance(card->distanceMeters); + + // Draw the info + // ==================================== + + // Define two lines of text for the card + // We will center our text on these lines + uint16_t lineAY = cardTopY + (fontLarge.lineHeight() / 2); + uint16_t lineBY = cardTopY + fontLarge.lineHeight() + (fontSmall.lineHeight() / 2); + + // Print the short name + setFont(fontLarge); + printAt(0, lineAY, shortName, LEFT, MIDDLE); + + // Print the distance + setFont(fontSmall); + printAt(width() - 1, lineBY, distance, RIGHT, MIDDLE); + + // If we have a direct connection to the node, draw the signal indicator + if (hopsAway == 0 && signal != SIGNAL_UNKNOWN) { + uint16_t signalW = getTextWidth("Xkm"); // Indicator should be similar width to distance label + uint16_t signalH = fontLarge.lineHeight() * 0.75; + int16_t signalY = lineAY + (fontLarge.lineHeight() / 2) - (fontLarge.lineHeight() * 0.75); + int16_t signalX = width() - signalW; + drawSignalIndicator(signalX, signalY, signalW, signalH, signal); + } + // Otherwise, print "hops away" info, if available + else if (hopsAway != CardInfo::HOPS_UNKNOWN) { + std::string hopString = to_string(node->hops_away); + hopString += " Hop"; + if (node->hops_away != 1) + hopString += "s"; // Append s for "Hops", rather than "Hop" + + printAt(width() - 1, lineAY, hopString, RIGHT, MIDDLE); + } + + // Print the long name, cropping to prevent overflow onto the right-side info + setCrop(0, 0, dividerX - 1, height()); + printAt(0, lineBY, longName, LEFT, MIDDLE); + + // GFX effect: "hatch" the right edge of longName area + // If a longName has been cropped, it will appear to fade out, + // creating a soft barrier with the right-side info + const int16_t hatchLeft = dividerX - 1 - (fontSmall.lineHeight()); + const int16_t hatchWidth = fontSmall.lineHeight(); + hatchRegion(hatchLeft, cardTopY, hatchWidth, cardH, 2, WHITE); + + // Prepare to draw the next card + resetCrop(); + cardTopY += cardH; + + // Once we've run out of screen, stop drawing cards + // Depending on tiles / rotation, this may be before we hit maxCards + if (cardTopY > height()) { + break; + } + } +} + +// Draw element: a "mobile phone" style signal indicator +// We will calculate values as floats, then "rasterize" at the last moment, relative to x and w, etc +// This prevents issues with premature rounding when rendering tiny elements +void InkHUD::NodeListApplet::drawSignalIndicator(int16_t x, int16_t y, uint16_t w, uint16_t h, SignalStrength strength) +{ + + /* + +-------------------------------------------+ + | | + | | + | barHeightRelative=1.0 + | +--+ ^ | + | gutterW +--+ | | | | + | <--> +--+ | | | | | | + | +--+ | | | | | | | | + | | | | | | | | | | | + | <-> +--+ +--+ +--+ +--+ v | + | paddingW ^ | + | paddingH | | + | v | + +-------------------------------------------+ + */ + + constexpr float paddingW = 0.1; // Either side + constexpr float paddingH = 0.1; // Above and below + constexpr float gutterX = 0.1; // Between bars + + constexpr float barHRel[] = {0.3, 0.5, 0.7, 1.0}; // Heights of the signal bars, relative to the talleest + constexpr uint8_t barCount = 4; // How many bars we draw. Reference only: changing value won't change the count. + + // Dynamically calculate the width of the bars, and height of the rightmost, relative to other dimensions + float barW = (1.0 - (paddingW + ((barCount - 1) * gutterX) + paddingW)) / barCount; + float barHMax = 1.0 - (paddingH + paddingH); + + // Draw signal bar rectangles, then placeholder lines once strength reached + for (uint8_t i = 0; i < barCount; i++) { + // Co-ords for this specific bar + float barH = barHMax * barHRel[i]; + float barX = paddingW + (i * (gutterX + barW)); + float barY = paddingH + (barHMax - barH); + + // Rasterize to px coords at the last moment + int16_t rX = (x + (w * barX)) + 0.5; + int16_t rY = (y + (h * barY)) + 0.5; + uint16_t rW = (w * barW) + 0.5; + uint16_t rH = (h * barH) + 0.5; + + // Draw signal bars, until we are displaying the correct "signal strength", then just draw placeholder lines + if (i <= strength) + drawRect(rX, rY, rW, rH, BLACK); + else { + // Just draw a placeholder line + float lineY = barY + barH; + uint16_t rLineY = (y + (h * lineY)) + 0.5; // Rasterize + drawLine(rX, rLineY, rX + rW - 1, rLineY, BLACK); + } + } +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.h b/src/graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.h new file mode 100644 index 000000000..670dd9e9a --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.h @@ -0,0 +1,71 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +Base class for Applets which display a list of nodes +Used by the "Recents" and "Heard" applets. Possibly more in future? + + +-------------------------------+ + | | | + | SHRT . | | | + | Long name 50km | + | | + | ABCD 2 Hops | + | abcdedfghijk 30km | + | | + +-------------------------------+ + +*/ + +#pragma once + +#include "configuration.h" + +#include "graphics/niche/InkHUD/Applet.h" + +namespace NicheGraphics::InkHUD +{ + +class NodeListApplet : public Applet, public MeshModule +{ + protected: + // Info used to draw one card to the node list + struct CardInfo { + static constexpr uint8_t HOPS_UNKNOWN = -1; + static constexpr uint32_t DISTANCE_UNKNOWN = -1; + + NodeNum nodeNum = 0; + SignalStrength signal = SignalStrength::SIGNAL_UNKNOWN; + uint32_t distanceMeters = DISTANCE_UNKNOWN; + uint8_t hopsAway = HOPS_UNKNOWN; // Unknown + }; + + public: + NodeListApplet(const char *name); + void onRender() override; + + // MeshModule overrides + virtual bool wantPacket(const meshtastic_MeshPacket *p) override; + virtual ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override; + + protected: + virtual void handleParsed(CardInfo c) = 0; // Pass extracted info from a new packet to derived class, for sorting and storage + virtual std::string getHeaderText() = 0; // Title for the applet's header. Todo: get this info another way? + + uint8_t maxCards(); // Calculate the maximum number of cards an applet could ever display + + std::deque cards; // Derived applet places cards here, for this base applet to render + + private: + // UI element: a "mobile phone" style signal indicator + void drawSignalIndicator(int16_t x, int16_t y, uint16_t w, uint16_t h, SignalStrength signal); + + // Dimensions for drawing + // Used for render, and also for maxCards calc + const uint8_t cardMarginH = fontSmall.lineHeight() / 2; // Gap between cards + const uint16_t cardH = fontLarge.lineHeight() + fontSmall.lineHeight() + cardMarginH; // Height of card +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.cpp b/src/graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.cpp new file mode 100644 index 000000000..17458ab96 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.cpp @@ -0,0 +1,14 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./BasicExampleApplet.h" + +using namespace NicheGraphics; + +// All drawing happens here +// Our basic example doesn't do anything useful. It just passively prints some text. +void InkHUD::BasicExampleApplet::onRender() +{ + print("Hello, World!"); +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.h b/src/graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.h new file mode 100644 index 000000000..aed63cdc8 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.h @@ -0,0 +1,36 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +A bare-minimum example of an InkHUD applet. +Only prints Hello World. + +In variants//nicheGraphics.h: + + - include this .h file + - add the following line of code: + windowManager->addApplet("Basic", new InkHUD::BasicExampleApplet); + +*/ + +#pragma once + +#include "configuration.h" + +#include "graphics/niche/InkHUD/Applet.h" + +namespace NicheGraphics::InkHUD +{ + +class BasicExampleApplet : public Applet +{ + public: + // You must have an onRender() method + // All drawing happens here + + void onRender() override; +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.cpp b/src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.cpp new file mode 100644 index 000000000..e0b2a4238 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.cpp @@ -0,0 +1,54 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./NewMsgExampleApplet.h" + +using namespace NicheGraphics; + +// We configured MeshModule API to call this method when we receive a new text message +ProcessMessage InkHUD::NewMsgExampleApplet::handleReceived(const meshtastic_MeshPacket &mp) +{ + + // Abort if applet fully deactivated + if (!isActive()) + return ProcessMessage::CONTINUE; + + // Check that this is an incoming message + // Outgoing messages (sent by us) will also call handleReceived + + if (!isFromUs(&mp)) { + // Store the sender's nodenum + // We need to keep this information, so we can re-use it anytime render() is called + haveMessage = true; + fromWho = mp.from; + + // Tell InkHUD that we have something new to show on the screen + requestUpdate(); + } + + // Tell MeshModule API to continue informing other firmware components about this message + // We're not the only component which is interested in new text messages + return ProcessMessage::CONTINUE; +} + +// All drawing happens here +// We can trigger a render by calling requestUpdate() +// Render might be called by some external source +// We should always be ready to draw +void InkHUD::NewMsgExampleApplet::onRender() +{ + setFont(fontSmall); + + printAt(0, 0, "Example: NewMsg", LEFT, TOP); // Print top-left corner of text at (0,0) + + int16_t centerX = X(0.5); // Same as width() / 2 + int16_t centerY = Y(0.5); // Same as height() / 2 + + if (haveMessage) { + printAt(centerX, centerY, "New Message", CENTER, BOTTOM); + printAt(centerX, centerY, "From: " + hexifyNodeNum(fromWho), CENTER, TOP); + } else { + printAt(centerX, centerY, "No Message", CENTER, MIDDLE); // Place center of string at (centerX, centerY) + } +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h b/src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h new file mode 100644 index 000000000..edfb211d7 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h @@ -0,0 +1,61 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +An example of an InkHUD applet. +Tells us when a new text message arrives. + +This applet makes use of the MeshModule API to detect new messages, +which is a general part of the Meshtastic firmware, and not part of InkHUD. + +In variants//nicheGraphics.h: + + - include this .h file + - add the following line of code: + windowManager->addApplet("New Msg", new InkHUD::NewMsgExampleApplet); + +*/ + +#pragma once + +#include "configuration.h" + +#include "graphics/niche/InkHUD/Applet.h" + +#include "mesh/SinglePortModule.h" + +namespace NicheGraphics::InkHUD +{ + +class NewMsgExampleApplet : public Applet, public SinglePortModule +{ + public: + // The MeshModule API requires us to have a constructor, to specify that we're interested in Text Messages. + NewMsgExampleApplet() : SinglePortModule("NewMsgExampleApplet", meshtastic_PortNum_TEXT_MESSAGE_APP) {} + + // All drawing happens here + void onRender() override; + + // Your applet might also want to use some of these + // Useful for setting up or tidying up + + /* + void onActivate(); // When started + void onDeactivate(); // When stopped + void onForeground(); // When shown by short-press + void onBackground(); // When hidden by short-press + */ + + private: + // Called when we receive new text messages + // Part of the MeshModule API + ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override; + + // Store info from handleReceived + bool haveMessage = false; + NodeNum fromWho; +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/BatteryIcon/BatteryIconApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/BatteryIcon/BatteryIconApplet.cpp new file mode 100644 index 000000000..e4432a7c2 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/System/BatteryIcon/BatteryIconApplet.cpp @@ -0,0 +1,107 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./BatteryIconApplet.h" + +using namespace NicheGraphics; + +void InkHUD::BatteryIconApplet::onActivate() +{ + // Show at boot, if user has previously enabled the feature + if (settings.optionalFeatures.batteryIcon) + bringToForeground(); + + // Register to our have BatteryIconApplet::onPowerStatusUpdate method called when new power info is available + // This happens whether or not the battery icon feature is enabled + powerStatusObserver.observe(&powerStatus->onNewStatus); +} + +void InkHUD::BatteryIconApplet::onDeactivate() +{ + // Stop having onPowerStatusUpdate called + powerStatusObserver.unobserve(&powerStatus->onNewStatus); +} + +// We handle power status' even when the feature is disabled, +// so that we have up to date data ready if the feature is enabled later. +// Otherwise could be 30s before new status update, with weird battery value displayed +int InkHUD::BatteryIconApplet::onPowerStatusUpdate(const meshtastic::Status *status) +{ + // System applets are always active + assert(isActive()); + + // This method should only receive power statuses + // If we get a different type of status, something has gone weird elsewhere + assert(status->getStatusType() == STATUS_TYPE_POWER); + + meshtastic::PowerStatus *powerStatus = (meshtastic::PowerStatus *)status; + + // Get the new state of charge %, and round to the nearest 10% + uint8_t newSocRounded = ((powerStatus->getBatteryChargePercent() + 5) / 10) * 10; + + // If rounded value has changed, trigger a display update + // It's okay to requestUpdate before we store the new value, as the update won't run until next loop() + // Don't trigger an update if the feature is disabled + if (this->socRounded != newSocRounded && settings.optionalFeatures.batteryIcon) + requestUpdate(); + + // Store the new value + this->socRounded = newSocRounded; + + return 0; // Tell Observable to continue informing other observers +} + +void InkHUD::BatteryIconApplet::onRender() +{ + // Fill entire tile + // - size of icon controlled by size of tile + int16_t l = 0; + int16_t t = 0; + uint16_t w = width(); + int16_t h = height(); + + // Clear the region beneath the tile + // Most applets are drawing onto an empty frame buffer and don't need to do this + // We do need to do this with the battery though, as it is an "overlay" + fillRect(l, t, w, h, WHITE); + + // Vertical centerline + const int16_t m = t + (h / 2); + + // ===================== + // Draw battery outline + // ===================== + + // Positive terminal "bump" + const int16_t &bumpL = l; + const uint16_t bumpH = h / 2; + const int16_t bumpT = m - (bumpH / 2); + constexpr uint16_t bumpW = 2; + fillRect(bumpL, bumpT, bumpW, bumpH, BLACK); + + // Main body of battery + const int16_t bodyL = bumpL + bumpW; + const int16_t &bodyT = t; + const int16_t &bodyH = h; + const int16_t bodyW = w - bumpW; + drawRect(bodyL, bodyT, bodyW, bodyH, BLACK); + + // Erase join between bump and body + drawLine(bodyL, bumpT, bodyL, bumpT + bumpH - 1, WHITE); + + // =================== + // Draw battery level + // =================== + + constexpr int16_t slicePad = 2; + const int16_t sliceL = bodyL + slicePad; + const int16_t sliceT = bodyT + slicePad; + const uint16_t sliceH = bodyH - (slicePad * 2); + uint16_t sliceW = bodyW - (slicePad * 2); + + sliceW = (sliceW * socRounded) / 100; // Apply percentage + + hatchRegion(sliceL, sliceT, sliceW, sliceH, 2, BLACK); + drawRect(sliceL, sliceT, sliceW, sliceH, BLACK); +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/BatteryIcon/BatteryIconApplet.h b/src/graphics/niche/InkHUD/Applets/System/BatteryIcon/BatteryIconApplet.h new file mode 100644 index 000000000..765ca073f --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/System/BatteryIcon/BatteryIconApplet.h @@ -0,0 +1,41 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +This applet floats top-left, giving a graphical representation of battery remaining +It should be optional, enabled by the on-screen menu + +*/ + +#pragma once + +#include "configuration.h" + +#include "graphics/niche/InkHUD/Applet.h" + +#include "PowerStatus.h" + +namespace NicheGraphics::InkHUD +{ + +class BatteryIconApplet : public Applet +{ + public: + void onRender() override; + + void onActivate() override; + void onDeactivate() override; + + int onPowerStatusUpdate(const meshtastic::Status *status); // Called when new info about battery is available + + protected: + // Get informed when new information about the battery is available (via onPowerStatusUpdate method) + CallbackObserver powerStatusObserver = + CallbackObserver(this, &BatteryIconApplet::onPowerStatusUpdate); + + uint8_t socRounded = 0; // Battery state of charge, rounded to nearest 10% +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp new file mode 100644 index 000000000..cc24417ab --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp @@ -0,0 +1,108 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./LogoApplet.h" + +using namespace NicheGraphics; + +InkHUD::LogoApplet::LogoApplet() : concurrency::OSThread("LogoApplet") +{ + // Don't autostart the runOnce() timer + OSThread::disable(); + + // Grab the WindowManager singleton, for convenience + windowManager = WindowManager::getInstance(); +} + +void InkHUD::LogoApplet::onRender() +{ + // Size of the region which the logo should "scale to fit" + uint16_t logoWLimit = X(0.8); + uint16_t logoHLimit = Y(0.5); + + // Get the max width and height we can manage within the region, while still maintaining aspect ratio + uint16_t logoW = getLogoWidth(logoWLimit, logoHLimit); + uint16_t logoH = getLogoHeight(logoWLimit, logoHLimit); + + // Where to place the center of the logo + int16_t logoCX = X(0.5); + int16_t logoCY = Y(0.5 - 0.05); + + drawLogo(logoCX, logoCY, logoW, logoH); + + if (!textLeft.empty()) { + setFont(fontSmall); + printAt(0, 0, textLeft, LEFT, TOP); + } + + if (!textRight.empty()) { + setFont(fontSmall); + printAt(X(1), 0, textRight, RIGHT, TOP); + } + + if (!textTitle.empty()) { + int16_t logoB = logoCY + (logoH / 2); // Bottom of the logo + setFont(fontTitle); + printAt(X(0.5), logoB + Y(0.1), textTitle, CENTER, TOP); + } +} + +void InkHUD::LogoApplet::onForeground() +{ + // If another applet has locked the display, ask it to exit + Applet *other = windowManager->whoLocked(); + if (other != nullptr) + other->sendToBackground(); + + windowManager->claimFullscreen(this); // Take ownership of fullscreen tile + windowManager->lock(this); // Prevent other applets from requesting updates +} + +void InkHUD::LogoApplet::onBackground() +{ + OSThread::disable(); // Disable auto-dismiss timer, in case applet was dismissed early (sendToBackground from outside class) + + windowManager->releaseFullscreen(); // Relinquish ownership of fullscreen tile + windowManager->unlock(this); // Allow normal user applet update requests to resume + + // Need to force an update, as a polite request wouldn't be honored, seeing how we are now in the background + // Usually, onBackground is followed by another applet's onForeground (which requests update), but not in this case + windowManager->forceUpdate(EInk::UpdateTypes::FULL); +} + +int32_t InkHUD::LogoApplet::runOnce() +{ + LOG_DEBUG("Sent to background by timer"); + sendToBackground(); + return OSThread::disable(); +} + +// Begin displaying the screen which is shown at startup +// Suggest EInk::await after calling this method +void InkHUD::LogoApplet::showBootScreen() +{ + OSThread::setIntervalFromNow(8 * 1000UL); + OSThread::enabled = true; + + textLeft = ""; + textRight = ""; + textTitle = xstr(APP_VERSION_SHORT); + fontTitle = fontSmall; + + bringToForeground(); + requestUpdate(Drivers::EInk::UpdateTypes::FULL); // Already requested, just upgrading to FULL +} + +// Begin displaying the screen which is shown at shutdown +// Needs EInk::await after calling this method, to ensure display updates before shutdown +void InkHUD::LogoApplet::showShutdownScreen() +{ + textLeft = ""; + textRight = ""; + textTitle = owner.short_name; + fontTitle = fontLarge; + + bringToForeground(); + requestUpdate(Drivers::EInk::UpdateTypes::FULL); // Already requested, just upgrading to FULL +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.h b/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.h new file mode 100644 index 000000000..aa1bf8b2c --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.h @@ -0,0 +1,47 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + + Shows the Meshtastic logo fullscreen, with accompanying text + Used for boot and shutdown + +*/ + +#pragma once + +#include "configuration.h" + +#include "concurrency/OSThread.h" +#include "graphics/niche/InkHUD/Applet.h" + +namespace NicheGraphics::InkHUD +{ + +class LogoApplet : public Applet, public concurrency::OSThread +{ + public: + LogoApplet(); + void onRender() override; + void onForeground() override; + void onBackground() override; + + // Note: interacting directly with an applet like this is non-standard + // Only permitted because this is a "system applet", which has special behavior and interacts directly with WindowManager + + void showBootScreen(); + void showShutdownScreen(); + + protected: + int32_t runOnce() override; + + std::string textLeft; + std::string textRight; + std::string textTitle; + AppletFont fontTitle; + + WindowManager *windowManager = nullptr; // For convenience +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h new file mode 100644 index 000000000..6950bb110 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h @@ -0,0 +1,38 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +Set of end-point actions for the Menu Applet + +Added as menu entries in MenuApplet::showPage +Behaviors assigned in MenuApplet::execute + +*/ + +#pragma once + +#include "configuration.h" + +namespace NicheGraphics::InkHUD +{ + +enum MenuAction { + NO_ACTION, + SEND_NODEINFO, + SEND_POSITION, + SHUTDOWN, + NEXT_TILE, + TOGGLE_APPLET, + ACTIVATE_APPLETS, // Todo: remove? Possible redundant, handled by TOGGLE_APPLET? + TOGGLE_AUTOSHOW_APPLET, + SET_RECENTS, + ROTATE, + LAYOUT, + TOGGLE_BATTERY_ICON, + TOGGLE_NOTIFICATIONS, + TOGGLE_BACKLIGHT, +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp new file mode 100644 index 000000000..d24ae59a5 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp @@ -0,0 +1,612 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./MenuApplet.h" + +#include "PowerStatus.h" +#include "RTC.h" + +using namespace NicheGraphics; + +static constexpr uint8_t MENU_TIMEOUT_SEC = 60; // How many seconds before menu auto-closes + +// Options for the "Recents" menu +// These are offered to users as possible values for settings.recentlyActiveSeconds +static constexpr uint8_t RECENTS_OPTIONS_MINUTES[] = {2, 5, 10, 30, 60, 120}; + +InkHUD::MenuApplet::MenuApplet() : concurrency::OSThread("MenuApplet") +{ + // No timer tasks at boot + OSThread::disable(); +} + +void InkHUD::MenuApplet::onActivate() +{ + // Grab pointers to some singleton components which the menu interacts with + // We could do this every time we needed them, in place, + // but this just makes the code tidier + + this->windowManager = WindowManager::getInstance(); + + // Note: don't get instance if we're not actually using the backlight, + // or else you will unintentionally instantiate it + if (settings.optionalMenuItems.backlight) { + backlight = Drivers::LatchingBacklight::getInstance(); + } +} + +void InkHUD::MenuApplet::onForeground() +{ + // We do need this before we render, but we can optimize by just calculating it once now + systemInfoPanelHeight = getSystemInfoPanelHeight(); + + // Display initial menu page + showPage(MenuPage::ROOT); + + // If device has a backlight which isn't controlled by aux button: + // backlight on always when menu opens. + // Courtesy to T-Echo users who removed the capacitive touch button + if (settings.optionalMenuItems.backlight) { + assert(backlight); + if (!backlight->isOn()) + backlight->peek(); + } + + // Prevent user applets requested update while menu is open + windowManager->lock(this); + + // Begin the auto-close timeout + OSThread::setIntervalFromNow(MENU_TIMEOUT_SEC * 1000UL); + OSThread::enabled = true; + + // Upgrade the refresh to FAST, for guaranteed responsiveness + windowManager->forceUpdate(EInk::UpdateTypes::FAST); +} + +void InkHUD::MenuApplet::onBackground() +{ + // If device has a backlight which isn't controlled by aux button: + // Item in options submenu allows keeping backlight on after menu is closed + // If this item is deselected we will turn backlight off again, now that menu is closing + if (settings.optionalMenuItems.backlight) { + assert(backlight); + if (!backlight->isLatched()) + backlight->off(); + } + + // Stop the auto-timeout + OSThread::disable(); + + // Resume normal rendering and button behavior of user applets + windowManager->unlock(this); + + // Restore the user applet whose tile we borrowed + if (borrowedTileOwner) + borrowedTileOwner->bringToForeground(); + Tile *t = getTile(); + t->assignApplet(borrowedTileOwner); // Break our link with the tile, (and relink it with real owner, if it had one) + borrowedTileOwner = nullptr; + + // Need to force an update, as a polite request wouldn't be honored, seeing how we are now in the background + // We're only updating here to ugrade from UNSPECIFIED to FAST, to ensure responsiveness when exiting menu + windowManager->forceUpdate(EInk::UpdateTypes::FAST); +} + +// Open the menu +// Parameter specifies which user-tile the menu will use +// The user applet originally on this tile will be restored when the menu closes +void InkHUD::MenuApplet::show(Tile *t) +{ + // Remember who *really* owns this tile + borrowedTileOwner = t->getAssignedApplet(); + + // Hide the owner, if it is a valid applet + if (borrowedTileOwner) + borrowedTileOwner->sendToBackground(); + + // Break the owner's link with tile + // Relink it to menu applet + t->assignApplet(this); + + // Show menu + bringToForeground(); +} + +// Auto-exit the menu applet after a period of inactivity +// The values shown on the root menu are only a snapshot: they are not re-rendered while the menu remains open. +// By exiting the menu, we prevent users mistakenly believing that the data will update. +int32_t InkHUD::MenuApplet::runOnce() +{ + // runOnce's interval is pushed back when a button is pressed + // If we do actually run, it means no button input occurred within MENU_TIMEOUT_SEC, + // so we close the menu. + showPage(EXIT); + + // Timer should disable after firing + // This is redundant, as onBackground() will also disable + return OSThread::disable(); +} + +// Perform action for a menu item, then change page +// Behaviors for MenuActions are defined here +void InkHUD::MenuApplet::execute(MenuItem item) +{ + // Perform an action + // ------------------ + switch (item.action) { + + // Open a submenu without performing any action + // Also handles exit + case NO_ACTION: + break; + + case NEXT_TILE: + // Note performed manually; + // WindowManager::nextTile is raised by aux button press only, and will interact poorly with the menu + settings.userTiles.focused = (settings.userTiles.focused + 1) % settings.userTiles.count; + windowManager->changeLayout(); + cursor = 0; // No menu item selected, for quick exit after tile swap + cursorShown = false; + break; + + case ROTATE: + settings.rotation = (settings.rotation + 1) % 4; + windowManager->changeLayout(); + // requestUpdate(Drivers::EInk::UpdateTypes::FULL); // Would update regardless; just selecting FULL + break; + + case LAYOUT: + // Todo: smarter incrementing of tile count + settings.userTiles.count++; + + if (settings.userTiles.count == 3) // Skip 3 tiles: not done yet + settings.userTiles.count++; + + if (settings.userTiles.count > settings.userTiles.maxCount) // Loop around if tile count now too high + settings.userTiles.count = 1; + + windowManager->changeLayout(); + // requestUpdate(Drivers::EInk::UpdateTypes::FULL); // Would update regardless; just selecting FULL + break; + + case TOGGLE_APPLET: + settings.userApplets.active[cursor] = !settings.userApplets.active[cursor]; + windowManager->changeActivatedApplets(); + // requestUpdate(Drivers::EInk::UpdateTypes::FULL); // Select FULL, seeing how this action doesn't auto exit + break; + + case ACTIVATE_APPLETS: + // Todo: remove this action? Already handled by TOGGLE_APPLET? + windowManager->changeActivatedApplets(); + break; + + case TOGGLE_AUTOSHOW_APPLET: + // Toggle settings.userApplets.autoshow[] value, via MenuItem::checkState pointer set in populateAutoshowPage() + *items.at(cursor).checkState = !(*items.at(cursor).checkState); + break; + + case TOGGLE_NOTIFICATIONS: + settings.optionalFeatures.notifications = !settings.optionalFeatures.notifications; + break; + + case SET_RECENTS: + // Set value of settings.recentlyActiveSeconds + // Uses menu cursor to read RECENTS_OPTIONS_MINUTES array (defined at top of this file) + assert(cursor < sizeof(RECENTS_OPTIONS_MINUTES) / sizeof(RECENTS_OPTIONS_MINUTES[0])); + settings.recentlyActiveSeconds = RECENTS_OPTIONS_MINUTES[cursor] * 60; // Menu items are in minutes + break; + + case SHUTDOWN: + LOG_INFO("Shutting down from menu"); + power->shutdown(); + // Menu is then sent to background via onShutdown + break; + + case TOGGLE_BATTERY_ICON: + windowManager->toggleBatteryIcon(); + break; + + case TOGGLE_BACKLIGHT: + // Note: backlight is already on in this situation + // We're marking that it should *remain* on once menu closes + assert(backlight); + if (backlight->isLatched()) + backlight->off(); + else + backlight->latch(); + break; + + default: + LOG_WARN("Action not implemented"); + } + + // Move to next page, as defined for the MenuItem + showPage(item.nextPage); +} + +// Display a new page of MenuItems +// May reload same page, or exit menu applet entirely +// Fills the MenuApplet::items vector +void InkHUD::MenuApplet::showPage(MenuPage page) +{ + items.clear(); + + switch (page) { + case ROOT: + // Optional: next applet + if (settings.optionalMenuItems.nextTile && settings.userTiles.count > 1) + items.push_back(MenuItem("Next Tile", MenuAction::NEXT_TILE, MenuPage::ROOT)); // Only if multiple applets shown + + // items.push_back(MenuItem("Send", MenuPage::SEND)); // TODO + items.push_back(MenuItem("Options", MenuPage::OPTIONS)); + // items.push_back(MenuItem("Display Off", MenuPage::EXIT)); // TODO + items.push_back(MenuItem("Save & Shutdown", MenuAction::SHUTDOWN)); + items.push_back(MenuItem("Exit", MenuPage::EXIT)); + break; + + case SEND: + items.push_back(MenuItem("Send Message", MenuPage::EXIT)); + items.push_back(MenuItem("Send NodeInfo", MenuAction::SEND_NODEINFO)); + items.push_back(MenuItem("Send Position", MenuAction::SEND_POSITION)); + items.push_back(MenuItem("Exit", MenuPage::EXIT)); + break; + + case OPTIONS: + // Optional: backlight + if (settings.optionalMenuItems.backlight) { + assert(backlight); + items.push_back(MenuItem(backlight->isLatched() ? "Backlight Off" : "Keep Backlight On", // Label + MenuAction::TOGGLE_BACKLIGHT, // Action + MenuPage::EXIT // Exit once complete + )); + } + + items.push_back(MenuItem("Applets", MenuPage::APPLETS)); + items.push_back(MenuItem("Auto-show", MenuPage::AUTOSHOW)); + items.push_back(MenuItem("Recents Duration", MenuPage::RECENTS)); + if (settings.userTiles.maxCount > 1) + items.push_back(MenuItem("Layout", MenuAction::LAYOUT, MenuPage::OPTIONS)); + items.push_back(MenuItem("Rotate", MenuAction::ROTATE, MenuPage::OPTIONS)); + items.push_back(MenuItem("Notifications", MenuAction::TOGGLE_NOTIFICATIONS, MenuPage::OPTIONS, + &settings.optionalFeatures.notifications)); + items.push_back( + MenuItem("Battery Icon", MenuAction::TOGGLE_BATTERY_ICON, MenuPage::OPTIONS, &settings.optionalFeatures.batteryIcon)); + + // TODO - GPS and Wifi switches + /* + // Optional: has GPS + if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_DISABLED) + items.push_back(MenuItem("Enable GPS", MenuPage::EXIT)); // TODO + if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED) + items.push_back(MenuItem("Disable GPS", MenuPage::EXIT)); // TODO + + // Optional: using wifi + if (!config.bluetooth.enabled) + items.push_back(MenuItem("Enable Bluetooth", MenuPage::EXIT)); // TODO: escape hatch if wifi configured wrong + */ + + items.push_back(MenuItem("Exit", MenuPage::EXIT)); + break; + + case APPLETS: + populateAppletPage(); + items.push_back(MenuItem("Exit", MenuAction::ACTIVATE_APPLETS)); + break; + + case AUTOSHOW: + populateAutoshowPage(); + items.push_back(MenuItem("Exit", MenuPage::EXIT)); + break; + + case RECENTS: + populateRecentsPage(); + break; + + case EXIT: + sendToBackground(); // Menu applet dismissed, allow normal behavior to resume + // requestUpdate(Drivers::EInk::UpdateTypes::FULL); + break; + + default: + LOG_WARN("Page not implemented"); + } + + // Reset the cursor, unless reloading same page + // (or now out-of-bounds) + if (page != currentPage || cursor >= items.size()) { + cursor = 0; + + // ROOT menu has special handling: unselected at first, to emphasise the system info panel + if (page == ROOT) + cursorShown = false; + } + + // Remember which page we are on now + currentPage = page; +} + +void InkHUD::MenuApplet::onRender() +{ + if (items.size() == 0) + LOG_ERROR("Empty Menu"); + + // Testing only + setFont(fontSmall); + + // Dimensions for the slots where we will draw menuItems + const float padding = 0.05; + const uint16_t itemH = fontSmall.lineHeight() * 2; + const int16_t itemW = width() - X(padding) - X(padding); + const int16_t itemL = X(padding); + const int16_t itemR = X(1 - padding); + int16_t itemT = 0; // Top (y px of current slot). Incremented as we draw. Adjusted to fit system info panel on ROOT menu. + + // How many full menuItems will fit on screen + uint8_t slotCount = (height() - itemT) / itemH; + + // System info panel at the top of the menu + // ========================================= + + uint16_t &siH = systemInfoPanelHeight; // System info - height. Calculated at onForeground + const uint8_t slotsObscured = ceilf(siH / (float)itemH); // How many slots are obscured by system info panel + + // System info - top + // Remain at 0px, until cursor reaches bottom of screen, then begin to scroll off screen. + // This is the same behavior we expect from the non-root menus. + // Implementing this with the systemp panel is slightly annoying though, + // and required adding the MenuApplet::getSystemInfoPanelHeight method + int16_t siT; + if (cursor < slotCount - slotsObscured - 1) // (Minus 1: comparing zero based index with a count) + siT = 0; + else + siT = 0 - ((cursor - (slotCount - slotsObscured - 1)) * itemH); + + // If showing ROOT menu, + // and the panel isn't yet scrolled off screen top + if (currentPage == ROOT) { + drawSystemInfoPanel(0, siT, width()); // Draw the panel. + itemT = max(siT + siH, 0); // Offset the first menu entry, so menu starts below the system info panel + } + + // Draw menu items + // =================== + + // Which item will be drawn to the top-most slot? + // Initially, this is the item 0, but may increase once we begin scrolling + uint8_t firstItem; + if (cursor < slotCount) + firstItem = 0; + else + firstItem = cursor - (slotCount - 1); + + // Which item will be drawn to the bottom-most slot? + // This may be beyond the slot-count, to draw a partially off-screen item below the bottom-most slow + // This may be less than the slot-count, if we are reaching the end of the menuItems + uint8_t lastItem = min((uint8_t)firstItem + slotCount, (uint8_t)items.size() - 1); + + // -- Loop: draw each (visible) menu item -- + for (uint8_t i = firstItem; i <= lastItem; i++) { + // Grab the menuItem + MenuItem item = items.at(i); + + // Center-line for the text + int16_t center = itemT + (itemH / 2); + + if (cursorShown && i == cursor) + drawRect(itemL, itemT, itemW, itemH, BLACK); + printAt(itemL + X(padding), center, item.label, LEFT, MIDDLE); + + // Testing only: circle instead of check box + if (item.checkState) { + const uint16_t cbWH = fontSmall.lineHeight(); // Checbox: width / height + const int16_t cbL = itemR - X(padding) - cbWH; // Checkbox: left + const int16_t cbT = center - (cbWH / 2); // Checkbox : top + // Checkbox ticked + if (*(item.checkState)) { + drawRect(cbL, cbT, cbWH, cbWH, BLACK); + // First point of tick: pen down + const int16_t t1Y = center; + const int16_t t1X = cbL + 3; + // Second point of tick: base + const int16_t t2Y = center + (cbWH / 2) - 2; + const int16_t t2X = cbL + (cbWH / 2); + // Third point of tick: end of tail + const int16_t t3Y = center - (cbWH / 2) - 2; + const int16_t t3X = cbL + cbWH + 2; + // Draw twice: faux bold + drawLine(t1X, t1Y, t2X, t2Y, BLACK); + drawLine(t2X, t2Y, t3X, t3Y, BLACK); + drawLine(t1X + 1, t1Y, t2X + 1, t2Y, BLACK); + drawLine(t2X + 1, t2Y, t3X + 1, t3Y, BLACK); + } + // Checkbox ticked + else + drawRect(cbL, cbT, cbWH, cbWH, BLACK); + } + + // Increment the y value (top) as we go + itemT += itemH; + } +} + +void InkHUD::MenuApplet::onButtonShortPress() +{ + // Push the auto-close timer back + OSThread::setIntervalFromNow(MENU_TIMEOUT_SEC * 1000UL); + + // Move menu cursor to next entry, then update + if (cursorShown) + cursor = (cursor + 1) % items.size(); + else + cursorShown = true; + requestUpdate(Drivers::EInk::UpdateTypes::FAST); +} + +void InkHUD::MenuApplet::onButtonLongPress() +{ + // Push the auto-close timer back + OSThread::setIntervalFromNow(MENU_TIMEOUT_SEC * 1000UL); + + if (cursorShown) + execute(items.at(cursor)); + else + showPage(MenuPage::EXIT); // Special case: Peek at root-menu; longpress again to close + + // If we didn't already request a specialized update, when handling a menu action, + // then perform the usual fast update. + // FAST keeps things responsive: important because we're dealing with user input + if (!wantsToRender()) + requestUpdate(Drivers::EInk::UpdateTypes::FAST); +} + +// Dynamically create MenuItem entries for activating / deactivating Applets, for the "Applet Selection" submenu +void InkHUD::MenuApplet::populateAppletPage() +{ + assert(items.size() == 0); + + for (uint8_t i = 0; i < windowManager->getAppletCount(); i++) { + const char *name = windowManager->getAppletName(i); + bool *isActive = &(settings.userApplets.active[i]); + items.push_back(MenuItem(name, MenuAction::TOGGLE_APPLET, MenuPage::APPLETS, isActive)); + } +} + +// Dynamically create MenuItem entries for selecting which applets will automatically come to foreground when they have new data +// We only populate this menu page with applets which are actually active +// We use the MenuItem::checkState pointer to toggle the setting in MenuApplet::execute. Bit of a hack, but convenient. +void InkHUD::MenuApplet::populateAutoshowPage() +{ + assert(items.size() == 0); + + for (uint8_t i = 0; i < windowManager->getAppletCount(); i++) { + // Only add a menu item if applet is active + if (settings.userApplets.active[i]) { + const char *name = windowManager->getAppletName(i); + bool *isActive = &(settings.userApplets.autoshow[i]); + items.push_back(MenuItem(name, MenuAction::TOGGLE_AUTOSHOW_APPLET, MenuPage::AUTOSHOW, isActive)); + } + } +} + +void InkHUD::MenuApplet::populateRecentsPage() +{ + // How many values are shown for use to choose from + constexpr uint8_t optionCount = sizeof(RECENTS_OPTIONS_MINUTES) / sizeof(RECENTS_OPTIONS_MINUTES[0]); + + // Create an entry for each item in RECENTS_OPTIONS_MINUTES array + // (Defined at top of this file) + for (uint8_t i = 0; i < optionCount; i++) { + std::string label = to_string(RECENTS_OPTIONS_MINUTES[i]) + " mins"; + items.push_back(MenuItem(label.c_str(), MenuAction::SET_RECENTS, MenuPage::EXIT)); + } +} + +// Renders the panel shown at the top of the root menu. +// Displays the clock, and several other pieces of instantaneous system info, +// which we'd prefer not to have displayed in a normal applet, as they update too frequently. +void InkHUD::MenuApplet::drawSystemInfoPanel(int16_t left, int16_t top, uint16_t width, uint16_t *renderedHeight) +{ + // Reset the height + // We'll add to this as we add elements + uint16_t height = 0; + + // Clock (potentially) + // ==================== + std::string clockString = getTimeString(); + if (clockString.length() > 0) { + setFont(fontLarge); + printAt(width / 2, top, clockString, CENTER, TOP); + + height += fontLarge.lineHeight(); + height += fontLarge.lineHeight() * 0.1; // Padding below clock + } + + // Stats + // =================== + + setFont(fontSmall); + + // Position of the label row for the system info + const int16_t labelT = top + height; + height += fontSmall.lineHeight() * 1.1; // Slightly increased spacing + + // Position of the data row for the system info + const int16_t valT = top + height; + height += fontSmall.lineHeight() * 1.1; // Slightly increased spacing (between bottom line and divider) + + // Position of divider between the info panel and the menu entries + const int16_t divY = top + height; + height += fontSmall.lineHeight() * 0.2; // Padding *below* the divider. (Above first menu item) + + // Create a variable number of columns + // Either 3 or 4, depending on whether we have GPS + // Todo + constexpr uint8_t N_COL = 3; + int16_t colL[N_COL]; + int16_t colC[N_COL]; + int16_t colR[N_COL]; + for (uint8_t i = 0; i < N_COL; i++) { + colL[i] = left + ((width / N_COL) * i); + colC[i] = colL[i] + ((width / N_COL) / 2); + colR[i] = colL[i] + (width / N_COL); + } + + // Info blocks, left to right + + // Voltage + float voltage = powerStatus->getBatteryVoltageMv() / 1000.0; + char voltageStr[6]; // "XX.XV" + sprintf(voltageStr, "%.1fV", voltage); + printAt(colC[0], labelT, "Bat", CENTER, TOP); + printAt(colC[0], valT, voltageStr, CENTER, TOP); + + // Divider + for (int16_t y = valT; y <= divY; y += 3) + drawPixel(colR[0], y, BLACK); + + // Channel Util + char chUtilStr[4]; // "XX%" + sprintf(chUtilStr, "%2.f%%", airTime->channelUtilizationPercent()); + printAt(colC[1], labelT, "Ch", CENTER, TOP); + printAt(colC[1], valT, chUtilStr, CENTER, TOP); + + // Divider + for (int16_t y = valT; y <= divY; y += 3) + drawPixel(colR[1], y, BLACK); + + // Duty Cycle (AirTimeTx) + char dutyUtilStr[4]; // "XX%" + sprintf(dutyUtilStr, "%2.f%%", airTime->utilizationTXPercent()); + printAt(colC[2], labelT, "Duty", CENTER, TOP); + printAt(colC[2], valT, dutyUtilStr, CENTER, TOP); + + /* + // Divider + for (int16_t y = valT; y <= divY; y += 3) + drawPixel(colR[2], y, BLACK); + + // GPS satellites - todo + printAt(colC[3], labelT, "Sats", CENTER, TOP); + printAt(colC[3], valT, "ToDo", CENTER, TOP); + */ + + // Horizontal divider, at bottom of system info panel + for (int16_t x = 0; x < width; x += 2) // Divider, centered in the padding between first system panel and first item + drawPixel(x, divY, BLACK); + + if (renderedHeight != nullptr) + *renderedHeight = height; +} + +// Get the height of the the panel drawn at the top of the menu +// This is inefficient, as we do actually have to render the panel to determine the height +// It solves a catch-22 situtation, where slotCount needs to know panel height, and panel height needs to know slotCount +uint16_t InkHUD::MenuApplet::getSystemInfoPanelHeight() +{ + // Render *waay* off screen + uint16_t height = 0; + drawSystemInfoPanel(INT16_MIN, INT16_MIN, 1, &height); + + return height; +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.h b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.h new file mode 100644 index 000000000..f2e9b3947 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.h @@ -0,0 +1,60 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "configuration.h" + +#include "graphics/niche/Drivers/Backlight/LatchingBacklight.h" +#include "graphics/niche/InkHUD/Applet.h" +#include "graphics/niche/InkHUD/WindowManager.h" + +#include "./MenuItem.h" +#include "./MenuPage.h" + +#include "concurrency/OSThread.h" + +namespace NicheGraphics::InkHUD +{ + +class Applet; + +class MenuApplet : public Applet, public concurrency::OSThread +{ + public: + MenuApplet(); + void onActivate() override; + void onForeground() override; + void onBackground() override; + void onButtonShortPress() override; + void onButtonLongPress() override; + void onRender() override; + + void show(Tile *t); // Open the menu, onto a user tile + + protected: + int32_t runOnce() override; + + void execute(MenuItem item); // Perform the MenuAction associated with a MenuItem, if any + void showPage(MenuPage page); // Load and display a MenuPage + void populateAppletPage(); // Dynamically create MenuItems for toggling loaded applets + void populateAutoshowPage(); // Dynamically create MenuItems for selecting which applets can autoshow + void populateRecentsPage(); // Create menu items: a choice of values for settings.recentlyActiveSeconds + uint16_t getSystemInfoPanelHeight(); + void drawSystemInfoPanel(int16_t left, int16_t top, uint16_t width, + uint16_t *height = nullptr); // Info panel at top of root menu + + MenuPage currentPage; + uint8_t cursor = 0; // Which menu item is currently highlighted + bool cursorShown = false; // Is *any* item highlighted? (Root menu: no initial selection) + + uint16_t systemInfoPanelHeight = 0; // Need to know before we render + + std::vector items; // MenuItems for the current page. Filled by ShowPage + + Applet *borrowedTileOwner = nullptr; // Which applet we have temporarily replaced while displaying menu + + WindowManager *windowManager = nullptr; // Convenient access to the InkHUD::WindowManager singleton + Drivers::LatchingBacklight *backlight = nullptr; // Convenient access to the backlight singleton +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuItem.h b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuItem.h new file mode 100644 index 000000000..c74fe3d8a --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuItem.h @@ -0,0 +1,47 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +One item of a MenuPage, in InkHUD::MenuApplet + +Added to MenuPages in InkHUD::showPage + +- May open a submenu or exit +- May perform an action +- May toggle a bool value, shown by a checkbox + +*/ + +#pragma once + +#include "configuration.h" + +#include "./MenuAction.h" +#include "./MenuPage.h" + +namespace NicheGraphics::InkHUD +{ + +// One item of a MenuPage +class MenuItem +{ + public: + std::string label; + MenuAction action = NO_ACTION; + MenuPage nextPage = EXIT; + bool *checkState = nullptr; + + // Various constructors, depending on the intended function of the item + + MenuItem(const char *label, MenuPage nextPage) : label(label), nextPage(nextPage) {} + MenuItem(const char *label, MenuAction action) : label(label), action(action) {} + MenuItem(const char *label, MenuAction action, MenuPage nextPage) : label(label), action(action), nextPage(nextPage) {} + MenuItem(const char *label, MenuAction action, MenuPage nextPage, bool *checkState) + : label(label), action(action), nextPage(nextPage), checkState(checkState) + { + } +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuPage.h b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuPage.h new file mode 100644 index 000000000..d2314e83b --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuPage.h @@ -0,0 +1,30 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +Sub-menu for InkHUD::MenuApplet +Structure of the menu is defined in InkHUD::showPage + +*/ + +#pragma once + +#include "configuration.h" + +namespace NicheGraphics::InkHUD +{ + +// Sub-menu for MenuApplet +enum MenuPage : uint8_t { + ROOT, // Initial menu page + SEND, + OPTIONS, + APPLETS, + AUTOSHOW, + RECENTS, // Select length of "recentlyActiveSeconds" + EXIT, // Dismiss the menu applet +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/Notification/Notification.h b/src/graphics/niche/InkHUD/Applets/System/Notification/Notification.h new file mode 100644 index 000000000..d8c4f8366 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/System/Notification/Notification.h @@ -0,0 +1,40 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +A notification which might be displayed by the NotificationApplet + +An instance of this class is offered to Applets via Applet::approveNotification, in case they want to veto the notification. +An Applet should veto a notification if it is already displaying the same info which the notification would convey. + +*/ + +#pragma once + +#include "configuration.h" + +namespace NicheGraphics::InkHUD +{ + +class Notification +{ + public: + enum Type : uint8_t { NOTIFICATION_MESSAGE_BROADCAST, NOTIFICATION_MESSAGE_DIRECT, NOTIFICATION_BATTERY } type; + + uint32_t timestamp; + + uint8_t getChannel() { return channel; } + uint32_t getSender() { return sender; } + uint8_t getBatteryPercentage() { return batteryPercentage; } + + friend class NotificationApplet; + + protected: + uint8_t channel; + uint32_t sender; + uint8_t batteryPercentage; +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.cpp new file mode 100644 index 000000000..886be84b5 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.cpp @@ -0,0 +1,219 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./NotificationApplet.h" + +#include "./Notification.h" + +#include "RTC.h" + +using namespace NicheGraphics; + +void InkHUD::NotificationApplet::onActivate() +{ + textMessageObserver.observe(textMessageModule); +} + +// Note: This applet probably won't ever be deactivated +void InkHUD::NotificationApplet::onDeactivate() +{ + textMessageObserver.unobserve(textMessageModule); +} + +// Collect meta-info about the text message, and ask for approval for the notification +// No need to save the message itself; we can use the cached InkHUD::latestMessage data during render() +int InkHUD::NotificationApplet::onReceiveTextMessage(const meshtastic_MeshPacket *p) +{ + // System applets are always active + assert(isActive()); + + // Abort if feature disabled + // This is a bit clumsy, but avoids complicated handling when the feature is enabled / disabled + if (!settings.optionalFeatures.notifications) + return 0; + + // Abort if this is an outgoing message + if (getFrom(p) == nodeDB->getNodeNum()) + return 0; + + // Abort if message was only an "emoji reaction" + // Possibly some implemetation of this in future? + if (p->decoded.emoji) + return 0; + + Notification n; + n.timestamp = getValidTime(RTCQuality::RTCQualityDevice, true); // Current RTC time + + // Gather info: in-channel message + if (isBroadcast(p->to)) { + n.type = Notification::Type::NOTIFICATION_MESSAGE_BROADCAST; + n.channel = p->channel; + } + + // Gather info: DM + else { + n.type = Notification::Type::NOTIFICATION_MESSAGE_DIRECT; + n.sender = p->from; + } + + // Check if we should display the notification + // A foreground applet might already be displaying this info + hasNotification = true; + currentNotification = n; + if (isApproved()) { + bringToForeground(); + WindowManager::getInstance()->forceUpdate(); + } else + hasNotification = false; // Clear the pending notification: it was rejected + + // Return zero: no issues here, carry on notifying other observers! + return 0; +} + +void InkHUD::NotificationApplet::onRender() +{ + // Clear the region beneath the tile + // Most applets are drawing onto an empty frame buffer and don't need to do this + // We do need to do this with the battery though, as it is an "overlay" + fillRect(0, 0, width(), height(), WHITE); + + setFont(fontSmall); + + // Padding (horizontal) + const uint16_t padW = 4; + + // Main border + drawRect(0, 0, width(), height(), BLACK); + // drawRect(1, 1, width() - 2, height() - 2, BLACK); + + // Timestamp (potentially) + // ==================== + std::string ts = getTimeString(currentNotification.timestamp); + uint16_t tsW = 0; + int16_t divX = 0; + + // Timestamp available + if (ts.length() > 0) { + tsW = getTextWidth(ts); + divX = padW + tsW + padW; + + hatchRegion(0, 0, divX, height(), 2, BLACK); // Fill with a dark background + drawLine(divX, 0, divX, height() - 1, BLACK); // Draw divider between timestamp and main text + + setCrop(1, 1, divX - 1, height() - 2); + + // Drop shadow + setTextColor(WHITE); + printThick(padW + (tsW / 2), height() / 2, ts, 4, 4); + + // Bold text + setTextColor(BLACK); + printThick(padW + (tsW / 2), height() / 2, ts, 2, 1); + } + + // Main text + // ===================== + + // Background fill + // - medium dark (1/3) + hatchRegion(divX, 0, width() - divX - 1, height(), 3, BLACK); + + uint16_t availableWidth = width() - divX - padW; + std::string text = getNotificationText(availableWidth); + + int16_t textM = divX + padW + (getTextWidth(text) / 2); + + // Restrict area for printing + // - don't overlap border, or diveder + setCrop(divX + 1, 1, (width() - (divX + 1) - 1), height() - 2); + + // Drop shadow + // - thick white text + setTextColor(WHITE); + printThick(textM, height() / 2, text, 4, 4); + + // Main text + // - faux bold: double width + setTextColor(BLACK); + printThick(textM, height() / 2, text, 2, 1); +} + +// Ask the WindowManager to check whether any displayed applets are already displaying the info from this notification +// Called internally when we first get a "notifiable event", and then again before render, +// in case autoshow swapped which applet was displayed +bool InkHUD::NotificationApplet::isApproved() +{ + // Instead of an assert + if (!hasNotification) { + LOG_WARN("No notif to approve"); + return false; + } + + return WindowManager::getInstance()->approveNotification(currentNotification); +} + +// Mark that the notification should no-longer be rendered +// In addition to calling thing method, code needs to request a re-render of all applets +void InkHUD::NotificationApplet::dismiss() +{ + sendToBackground(); + hasNotification = false; + // Not requesting update directly from this method, + // as it is used to dismiss notifications which have been made redundant by autoshow settings, before they are ever drawn +} + +// Get a string for the main body text of a notification +// Formatted to suit screen width +// Takes info from InkHUD::currentNotification +std::string InkHUD::NotificationApplet::getNotificationText(uint16_t widthAvailable) +{ + assert(hasNotification); + + std::string text; + + // Text message + // ============== + + if (IS_ONE_OF(currentNotification.type, Notification::Type::NOTIFICATION_MESSAGE_DIRECT, + Notification::Type::NOTIFICATION_MESSAGE_BROADCAST)) { + + // Although we are handling DM and broadcast notifications together, we do need to treat them slightly differently + bool isBroadcast = currentNotification.type == Notification::Type::NOTIFICATION_MESSAGE_BROADCAST; + + // Pick source of message + MessageStore::Message *message = isBroadcast ? &latestMessage.broadcast : &latestMessage.dm; + + // Find info about the sender + meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(message->sender); + + // Leading tag (channel vs. DM) + text += isBroadcast ? "From:" : "DM: "; + + // Sender id + if (node && node->has_user) + text += node->user.short_name; + else + text += hexifyNodeNum(message->sender); + + // Check if text fits + // - use a longer string, if we have the space + if (getTextWidth(text) < widthAvailable * 0.5) { + text.clear(); + + // Leading tag (channel vs. DM) + text += isBroadcast ? "Msg from " : "DM from "; + + // Sender id + if (node && node->has_user) + text += node->user.short_name; + else + text += hexifyNodeNum(message->sender); + + text += ": "; + text += message->text; + } + } + + return text; +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.h b/src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.h new file mode 100644 index 000000000..c4d36a4fd --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.h @@ -0,0 +1,49 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +Pop-up notification bar, on screen top edge +Displays information we feel is important, but which is not shown on currently focussed applet(s) +E.g.: messages, while viewing map, etc + +Feature should be optional; enable disable via on-screen menu + +*/ + +#pragma once + +#include "configuration.h" + +#include "concurrency/OSThread.h" + +#include "graphics/niche/InkHUD/Applet.h" + +namespace NicheGraphics::InkHUD +{ + +class NotificationApplet : public Applet +{ + public: + void onRender() override; + void onActivate() override; + void onDeactivate() override; + + int onReceiveTextMessage(const meshtastic_MeshPacket *p); + + bool isApproved(); // Does a foreground applet make notification redundant? + void dismiss(); // Close the Notification Popup + + protected: + // Get notified when a new text message arrives + CallbackObserver textMessageObserver = + CallbackObserver(this, &NotificationApplet::onReceiveTextMessage); + + std::string getNotificationText(uint16_t widthAvailable); // Get text for notification, to suit screen width + + bool hasNotification = false; // Only used for assert. Todo: remove? + Notification currentNotification; // Set when something notification-worthy happens. Used by render() +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/Pairing/PairingApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Pairing/PairingApplet.cpp new file mode 100644 index 000000000..457fa0f3f --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/System/Pairing/PairingApplet.cpp @@ -0,0 +1,96 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./PairingApplet.h" + +using namespace NicheGraphics; + +InkHUD::PairingApplet::PairingApplet() +{ + // Grab the window manager singleton, for convenience + windowManager = WindowManager::getInstance(); +} + +void InkHUD::PairingApplet::onRender() +{ + // Header + setFont(fontLarge); + printAt(X(0.5), Y(0.25), "Bluetooth", CENTER, BOTTOM); + setFont(fontSmall); + printAt(X(0.5), Y(0.25), "Enter this code", CENTER, TOP); + + // Passkey + setFont(fontLarge); + printThick(X(0.5), Y(0.5), passkey.substr(0, 3) + " " + passkey.substr(3), 3, 2); + + // Device's bluetooth name, if it will fit + setFont(fontSmall); + std::string name = "Name: " + std::string(getDeviceName()); + if (getTextWidth(name) > width()) // Too wide, try without the leading "Name: " + name = std::string(getDeviceName()); + if (getTextWidth(name) < width()) // Does it fit? + printAt(X(0.5), Y(0.75), name, CENTER, MIDDLE); +} + +void InkHUD::PairingApplet::onActivate() +{ + bluetoothStatusObserver.observe(&bluetoothStatus->onNewStatus); +} + +void InkHUD::PairingApplet::onDeactivate() +{ + bluetoothStatusObserver.unobserve(&bluetoothStatus->onNewStatus); +} + +void InkHUD::PairingApplet::onForeground() +{ + // If another applet has locked the display, ask it to exit + Applet *other = windowManager->whoLocked(); + if (other != nullptr) + other->sendToBackground(); + + windowManager->claimFullscreen(this); // Take ownership of the fullscreen tile + windowManager->lock(this); // Prevent user applets from requesting update +} +void InkHUD::PairingApplet::onBackground() +{ + windowManager->releaseFullscreen(); // Relinquish ownership of the fullscreen tile + windowManager->unlock(this); // Allow normal user applet update requests to resume + + // Need to force an update, as a polite request wouldn't be honored, seeing how we are now in the background + // Usually, onBackground is followed by another applet's onForeground (which requests update), but not in this case + windowManager->forceUpdate(EInk::UpdateTypes::FULL); +} + +int InkHUD::PairingApplet::onBluetoothStatusUpdate(const meshtastic::Status *status) +{ + // The standard Meshtastic convention is to pass these "generic" Status objects, + // check their type, and then cast them. + // We'll mimic that behavior, just to keep in line with the other Statuses, + // even though I'm not sure what the original reason for jumping through these extra hoops was. + assert(status->getStatusType() == STATUS_TYPE_BLUETOOTH); + meshtastic::BluetoothStatus *bluetoothStatus = (meshtastic::BluetoothStatus *)status; + + // When pairing begins + if (bluetoothStatus->getConnectionState() == meshtastic::BluetoothStatus::ConnectionState::PAIRING) { + // Store the passkey for rendering + passkey = bluetoothStatus->getPasskey(); + + // Make sure no other system applets have a lock on the display + // Boot screen, menu, etc + Applet *lockOwner = windowManager->whoLocked(); + if (lockOwner) + lockOwner->sendToBackground(); + + // Show pairing screen + bringToForeground(); + } + + // When pairing ends + // or rather, when something changes, and we shouldn't be showing the pairing screen + else if (isForeground()) + sendToBackground(); + + return 0; // No special result to report back to Observable +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/Pairing/PairingApplet.h b/src/graphics/niche/InkHUD/Applets/System/Pairing/PairingApplet.h new file mode 100644 index 000000000..ce420e68b --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/System/Pairing/PairingApplet.h @@ -0,0 +1,43 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + + Shows the Bluetooth passkey during pairing + +*/ + +#pragma once + +#include "configuration.h" + +#include "graphics/niche/InkHUD/Applet.h" + +namespace NicheGraphics::InkHUD +{ + +class PairingApplet : public Applet +{ + public: + PairingApplet(); + + void onRender() override; + void onActivate() override; + void onDeactivate() override; + void onForeground() override; + void onBackground() override; + + int onBluetoothStatusUpdate(const meshtastic::Status *status); + + protected: + // Get notified when status of the Bluetooth connection changes + CallbackObserver bluetoothStatusObserver = + CallbackObserver(this, &PairingApplet::onBluetoothStatusUpdate); + + std::string passkey = ""; // Passkey. Six digits, possibly with leading zeros + + WindowManager *windowManager = nullptr; // For convenience. Set in constructor. +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/Placeholder/PlaceholderApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Placeholder/PlaceholderApplet.cpp new file mode 100644 index 000000000..4f66593b9 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/System/Placeholder/PlaceholderApplet.cpp @@ -0,0 +1,21 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./PlaceholderApplet.h" + +using namespace NicheGraphics; + +InkHUD::PlaceholderApplet::PlaceholderApplet() +{ + // Because this applet sometimes gets processed as if it were a bonafide user applet, + // it's probably better that we do give it a human readable name, just in case it comes up later. + // For genuine user applets, this is set by WindowManager::addApplet + Applet::name = "Placeholder"; +} + +void InkHUD::PlaceholderApplet::onRender() +{ + // This placeholder applet fills its area with sparse diagonal lines + hatchRegion(0, 0, width(), height(), 8, BLACK); +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/Placeholder/PlaceholderApplet.h b/src/graphics/niche/InkHUD/Applets/System/Placeholder/PlaceholderApplet.h new file mode 100644 index 000000000..e5106105c --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/System/Placeholder/PlaceholderApplet.h @@ -0,0 +1,30 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +Shown when a tile doesn't have any other valid Applets +Fills the area with diagonal lines + +*/ + +#include "configuration.h" + +#include "graphics/niche/InkHUD/Applet.h" + +namespace NicheGraphics::InkHUD +{ + +class PlaceholderApplet : public Applet +{ + public: + PlaceholderApplet(); + void onRender() override; + + // Note: onForeground, onBackground, and wantsToRender are not meaningful for this applet. + // The window manager decides when and where it should be rendered + // It may be drawn to several different tiles during on WindowManager::render call +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.cpp new file mode 100644 index 000000000..e6b5b5dc9 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.cpp @@ -0,0 +1,234 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./TipsApplet.h" + +using namespace NicheGraphics; + +InkHUD::TipsApplet::TipsApplet() +{ + // Grab the window manager singleton, for convenience + windowManager = WindowManager::getInstance(); +} + +void InkHUD::TipsApplet::onRender() +{ + switch (tipQueue.front()) { + case Tip::WELCOME: + renderWelcome(); + break; + + case Tip::FINISH_SETUP: { + setFont(fontLarge); + printAt(0, 0, "Tip: Finish Setup"); + + setFont(fontSmall); + int16_t cursorY = fontLarge.lineHeight() * 1.5; + printAt(0, cursorY, "- connect antenna"); + + cursorY += fontSmall.lineHeight() * 1.2; + printAt(0, cursorY, "- connect a client app"); + + // Only if region not set + if (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET) { + cursorY += fontSmall.lineHeight() * 1.2; + printAt(0, cursorY, "- set region"); + } + + // Only if tz not set + if (!(*config.device.tzdef && config.device.tzdef[0] != 0)) { + cursorY += fontSmall.lineHeight() * 1.2; + printAt(0, cursorY, "- set timezone"); + } + + cursorY += fontSmall.lineHeight() * 1.5; + printAt(0, cursorY, "More info at meshtastic.org"); + + setFont(fontSmall); + printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM); + } break; + + case Tip::SAFE_SHUTDOWN: { + setFont(fontLarge); + printAt(0, 0, "Tip: Shutdown"); + + setFont(fontSmall); + std::string shutdown; + shutdown += "Before removing power, please shutdown from InkHUD menu, or a client app. \n"; + shutdown += "\n"; + shutdown += "This ensures data is saved."; + printWrapped(0, fontLarge.lineHeight() * 1.5, width(), shutdown); + + printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM); + + } break; + + case Tip::CUSTOMIZATION: { + setFont(fontLarge); + printAt(0, 0, "Tip: Customization"); + + setFont(fontSmall); + printWrapped(0, fontLarge.lineHeight() * 1.5, width(), + "Configure & control display with the InkHUD menu. Optional features, layout, rotation, and more."); + + printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM); + } break; + + case Tip::BUTTONS: { + setFont(fontLarge); + printAt(0, 0, "Tip: Buttons"); + + setFont(fontSmall); + int16_t cursorY = fontLarge.lineHeight() * 1.5; + + printAt(0, cursorY, "User Button"); + cursorY += fontSmall.lineHeight() * 1.2; + printAt(0, cursorY, "- short press: next"); + cursorY += fontSmall.lineHeight() * 1.2; + printAt(0, cursorY, "- long press: select / open menu"); + cursorY += fontSmall.lineHeight() * 1.5; + + printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM); + } break; + + case Tip::ROTATION: { + setFont(fontLarge); + printAt(0, 0, "Tip: Rotation"); + + setFont(fontSmall); + printWrapped(0, fontLarge.lineHeight() * 1.5, width(), + "To rotate the display, use the InkHUD menu. Long-press the user button > Options > Rotate."); + + printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM); + + // Revert the "flip screen" setting, preventing this message showing again + config.display.flip_screen = false; + nodeDB->saveToDisk(SEGMENT_DEVICESTATE); + } break; + } +} + +// This tip has its own render method, only because it's a big block of code +// Didn't want to clutter up the switch in onRender too much +void InkHUD::TipsApplet::renderWelcome() +{ + uint16_t padW = X(0.05); + + // Block 1 - logo & title + // ======================== + + // Logo size + uint16_t logoWLimit = X(0.3); + uint16_t logoHLimit = Y(0.3); + uint16_t logoW = getLogoWidth(logoWLimit, logoHLimit); + uint16_t logoH = getLogoHeight(logoWLimit, logoHLimit); + + // Title size + setFont(fontLarge); + std::string title; + if (width() >= 200) // Future proofing: hide if *tiny* display + title = "meshtastic.org"; + uint16_t titleW = getTextWidth(title); + + // Center the block + // Desired effect: equal margin from display edge for logo left and title right + int16_t block1Y = Y(0.3); + int16_t block1CX = X(0.5) + (logoW / 2) - (titleW / 2); + int16_t logoCX = block1CX - (logoW / 2) - (padW / 2); + int16_t titleCX = block1CX + (titleW / 2) + (padW / 2); + + // Draw block + drawLogo(logoCX, block1Y, logoW, logoH); + printAt(titleCX, block1Y, title, CENTER, MIDDLE); + + // Block 2 - subtitle + // ======================= + setFont(fontSmall); + std::string subtitle = "InkHUD"; + if (width() >= 200) + subtitle += " - A Heads-Up Display"; // Future proofing: narrower for tiny display + printAt(X(0.5), Y(0.6), subtitle, CENTER, MIDDLE); + + // Block 3 - press to continue + // ============================ + printAt(X(0.5), Y(1), "Press button to continue", CENTER, BOTTOM); +} + +// Grab fullscreen tile, and lock the window manager, when applet is shown +void InkHUD::TipsApplet::onForeground() +{ + windowManager->lock(this); + windowManager->claimFullscreen(this); +} + +void InkHUD::TipsApplet::onBackground() +{ + windowManager->releaseFullscreen(); + windowManager->unlock(this); +} + +void InkHUD::TipsApplet::onActivate() +{ + // Decide which tips (if any) should be shown to user after the boot screen + + // Welcome screen + if (settings.tips.firstBoot) + tipQueue.push_back(Tip::WELCOME); + + // Antenna, region, timezone + // Shown at boot if region not yet set + if (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET) + tipQueue.push_back(Tip::FINISH_SETUP); + + // Shutdown info + // Shown until user performs one valid shutdown + if (!settings.tips.safeShutdownSeen) + tipQueue.push_back(Tip::SAFE_SHUTDOWN); + + // Using the UI + if (settings.tips.firstBoot) { + tipQueue.push_back(Tip::CUSTOMIZATION); + tipQueue.push_back(Tip::BUTTONS); + } + + // Catch an incorrect attempt at rotating display + if (config.display.flip_screen) + tipQueue.push_back(Tip::ROTATION); + + // Applet will be brought to foreground when boot screen closes, via TipsApplet::onLockAvailable +} + +// While our applet has the window manager locked, we will receive the button input +void InkHUD::TipsApplet::onButtonShortPress() +{ + tipQueue.pop_front(); + + // All tips done + if (tipQueue.empty()) { + // Record that user has now seen the "tutorial" set of tips + // Don't show them on subsequent boots + if (settings.tips.firstBoot) { + settings.tips.firstBoot = false; + saveDataToFlash(); + } + + // Close applet, and full refresh to clean the screen + // Need to force update, because our request would be ignored otherwise, as we are now background + sendToBackground(); + windowManager->forceUpdate(EInk::UpdateTypes::FULL); + } + + // More tips left + else + requestUpdate(); +} + +// If the wm lock has just become availale (rendering, input), and we've still got tips, grab it! +// This situation would arise if bluetooth pairing occurs while TipsApplet was already shown (after pairing) +// Note: this event is only raised when *other* applets unlock the window manager +void InkHUD::TipsApplet::onLockAvailable() +{ + if (!tipQueue.empty()) + bringToForeground(); +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.h b/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.h new file mode 100644 index 000000000..29bcdfa8b --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.h @@ -0,0 +1,52 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + + Shows info on how to use InkHUD + - tutorial at first boot + - additional tips in certain situation (e.g. bad shutdown, region unset) + +*/ + +#pragma once + +#include "configuration.h" + +#include "graphics/niche/InkHUD/Applet.h" + +namespace NicheGraphics::InkHUD +{ + +class TipsApplet : public Applet +{ + protected: + enum class Tip { + WELCOME, + FINISH_SETUP, + SAFE_SHUTDOWN, + CUSTOMIZATION, + BUTTONS, + ROTATION, + }; + + public: + TipsApplet(); + + void onRender() override; + void onActivate() override; + void onForeground() override; + void onBackground() override; + void onButtonShortPress() override; + void onLockAvailable() override; // Reopen if interrupted by bluetooth pairing + + protected: + void renderWelcome(); // Very first screen of tutorial + + std::deque tipQueue; // List of tips to show, one after another + + WindowManager *windowManager = nullptr; // For convenience. Set in constructor. +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.cpp b/src/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.cpp new file mode 100644 index 000000000..1ae313d8a --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.cpp @@ -0,0 +1,133 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./AllMessageApplet.h" + +using namespace NicheGraphics; + +void InkHUD::AllMessageApplet::onActivate() +{ + textMessageObserver.observe(textMessageModule); +} + +void InkHUD::AllMessageApplet::onDeactivate() +{ + textMessageObserver.unobserve(textMessageModule); +} + +// We're not consuming the data passed to this method; +// we're just just using it to trigger a render +int InkHUD::AllMessageApplet::onReceiveTextMessage(const meshtastic_MeshPacket *p) +{ + // Abort if applet fully deactivated + // Already handled by onActivate and onDeactivate, but good practice for all applets + if (!isActive()) + return 0; + + // Abort if this is an outgoing message + if (getFrom(p) == nodeDB->getNodeNum()) + return 0; + + // Abort if message was only an "emoji reaction" + // Possibly some implemetation of this in future? + if (p->decoded.emoji) + return 0; + + requestAutoshow(); // Want to become foreground, if permitted + requestUpdate(); // Want to update display, if applet is foreground + + // Return zero: no issues here, carry on notifying other observers! + return 0; +} + +void InkHUD::AllMessageApplet::onRender() +{ + setFont(fontSmall); + + // Find newest message, regardless of whether DM or broadcast + MessageStore::Message *message; + if (latestMessage.wasBroadcast) + message = &latestMessage.broadcast; + else + message = &latestMessage.dm; + + // Short circuit: no text message + if (!message->sender) { + printAt(X(0.5), Y(0.5), "No Message", CENTER, MIDDLE); + return; + } + + // =========================== + // Header (sender, timestamp) + // =========================== + + // Y position for divider + // - between header text and messages + + std::string header; + + // RX Time + // - if valid + std::string timeString = getTimeString(message->timestamp); + if (timeString.length() > 0) { + header += timeString; + header += ": "; + } + + // Sender's id + // - shortname, if available, or + // - node id + meshtastic_NodeInfoLite *sender = nodeDB->getMeshNode(message->sender); + if (sender && sender->has_user) { + header += sender->user.short_name; + header += " ("; + header += sender->user.long_name; + header += ")"; + } else + header += hexifyNodeNum(message->sender); + + // Draw a "standard" applet header + drawHeader(header); + + // Fade the right edge of the header, if text spills over edge + uint8_t wF = getFont().lineHeight() / 2; // Width of fade effect + uint8_t hF = getHeaderHeight(); // Height of fade effect + if (getCursorX() > width()) + hatchRegion(width() - wF - 1, 1, wF, hF, 2, WHITE); + + // Dimensions of the header + constexpr int16_t padDivH = 2; + const int16_t headerDivY = Applet::getHeaderHeight() - 1; + + // =================== + // Print message text + // =================== + + // Extra gap below the header + int16_t textTop = headerDivY + padDivH; + + // Determine size if printed large + setFont(fontLarge); + uint32_t textHeight = getWrappedTextHeight(0, width(), message->text); + + // If too large, swap to small font + if (textHeight + textTop > (uint32_t)height()) // (compare signed and unsigned) + setFont(fontSmall); + + // Print text + printWrapped(0, textTop, width(), message->text); +} + +// Don't show notifications for text messages when our applet is displayed +bool InkHUD::AllMessageApplet::approveNotification(Notification &n) +{ + if (n.type == Notification::Type::NOTIFICATION_MESSAGE_BROADCAST) + return false; + + else if (n.type == Notification::Type::NOTIFICATION_MESSAGE_DIRECT) + return false; + + else + return true; +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.h b/src/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.h new file mode 100644 index 000000000..c74e16196 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.h @@ -0,0 +1,49 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +Shows the latest incoming text message, as well as sender. +Both broadcast and direct messages will be shown here, from all channels. + +This module doesn't doesn't use the devicestate.rx_text_message,' as this is overwritten to contain outgoing messages +This module doesn't collect its own text message. Instead, the WindowManager stores the most recent incoming text message. +This is available to any interested modules (SingeMessageApplet, NotificationApplet etc.) via InkHUD::latestMessage + +We do still receive notifications from the text message module though, +to know when a new message has arrived, and trigger the update. + +*/ + +#pragma once + +#include "configuration.h" + +#include "graphics/niche/InkHUD/Applet.h" + +#include "modules/TextMessageModule.h" + +namespace NicheGraphics::InkHUD +{ + +class Applet; + +class AllMessageApplet : public Applet +{ + public: + void onRender() override; + + void onActivate() override; + void onDeactivate() override; + int onReceiveTextMessage(const meshtastic_MeshPacket *p); + + bool approveNotification(Notification &n) override; // Which notifications to suppress + + protected: + // Used to register our text message callback + CallbackObserver textMessageObserver = + CallbackObserver(this, &AllMessageApplet::onReceiveTextMessage); +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.cpp b/src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.cpp new file mode 100644 index 000000000..526b86901 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.cpp @@ -0,0 +1,126 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./DMApplet.h" + +using namespace NicheGraphics; + +void InkHUD::DMApplet::onActivate() +{ + textMessageObserver.observe(textMessageModule); +} + +void InkHUD::DMApplet::onDeactivate() +{ + textMessageObserver.unobserve(textMessageModule); +} + +// We're not consuming the data passed to this method; +// we're just just using it to trigger a render +int InkHUD::DMApplet::onReceiveTextMessage(const meshtastic_MeshPacket *p) +{ + // Abort if applet fully deactivated + // Already handled by onActivate and onDeactivate, but good practice for all applets + if (!isActive()) + return 0; + + // Abort if only an "emoji reactions" + // Possibly some implemetation of this in future? + if (p->decoded.emoji) + return 0; + + // If DM (not broadcast) + if (!isBroadcast(p->to)) { + // Want to update display, if applet is foreground + requestUpdate(); + + // If this was an incoming message, suggest that our applet becomes foreground, if permitted + if (getFrom(p) != nodeDB->getNodeNum()) + requestAutoshow(); + } + + // Return zero: no issues here, carry on notifying other observers! + return 0; +} + +void InkHUD::DMApplet::onRender() +{ + setFont(fontSmall); + + // Abort if no text message + if (!latestMessage.dm.sender) { + printAt(X(0.5), Y(0.5), "No DMs", CENTER, MIDDLE); + return; + } + + // =========================== + // Header (sender, timestamp) + // =========================== + + // Y position for divider + // - between header text and messages + + std::string header; + + // RX Time + // - if valid + std::string timeString = getTimeString(latestMessage.dm.timestamp); + if (timeString.length() > 0) { + header += timeString; + header += ": "; + } + + // Sender's id + // - shortname, if available, or + // - node id + meshtastic_NodeInfoLite *sender = nodeDB->getMeshNode(latestMessage.dm.sender); + if (sender && sender->has_user) { + header += sender->user.short_name; + header += " ("; + header += sender->user.long_name; + header += ")"; + } else + header += hexifyNodeNum(latestMessage.dm.sender); + + // Draw a "standard" applet header + drawHeader(header); + + // Fade the right edge of the header, if text spills over edge + uint8_t wF = getFont().lineHeight() / 2; // Width of fade effect + uint8_t hF = getHeaderHeight(); // Height of fade effect + if (getCursorX() > width()) + hatchRegion(width() - wF - 1, 1, wF, hF, 2, WHITE); + + // Dimensions of the header + constexpr int16_t padDivH = 2; + const int16_t headerDivY = Applet::getHeaderHeight() - 1; + + // =================== + // Print message text + // =================== + + // Extra gap below the header + int16_t textTop = headerDivY + padDivH; + + // Determine size if printed large + setFont(fontLarge); + uint32_t textHeight = getWrappedTextHeight(0, width(), latestMessage.dm.text); + + // If too large, swap to small font + if (textHeight + textTop > (uint32_t)height()) // (compare signed and unsigned) + setFont(fontSmall); + + // Print text + printWrapped(0, textTop, width(), latestMessage.dm.text); +} + +// Don't show notifications for direct messages when our applet is displayed +bool InkHUD::DMApplet::approveNotification(Notification &n) +{ + if (n.type == Notification::Type::NOTIFICATION_MESSAGE_DIRECT) + return false; + + else + return true; +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.h b/src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.h new file mode 100644 index 000000000..b3dc36e66 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.h @@ -0,0 +1,49 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +Shows the latest incoming *Direct Message* (DM), as well as sender. +This compliments the threaded message applets + +This module doesn't doesn't use the devicestate.rx_text_message,' as this is overwritten to contain outgoing messages +This module doesn't collect its own text message. Instead, the WindowManager stores the most recent incoming text message. +This is available to any interested modules (SingeMessageApplet, NotificationApplet etc.) via InkHUD::latestMessage + +We do still receive notifications from the text message module though, +to know when a new message has arrived, and trigger the update. + +*/ + +#pragma once + +#include "configuration.h" + +#include "graphics/niche/InkHUD/Applet.h" + +#include "modules/TextMessageModule.h" + +namespace NicheGraphics::InkHUD +{ + +class Applet; + +class DMApplet : public Applet +{ + public: + void onRender() override; + + void onActivate() override; + void onDeactivate() override; + int onReceiveTextMessage(const meshtastic_MeshPacket *p); + + bool approveNotification(Notification &n) override; // Which notifications to suppress + + protected: + // Used to register our text message callback + CallbackObserver textMessageObserver = + CallbackObserver(this, &DMApplet::onReceiveTextMessage); +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/User/Heard/HeardApplet.cpp b/src/graphics/niche/InkHUD/Applets/User/Heard/HeardApplet.cpp new file mode 100644 index 000000000..ceb9c01fe --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/User/Heard/HeardApplet.cpp @@ -0,0 +1,123 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "RTC.h" + +#include "gps/GeoCoord.h" + +#include "./HeardApplet.h" + +using namespace NicheGraphics; + +void InkHUD::HeardApplet::onActivate() +{ + // When applet begins, pre-fill with stale info from NodeDB + populateFromNodeDB(); +} + +void InkHUD::HeardApplet::onDeactivate() +{ + // Avoid an unlikely situation where frquent activation / deactivation populated duplicate info from node DB + cards.clear(); +} + +// When base applet hears a new packet, it extracts the info and passes it to us as CardInfo +// We need to store it (at front to sort recent), and request display update if our list has visibly changed as a result +void InkHUD::HeardApplet::handleParsed(CardInfo c) +{ + // Grab the previous entry. + // To check if the new data is different enough to justify re-render + // Need to cache now, before we manipulate the deque + CardInfo previous; + if (!cards.empty()) + previous = cards.at(0); + + // If we're updating an existing entry, remove the old one. Will reinsert at front + for (auto it = cards.begin(); it != cards.end(); ++it) { + if (it->nodeNum == c.nodeNum) { + cards.erase(it); + break; + } + } + + cards.push_front(c); // Insert into base class' card collection + cards.resize(min(maxCards(), (uint8_t)cards.size())); // Don't keep more cards than we could *ever* fit on screen + + // Our rendered image needs to change if: + if (previous.nodeNum != c.nodeNum // Different node + || previous.signal != c.signal // or different signal strength + || previous.distanceMeters != c.distanceMeters // or different position + || previous.hopsAway != c.hopsAway) // or different hops away + { + requestAutoshow(); + requestUpdate(); + } +} + +// When applet is activated, pre-fill with stale data from NodeDB +// We're sorting using the last_heard value. Succeptible to weirdness if node's RTC changes. +// No SNR is available in node db, so we can't calculate signal either +// These initial cards from node db will be gradually pushed out by new packets which originate from out base applet instead +void InkHUD::HeardApplet::populateFromNodeDB() +{ + // Fill a collection with pointers to each node in db + std::vector ordered; + for (auto mn = nodeDB->meshNodes->begin(); mn != nodeDB->meshNodes->end(); ++mn) { + // Only copy if valid, and not our own node + if (mn->num != 0 && mn->num != nodeDB->getNodeNum()) + ordered.push_back(&*mn); + } + + // Sort the collection by age + std::sort(ordered.begin(), ordered.end(), [](meshtastic_NodeInfoLite *top, meshtastic_NodeInfoLite *bottom) -> bool { + return (top->last_heard > bottom->last_heard); + }); + + // Keep the most recent entries onlyt + // Just enough to fill the screen + if (ordered.size() > maxCards()) + ordered.resize(maxCards()); + + // Create card info for these (stale) node observations + meshtastic_NodeInfoLite *ourNode = nodeDB->getMeshNode(nodeDB->getNodeNum()); + for (meshtastic_NodeInfoLite *node : ordered) { + CardInfo c; + c.nodeNum = node->num; + + if (node->has_hops_away) + c.hopsAway = node->hops_away; + + if (nodeDB->hasValidPosition(node) && nodeDB->hasValidPosition(ourNode)) { + // Get lat and long as float + // Meshtastic stores these as integers internally + float ourLat = ourNode->position.latitude_i * 1e-7; + float ourLong = ourNode->position.longitude_i * 1e-7; + float theirLat = node->position.latitude_i * 1e-7; + float theirLong = node->position.longitude_i * 1e-7; + + c.distanceMeters = (int32_t)GeoCoord::latLongToMeter(theirLat, theirLong, ourLat, ourLong); + } + + // Insert into the card collection (member of base class) + cards.push_back(c); + } +} + +// Text drawn in the usual applet header +// Handled by base class: ChronoListApplet +std::string InkHUD::HeardApplet::getHeaderText() +{ + uint16_t nodeCount = nodeDB->getNumMeshNodes() - 1; // Don't count our own node + + std::string text = "Heard: "; + + // Print node count, if nodeDB not yet nearing full + if (nodeCount < MAX_NUM_NODES) { + text += to_string(nodeCount); // Max nodes + text += " "; + text += (nodeCount == 1) ? "node" : "nodes"; + } + + return text; +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/User/Heard/HeardApplet.h b/src/graphics/niche/InkHUD/Applets/User/Heard/HeardApplet.h new file mode 100644 index 000000000..932b5a75e --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/User/Heard/HeardApplet.h @@ -0,0 +1,35 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +Shows a list of all nodes (recently heard or not), sorted by time last heard. +Most of the work is done by the InkHUD::NodeListApplet base class + +*/ + +#pragma once + +#include "configuration.h" + +#include "graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.h" + +namespace NicheGraphics::InkHUD +{ + +class HeardApplet : public NodeListApplet +{ + public: + HeardApplet() : NodeListApplet("HeardApplet") {} + void onActivate() override; + void onDeactivate() override; + + protected: + void handleParsed(CardInfo c) override; // Store new info, and update display if needed + std::string getHeaderText() override; // Set title for this applet + + void populateFromNodeDB(); // Pre-fill the CardInfo collection from NodeDB +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.cpp b/src/graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.cpp new file mode 100644 index 000000000..88bed998d --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.cpp @@ -0,0 +1,110 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./PositionsApplet.h" + +using namespace NicheGraphics; + +void InkHUD::PositionsApplet::onRender() +{ + // Draw the usual map applet first + MapApplet::onRender(); + + // Draw our latest "node of interest" as a special marker + // ------------------------------------------------------- + // We might be rendering because we got a position packet from them + // We might be rendering because our own position updated + // Either way, we still highlight which node most recently sent us a position packet + meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(lastFrom); + if (node && nodeDB->hasValidPosition(node) && enoughMarkers()) + drawLabeledMarker(node); +} + +// Determine if we need to redraw the map, when we receive a new position packet +ProcessMessage InkHUD::PositionsApplet::handleReceived(const meshtastic_MeshPacket &mp) +{ + // If applet is not active, we shouldn't be handling any data + // It's good practice for all applets to implement an early return like this + // for PositionsApplet, this is **required** - it's where we're handling active vs deactive + if (!isActive()) + return ProcessMessage::CONTINUE; + + // Try decode a position from the packet + bool hasPosition = false; + float lat; + float lng; + if (mp.which_payload_variant == meshtastic_MeshPacket_decoded_tag && mp.decoded.portnum == meshtastic_PortNum_POSITION_APP) { + meshtastic_Position position = meshtastic_Position_init_default; + if (pb_decode_from_bytes(mp.decoded.payload.bytes, mp.decoded.payload.size, &meshtastic_Position_msg, &position)) { + if (position.has_latitude_i && position.has_longitude_i // Actually has position + && (position.latitude_i != 0 || position.longitude_i != 0)) // Position isn't "null island" + { + hasPosition = true; + lat = position.latitude_i * 1e-7; // Convert from Meshtastic's internal int32_t format + lng = position.longitude_i * 1e-7; + } + } + } + + // Skip if we didn't get a valid position + if (!hasPosition) + return ProcessMessage::CONTINUE; + + bool hasHopsAway = (mp.hop_start != 0 && mp.hop_limit <= mp.hop_start); // From NodeDB::updateFrom + uint8_t hopsAway = mp.hop_start - mp.hop_limit; + + // Determine if the position packet would change anything on-screen + // ----------------------------------------------------------------- + + bool somethingChanged = false; + + // If our own position + if (isFromUs(&mp)) { + // We get frequent position updates from connected phone + // Only update if we're travelled some distance, for rate limiting + // Todo: smarter detection of position changes + if (GeoCoord::latLongToMeter(ourLastLat, ourLastLng, lat, lng) > 50) { + somethingChanged = true; + ourLastLat = lat; + ourLastLng = lng; + } + } + + // If someone else's position + else { + // Check if this position is from someone different than our previous position packet + if (mp.from != lastFrom) { + somethingChanged = true; + lastFrom = mp.from; + lastLat = lat; + lastLng = lng; + lastHopsAway = hopsAway; + } + + // Same sender: check if position changed + // Todo: smarter detection of position changes + else if (GeoCoord::latLongToMeter(lastLat, lastLng, lat, lng) > 10) { + somethingChanged = true; + lastLat = lat; + lastLng = lng; + } + + // Same sender, same position: check if hops changed + // Only pay attention if the hopsAway value is valid + else if (hasHopsAway && (hopsAway != lastHopsAway)) { + somethingChanged = true; + lastHopsAway = hopsAway; + } + } + + // Decision reached + // ----------------- + + if (somethingChanged) { + requestAutoshow(); // Todo: only request this in some situations? + requestUpdate(); + } + + return ProcessMessage::CONTINUE; +} + +#endif diff --git a/src/graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.h b/src/graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.h new file mode 100644 index 000000000..5bcec339d --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.h @@ -0,0 +1,43 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +Plots position of all nodes from DB, with North facing up. +Scaled to fit the most distant node. +Size of cross represents hops away. +The node which has most recently sent a position will be labeled. + +*/ + +#pragma once + +#include "configuration.h" + +#include "graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.h" + +#include "SinglePortModule.h" + +namespace NicheGraphics::InkHUD +{ + +class PositionsApplet : public MapApplet, public SinglePortModule +{ + public: + PositionsApplet() : SinglePortModule("PositionsApplet", meshtastic_PortNum_POSITION_APP) {} + void onRender() override; + + protected: + ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override; + + NodeNum lastFrom; // Sender of most recent (non-local) position packet + float lastLat; + float lastLng; + float lastHopsAway; + + float ourLastLat; // Info about the most recent (non-local) position packet + float ourLastLng; // Info about most recent *local* position +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.cpp b/src/graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.cpp new file mode 100644 index 000000000..54e67efef --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.cpp @@ -0,0 +1,150 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./RecentsListApplet.h" + +#include "RTC.h" + +using namespace NicheGraphics; + +InkHUD::RecentsListApplet::RecentsListApplet() : NodeListApplet("RecentsListApplet"), concurrency::OSThread("RecentsListApplet") +{ + // No scheduled tasks initially + OSThread::disable(); +} + +void InkHUD::RecentsListApplet::onActivate() +{ + // When the applet is activated, begin scheduled purging of any nodes which are no longer "active" + OSThread::enabled = true; + OSThread::setIntervalFromNow(60 * 1000UL); // Every minute +} + +void InkHUD::RecentsListApplet::onDeactivate() +{ + // Halt scheduled purging + OSThread::disable(); +} + +int32_t InkHUD::RecentsListApplet::runOnce() +{ + prune(); // Remove CardInfo and Age record for nodes which we haven't heard recently + return OSThread::interval; +} + +// When base applet hears a new packet, it extracts the info and passes it to us as CardInfo +// We need to store it (at front to sort recent), and request display update if our list has visibly changed as a result +// We also need to record the current time against the nodenum, so we know when it becomes inactive +void InkHUD::RecentsListApplet::handleParsed(CardInfo c) +{ + // Grab the previous entry. + // To check if the new data is different enough to justify re-render + // Need to cache now, before we manipulate the deque + CardInfo previous; + if (!cards.empty()) + previous = cards.at(0); + + // If we're updating an existing entry, remove the old one. Will reinsert at front + for (auto it = cards.begin(); it != cards.end(); ++it) { + if (it->nodeNum == c.nodeNum) { + cards.erase(it); + break; + } + } + + cards.push_front(c); // Store this CardInfo + cards.resize(min(maxCards(), (uint8_t)cards.size())); // Don't keep more cards than we could *ever* fit on screen + + // Record the time of this observation + // Used to count active nodes, and to know when to prune inactive nodes + seenNow(c.nodeNum); + + // Our rendered image needs to change if: + if (previous.nodeNum != c.nodeNum // Different node + || previous.signal != c.signal // or different signal strength + || previous.distanceMeters != c.distanceMeters // or different position + || previous.hopsAway != c.hopsAway) // or different hops away + { + prune(); // Take the opportunity now to remove inactive nodes + requestAutoshow(); + requestUpdate(); + } +} + +// Record the time (millis, right now) that we hear a node +// If we do not hear from a node for a while, its card and age info will be removed by the purge method, which runs regularly +void InkHUD::RecentsListApplet::seenNow(NodeNum nodeNum) +{ + // If we're updating an existing entry, remove the old one. Will reinsert at front + for (auto it = ages.begin(); it != ages.end(); ++it) { + if (it->nodeNum == nodeNum) { + ages.erase(it); + break; + } + } + + Age a; + a.nodeNum = nodeNum; + a.seenAtMs = millis(); + + ages.push_front(a); +} + +// Remove Card and Age info for any nodes which are now inactive +// Determined by when a node was last heard, in our internal record (not from nodeDB) +void InkHUD::RecentsListApplet::prune() +{ + // Iterate age records from newest to oldest + for (uint16_t i = 0; i < ages.size(); i++) { + // Found the first record which is too old + if (!isActive(ages.at(i).seenAtMs)) { + // Drop this item, and all others behind it + ages.resize(i); + cards.resize(i); + + // Request an update, if pruning did modify our data + // Required if pruning was scheduled. Redundent if pruning was prior to rendering. + requestAutoshow(); + requestUpdate(); + + break; + } + } + + // Push next scheduled pruning back + // Pruning may be called from by handleParsed, immediately prior to rendering + // In that case, we can slightly delay our scheduled pruning + OSThread::setIntervalFromNow(60 * 1000UL); +} + +// Is a timestamp old enough that it would make a node inactive, and in need of purging? +bool InkHUD::RecentsListApplet::isActive(uint32_t seenAtMs) +{ + uint32_t now = millis(); + uint32_t secsAgo = (now - seenAtMs) / 1000UL; // millis() overflow safe + + return (secsAgo < settings.recentlyActiveSeconds); +} + +// Text to be shown at top of applet +// ChronoListApplet base class allows us to set this dynamically +// Might want to adjust depending on node count, RTC status, etc +std::string InkHUD::RecentsListApplet::getHeaderText() +{ + std::string text; + + // Print the length of our "Recents" time-window + text += "Last "; + text += to_string(settings.recentlyActiveSeconds / 60); + text += " mins"; + + // Print the node count + const uint16_t nodeCount = ages.size(); + text += ": "; + text += to_string(nodeCount); + text += " "; + text += (nodeCount == 1) ? "node" : "nodes"; + + return text; +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h b/src/graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h new file mode 100644 index 000000000..74f5f3e57 --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h @@ -0,0 +1,52 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +Shows a list of nodes which have been recently active +The length of this "recently active" window is configurable using the onscreen menu + +Most of the work is done by the shared InkHUD::NodeListApplet base class + +*/ + +#pragma once + +#include "configuration.h" + +#include "graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.h" + +namespace NicheGraphics::InkHUD +{ + +class RecentsListApplet : public NodeListApplet, public concurrency::OSThread +{ + protected: + // Used internally to count the number of active nodes + // We count for ourselves, instead of using the value provided by NodeDB, + // as the values occasionally differ, due to the timing of our Applet's purge method + struct Age { + uint32_t nodeNum; + uint32_t seenAtMs; + }; + + public: + RecentsListApplet(); + void onActivate() override; + void onDeactivate() override; + + protected: + int32_t runOnce() override; + + void handleParsed(CardInfo c) override; // Store new info, update active count, update display if needed + std::string getHeaderText() override; // Set title for this applet + + void seenNow(NodeNum nodeNum); // Record that we have just seen this node, for active node count + void prune(); // Remove cards for nodes which we haven't seen recently + bool isActive(uint32_t seenAtMillis); // Is a node still active, based on when we last heard it? + + std::deque ages; // Information about when we last heard nodes. Independent of NodeDB +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.cpp b/src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.cpp new file mode 100644 index 000000000..d81dd020c --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.cpp @@ -0,0 +1,270 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./ThreadedMessageApplet.h" + +#include "RTC.h" +#include "mesh/NodeDB.h" + +using namespace NicheGraphics; + +// Hard limits on how much message data to write to flash +// Avoid filling the storage if something goes wrong +// Normal usage should be well below this size +constexpr uint8_t MAX_MESSAGES_SAVED = 10; +constexpr uint32_t MAX_MESSAGE_SIZE = 250; + +InkHUD::ThreadedMessageApplet::ThreadedMessageApplet(uint8_t channelIndex) : channelIndex(channelIndex) +{ + // Create the message store + // Will shortly attempt to load messages from RAM, if applet is active + // Label (filename in flash) is set from channel index + store = new MessageStore("ch" + to_string(channelIndex)); +} + +void InkHUD::ThreadedMessageApplet::onRender() +{ + setFont(fontSmall); + + // ============= + // Draw a header + // ============= + + // Header text + std::string headerText; + headerText += "Channel "; + headerText += to_string(channelIndex); + headerText += ": "; + if (channels.isDefaultChannel(channelIndex)) + headerText += "Public"; + else + headerText += channels.getByIndex(channelIndex).settings.name; + + // Draw a "standard" applet header + drawHeader(headerText); + + // Y position for divider + const int16_t dividerY = Applet::getHeaderHeight() - 1; + + // ================== + // Draw each message + // ================== + + // Restrict drawing area + // - don't overdraw the header + // - small gap below divider + setCrop(0, dividerY + 2, width(), height() - (dividerY + 2)); + + // Set padding + // - separates text from the vertical line which marks its edge + constexpr uint16_t padW = 2; + constexpr int16_t msgL = padW; + const int16_t msgR = (width() - 1) - padW; + const uint16_t msgW = (msgR - msgL) + 1; + + int16_t msgB = height() - 1; // Vertical cursor for drawing. Messages are bottom-aligned to this value. + uint8_t i = 0; // Index of stored message + + // Loop over messages + // - until no messages left, or + // - until no part of message fits on screen + while (msgB >= (0 - fontSmall.lineHeight()) && i < store->messages.size()) { + + // Grab data for message + MessageStore::Message &m = store->messages.at(i); + bool outgoing = (m.sender == 0); + meshtastic_NodeInfoLite *sender = nodeDB->getMeshNode(m.sender); + + // Cache bottom Y of message text + // - Used when drawing vertical line alongside + const int16_t dotsB = msgB; + + // Get dimensions for message text + uint16_t bodyH = getWrappedTextHeight(msgL, msgW, m.text); + int16_t bodyT = msgB - bodyH; + + // Print message + // - if incoming + if (!outgoing) + printWrapped(msgL, bodyT, msgW, m.text); + + // Print message + // - if outgoing + else { + if (getTextWidth(m.text) < width()) // If short, + printAt(msgR, bodyT, m.text, RIGHT); // print right align + else // If long, + printWrapped(msgL, bodyT, msgW, m.text); // need printWrapped(), which doesn't support right align + } + + // Move cursor up + // - above message text + msgB -= bodyH; + msgB -= getFont().lineHeight() * 0.2; // Padding between message and header + + // Compose info string + // - shortname, if possible, or "me" + // - time received, if possible + std::string info; + if (sender && sender->has_user) + info += sender->user.short_name; + else if (outgoing) + info += "Me"; + else + info += hexifyNodeNum(m.sender); + + std::string timeString = getTimeString(m.timestamp); + if (timeString.length() > 0) { + info += " - "; + info += timeString; + } + + // Print the info string + // - Faux bold: printed twice, shifted horizontally by one px + printAt(outgoing ? msgR : msgL, msgB, info, outgoing ? RIGHT : LEFT, BOTTOM); + printAt(outgoing ? msgR - 1 : msgL + 1, msgB, info, outgoing ? RIGHT : LEFT, BOTTOM); + + // Underline the info string + const int16_t divY = msgB; + int16_t divL; + int16_t divR; + if (!outgoing) { + // Left side - incoming + divL = msgL; + divR = getTextWidth(info) + getFont().lineHeight() / 2; + } else { + // Right side - outgoing + divR = msgR; + divL = divR - getTextWidth(info) - getFont().lineHeight() / 2; + } + for (int16_t x = divL; x <= divR; x += 2) + drawPixel(x, divY, BLACK); + + // Move cursor up: above info string + msgB -= fontSmall.lineHeight(); + + // Vertical line alongside message + for (int16_t y = msgB; y < dotsB; y += 1) + drawPixel(outgoing ? width() - 1 : 0, y, BLACK); + + // Move cursor up: padding before next message + msgB -= fontSmall.lineHeight() * 0.5; + + i++; + } // End of loop: drawing each message + + // Fade effect: + // Area immediately below the divider. Overdraw with sparse white lines. + // Make text appear to pass behind the header + hatchRegion(0, dividerY + 1, width(), fontSmall.lineHeight() / 3, 2, WHITE); + + // If we've run out of screen to draw messages, we can drop any leftover data from the queue + // Those messages have been pushed off the screen-top by newer ones + while (i < store->messages.size()) + store->messages.pop_back(); +} + +// Code which runs when the applet begins running +// This might happen at boot, or if user enables the applet at run-time, via the menu +void InkHUD::ThreadedMessageApplet::onActivate() +{ + loadMessagesFromFlash(); + textMessageObserver.observe(textMessageModule); // Begin handling any new text messages with onReceiveTextMessage +} + +// Code which runs when the applet stop running +// This might be happen at shutdown, or if user disables the applet at run-time +void InkHUD::ThreadedMessageApplet::onDeactivate() +{ + textMessageObserver.unobserve(textMessageModule); // Stop handling any new text messages with onReceiveTextMessage +} + +// Handle new text messages +// These might be incoming, from the mesh, or outgoing from phone +// Each instance of the ThreadMessageApplet will only listen on one specific channel +// Method should return 0, to indicate general success to TextMessageModule +int InkHUD::ThreadedMessageApplet::onReceiveTextMessage(const meshtastic_MeshPacket *p) +{ + // Abort if applet fully deactivated + // Already handled by onActivate and onDeactivate, but good practice for all applets + if (!isActive()) + return 0; + + // Abort if wrong channel + if (p->channel != this->channelIndex) + return 0; + + // Abort if message was a DM + if (p->to != NODENUM_BROADCAST) + return 0; + + // Abort if messages was an "emoji reaction" + // Possibly some implemetation of this in future? + if (p->decoded.emoji) + return 0; + + // Extract info into our slimmed-down "StoredMessage" type + MessageStore::Message newMessage; + newMessage.timestamp = getValidTime(RTCQuality::RTCQualityDevice, true); // Current RTC time + newMessage.sender = p->from; + newMessage.channelIndex = p->channel; + newMessage.text = std::string(&p->decoded.payload.bytes[0], &p->decoded.payload.bytes[p->decoded.payload.size]); + + // Store newest message at front + // These records are used when rendering, and also stored in flash at shutdown + store->messages.push_front(newMessage); + + // If this was an incoming message, suggest that our applet becomes foreground, if permitted + if (getFrom(p) != nodeDB->getNodeNum()) + requestAutoshow(); + + // Redraw the applet, perhaps. + requestUpdate(); // Want to update display, if applet is foreground + + return 0; +} + +// Don't show notifications for text messages broadcast to our channel, when the applet is displayed +bool InkHUD::ThreadedMessageApplet::approveNotification(Notification &n) +{ + if (n.type == Notification::Type::NOTIFICATION_MESSAGE_BROADCAST && n.getChannel() == channelIndex) + return false; + + // None of our business. Allow the notification. + else + return true; +} + +// Save several recent messages to flash +// Stores the contents of ThreadedMessageApplet::messages +// Just enough messages to fill the display +// Messages are packed "back-to-back", to minimize blocks of flash used +void InkHUD::ThreadedMessageApplet::saveMessagesToFlash() +{ + // Create a label (will become the filename in flash) + std::string label = "ch" + to_string(channelIndex); + + store->saveToFlash(); +} + +// Load recent messages to flash +// Fills ThreadedMessageApplet::messages with previous messages +// Just enough messages have been stored to cover the display +void InkHUD::ThreadedMessageApplet::loadMessagesFromFlash() +{ + // Create a label (will become the filename in flash) + std::string label = "ch" + to_string(channelIndex); + + store->loadFromFlash(); +} + +// Code to run when device is shutting down +// This is in addition to any onDeactivate() code, which will also run +// Todo: implement before a reboot also +void InkHUD::ThreadedMessageApplet::onShutdown() +{ + // Save our current set of messages to flash, provided the applet isn't disabled + if (isActive()) + saveMessagesToFlash(); +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h b/src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h new file mode 100644 index 000000000..5bb8bf96e --- /dev/null +++ b/src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h @@ -0,0 +1,63 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +Displays a thread-view of incoming and outgoing message for a specific channel + +The channel for this applet is set in the constructor, +when the applet is added to WindowManager in the setupNicheGraphics method. + +Several messages are saved to flash at shutdown, to preseve applet between reboots. +This class has its own internal method for saving and loading to fs, which interacts directly with the FSCommon layer. +If the amount of flash usage is unacceptable, we could keep these in RAM only. + +Multiple instances of this channel may be used. This must be done at buildtime. +Suggest a max of two channel, to minimize fs usage? + +*/ + +#pragma once + +#include "configuration.h" + +#include "graphics/niche/InkHUD/Applet.h" +#include "graphics/niche/InkHUD/MessageStore.h" + +#include "modules/TextMessageModule.h" + +namespace NicheGraphics::InkHUD +{ + +class Applet; + +class ThreadedMessageApplet : public Applet +{ + public: + ThreadedMessageApplet(uint8_t channelIndex); + ThreadedMessageApplet() = delete; + + void onRender() override; + + void onActivate() override; + void onDeactivate() override; + void onShutdown() override; + int onReceiveTextMessage(const meshtastic_MeshPacket *p); + + bool approveNotification(Notification &n) override; // Which notifications to suppress + + protected: + // Used to register our text message callback + CallbackObserver textMessageObserver = + CallbackObserver(this, + &ThreadedMessageApplet::onReceiveTextMessage); + + void saveMessagesToFlash(); + void loadMessagesFromFlash(); + + MessageStore *store; // Messages, held in RAM for use, ready to save to flash on shutdown + uint8_t channelIndex = 0; +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/MessageStore.cpp b/src/graphics/niche/InkHUD/MessageStore.cpp new file mode 100644 index 000000000..ac6fe1b35 --- /dev/null +++ b/src/graphics/niche/InkHUD/MessageStore.cpp @@ -0,0 +1,139 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./MessageStore.h" + +#include "SafeFile.h" + +using namespace NicheGraphics; + +// Hard limits on how much message data to write to flash +// Avoid filling the storage if something goes wrong +// Normal usage should be well below this size +constexpr uint8_t MAX_MESSAGES_SAVED = 10; +constexpr uint32_t MAX_MESSAGE_SIZE = 250; + +InkHUD::MessageStore::MessageStore(std::string label) +{ + filename = ""; + filename += "/NicheGraphics"; + filename += "/"; + filename += label; + filename += ".msgs"; +} + +// Write the contents of the MessageStore::messages object to flash +void InkHUD::MessageStore::saveToFlash() +{ + assert(!filename.empty()); + +#ifdef FSCom + // Make the directory, if doesn't already exist + // This is the same directory accessed by NicheGraphics::FlashData + FSCom.mkdir("/NicheGraphics"); + + // Open or create the file + // No "full atomic": don't save then rename + auto f = SafeFile(filename.c_str(), false); + + LOG_INFO("Saving messages in %s", filename.c_str()); + + // 1st byte: how many messages will be written to store + f.write(messages.size()); + + // For each message + for (uint8_t i = 0; i < messages.size() && i < MAX_MESSAGES_SAVED; i++) { + Message &m = messages.at(i); + f.write((uint8_t *)&m.timestamp, sizeof(m.timestamp)); // Write timestamp. 4 bytes + f.write((uint8_t *)&m.sender, sizeof(m.sender)); // Write sender NodeId. 4 Bytes + f.write((uint8_t *)&m.channelIndex, sizeof(m.channelIndex)); // Write channel index. 1 Byte + f.write((uint8_t *)m.text.c_str(), min(MAX_MESSAGE_SIZE, m.text.size())); // Write message text. Variable length + f.write('\0'); // Append null term + LOG_DEBUG("Wrote message %u, length %u, text \"%s\"", (uint32_t)i, min(MAX_MESSAGE_SIZE, m.text.size()), m.text.c_str()); + } + + bool writeSucceeded = f.close(); + + if (!writeSucceeded) { + LOG_ERROR("Can't write data!"); + } +#else + LOG_ERROR("ERROR: Filesystem not implemented\n"); +#endif +} + +// Attempt to load the previous contents of the MessageStore:message deque from flash. +// Filename is controlled by the "label" parameter +void InkHUD::MessageStore::loadFromFlash() +{ + // Hopefully redundant. Initial intention is to only load / save once per boot. + messages.clear(); + +#ifdef FSCom + + // Check that the file *does* actually exist + if (!FSCom.exists(filename.c_str())) { + LOG_WARN("'%s' not found. Using default values", filename.c_str()); + return; + } + + // Check that the file *does* actually exist + if (!FSCom.exists(filename.c_str())) { + LOG_INFO("'%s' not found.", filename.c_str()); + return; + } + + // Open the file + auto f = FSCom.open(filename.c_str(), FILE_O_READ); + + if (f.size() == 0) { + LOG_INFO("%s is empty", filename.c_str()); + f.close(); + return; + } + + // If opened, start reading + if (f) { + LOG_INFO("Loading threaded messages '%s'", filename.c_str()); + + // First byte: how many messages are in the flash store + uint8_t flashMessageCount = 0; + f.readBytes((char *)&flashMessageCount, 1); + LOG_DEBUG("Messages available: %u", (uint32_t)flashMessageCount); + + // For each message + for (uint8_t i = 0; i < flashMessageCount && i < MAX_MESSAGES_SAVED; i++) { + Message m; + + // Read meta data (fixed width) + f.readBytes((char *)&m.timestamp, sizeof(m.timestamp)); + f.readBytes((char *)&m.sender, sizeof(m.sender)); + f.readBytes((char *)&m.channelIndex, sizeof(m.channelIndex)); + + // Read characters until we find a null term + char c; + while (m.text.size() < MAX_MESSAGE_SIZE) { + f.readBytes(&c, 1); + if (c != '\0') + m.text += c; + else + break; + } + + // Store in RAM + messages.push_back(m); + + LOG_DEBUG("#%u, timestamp=%u, sender(num)=%u, text=\"%s\"", (uint32_t)i, m.timestamp, m.sender, m.text.c_str()); + } + + f.close(); + } else { + LOG_ERROR("Could not open / read %s", filename.c_str()); + } +#else + LOG_ERROR("Filesystem not implemented"); + state = LoadFileState::NO_FILESYSTEM; +#endif + return; +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/MessageStore.h b/src/graphics/niche/InkHUD/MessageStore.h new file mode 100644 index 000000000..3cf7d0f68 --- /dev/null +++ b/src/graphics/niche/InkHUD/MessageStore.h @@ -0,0 +1,47 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +We hold a few recent messages, for features like the threaded message applet. +This class contains a struct for storing those messages, +and methods for serializing them to flash. + +*/ + +#pragma once + +#include "configuration.h" + +#include + +#include "mesh/MeshTypes.h" + +namespace NicheGraphics::InkHUD +{ + +class MessageStore +{ + public: + // A stored message + struct Message { + uint32_t timestamp; // Epoch seconds + NodeNum sender = 0; + uint8_t channelIndex; + std::string text; + }; + + MessageStore() = delete; + MessageStore(std::string label); // Label determines filename in flash + + void saveToFlash(); + void loadFromFlash(); + + std::deque messages; // Interact with this object! + + private: + std::string filename; +}; + +} // namespace NicheGraphics::InkHUD + +#endif diff --git a/src/graphics/niche/InkHUD/Persistence.cpp b/src/graphics/niche/InkHUD/Persistence.cpp new file mode 100644 index 000000000..6e8ac0458 --- /dev/null +++ b/src/graphics/niche/InkHUD/Persistence.cpp @@ -0,0 +1,59 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./Persistence.h" + +using namespace NicheGraphics; + +// Load settings and latestMessage data +void InkHUD::loadDataFromFlash() +{ + // Load the InkHUD settings from flash, and check version number + // We should only consider the version number if the InkHUD flashdata component reports that we *did* actually load flash data + InkHUD::Settings loadedSettings; + bool loadSucceeded = FlashData::load(&loadedSettings, "settings"); + if (loadSucceeded && loadedSettings.meta.version == SETTINGS_VERSION && loadedSettings.meta.version != 0) + settings = loadedSettings; // Version matched, replace the defaults with the loaded values + else + LOG_WARN("Settings version changed. Using defaults"); + + // Load previous "latestMessages" data from flash + MessageStore store("latest"); + store.loadFromFlash(); + + // Place into latestMessage struct, for convenient access + // Number of strings loaded determines whether last message was broadcast or dm + if (store.messages.size() == 1) { + latestMessage.dm = store.messages.at(0); + latestMessage.wasBroadcast = false; + } else if (store.messages.size() == 2) { + latestMessage.dm = store.messages.at(0); + latestMessage.broadcast = store.messages.at(1); + latestMessage.wasBroadcast = true; + } +} + +// Save settings and latestMessage data +void InkHUD::saveDataToFlash() +{ + // Save the InkHUD settings to flash + FlashData::save(&settings, "settings"); + + // Number of strings saved determines whether last message was broadcast or dm + MessageStore store("latest"); + store.messages.push_back(latestMessage.dm); + if (latestMessage.wasBroadcast) + store.messages.push_back(latestMessage.broadcast); + store.saveToFlash(); +} + +// Holds InkHUD settings while running +// Saved back to Flash at shutdown +// Accessed by including persistence.h +InkHUD::Settings InkHUD::settings; + +// Holds copies of the most recent broadcast and DM messages while running +// Saved to Flash at shutdown +// Accessed by including persistence.h +InkHUD::LatestMessage InkHUD::latestMessage; + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Persistence.h b/src/graphics/niche/InkHUD/Persistence.h new file mode 100644 index 000000000..e2daa02d9 --- /dev/null +++ b/src/graphics/niche/InkHUD/Persistence.h @@ -0,0 +1,123 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +A quick and dirty alternative to storing "device only" settings using the protobufs +Convenient during development. +Potentially a polite option, to avoid polluting the generated code with values for obscure use cases like this. + +The save / load mechanism is a shared NicheGraphics feature. + +*/ + +#pragma once + +#include "configuration.h" + +#include "graphics/niche/FlashData.h" +#include "graphics/niche/InkHUD/MessageStore.h" + +namespace NicheGraphics::InkHUD +{ + +constexpr uint8_t MAX_TILES_GLOBAL = 4; +constexpr uint8_t MAX_USERAPPLETS_GLOBAL = 16; + +// Used to invalidate old settings, if needed +// Version 0 is reserved for testing, and will always load defaults +constexpr uint32_t SETTINGS_VERSION = 2; + +struct Settings { + struct Meta { + // Used to invalidate old savefiles, if we make breaking changes + uint32_t version = SETTINGS_VERSION; + } meta; + + struct UserTiles { + // How many tiles are shown + uint8_t count = 1; + + // Maximum amount of tiles for this display + uint8_t maxCount = 4; + + // Which tile is focused (responding to user button input) + uint8_t focused = 0; + + // Which applet is displayed on which tile + // Index of array: which tile, as indexed in WindowManager::tiles + // Value of array: which applet, as indexed in WindowManager::activeApplets + uint8_t displayedUserApplet[MAX_TILES_GLOBAL] = {0, 1, 2, 3}; + } userTiles; + + struct UserApplets { + // Which applets are running (either displayed, or in the background) + // Index of array: which applet, as indexed in WindowManager::applets + // Initial value is set by the "activeByDefault" parameter of WindowManager::addApplet, in setupNicheGraphics() + bool active[MAX_USERAPPLETS_GLOBAL]; + + // Which user applets should be automatically shown when they have important data to show + // If none set, foreground applets should remain foreground without manual user input + // If multiple applets request this at once, + // priority is the order which they were passed to WindowManager::addApplets, in setupNicheGraphics() + bool autoshow[MAX_USERAPPLETS_GLOBAL]{false}; + } userApplets; + + // Features which the use can enable / disable via the on-screen menu + struct OptionalFeatures { + bool notifications = true; + bool batteryIcon = false; + } optionalFeatures; + + // Some menu items may not be required, based on device / configuration + // We can enable them only when needed, to de-clutter the menu + struct OptionalMenuItems { + // If aux button is used to swap between tiles, we have to need for this menu item + bool nextTile = true; + + // Used if backlight present, and not controlled by AUX button + // If this item is added to menu: backlight is always active when menu is open + // The added menu items then allows the user to "Keep Backlight On", globally. + bool backlight = false; + } optionalMenuItems; + + // Allows tips to be run once only + struct Tips { + // Enables the longer "tutorial" shown only on first boot + // Once tutorial has been completed, it is no longer shown + bool firstBoot = true; + + // User is advised to shutdown before removing device power + // Once user executes a shutdown (either via menu or client app), + // this tip is no longer shown + bool safeShutdownSeen = false; + } tips; + + // Rotation of the display + // Multiples of 90 degrees clockwise + // Most commonly: rotation is 0 when flex connector is oriented below display + uint8_t rotation = 1; + + // How long do we consider another node to be "active"? + // Used when applets want to filter for "active nodes" only + uint32_t recentlyActiveSeconds = 2 * 60; +}; + +// Most recently received text message +// Value is updated by InkHUD::WindowManager, as a courtesty to applets +// Note: different from devicestate.rx_text_message, +// which may contain an *outgoing message* to broadcast +struct LatestMessage { + MessageStore::Message broadcast; // Most recent message received broadcast + MessageStore::Message dm; // Most recent received DM + bool wasBroadcast; // True if most recent broadcast is newer than most recent dm +}; + +extern Settings settings; +extern LatestMessage latestMessage; + +void loadDataFromFlash(); +void saveDataToFlash(); + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/PlatformioConfig.ini b/src/graphics/niche/InkHUD/PlatformioConfig.ini new file mode 100644 index 000000000..7eb1d34e9 --- /dev/null +++ b/src/graphics/niche/InkHUD/PlatformioConfig.ini @@ -0,0 +1,10 @@ +[inkhud] +board_level = extra +build_src_filter = +<../variants/$PIOENV> ; Include nicheGraphics.h +build_flags = + -D MESHTASTIC_INCLUDE_NICHE_GRAPHICS ; Use NicheGraphics + -D MESHTASTIC_INCLUDE_INKHUD ; Use InkHUD (a NicheGraphics UI) + -D MESHTASTIC_EXCLUDE_SCREEN ; Suppress default Screen class + -D HAS_BUTTON=0 ; Suppress default ButtonThread +lib_deps = + https://github.com/ZinggJM/GFX_Root#2.0.0 ; Used by InkHUD as a "slimmer" version of AdafruitGFX \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/README.md b/src/graphics/niche/InkHUD/README.md new file mode 100644 index 000000000..8d788ffa8 --- /dev/null +++ b/src/graphics/niche/InkHUD/README.md @@ -0,0 +1,12 @@ +# InkHUD + +A heads-up-display for E-Ink devices, intended to supplement a connected phone / client. Implemented as a "NicheGraphics" UI. + +Supported devices (as of 1st Feb. 2025): + +- Heltec Vision Master E213 +- Heltec Vision Master E290 +- Heltec Wireless Paper V1.1 +- LILYGO T-Echo + +More to follow diff --git a/src/graphics/niche/InkHUD/Tile.cpp b/src/graphics/niche/InkHUD/Tile.cpp new file mode 100644 index 000000000..e65835801 --- /dev/null +++ b/src/graphics/niche/InkHUD/Tile.cpp @@ -0,0 +1,237 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./Tile.h" + +#include "concurrency/Periodic.h" + +using namespace NicheGraphics; + +// Static members of Tile class (for linking) +InkHUD::Tile *InkHUD::Tile::highlightTarget; +bool InkHUD::Tile::highlightShown; + +// For dismissing the highlight indicator, after a few seconds +// Highlighting is used to inform user of which tile is now focused +static concurrency::Periodic *taskHighlight; +static int32_t runtaskHighlight() +{ + LOG_DEBUG("Dismissing Highlight"); + InkHUD::Tile::highlightShown = false; + InkHUD::Tile::highlightTarget = nullptr; + InkHUD::WindowManager::getInstance()->forceUpdate(Drivers::EInk::UpdateTypes::FAST); // Re-render, clearing the highlighting + return taskHighlight->disable(); +} +static void inittaskHighlight() +{ + static bool doneOnce = false; + if (!doneOnce) { + taskHighlight = new concurrency::Periodic("Highlight", runtaskHighlight); + taskHighlight->disable(); + doneOnce = true; + } +} + +InkHUD::Tile::Tile() +{ + // For convenince + windowManager = InkHUD::WindowManager::getInstance(); + + inittaskHighlight(); + Tile::highlightTarget = nullptr; + Tile::highlightShown = false; +} + +// Set the region of the tile automatically, based on the user's chosen layout +// This method places tiles which will host user applets +// The WindowManager multiplexes the applets to these tiles automatically +void InkHUD::Tile::placeUserTile(uint8_t userTileCount, uint8_t tileIndex) +{ + uint16_t displayWidth = windowManager->getWidth(); + uint16_t displayHeight = windowManager->getHeight(); + + bool landscape = displayWidth > displayHeight; + + // Check for any stray tiles + if (tileIndex > (userTileCount - 1)) { + // Dummy values to prevent rendering + LOG_WARN("Tile index out of bounds"); + left = -2; + top = -2; + width = 1; + height = 1; + return; + } + + // Todo: special handling for the notification area + // Todo: special handling for 3 tile layout + + // Gap between tiles + const uint16_t spacing = 4; + + switch (userTileCount) { + // One tile only + case 1: + left = 0; + top = 0; + width = displayWidth; + height = displayHeight; + break; + + // Two tiles + case 2: + if (landscape) { + // Side by side + left = ((displayWidth / 2) + (spacing / 2)) * tileIndex; + top = 0; + width = (displayWidth / 2) - (spacing / 2); + height = displayHeight; + } else { + // Above and below + left = 0; + top = 0 + (((displayHeight / 2) + (spacing / 2)) * tileIndex); + width = displayWidth; + height = (displayHeight / 2) - (spacing / 2); + } + break; + + // Four tiles + case 4: + width = (displayWidth / 2) - (spacing / 2); + height = (displayHeight / 2) - (spacing / 2); + switch (tileIndex) { + case 0: + left = 0; + top = 0; + break; + case 1: + left = 0 + (width - 1) + spacing; + top = 0; + break; + case 2: + left = 0; + top = 0 + (height - 1) + spacing; + break; + case 3: + left = 0 + (width - 1) + spacing; + top = 0 + (height - 1) + spacing; + break; + } + break; + + default: + LOG_ERROR("Unsupported tile layout"); + assert(0); + } + + assert(width > 0 && height > 0); + + this->left = left; + this->top = top; + this->width = width; + this->height = height; +} + +// Manually set the region for a tile +// This is only done for tiles which will host certain "System Applets", which have unique position / sizes: +// Things like the NotificationApplet, BatteryIconApplet, etc +void InkHUD::Tile::placeSystemTile(int16_t left, int16_t top, uint16_t width, uint16_t height) +{ + assert(width > 0 && height > 0); + + this->left = left; + this->top = top; + this->width = width; + this->height = height; +} + +// Place an applet onto a tile +// Creates a reciprocal link between applet and tile +// The tile should always know which applet is displayed +// The applet should always know which tile it is display on +// This is enforced with asserts +// Assigning a new applet will break a previous link +// Link may also be broken by assigning a nullptr +void InkHUD::Tile::assignApplet(Applet *a) +{ + // Break the link between old applet and this tile + if (assignedApplet) + assignedApplet->setTile(nullptr); + + // Store the new applet + assignedApplet = a; + + // Create the reciprocal link between the new applet and this tile + if (a) + a->setTile(this); +} + +// Get pointer to whichever applet is displayed on this tile +InkHUD::Applet *InkHUD::Tile::getAssignedApplet() +{ + return assignedApplet; +} + +// Receive drawing output from the assigned applet, +// and translate it from "applet-space" coordinates, to it's true location. +// The final "rotation" step is performed by the windowManager +void InkHUD::Tile::handleAppletPixel(int16_t x, int16_t y, Color c) +{ + // Move pixels from applet-space to tile-space + x += left; + y += top; + + // Crop to tile borders + if (x >= left && x < (left + width) && y >= top && y < (top + height)) { + // Pass to the window manager + windowManager->handleTilePixel(x, y, c); + } +} + +// Called by Applet base class, when learning of its dimensions +uint16_t InkHUD::Tile::getWidth() +{ + return width; +} + +// Called by Applet base class, when learning of its dimensions +uint16_t InkHUD::Tile::getHeight() +{ + return height; +} + +// Longest edge of the display, in pixels +// Maximum possible size of any tile's width / height +// Used by some components to allocate resources for the "worst possible situtation" +// "Sizing the cathedral for christmas eve" +uint16_t InkHUD::Tile::maxDisplayDimension() +{ + WindowManager *wm = WindowManager::getInstance(); + return max(wm->getHeight(), wm->getWidth()); +} + +// Ask for this tile to be highlighted +// Used to indicate which tile is now indicated after focus changes +// Only used for aux button focus changes, not changes via menu +void InkHUD::Tile::requestHighlight() +{ + Tile::highlightTarget = this; + Tile::highlightShown = false; + windowManager->forceUpdate(Drivers::EInk::UpdateTypes::FAST); +} + +// Starts the timer which will automatically dismiss the highlighting, if the tile doesn't organically redraw first +void InkHUD::Tile::startHighlightTimeout() +{ + taskHighlight->setIntervalFromNow(5 * 1000UL); + taskHighlight->enabled = true; +} + +// Stop the timer which would automatically dismiss the highlighting +// Called if the tile organically renders before the timer is up +void InkHUD::Tile::cancelHighlightTimeout() +{ + if (taskHighlight->enabled) + taskHighlight->disable(); +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Tile.h b/src/graphics/niche/InkHUD/Tile.h new file mode 100644 index 000000000..e41536e53 --- /dev/null +++ b/src/graphics/niche/InkHUD/Tile.h @@ -0,0 +1,62 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + + Class which represents a region of the display area + Applets are assigned to a tile + Tile controls the Applet's dimensions + Tile receives pixel output from the applet, and translates it to the correct display region + +*/ + +#pragma once + +#include "configuration.h" + +#include "./Applet.h" +#include "./Types.h" +#include "./WindowManager.h" + +#include + +namespace NicheGraphics::InkHUD +{ + +class Applet; +class WindowManager; + +class Tile +{ + public: + Tile(); + void placeUserTile(uint8_t layoutSize, uint8_t tileIndex); // Assign region automatically, based on layout + void placeSystemTile(int16_t left, int16_t top, uint16_t width, uint16_t height); // Assign region manually + void handleAppletPixel(int16_t x, int16_t y, Color c); // Receive px output from assigned applet + uint16_t getWidth(); // Used to set the assigned applet's width before render + uint16_t getHeight(); // Used to set the assigned applet's height before render + static uint16_t maxDisplayDimension(); // Largest possible width / height any tile may ever encounter + + void assignApplet(Applet *a); // Place an applet onto a tile + Applet *getAssignedApplet(); // Applet which is on a tile + + void requestHighlight(); // Ask for this tile to be highlighted + static void startHighlightTimeout(); // Start the auto-dismissal timer + static void cancelHighlightTimeout(); // Cancel the auto-dismissal timer early; already dismissed + + static Tile *highlightTarget; // Which tile are we highlighting? (Intending to highlight?) + static bool highlightShown; // Is the tile highlighted yet? Controlls highlight vs dismiss + + protected: + int16_t left; + int16_t top; + uint16_t width; + uint16_t height; + + Applet *assignedApplet = nullptr; // Pointer to the applet which is currently linked with the tile + + WindowManager *windowManager; // Convenient access to the WindowManager singleton +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Types.h b/src/graphics/niche/InkHUD/Types.h new file mode 100644 index 000000000..f4ab9ed4e --- /dev/null +++ b/src/graphics/niche/InkHUD/Types.h @@ -0,0 +1,62 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +Custom data types for InkHUD + +Only "general purpose" data-types should be defined here. +If your applet has its own structs or enums, which won't be useful to other applets, +please define them inside (or in the same folder as) your applet. + +*/ + +#pragma once + +#include "configuration.h" + +#include "graphics/niche/Drivers/EInk/EInk.h" + +namespace NicheGraphics::InkHUD +{ + +// Color, understood by display controller IC (as bit values) +// Also suitable for use as AdafruitGFX colors +enum Color : uint8_t { + BLACK = 0, + WHITE = 1, +}; + +// Info contained within AppletFont +struct FontDimensions { + uint8_t height; + uint8_t ascenderHeight; + uint8_t descenderHeight; +}; + +// Which edge Applet::printAt will place on the X parameter +enum HorizontalAlignment : uint8_t { + LEFT, + RIGHT, + CENTER, +}; + +// Which edge Applet::printAt will place on the Y parameter +enum VerticalAlignment : uint8_t { + TOP, + MIDDLE, + BOTTOM, +}; + +// An easy-to-understand intepretation of SNR and RSSI +// Calculate with Applet::getSignalStringth +enum SignalStrength : int8_t { + SIGNAL_UNKNOWN = -1, + SIGNAL_NONE, + SIGNAL_BAD, + SIGNAL_FAIR, + SIGNAL_GOOD, +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/UpdateMediator.cpp b/src/graphics/niche/InkHUD/UpdateMediator.cpp new file mode 100644 index 000000000..16fc21cef --- /dev/null +++ b/src/graphics/niche/InkHUD/UpdateMediator.cpp @@ -0,0 +1,151 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./UpdateMediator.h" + +#include "./WindowManager.h" + +using namespace NicheGraphics; + +static constexpr uint32_t MAINTENANCE_MS_INITIAL = 60 * 1000UL; +static constexpr uint32_t MAINTENANCE_MS = 60 * 60 * 1000UL; + +InkHUD::UpdateMediator::UpdateMediator() : concurrency::OSThread("Mediator") +{ + // Timer disabled by default + OSThread::disable(); +} + +// Ask which type of update operation we should perform +// Even if we explicitly want a FAST or FULL update, we should pass it through this method, +// as it allows UpdateMediator to count the refreshes. +// Internal "maintenance" refreshes are not passed through evaluate, however. +Drivers::EInk::UpdateTypes InkHUD::UpdateMediator::evaluate(Drivers::EInk::UpdateTypes requested) +{ + LOG_DEBUG("FULL-update debt:%f", debt); + + // For conveninece + typedef Drivers::EInk::UpdateTypes UpdateTypes; + + // Check whether we've paid off enough debt to stop unprovoked refreshing (if in progress) + // This maintenance behavior will also halt itself when the timer next fires, + // but that could be an hour away, so we can stop it early here and free up resources + if (OSThread::enabled && debt == 0.0) + endMaintenance(); + + // Explicitly requested FULL + if (requested == UpdateTypes::FULL) { + LOG_DEBUG("Explicit FULL"); + debt = max(debt - 1.0, 0.0); // Record that we have paid back (some of) the FULL refresh debt + return UpdateTypes::FULL; + } + + // Explicitly requested FAST + if (requested == UpdateTypes::FAST) { + LOG_DEBUG("Explicit FAST"); + // Add to the FULL refresh debt + if (debt < 1.0) + debt += 1.0 / fastPerFull; + else + debt += stressMultiplier * (1.0 / fastPerFull); // More debt if too many consecutive FAST refreshes + + // If *significant debt*, begin occasionally refreshing *unprovoked* + // This maintenance behavior is only triggered here, during periods of user interaction + if (debt >= 2.0) + beginMaintenance(); + + return UpdateTypes::FAST; // Give them what the asked for + } + + // Handling UpdateTypes::UNSPECIFIED + // ----------------------------------- + // In this case, the UI doesn't care which refresh we use + + // Not much debt: suggest FAST + if (debt < 1.0) { + LOG_DEBUG("UNSPECIFIED: using FAST"); + debt += 1.0 / fastPerFull; + return UpdateTypes::FAST; + } + + // In debt: suggest FULL + else { + LOG_DEBUG("UNSPECIFIED: using FULL"); + debt = max(debt - 1.0, 0.0); // Record that we have paid back (some of) the FULL refresh debt + + // When maintenance begins, the first refresh happens shortly after user interaction ceases (a minute or so) + // If we *are* given an opportunity to refresh before that, we'll skip that initial maintenance refresh + // We were intending to use that initial refresh to redraw the screen as FULL, but we're doing that now, organically + if (OSThread::enabled && OSThread::interval == MAINTENANCE_MS_INITIAL) { + LOG_DEBUG("Initial maintenance skipped"); + OSThread::setInterval(MAINTENANCE_MS); // Note: not intervalFromNow + } + + return UpdateTypes::FULL; + } +} + +// Determine which of two update types is more important to honor +// Explicit FAST is more important than UNSPECIFIED - prioritize responsiveness +// Explicit FULL is more important than explicint FAST - prioritize image quality: explicit FULL is rare +Drivers::EInk::UpdateTypes InkHUD::UpdateMediator::prioritize(Drivers::EInk::UpdateTypes type1, Drivers::EInk::UpdateTypes type2) +{ + switch (type1) { + case Drivers::EInk::UpdateTypes::UNSPECIFIED: + return type2; + + case Drivers::EInk::UpdateTypes::FAST: + return (type2 == Drivers::EInk::UpdateTypes::FULL) ? Drivers::EInk::UpdateTypes::FULL : Drivers::EInk::UpdateTypes::FAST; + + case Drivers::EInk::UpdateTypes::FULL: + return type1; + } + + return Drivers::EInk::UpdateTypes::UNSPECIFIED; // Suppress compiler warning only +} + +// We're using the timer to perform "maintenance" +// If signifcant FULL-refresh debt has accumulated, we will occasionally run FULL refreshes unprovoked. +// This prevents gradual build-up of debt, +// in case we don't have enough UNSPECIFIED refreshes to pay the debt back organically. +// The first refresh takes place shortly after user finishes interacting with the device; this does the bulk of the restoration +// Subsequent refreshes take place *much* less frequently. +// Hopefully an applet will want to render before this, meaning we can cancel the maintenance. +int32_t InkHUD::UpdateMediator::runOnce() +{ + if (debt > 0.0) { + LOG_DEBUG("debt=%f: performing maintenance", debt); + + // Ask WindowManager to redraw everything, purely for the refresh + // Todo: optimize? Could update without re-rendering + WindowManager::getInstance()->forceUpdate(EInk::UpdateTypes::FULL); + + // Record that we have paid back (some of) the FULL refresh debt + debt = max(debt - 1.0, 0.0); + + // Next maintenance refresh scheduled - long wait (an hour?) + return MAINTENANCE_MS; + } + + else + return endMaintenance(); +} + +// Begin periodically refreshing the display, to repay FULL-refresh debt +// We do this in case user doesn't have enough activity to repay it organically, with UpdateTypes::UNSPECIFIED +// After an initial refresh, to redraw as FULL, we only perform these maintenance refreshes very infrequently +// This gives the display a chance to heal by evaluating UNSPECIFIED as FULL, which is preferable +void InkHUD::UpdateMediator::beginMaintenance() +{ + LOG_DEBUG("Maintenance enabled"); + OSThread::setIntervalFromNow(MAINTENANCE_MS_INITIAL); + OSThread::enabled = true; +} + +// FULL-refresh debt is low enough that we no longer need to pay it back with periodic updates +int32_t InkHUD::UpdateMediator::endMaintenance() +{ + LOG_DEBUG("Maintenance disabled"); + return OSThread::disable(); +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/UpdateMediator.h b/src/graphics/niche/InkHUD/UpdateMediator.h new file mode 100644 index 000000000..e4c7c6786 --- /dev/null +++ b/src/graphics/niche/InkHUD/UpdateMediator.h @@ -0,0 +1,45 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +Responsible for display health +- counts number of FULL vs FAST refresh +- suggests whether to use FAST or FULL, when not explicitly specified +- periodically requests update unprovoked, if required for display health + +*/ + +#pragma once + +#include "configuration.h" + +#include "graphics/niche/Drivers/EInk/EInk.h" + +namespace NicheGraphics::InkHUD +{ + +class UpdateMediator : protected concurrency::OSThread +{ + public: + UpdateMediator(); + + // Tell the mediator what we want, get told what we can have + Drivers::EInk::UpdateTypes evaluate(Drivers::EInk::UpdateTypes requested); + + // Determine which of two update types is more important to honor + Drivers::EInk::UpdateTypes prioritize(Drivers::EInk::UpdateTypes type1, Drivers::EInk::UpdateTypes type2); + + uint8_t fastPerFull = 5; // Ideal number of fast refreshes between full refreshes + float stressMultiplier = 2.0; // How bad for the display are extra fast refreshes beyond fastPerFull? + + private: + int32_t runOnce() override; + void beginMaintenance(); // Excessive debt: begin unprovoked refreshing of display, for health + int32_t endMaintenance(); // End unprovoked refreshing: debt paid + + float debt = 0.0; // How many full refreshes are due +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/WindowManager.cpp b/src/graphics/niche/InkHUD/WindowManager.cpp new file mode 100644 index 000000000..f987a3646 --- /dev/null +++ b/src/graphics/niche/InkHUD/WindowManager.cpp @@ -0,0 +1,1128 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./WindowManager.h" + +#include "RTC.h" +#include "mesh/NodeDB.h" + +// System applets +// Must be defined in .cpp to prevent a circular dependency with Applet base class +#include "./Applets/System/BatteryIcon/BatteryIconApplet.h" +#include "./Applets/System/Logo/LogoApplet.h" +#include "./Applets/System/Menu/MenuApplet.h" +#include "./Applets/System/Notification/NotificationApplet.h" +#include "./Applets/System/Pairing/PairingApplet.h" +#include "./Applets/System/Placeholder/PlaceholderApplet.h" +#include "./Applets/System/Tips/TipsApplet.h" + +using namespace NicheGraphics; + +InkHUD::WindowManager::WindowManager() : concurrency::OSThread("InkHUD WM") +{ + // Nothing for the timer to do just yet + OSThread::disable(); +} + +// Get or create the WindowManager singleton +InkHUD::WindowManager *InkHUD::WindowManager::getInstance() +{ + // Create the singleton instance of our class, if not yet done + static InkHUD::WindowManager *instance = new InkHUD::WindowManager(); + return instance; +} + +// Connect the driver, which is created independently is setupNicheGraphics() +void InkHUD::WindowManager::setDriver(Drivers::EInk *driver) +{ + // Make sure not already set + if (this->driver) { + LOG_ERROR("Driver already set"); + delay(2000); // Wait for native serial.. + assert(false); + } + + // Store the driver which was created in setupNicheGraphics() + this->driver = driver; + + // Determine the dimensions of the image buffer, in bytes. + // Along rows, pixels are stored 8 per byte. + // Not all display widths are divisible by 8. Need to make sure bytecount accommodates padding for these. + imageBufferWidth = ((driver->width - 1) / 8) + 1; + imageBufferHeight = driver->height; + + // Allocate the image buffer + imageBuffer = new uint8_t[imageBufferWidth * imageBufferHeight]; +} + +// Sets the ideal ratio of FAST updates to FULL updates +// We want as many FAST updates as possible, without causing gradual degradation of the display +// If explicitly requested, number of FAST updates may exceed fastPerFull value. +// In this case, the stressMultiplier is applied, causing the "FULL update debt" to increase by more than normal +// The stressMultplier helps the display recover from particularly taxing periods of use +// (Default arguments of 5,2 are very conservative values) +void InkHUD::WindowManager::setDisplayResilience(uint8_t fastPerFull = 5, float stressMultiplier = 2.0) +{ + mediator.fastPerFull = fastPerFull; + mediator.stressMultiplier = stressMultiplier; +} + +// Register a user applet with the WindowManager +// This is called in setupNicheGraphics() +// This should be the only time that specific user applets are mentioned in the code +// If a user applet is not added with this method, its code should not be built +void InkHUD::WindowManager::addApplet(const char *name, Applet *a, bool defaultActive, bool defaultAutoshow, uint8_t onTile) +{ + userApplets.push_back(a); + + // If requested, mark in settings that this applet should be active by default + // This means that it will be available for the user to cycle to with short-press of the button + // This is the default state only: user can activate or deactive applets through the menu. + // User's choice of active applets is stored in settings, and will be honored instead of these defaults, if present + if (defaultActive) + settings.userApplets.active[userApplets.size() - 1] = true; + + // If requested, mark in settings that this applet should "autoshow" by default + // This means that the applet will be automatically brought to foreground when it has new data to show + // This is the default state only: user can select which applets have this behavior through the menu + // User's selection is stored in settings, and will be honored instead of these defaults, if present + if (defaultAutoshow) + settings.userApplets.autoshow[userApplets.size() - 1] = true; + + // If specified, mark this as the default applet for a given tile index + // Used only to avoid placeholder applet "out of the box", when default settings have more than one tile + if (onTile != (uint8_t)-1) + settings.userTiles.displayedUserApplet[onTile] = userApplets.size() - 1; + + // The label that will be show in the applet selection menu, on the device + a->name = name; +} + +// Perform initial setup, and begin responding to incoming events +// First task once init is to show the boot screen +void InkHUD::WindowManager::begin() +{ + // Make sure we have set a driver + if (!this->driver) { + LOG_ERROR("Driver not set"); + delay(2000); // Wait for native serial.. + assert(false); + } + + loadDataFromFlash(); + + createSystemApplets(); + createSystemTiles(); + placeSystemTiles(); + assignSystemAppletsToTiles(); + + createUserApplets(); + createUserTiles(); + placeUserTiles(); + assignUserAppletsToTiles(); + refocusTile(); + + logoApplet->showBootScreen(); + forceUpdate(Drivers::EInk::FULL, false); // Update now, and wait here until complete + + deepSleepObserver.observe(¬ifyDeepSleep); + rebootObserver.observe(¬ifyReboot); + textMessageObserver.observe(textMessageModule); +#ifdef ARCH_ESP32 + lightSleepObserver.observe(¬ifyLightSleep); +#endif +} + +// Set-up special "system applets" +// These handle things like bootscreen, pop-up notifications etc +// They are processed separately from the user applets, because they might need to do "weird things" +// They also won't be activated or deactivated +void InkHUD::WindowManager::createSystemApplets() +{ + logoApplet = new LogoApplet; + pairingApplet = new PairingApplet; + tipsApplet = new TipsApplet; + notificationApplet = new NotificationApplet; + batteryIconApplet = new BatteryIconApplet; + menuApplet = new MenuApplet; + placeholderApplet = new PlaceholderApplet; + + // System applets are always active + logoApplet->activate(); + pairingApplet->activate(); + tipsApplet->activate(); + notificationApplet->activate(); + batteryIconApplet->activate(); + menuApplet->activate(); + placeholderApplet->activate(); + + // Add to the systemApplets vector + // Although system applets often need special handling, sometimes we can process them en-masse with this vector + // e.g. rendering, raising events + // Order of these entries determines Z-Index when rendering + systemApplets.push_back(logoApplet); + systemApplets.push_back(pairingApplet); + systemApplets.push_back(tipsApplet); + systemApplets.push_back(batteryIconApplet); + systemApplets.push_back(menuApplet); + systemApplets.push_back(notificationApplet); + // Note: placeholder applet is technically a system applet, but it renders in WindowManager::renderPlaceholders +} + +void InkHUD::WindowManager::createSystemTiles() +{ + fullscreenTile = new Tile; + notificationTile = new Tile; + batteryIconTile = new Tile; +} + +void InkHUD::WindowManager::placeSystemTiles() +{ + fullscreenTile->placeSystemTile(0, 0, getWidth(), getHeight()); + notificationTile->placeSystemTile(0, 0, getWidth(), 20); // Testing only: constant value + + // Todo: appropriate sizing for the battery icon + const uint16_t batteryIconHeight = Applet::getHeaderHeight() - (2 * 2); + uint16_t batteryIconWidth = batteryIconHeight * 1.8; + + batteryIconTile->placeSystemTile(getWidth() - batteryIconWidth, 2, batteryIconWidth, batteryIconHeight); +} + +// Assign a system applet to the fullscreen tile +// Rendering of user tiles is suspended when the fullscreen tile is occupied +void InkHUD::WindowManager::claimFullscreen(InkHUD::Applet *a) +{ + // Make sure that only system applets use the fullscreen tile + bool isSystemApplet = false; + for (Applet *sa : systemApplets) { + if (sa == a) { + isSystemApplet = true; + break; + } + } + assert(isSystemApplet); + + fullscreenTile->assignApplet(a); +} + +// Clear the fullscreen tile, unlinking whichever system applet is assigned +// This allows the normal rendering of user tiles to resume +void InkHUD::WindowManager::releaseFullscreen() +{ + // Make sure the applet is ready to release the tile + assert(!fullscreenTile->getAssignedApplet()->isForeground()); + + // Break the link between the applet and the fullscreen tile + fullscreenTile->assignApplet(nullptr); +} + +// Some system applets can be assigned to a tile at boot +// These are applets which do have their own tile, and whose assignment never changes +// Applets which: +// - share the fullscreen tile (e.g. logoApplet, pairingApplet), +// - render on user tiles (e.g. menuApplet, placeholderApplet), +// are assigned to the tile only when needed +void InkHUD::WindowManager::assignSystemAppletsToTiles() +{ + notificationTile->assignApplet(notificationApplet); + batteryIconTile->assignApplet(batteryIconApplet); +} + +// Activate or deactivate user applets, to match settings +// Called at boot, or after run-time config changes via menu +// Note: this method does not instantiate the applets; +// this is done in setupNicheGraphics, with WindowManager::addApplet +void InkHUD::WindowManager::createUserApplets() +{ + // Deactivate and remove any no-longer-needed applets + for (uint8_t i = 0; i < userApplets.size(); i++) { + Applet *a = userApplets.at(i); + + // If the applet is active, but settings say it shouldn't be: + // - run applet's custom deactivation code + // - mark applet as inactive (internally) + if (a->isActive() && !settings.userApplets.active[i]) + a->deactivate(); + } + + // Activate and add any new applets + for (uint8_t i = 0; i < userApplets.size() && i < MAX_USERAPPLETS_GLOBAL; i++) { + + // If not activated, but it now should be: + // - run applet's custom activation code + // - mark applet as active (internally) + if (!userApplets.at(i)->isActive() && settings.userApplets.active[i]) + userApplets.at(i)->activate(); + } +} + +void InkHUD::WindowManager::createUserTiles() +{ + // Delete any tiles which currently exist + for (Tile *t : userTiles) + delete t; + userTiles.clear(); + + // Create new tiles + for (uint8_t i = 0; i < settings.userTiles.count; i++) { + Tile *t = new Tile; + userTiles.push_back(t); + } +} + +void InkHUD::WindowManager::placeUserTiles() +{ + // Calculate the display region occupied by each tile + // This determines how pixels are translated from applet-space to windowmanager-space + for (uint8_t i = 0; i < userTiles.size(); i++) + userTiles.at(i)->placeUserTile(settings.userTiles.count, i); +} + +void InkHUD::WindowManager::assignUserAppletsToTiles() +{ + // Set "assignedApplet" property + // Which applet should be initially shown on a tile? + // This is preserved between reboots, but the value needs validating at startup + for (uint8_t i = 0; i < userTiles.size(); i++) { + Tile *t = userTiles.at(i); + + // Check whether tile can display the previously shown applet again + uint8_t oldIndex = settings.userTiles.displayedUserApplet[i]; // Previous index in WindowManager::userApplets + bool canRestore = true; + if (oldIndex > userApplets.size() - 1) // Check if old index is now out of bounds + canRestore = false; + else if (!settings.userApplets.active[oldIndex]) // Check that old applet is still activated + canRestore = false; + else { // Check that the old applet isn't now shown already on a different tile + for (uint8_t i2 = 0; i2 < i; i2++) { + if (settings.userTiles.displayedUserApplet[i2] == oldIndex) { + canRestore = false; + break; + } + } + } + + // Restore previously shown applet if possible, + // otherwise assign nullptr, which will render specially using placeholderApplet + if (canRestore) { + Applet *a = userApplets.at(oldIndex); + t->assignApplet(a); + a->bringToForeground(); + } else { + t->assignApplet(nullptr); + settings.userTiles.displayedUserApplet[i] = -1; // Update settings: current tile has no valid applet + } + } +} + +void InkHUD::WindowManager::refocusTile() +{ + // Validate "focused tile" setting + // - info: focused tile responds to button presses: applet cycling, menu, etc + // - if number of tiles changed, might now be out of index + if (settings.userTiles.focused >= userTiles.size()) + settings.userTiles.focused = 0; + + // Give "focused tile" a valid applet + // - scan for another valid applet, which we can addSubstitution + // - reason: nextApplet() won't cycle if no applet is assigned + Tile *focusedTile = userTiles.at(settings.userTiles.focused); + if (!focusedTile->getAssignedApplet()) { + // Search for available applets + for (uint8_t i = 0; i < userApplets.size(); i++) { + Applet *a = userApplets.at(i); + if (a->isActive() && !a->isForeground()) { + // Found a suitable applet + // Assign it to the focused tile + focusedTile->assignApplet(a); + a->bringToForeground(); + settings.userTiles.displayedUserApplet[settings.userTiles.focused] = i; // Record change: persist after reboot + break; + } + } + } +} + +// Callback for deepSleepObserver +// Returns 0 to signal that we agree to sleep now +int InkHUD::WindowManager::beforeDeepSleep(void *unused) +{ + // Notify all applets that we're shutting down + for (Applet *ua : userApplets) { + ua->onDeactivate(); + ua->onShutdown(); + } + for (Applet *sa : userApplets) { + // Note: no onDeactivate. System applets are always active. + sa->onShutdown(); + } + + // User has successfull executed a safe shutdown + // We don't need to nag at boot anymore + settings.tips.safeShutdownSeen = true; + + saveDataToFlash(); + + // Display the shutdown screen, and wait here until the update is complete + logoApplet->showShutdownScreen(); + forceUpdate(Drivers::EInk::UpdateTypes::FULL, false); + + return 0; // We agree: deep sleep now +} + +// Callback for rebootObserver +// Same as shutdown, without drawing the logoApplet +// Makes sure we don't lose message history / InkHUD config +int InkHUD::WindowManager::beforeReboot(void *unused) +{ + + // Notify all applets that we're "shutting down" + // They don't need to know that it's really a reboot + for (Applet *a : userApplets) { + a->onDeactivate(); + a->onShutdown(); + } + for (Applet *sa : userApplets) { + // Note: no onDeactivate. System applets are always active. + sa->onShutdown(); + } + + saveDataToFlash(); + + return 0; // No special status to report. Ignored anyway by this Observable +} + +#ifdef ARCH_ESP32 +// Callback for lightSleepObserver +// Make sure the display is not partway through an update when we begin light sleep +// This is because some displays require active input from us to terminate the update process, and protect the panel hardware +int InkHUD::WindowManager::beforeLightSleep(void *unused) +{ + if (driver->busy()) { + LOG_INFO("Waiting for display"); + driver->await(); // Wait here for update to complete + } + + return 0; // No special status to report. Ignored anyway by this Observable +} +#endif + +// Callback when a new text message is received +// Caches the most recently received message, for use by applets +// Rx does not trigger a save to flash, however the data *will* be saved alongside other during shutdown, etc. +// Note: this is different from devicestate.rx_text_message, which may contain an *outgoing* message +int InkHUD::WindowManager::onReceiveTextMessage(const meshtastic_MeshPacket *packet) +{ + // Short circuit: don't store outgoing messages + if (getFrom(packet) == nodeDB->getNodeNum()) + return 0; + + // Short circuit: don't store "emoji reactions" + // Possibly some implemetation of this in future? + if (packet->decoded.emoji) + return 0; + + // Determine whether the message is broadcast or a DM + // Store this info to prevent confusion after a reboot + // Avoids need to compare timestamps, because of situation where "future" messages block newly received, if time not set + latestMessage.wasBroadcast = isBroadcast(packet->to); + + // Pick the appropriate variable to store the message in + MessageStore::Message *storedMessage = latestMessage.wasBroadcast ? &latestMessage.broadcast : &latestMessage.dm; + + // Store nodenum of the sender + // Applets can use this to fetch user data from nodedb, if they want + storedMessage->sender = packet->from; + + // Store the time (epoch seconds) when message received + storedMessage->timestamp = getValidTime(RTCQuality::RTCQualityDevice, true); // Current RTC time + + // Store the channel + // - (potentially) used to determine whether notification shows + // - (potentially) used to determine which applet to focus + storedMessage->channelIndex = packet->channel; + + // Store the text + // Need to specify manually how many bytes, because source not null-terminated + storedMessage->text = + std::string(&packet->decoded.payload.bytes[0], &packet->decoded.payload.bytes[packet->decoded.payload.size]); + + return 0; // Tell caller to continue notifying other observers. (No reason to abort this event) +} + +// Triggered by an input source when a short-press fires +// The input source is a separate component; not part of InkHUD +// It is connected in setupNicheGraphics() +void InkHUD::WindowManager::handleButtonShort() +{ + // If notification is open: close it + if (notificationApplet->isForeground()) { + notificationApplet->dismiss(); + forceUpdate(EInk::UpdateTypes::FULL); // Redraw everything, to clear the notification + } + + // If window manager is locked: lock owner handles button + else if (lockOwner) + lockOwner->onButtonShortPress(); + + // Normally: next applet + else + nextApplet(); +} + +// Triggered by an input source when a long-press fires +// The input source is a separate component; not part of InkHUD +// It is connected in setupNicheGraphics() +// Note: input source should raise this while button still held +void InkHUD::WindowManager::handleButtonLong() +{ + if (lockOwner) + lockOwner->onButtonLongPress(); + + else + menuApplet->show(userTiles.at(settings.userTiles.focused)); +} + +// On the currently focussed tile: cycle to the next available user applet +// Applets available for this must be activated, and not already displayed on another tile +void InkHUD::WindowManager::nextApplet() +{ + Tile *t = userTiles.at(settings.userTiles.focused); + + // Abort if zero applets available + // nullptr means WindowManager::refocusTile determined that there were no available applets + if (!t->getAssignedApplet()) + return; + + // Find the index of the applet currently shown on the tile + uint8_t appletIndex = -1; + for (uint8_t i = 0; i < userApplets.size(); i++) { + if (userApplets.at(i) == t->getAssignedApplet()) { + appletIndex = i; + break; + } + } + + // Confirm that we did find the applet + assert(appletIndex != (uint8_t)-1); + + // Iterate forward through the WindowManager::applets, looking for the next valid applet + Applet *nextValidApplet = nullptr; + // for (uint8_t i = (appletIndex + 1) % applets.size(); i != appletIndex; i = (i + 1) % applets.size()) { + for (uint8_t i = 1; i < userApplets.size(); i++) { + uint8_t newAppletIndex = (appletIndex + i) % userApplets.size(); + Applet *a = userApplets.at(newAppletIndex); + + // Looking for an applet which is active (enabled by user), but currently in background + if (a->isActive() && !a->isForeground()) { + nextValidApplet = a; + settings.userTiles.displayedUserApplet[settings.userTiles.focused] = + newAppletIndex; // Remember this setting between boots! + break; + } + } + + // Confirm that we found another applet + if (!nextValidApplet) + return; + + // Hide old applet, show new applet + t->getAssignedApplet()->sendToBackground(); + t->assignApplet(nextValidApplet); + nextValidApplet->bringToForeground(); + forceUpdate(EInk::UpdateTypes::FAST); // bringToForeground already requested, but we're manually forcing FAST +} + +// Focus on a different tile +// The "focused tile" is the one which cycles applets on user button press, +// and the one where the menu will be displayed +// Note: this method is only used by an aux button +// The menuApplet manually performs a subset of these actions, to avoid disturbing the stale image on adjacent tiles +void InkHUD::WindowManager::nextTile() +{ + // Close the menu applet if open + // We done *really* want to do this, but it simplifies handling *a lot* + if (menuApplet->isForeground()) + menuApplet->sendToBackground(); + + // Seems like some system applet other than menu is open. Pairing? Booting? + if (!canRequestUpdate()) + return; + + // Swap to next tile + settings.userTiles.focused = (settings.userTiles.focused + 1) % settings.userTiles.count; + + // Make sure that we don't get stuck on the placeholder tile + // changeLayout reassigns applets to tiles + changeLayout(); + + // Ask the tile to draw an indicator showing which tile is now focused + // Requests a render + userTiles.at(settings.userTiles.focused)->requestHighlight(); +} + +// Perform necessary reconfiguration when user changes number of tiles (or rotation) at run-time +// Call after changing settings.tiles.count +void InkHUD::WindowManager::changeLayout() +{ + // Recreate tiles + // - correct number created, from settings.userTiles.count + // - set dimension and position of tiles, according to layout + createUserTiles(); + placeUserTiles(); + placeSystemTiles(); + + // Handle fewer tiles + // - background any applets which have lost their tile + findOrphanApplets(); + + // Handle more tiles + // - create extra applets + // - assign them to the new extra tiles + createUserApplets(); + assignUserAppletsToTiles(); + + // Focus a valid tile + // - info: focused tile is the one which cycles applets when user button pressed + // - may now be out of bounds if tile count has decreased + refocusTile(); + + // Restore menu + // - its tile was just destroyed and recreated (createUserTiles) + // - its assignment was cleared (assignUserAppletsToTiles) + if (menuApplet->isForeground()) { + Tile *ft = userTiles.at(settings.userTiles.focused); + menuApplet->show(ft); + } + + // Force-render + // - redraw all applets + forceUpdate(EInk::UpdateTypes::FAST); +} + +// Perform necessary reconfiguration when user activates or deactivates applets at run-time +// Call after changing settings.userApplets.active +void InkHUD::WindowManager::changeActivatedApplets() +{ + assert(menuApplet->isForeground()); + + // Activate or deactivate applets + // - to match value of settings.userApplets.active + createUserApplets(); + + // Assign the placeholder applet + // - if applet was foreground on a tile when deactivated, swap it with a placeholder + // - placeholder applet may be assigned to multiple tiles, if needed + assignUserAppletsToTiles(); + + // Ensure focused tile has a valid applet + // - if focused tile's old applet was deactivated, give it a real applet, instead of placeholder + // - reason: nextApplet() won't cycle applets if placeholder is shown + refocusTile(); + + // Restore menu + // - its assignment was cleared (assignUserAppletsToTiles) + if (menuApplet->isForeground()) { + Tile *ft = userTiles.at(settings.userTiles.focused); + menuApplet->show(ft); + } + + // Force-render + // - redraw all applets + forceUpdate(EInk::UpdateTypes::FAST); +} + +// Change whether the battery icon is displayed (top left corner) +// Don't toggle the OptionalFeatures value before calling this, our method handles it internally +void InkHUD::WindowManager::toggleBatteryIcon() +{ + assert(batteryIconApplet->isActive()); + settings.optionalFeatures.batteryIcon = !settings.optionalFeatures.batteryIcon; // Preserve the change between boots + + // Show or hide the applet + if (settings.optionalFeatures.batteryIcon) + batteryIconApplet->bringToForeground(); + else + batteryIconApplet->sendToBackground(); + + // Force-render + // - redraw all applets + forceUpdate(EInk::UpdateTypes::FAST); +} + +// Allow applets to suppress notifications +// Applets will be asked whether they approve, before a notification is shown via the NotificationApplet +// An applet might want to suppress a notification if the applet itself already displays this info +// Example: AllMessageApplet should not approve notifications for messages, if it is in foreground +bool InkHUD::WindowManager::approveNotification(InkHUD::Notification &n) +{ + // Ask all currently displayed applets + for (Tile *ut : userTiles) { + Applet *ua = ut->getAssignedApplet(); + if (ua && !ua->approveNotification(n)) + return false; + } + + // Nobody objected + return true; +} + +// Set a flag, which will be picked up by runOnce, ASAP. +// Quite likely, multiple applets will all want to respond to one event (Observable, etc) +// Each affected applet can independently call requestUpdate(), and all share the one opportunity to render, at next runOnce +void InkHUD::WindowManager::requestUpdate() +{ + requestingUpdate = true; + + // We will run the thread as soon as we loop(), + // after all Applets have had a chance to observe whatever event set this off + OSThread::setIntervalFromNow(0); + OSThread::enabled = true; + runASAP = true; +} + +// requestUpdate will not actually update if no requests were made by applets which are actually visible +// This can occur, because applets requestUpdate even from the background, +// in case the user's autoshow settings permit them to be moved to foreground. +// Sometimes, however, we will want to trigger a display update manually, in the absense of any sort of applet event +// Display health, for example. +// In these situations, we use forceUpdate +void InkHUD::WindowManager::forceUpdate(EInk::UpdateTypes type, bool async) +{ + requestingUpdate = true; + forcingUpdate = true; + forcedUpdateType = type; + + // Normally, we need to start the timer, in case the display is busy and we briefly defer the update + if (async) { + // We will run the thread as soon as we loop(), + // after all Applets have had a chance to observe whatever event set this off + OSThread::setIntervalFromNow(0); + OSThread::enabled = true; + runASAP = true; + } + + // If the update is *not* asynchronous, we begin the render process directly here + // so that it can block code flow while running + else + render(false); +} + +// Receives rendered image data from an Applet, via a tile +// When applets render, they output pixel data relative to their own left / top edges +// They pass this pixel data to tile, which offsets the pixels, making them relative to the display left / top edges +// That data is then passed to this method, which applies any rotation, then places the pixels into the image buffer +// That image buffer is the fully-formatted data handed off to the driver +void InkHUD::WindowManager::handleTilePixel(int16_t x, int16_t y, Color c) +{ + rotatePixelCoords(&x, &y); + setBufferPixel(x, y, c); +} + +// Width of the display, relative to rotation +uint16_t InkHUD::WindowManager::getWidth() +{ + if (settings.rotation % 2) + return driver->height; + else + return driver->width; +} + +// Height of the display, relative to rotation +uint16_t InkHUD::WindowManager::getHeight() +{ + if (settings.rotation % 2) + return driver->width; + else + return driver->height; +} + +// How many user applets have been built? Includes applets which have been inactivated by user config +uint8_t InkHUD::WindowManager::getAppletCount() +{ + return userApplets.size(); +} + +// A tidy title for applets: used on-display in some situations +// Index is the order in the WindowManager::userApplets vector +// This is the same order that applets were added in setupNicheGraphics +const char *InkHUD::WindowManager::getAppletName(uint8_t index) +{ + return userApplets.at(index)->name; +} + +// Allows a system applet to prevent other applets from temporarily requesting updates +// All user applets will honor this. Some system applets might not, although they probably should +// WindowManager::forceUpdate will ignore this lock +void InkHUD::WindowManager::lock(Applet *owner) +{ + // Only one system applet may lock render at once + assert(!lockOwner); + + // Only system applets may lock rendering + for (Applet *a : userApplets) + assert(owner != a); + + lockOwner = owner; +} + +// Remove a lock placed by a system applet, which prevents other applets from rendering +void InkHUD::WindowManager::unlock(Applet *owner) +{ + assert(lockOwner = owner); + lockOwner = nullptr; + + // Raise this as an event (system applets only) + // - in case applet waiting for lock + // - in case applet relinquished its lock earlier, and wants it back + for (Applet *sa : systemApplets) { + // Don't raise event for the applet which is calling unlock + // - avoid loop of unlock->lock (some implementations of Applet::onLockAvailable) + if (sa != owner) + sa->onLockAvailable(); + } +} + +// Is an applet blocked from requesting update by a current lock? +// Applets are allowed to request updates if there is no lock, or if they are the owner of the lock +// If a == nullptr, checks permission "for everyone and anyone" +bool InkHUD::WindowManager::canRequestUpdate(Applet *a) +{ + if (!lockOwner) + return true; + else if (lockOwner == a) + return true; + else + return false; +} + +// Get the applet which is currently locking rendering +// We might be able to convince it release its lock, if we want it instead +InkHUD::Applet *InkHUD::WindowManager::whoLocked() +{ + return WindowManager::lockOwner; +} + +// Runs at regular intervals +// WindowManager's uses of this include: +// - postponing render: until next loop(), allowing all applets to be notified of some Mesh event before render +// - queuing another render: while one is already is progress +int32_t InkHUD::WindowManager::runOnce() +{ + // If an applet asked to render, and hardware is able, lets try now + if (requestingUpdate && !driver->busy()) { + render(); + } + + // If our render() call failed, try again shortly + // otherwise, stop our thread until next update due + if (requestingUpdate) + return 250UL; + else + return OSThread::disable(); +} + +// Some applets may be permitted to bring themselved to foreground, to show new data +// User selects which applets have this permission via on-screen menu +// Priority is determined by the order which applets were added to WindowManager in setupNicheGraphics +// We will only autoshow one applet +void InkHUD::WindowManager::autoshow() +{ + for (uint8_t i = 0; i < userApplets.size(); i++) { + Applet *a = userApplets.at(i); + if (a->wantsToAutoshow() // Applet wants to become foreground + && !a->isForeground() // Not yet foreground + && settings.userApplets.autoshow[i] // User permits this applet to autoshow + && canRequestUpdate()) // Updates not currently blocked by system applet + { + Tile *t = userTiles.at(settings.userTiles.focused); // Get focused tile + t->getAssignedApplet()->sendToBackground(); // Background whichever applet is already on the tile + t->assignApplet(a); // Assign our new applet to tile + a->bringToForeground(); // Foreground our new applet + + // Check if autoshown applet shows the same information as notification intended to + // In this case, we can dismiss the notification before it is shown + // Note: we are re-running the approval process. This normally occurs when the notification is initially triggered. + if (notificationApplet->isForeground() && !notificationApplet->isApproved()) + notificationApplet->dismiss(); + + break; // One autoshow only! Avoid conflicts + } + } +} + +// Check whether an update is justified +// We usually require that a foreground applet requested the update, +// but forceUpdate call will bypass these checks. +// Abstraction for WindowManager::render only +bool InkHUD::WindowManager::shouldUpdate() +{ + bool should = false; + + // via forceUpdate + should |= forcingUpdate; + + // via user applet + for (Tile *ut : userTiles) { + Applet *ua = ut->getAssignedApplet(); + if (ua // Tile has valid applet + && ua->wantsToRender() // This applet requested display update + && ua->isForeground() // This applet is currently shown + && canRequestUpdate()) // Requests are not currently locked + { + should = true; + break; + } + } + + // via system applet + for (Applet *sa : systemApplets) { + if (sa->wantsToRender() // This applet requested + && sa->isForeground() // This applet is currently shown + && canRequestUpdate(sa)) // Requests are not currently locked, or this applet owns the lock + { + should = true; + break; + } + } + + return should; +} + +// Determine which type of E-Ink update the display will perform, to change the image. +// Considers the needs of the various applets, then weighs against display health. +// An update type specified by forceUpdate will be granted with no further questioning. +// Abstraction for WindowManager::render only +Drivers::EInk::UpdateTypes InkHUD::WindowManager::selectUpdateType() +{ + // Ask applets which update type they would prefer + // Some update types take priority over others + EInk::UpdateTypes type = EInk::UpdateTypes::UNSPECIFIED; + if (forcingUpdate) { + // Update type was manually specified via forceUpdate + type = forcedUpdateType; + } else { + // User applets + for (Tile *ut : userTiles) { + Applet *ua = ut->getAssignedApplet(); + if (ua && ua->isForeground() && canRequestUpdate()) + type = mediator.prioritize(type, ua->wantsUpdateType()); + } + // System Applets + for (Applet *sa : systemApplets) { + if (sa->isForeground() && canRequestUpdate(sa)) + type = mediator.prioritize(type, sa->wantsUpdateType()); + } + } + + // Tell the mediator what update type the applets deciced on, + // find out what update type the mediator will actually allow us to have + type = mediator.evaluate(type); + + return type; +} + +// Run the drawing operations of any user applets which are currently displayed +// Pixel output is placed into the framebuffer, ready for handoff to the EInk driver +// Abstraction for WindowManager::render only +void InkHUD::WindowManager::renderUserApplets() +{ + // Don't render any user applets if the screen is covered by a system applet using the fullscreen tile + if (fullscreenTile->getAssignedApplet()) + return; + + // For each tile + for (Tile *ut : userTiles) { + Applet *ua = ut->getAssignedApplet(); // Get the applet on the tile + + // Don't render if tile has no applet. Handled in renderPlaceholders + if (!ua) + continue; + + // Don't render the menu applet, Handled by renderSystemApplets + if (ua == menuApplet) + continue; + + uint32_t start = millis(); + ua->render(); // Draw! + uint32_t stop = millis(); + LOG_DEBUG("%s took %dms to render", ua->name, stop - start); + } +} + +// Run the drawing operations of any system applets which are currently displayed +// Pixel output is placed into the framebuffer, ready for handoff to the EInk driver +// Abstraction for WindowManager::render only +void InkHUD::WindowManager::renderSystemApplets() +{ + // Each system applet + for (Applet *sa : systemApplets) { + // Skip if not shown + if (!sa->isForeground()) + continue; + + // Don't draw the battery overtop the menu + // Todo: smarter way to handle this + if (sa == batteryIconApplet && menuApplet->isForeground()) + continue; + + // Skip applet if fullscreen tile is in use, but not used by this applet + // Applet is "obscured" + if (fullscreenTile->getAssignedApplet() && fullscreenTile->getAssignedApplet() != sa) + continue; + + // uint32_t start = millis(); // Debugging only: runtime + sa->render(); // Draw! + // uint32_t stop = millis(); // Debugging only: runtime + // LOG_DEBUG("%s (system) took %dms to render", (sa->name == nullptr) ? "Unnamed" : sa->name, stop - start); + } +} + +// In some situations (e.g. layout or applet selection changes), +// a user tile can end up without an assigned applet. +// In this case, we will fill the empty space with diagonal lines. +void InkHUD::WindowManager::renderPlaceholders() +{ + // Don't draw if obscured by the fullscreen tile + if (fullscreenTile->getAssignedApplet()) + return; + + for (Tile *ut : userTiles) { + // If no applet assigned + if (!ut->getAssignedApplet()) { + ut->assignApplet(placeholderApplet); + placeholderApplet->render(); + ut->assignApplet(nullptr); + } + } +} + +// Make an attempt to gather image data from some / all applets, and update the display +// Might not be possible right now, if update already is progress. +void InkHUD::WindowManager::render(bool async) +{ + // Make sure the display is ready for a new update + if (async) { + // Previous update still running, Will try again shortly, via runOnce() + if (driver->busy()) + return; + } else { + // Wait here for previous update to complete + driver->await(); + } + + // (Potentially) change applet to display new info, + // then check if this newly displayed applet makes a pending notification redundant + autoshow(); + + // If an update is justified. + // We don't know this until after autoshow has run, as new applets may now be in foreground + if (shouldUpdate()) { + + // Decide which technique the display will use to change image + EInk::UpdateTypes updateType = selectUpdateType(); + + // Render the new image + clearBuffer(); + renderUserApplets(); + renderSystemApplets(); + renderPlaceholders(); + + // Tell display to begin process of drawing new image + LOG_INFO("Updating display"); + driver->update(imageBuffer, updateType); + + // If not async, wait here until the update is complete + if (!async) + driver->await(); + } else + LOG_DEBUG("Not updating display"); + + // Our part is done now. + // If update is async, the display hardware is still performing the update process, + // but that's all handled by NicheGraphics::Drivers::EInk + + // Tidy up, ready for a new request + requestingUpdate = false; + forcingUpdate = false; + forcedUpdateType = EInk::UpdateTypes::UNSPECIFIED; +} + +// Set a ready-to-draw pixel into the image buffer +// All rotations / translations have already taken place: this buffer data is formatted ready for the driver +void InkHUD::WindowManager::setBufferPixel(int16_t x, int16_t y, Color c) +{ + uint32_t byteNum = (y * imageBufferWidth) + (x / 8); // X data is 8 pixels per byte + uint8_t bitNum = 7 - (x % 8); // Invert order: leftmost bit (most significant) is leftmost pixel of byte. + + bitWrite(imageBuffer[byteNum], bitNum, c); +} + +// Applies the system-wide rotation to pixel positions +// This step is applied to image data which has already been translated by a Tile object +// This is the final step before the pixel is placed into the image buffer +// No return: values of the *x and *y parameters are modified by the method +void InkHUD::WindowManager::rotatePixelCoords(int16_t *x, int16_t *y) +{ + // Apply a global rotation to pixel locations + int16_t x1 = 0; + int16_t y1 = 0; + switch (settings.rotation) { + case 0: + x1 = *x; + y1 = *y; + break; + case 1: + x1 = (driver->width - 1) - *y; + y1 = *x; + break; + case 2: + x1 = (driver->width - 1) - *x; + y1 = (driver->height - 1) - *y; + break; + case 3: + x1 = *y; + y1 = (driver->height - 1) - *x; + break; + } + *x = x1; + *y = y1; +} + +// Manually fill the image buffer with WHITE +// Clears any old drawing +void InkHUD::WindowManager::clearBuffer() +{ + memset(imageBuffer, 0xFF, imageBufferHeight * imageBufferWidth); +} + +// Seach for any applets which believe they are foreground, but no longer have a valid tile +// Tidies up after layout changes at runtime +void InkHUD::WindowManager::findOrphanApplets() +{ + for (uint8_t ia = 0; ia < userApplets.size(); ia++) { + Applet *a = userApplets.at(ia); + + // Applet doesn't believe it is displayed: not orphaned + if (!a->isForeground()) + continue; + + // Check each tile, to see if anyone claims this applet + bool foundOwner = false; + for (uint8_t it = 0; it < userTiles.size(); it++) { + Tile *t = userTiles.at(it); + // A tile claims this applet: not orphaned + if (t->getAssignedApplet() == a) { + foundOwner = true; + break; + } + } + + // Orphan found + // Tell the applet that no tile is currently displaying it + // This allows the focussed tile to cycle to this applet again by pressing user button + if (!foundOwner) + a->sendToBackground(); + } +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/WindowManager.h b/src/graphics/niche/InkHUD/WindowManager.h new file mode 100644 index 000000000..f701233e2 --- /dev/null +++ b/src/graphics/niche/InkHUD/WindowManager.h @@ -0,0 +1,177 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + + Singleton class, which manages the broadest InkHUD behaviors + + Tasks include: + - containing instances of Tiles and Applets + - co-ordinating display updates + - interacting with other NicheGraphics componets, such as the driver, and input sources + - handling system-wide events (e.g. shutdown) + +*/ + +#pragma once + +#include "configuration.h" + +#include + +#include "main.h" +#include "modules/TextMessageModule.h" +#include "power.h" +#include "sleep.h" + +#include "./Applet.h" +#include "./Applets/System/Notification/Notification.h" +#include "./Persistence.h" +#include "./Tile.h" +#include "./Types.h" +#include "./UpdateMediator.h" +#include "graphics/niche/Drivers/EInk/EInk.h" + +namespace NicheGraphics::InkHUD +{ + +class Applet; +class Tile; + +class LogoApplet; +class MenuApplet; +class NotificationApplet; + +class WindowManager : protected concurrency::OSThread +{ + public: + static WindowManager *getInstance(); // Get or create singleton instance + + void setDriver(NicheGraphics::Drivers::EInk *driver); // Assign a driver class + void setDisplayResilience(uint8_t fastPerFull, float stressMultiplier); // How many FAST updates before FULL + void addApplet(const char *name, Applet *a, bool defaultActive = false, bool defaultAutoshow = false, + uint8_t onTile = -1); // Select which applets are used with InkHUD + void begin(); // Start running the window manager (provisioning done) + + void createSystemApplets(); // Instantiate and activate system applets + void createSystemTiles(); // Instantiate tiles which host system applets + void assignSystemAppletsToTiles(); + void placeSystemTiles(); // Set position and size + void claimFullscreen(Applet *sa); // Assign a system applet to the fullscreen tile + void releaseFullscreen(); // Remove any system applet from the fullscreen tile + + void createUserApplets(); // Activate user's selected applets + void createUserTiles(); // Instantiate enough tiles for user's selected layout + void assignUserAppletsToTiles(); + void placeUserTiles(); // Automatically place tiles, according to user's layout + void refocusTile(); // Ensure focused tile has a valid applet + + int beforeDeepSleep(void *unused); // Prepare for shutdown + int beforeReboot(void *unused); // Prepare for reboot + int onReceiveTextMessage(const meshtastic_MeshPacket *packet); // Store most recent text message +#ifdef ARCH_ESP32 + int beforeLightSleep(void *unused); // Prepare for light sleep +#endif + + void handleButtonShort(); // User button: short press + void handleButtonLong(); // User button: long press + + void nextApplet(); // Cycle through user applets + void nextTile(); // Focus the next tile (when showing multiple applets at once) + + void changeLayout(); // Change tile layout or count + void changeActivatedApplets(); // Change which applets are activated + void toggleBatteryIcon(); // Change whether the battery icon is shown + bool approveNotification(Notification &n); // Ask applets if a notification is worth showing + + void handleTilePixel(int16_t x, int16_t y, Color c); // Apply rotation, then store the pixel in framebuffer + void requestUpdate(); // Update display, if a foreground applet has info it wants to show + void forceUpdate(Drivers::EInk::UpdateTypes type = Drivers::EInk::UpdateTypes::UNSPECIFIED, + bool async = true); // Update display, regardless of whether any applets requested this + + uint16_t getWidth(); // Display width, relative to rotation + uint16_t getHeight(); // Display height, relative to rotation + uint8_t getAppletCount(); // How many user applets are available, including inactivated + const char *getAppletName(uint8_t index); // By order in userApplets + + void lock(Applet *owner); // Allows system applets to prevent other applets triggering a refresh + void unlock(Applet *owner); // Allows normal updating of user applets to continue + bool canRequestUpdate(Applet *a = nullptr); // Checks if allowed to request an update (not locked by other applet) + Applet *whoLocked(); // Find which applet is blocking update requests, if any + + protected: + WindowManager(); // Private constructor for singleton + + int32_t runOnce() override; + + void clearBuffer(); // Empty the framebuffer + void autoshow(); // Show a different applet, to display new info + bool shouldUpdate(); // Check if reason to change display image + Drivers::EInk::UpdateTypes selectUpdateType(); // Determine how the display hardware will perform the image update + void renderUserApplets(); // Draw all currently displayed user applets to the frame buffer + void renderSystemApplets(); // Draw all currently displayed system applets to the frame buffer + void renderPlaceholders(); // Draw diagonal lines on user tiles which have no assigned applet + void render(bool async = true); // Attempt to update the display + + void setBufferPixel(int16_t x, int16_t y, Color c); // Place pixels into the frame buffer. All translation / rotation done. + void rotatePixelCoords(int16_t *x, int16_t *y); // Apply the display rotation + + void findOrphanApplets(); // Find any applets left-behind when layout changes + + // Get notified when the system is shutting down + CallbackObserver deepSleepObserver = + CallbackObserver(this, &WindowManager::beforeDeepSleep); + + // Get notified when the system is rebooting + CallbackObserver rebootObserver = + CallbackObserver(this, &WindowManager::beforeReboot); + + // Cache *incoming* text messages, for use by applets + CallbackObserver textMessageObserver = + CallbackObserver(this, &WindowManager::onReceiveTextMessage); + +#ifdef ARCH_ESP32 + // Get notified when the system is entering light sleep + CallbackObserver lightSleepObserver = + CallbackObserver(this, &WindowManager::beforeLightSleep); +#endif + + NicheGraphics::Drivers::EInk *driver = nullptr; + uint8_t *imageBuffer; // Fed into driver + uint16_t imageBufferHeight; + uint16_t imageBufferWidth; + uint32_t imageBufferSize; // Bytes + + // Encapsulates decision making about E-Ink update types + // Responsible for display health + UpdateMediator mediator; + + // User Applets + std::vector userApplets; + std::vector userTiles; + + // System Applets + std::vector systemApplets; + Tile *fullscreenTile = nullptr; + Tile *notificationTile = nullptr; + Tile *batteryIconTile = nullptr; + LogoApplet *logoApplet; + Applet *pairingApplet; + Applet *tipsApplet; + NotificationApplet *notificationApplet; + Applet *batteryIconApplet; + MenuApplet *menuApplet; + Applet *placeholderApplet; + + // requestUpdate + bool requestingUpdate = false; // WindowManager::render run pending + + // forceUpdate + bool forcingUpdate = false; // WindowManager::render run pending, guaranteed no skip of update + Drivers::EInk::UpdateTypes forcedUpdateType = Drivers::EInk::UpdateTypes::UNSPECIFIED; // guaranteed update using this type + + Applet *lockOwner = nullptr; // Which system applet (if any) is preventing other applets from requesting update +}; + +}; // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/Inputs/README.md b/src/graphics/niche/Inputs/README.md new file mode 100644 index 000000000..767352881 --- /dev/null +++ b/src/graphics/niche/Inputs/README.md @@ -0,0 +1,7 @@ +# NiceGraphics - Inputs + +General purpose input sources, for use with NicheGraphics UIs. + +By remaining independent, we can have tailored input sources with further complicating the code in ButtonThread and the canned messages module. + +Depending on its role, a NicheGraphics UI may or may not want to make use of the existing input broker. diff --git a/src/graphics/niche/Inputs/TwoButton.cpp b/src/graphics/niche/Inputs/TwoButton.cpp new file mode 100644 index 000000000..e478364cc --- /dev/null +++ b/src/graphics/niche/Inputs/TwoButton.cpp @@ -0,0 +1,272 @@ +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +#include "./TwoButton.h" + +#include "PowerFSM.h" +#include "sleep.h" + +using namespace NicheGraphics::Inputs; + +TwoButton::TwoButton() : concurrency::OSThread("TwoButton") +{ + // Don't start polling buttons for release immediately + // Assume they are in a "released" state at boot + OSThread::disable(); + +#ifdef ARCH_ESP32 + // Register callbacks for before and after lightsleep + lsObserver.observe(¬ifyLightSleep); + lsEndObserver.observe(¬ifyLightSleepEnd); +#endif +} + +// Get access to (or create) the singleton instance of this class +// Accessible inside the ISRs, even though we maybe shouldn't +TwoButton *TwoButton::getInstance() +{ + // Instantiate the class the first time this method is called + static TwoButton *const singletonInstance = new TwoButton; + + return singletonInstance; +} + +// Begin receiving button input +// We probably need to do this after sleep, as well as at boot +void TwoButton::start() +{ + if (buttons[0].pin != 0xFF) + attachInterrupt(buttons[0].pin, TwoButton::isrPrimary, buttons[0].activeLogic == LOW ? FALLING : RISING); + + if (buttons[1].pin != 0xFF) + attachInterrupt(buttons[1].pin, TwoButton::isrSecondary, buttons[1].activeLogic == LOW ? FALLING : RISING); +} + +// Stop receiving button input, and run custom sleep code +// Called before device sleeps. This might be power-off, or just ESP32 light sleep +// Some devices will want to attach interrupts here, for the user button to wake from sleep +void TwoButton::stop() +{ + if (buttons[0].pin != 0xFF) + detachInterrupt(buttons[0].pin); + + if (buttons[1].pin != 0xFF) + detachInterrupt(buttons[1].pin); +} + +// Configures the wiring and logic of either button +// Called when outlining your NicheGraphics implementation, in variant/nicheGraphics.cpp +void TwoButton::setWiring(uint8_t whichButton, uint8_t pin, bool internalPullup) +{ + assert(whichButton < 2); + buttons[whichButton].pin = pin; + buttons[whichButton].activeLogic = LOW; + buttons[whichButton].mode = internalPullup ? INPUT_PULLUP : INPUT; // fix me + + pinMode(buttons[whichButton].pin, buttons[whichButton].mode); +} + +void TwoButton::setTiming(uint8_t whichButton, uint32_t debounceMs, uint32_t longpressMs) +{ + assert(whichButton < 2); + buttons[whichButton].debounceLength = debounceMs; + buttons[whichButton].longpressLength = longpressMs; +} + +// Set what should happen when a button becomes pressed +// Use this to implement a "while held" behavior +void TwoButton::setHandlerDown(uint8_t whichButton, Callback onDown) +{ + assert(whichButton < 2); + buttons[whichButton].onDown = onDown; +} + +// Set what should happen when a button becomes unpressed +// Use this to implement a "While held" behavior +void TwoButton::setHandlerUp(uint8_t whichButton, Callback onUp) +{ + assert(whichButton < 2); + buttons[whichButton].onUp = onUp; +} + +// Set what should happen when a "short press" event has occurred +void TwoButton::setHandlerShortPress(uint8_t whichButton, Callback onShortPress) +{ + assert(whichButton < 2); + buttons[whichButton].onShortPress = onShortPress; +} + +// Set what should happen when a "long press" event has fired +// Note: this will occur while the button is still held +void TwoButton::setHandlerLongPress(uint8_t whichButton, Callback onLongPress) +{ + assert(whichButton < 2); + buttons[whichButton].onLongPress = onLongPress; +} + +// Handle the start of a press to the primary button +// Wakes our button thread +void TwoButton::isrPrimary() +{ + static volatile bool isrRunning = false; + + if (!isrRunning) { + isrRunning = true; + TwoButton *b = TwoButton::getInstance(); + if (b->buttons[0].state == State::REST) { + b->buttons[0].state = State::IRQ; + b->buttons[0].irqAtMillis = millis(); + b->startThread(); + } + isrRunning = false; + } +} + +// Handle the start of a press to the secondary button +// Wakes our button thread +void TwoButton::isrSecondary() +{ + static volatile bool isrRunning = false; + + if (!isrRunning) { + isrRunning = true; + TwoButton *b = TwoButton::getInstance(); + if (b->buttons[1].state == State::REST) { + b->buttons[1].state = State::IRQ; + b->buttons[1].irqAtMillis = millis(); + b->startThread(); + } + isrRunning = false; + } +} + +// Concise method to start our button thread +// Follows an ISR, listening for button release +void TwoButton::startThread() +{ + if (!OSThread::enabled) { + OSThread::setInterval(50); + OSThread::enabled = true; + } +} + +// Concise method to stop our button thread +// Called when we no longer need to poll for button release +void TwoButton::stopThread() +{ + if (OSThread::enabled) { + OSThread::disable(); + } + + // Reset both buttons manually + // Just in case an IRQ fires during the process of resetting the system + // Can occur with super rapid presses? + buttons[0].state = REST; + buttons[1].state = REST; +} + +// Our button thread +// Started by an IRQ, on either button +// Polls for button releases +// Stops when both buttons released +int32_t TwoButton::runOnce() +{ + constexpr uint8_t BUTTON_COUNT = sizeof(buttons) / sizeof(Button); + + // Allow either button to request that our thread should continue polling + bool awaitingRelease = false; + + // Check both primary and secondary buttons + for (uint8_t i = 0; i < BUTTON_COUNT; i++) { + switch (buttons[i].state) { + // No action: button has not been pressed + case REST: + break; + + // New press detected by interrupt + case IRQ: + powerFSM.trigger(EVENT_PRESS); // Tell PowerFSM that press occurred (resets sleep timer) + buttons[i].onDown(); // Inform that press has begun (possible hold behavior) + buttons[i].state = State::POLLING_UNFIRED; // Mark that button-down has been handled + awaitingRelease = true; // Mark that polling-for-release should continue + break; + + // An existing press continues + // Not held long enough to register as longpress + case POLLING_UNFIRED: { + uint32_t length = millis() - buttons[i].irqAtMillis; + + // If button released since last thread tick, + if (digitalRead(buttons[i].pin) != buttons[i].activeLogic) { + buttons[i].onUp(); // Inform that press has ended (possible release of a hold) + buttons[i].state = State::REST; // Mark that the button has reset + if (length > buttons[i].debounceLength && length < buttons[i].longpressLength) + buttons[i].onShortPress(); + } + + // If button not yet released + else { + awaitingRelease = true; // Mark that polling-for-release should continue + if (length >= buttons[i].longpressLength) { + // Raise a long press event, once + // Then continue waiting for release, to rearm + buttons[i].state = State::POLLING_FIRED; + buttons[i].onLongPress(); + } + } + break; + } + + // Button still held, but duration long enough that longpress event already fired + // Just waiting for release + case POLLING_FIRED: + // Release detected + if (digitalRead(buttons[i].pin) != buttons[i].activeLogic) { + buttons[i].state = State::REST; + buttons[i].onUp(); // Possible release of hold (in this case: *after* longpress has fired) + } + // Not yet released, keep polling + else + awaitingRelease = true; + break; + } + } + + // If both buttons are now released + // we don't need to waste cpu resources polling + // IRQ will restart this thread when we next need it + if (!awaitingRelease) + stopThread(); + + // Run this method again, or don't.. + // Use whatever behavior was previously set by stopThread() or startThread() + return OSThread::interval; +} + +#ifdef ARCH_ESP32 + +// Detach our class' interrupts before lightsleep +// Allows sleep.cpp to configure its own interrupts, which wake the device on user-button press +int TwoButton::beforeLightSleep(void *unused) +{ + stop(); + return 0; // Indicates success +} + +// Reconfigure our interrupts +// Our class' interrupts were disconnected during sleep, to allow the user button to wake the device from sleep +int TwoButton::afterLightSleep(esp_sleep_wakeup_cause_t cause) +{ + start(); + + // Manually trigger the button-down ISR + // - during light sleep, our ISR is disabled + // - if light sleep ends by button press, pretend our own ISR caught it + if (cause == ESP_SLEEP_WAKEUP_GPIO) + isrPrimary(); + + return 0; // Indicates success +} + +#endif + +#endif \ No newline at end of file diff --git a/src/graphics/niche/Inputs/TwoButton.h b/src/graphics/niche/Inputs/TwoButton.h new file mode 100644 index 000000000..1e1576256 --- /dev/null +++ b/src/graphics/niche/Inputs/TwoButton.h @@ -0,0 +1,103 @@ +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +/* + +Re-usable NicheGraphics input source + +Short and Long press for up to two buttons +Interrupt driven + +*/ + +#pragma once + +#include "configuration.h" + +#include "assert.h" +#include "functional" + +#ifdef ARCH_ESP32 +#include "esp_sleep.h" // For light-sleep handling +#endif + +#include "Observer.h" + +namespace NicheGraphics::Inputs +{ + +class TwoButton : protected concurrency::OSThread +{ + public: + typedef std::function Callback; + + static TwoButton *getInstance(); // Create or get the singleton instance + void start(); // Start handling button input + void stop(); // Stop handling button input (disconnect ISRs for sleep) + void setWiring(uint8_t whichButton, uint8_t pin, bool internalPulldown = false); + void setTiming(uint8_t whichButton, uint32_t debounceMs, uint32_t longpressMs); + void setHandlerDown(uint8_t whichButton, Callback onDown); + void setHandlerUp(uint8_t whichButton, Callback onUp); + void setHandlerShortPress(uint8_t whichButton, Callback onShortPress); + void setHandlerLongPress(uint8_t whichButton, Callback onLongPress); + + // Disconnect and reconnect interrupts for light sleep +#ifdef ARCH_ESP32 + int beforeLightSleep(void *unused); + int afterLightSleep(esp_sleep_wakeup_cause_t cause); +#endif + + private: + // Internal state of a specific button + enum State { + REST, // Up, no activity + IRQ, // Down detected, not yet handled + POLLING_UNFIRED, // Down handled, polling for release + POLLING_FIRED, // Longpress fired, button still held + }; + + // Contains info about a specific button + // (Array of this struct below) + class Button + { + public: + // Per-button config + uint8_t pin = 0xFF; // 0xFF: unset + bool activeLogic = LOW; // Active LOW by default. Todo: remove, unused + uint8_t mode = INPUT; // Whether to use internal pull up / pull down resistors + uint32_t debounceLength = 50; // Minimum length for shortpress, in ms + uint32_t longpressLength = 500; // How long after button down to fire longpress, in ms + volatile State state = State::REST; // Internal state + volatile uint32_t irqAtMillis; // millis() when button went down + + // Per-button event callbacks + static void noop(){}; + std::function onDown = noop; + std::function onUp = noop; + std::function onShortPress = noop; + std::function onLongPress = noop; + }; + +#ifdef ARCH_ESP32 + // Get notified when lightsleep begins and ends + CallbackObserver lsObserver = CallbackObserver(this, &TwoButton::beforeLightSleep); + CallbackObserver lsEndObserver = + CallbackObserver(this, &TwoButton::afterLightSleep); +#endif + + int32_t runOnce() override; // Timer method. Polls for button release + + void startThread(); // Start polling for release + void stopThread(); // Stop polling for release + + static void isrPrimary(); // Detect start of press + static void isrSecondary(); // Detect start of press (optional aux button) + + TwoButton(); // Constructor made private: force use of Button::instance() + + // Info about both buttons + Button buttons[2]; +}; + +}; // namespace NicheGraphics::Inputs + +#endif \ No newline at end of file diff --git a/src/graphics/niche/README.md b/src/graphics/niche/README.md new file mode 100644 index 000000000..e87464abc --- /dev/null +++ b/src/graphics/niche/README.md @@ -0,0 +1,15 @@ +# NicheGraphics + +A pattern / collection of resources for creating custom UIs, to target small groups of devices which have specific design requirements. + +For an example, see the `heltec-vision-master-e290-inkhud` platformio env. + +- platformio.ini + + - suppress default Meshtastic components (Screen, ButtonThread, etc) + - define `MESHTASTIC_INCLUDE_NICHE_GRAPHICS` + - (possibly) Edit `build_src_filter` to include our new nicheGraphics.h file + +- nicheGraphics.h + - `#include` all necessary components + - perform all setup and config inside a `setupNicheGraphics()` method diff --git a/src/graphics/tftSetup.cpp b/src/graphics/tftSetup.cpp new file mode 100644 index 000000000..c31659c62 --- /dev/null +++ b/src/graphics/tftSetup.cpp @@ -0,0 +1,126 @@ +#if HAS_TFT + +#include "SPILock.h" +#include "sleep.h" + +#include "api/PacketAPI.h" +#include "comms/PacketClient.h" +#include "comms/PacketServer.h" +#include "graphics/DeviceScreen.h" +#include "graphics/driver/DisplayDriverConfig.h" + +#ifdef ARCH_PORTDUINO +#include "PortduinoGlue.h" +#endif + +DeviceScreen *deviceScreen = nullptr; + +#ifdef ARCH_ESP32 +// Get notified when the system is entering light sleep +CallbackObserver tftSleepObserver = + CallbackObserver(deviceScreen, &DeviceScreen::prepareSleep); +CallbackObserver endSleepObserver = + CallbackObserver(deviceScreen, &DeviceScreen::wakeUp); +#endif + +void tft_task_handler(void *param = nullptr) +{ + while (true) { + if (deviceScreen) { + spiLock->lock(); + deviceScreen->task_handler(); + spiLock->unlock(); + deviceScreen->sleep(); + } + } +} + +void tftSetup(void) +{ +#ifndef ARCH_PORTDUINO + deviceScreen = &DeviceScreen::create(); + PacketAPI::create(PacketServer::init()); + deviceScreen->init(new PacketClient); +#else + if (settingsMap[displayPanel] != no_screen) { + DisplayDriverConfig displayConfig; + static char *panels[] = {"NOSCREEN", "X11", "ST7789", "ST7735", "ST7735S", "ST7796", + "ILI9341", "ILI9342", "ILI9486", "ILI9488", "HX8357D"}; + static char *touch[] = {"NOTOUCH", "XPT2046", "STMPE610", "GT911", "FT5x06"}; +#ifdef USE_X11 + if (settingsMap[displayPanel] == x11) { + if (settingsMap[displayWidth] && settingsMap[displayHeight]) + displayConfig = DisplayDriverConfig(DisplayDriverConfig::device_t::X11, (uint16_t)settingsMap[displayWidth], + (uint16_t)settingsMap[displayHeight]); + else + displayConfig.device(DisplayDriverConfig::device_t::X11); + } else +#endif + { + displayConfig.device(DisplayDriverConfig::device_t::CUSTOM_TFT) + .panel(DisplayDriverConfig::panel_config_t{.type = panels[settingsMap[displayPanel]], + .panel_width = (uint16_t)settingsMap[displayWidth], + .panel_height = (uint16_t)settingsMap[displayHeight], + .rotation = (bool)settingsMap[displayRotate], + .pin_cs = (int16_t)settingsMap[displayCS], + .pin_rst = (int16_t)settingsMap[displayReset], + .offset_x = (uint16_t)settingsMap[displayOffsetX], + .offset_y = (uint16_t)settingsMap[displayOffsetY], + .offset_rotation = (uint8_t)settingsMap[displayOffsetRotate], + .invert = settingsMap[displayInvert] ? true : false, + .rgb_order = (bool)settingsMap[displayRGBOrder], + .dlen_16bit = settingsMap[displayPanel] == ili9486 || + settingsMap[displayPanel] == ili9488}) + .bus(DisplayDriverConfig::bus_config_t{.freq_write = (uint32_t)settingsMap[displayBusFrequency], + .freq_read = 16000000, + .spi{.pin_dc = (int8_t)settingsMap[displayDC], + .use_lock = true, + .spi_host = (uint16_t)settingsMap[displayspidev]}}) + .input(DisplayDriverConfig::input_config_t{.keyboardDevice = settingsStrings[keyboardDevice], + .pointerDevice = settingsStrings[pointerDevice]}) + .light(DisplayDriverConfig::light_config_t{.pin_bl = (int16_t)settingsMap[displayBacklight], + .pwm_channel = (int8_t)settingsMap[displayBacklightPWMChannel], + .invert = (bool)settingsMap[displayBacklightInvert]}); + if (settingsMap[touchscreenI2CAddr] == -1) { + displayConfig.touch( + DisplayDriverConfig::touch_config_t{.type = touch[settingsMap[touchscreenModule]], + .freq = (uint32_t)settingsMap[touchscreenBusFrequency], + .pin_int = (int16_t)settingsMap[touchscreenIRQ], + .offset_rotation = (uint8_t)settingsMap[touchscreenRotate], + .spi{ + .spi_host = (int8_t)settingsMap[touchscreenspidev], + }, + .pin_cs = (int16_t)settingsMap[touchscreenCS]}); + } else { + displayConfig.touch(DisplayDriverConfig::touch_config_t{ + .type = touch[settingsMap[touchscreenModule]], + .freq = (uint32_t)settingsMap[touchscreenBusFrequency], + .x_min = 0, + .x_max = + (int16_t)((settingsMap[touchscreenRotate] & 1 ? settingsMap[displayWidth] : settingsMap[displayHeight]) - + 1), + .y_min = 0, + .y_max = + (int16_t)((settingsMap[touchscreenRotate] & 1 ? settingsMap[displayHeight] : settingsMap[displayWidth]) - + 1), + .pin_int = (int16_t)settingsMap[touchscreenIRQ], + .offset_rotation = (uint8_t)settingsMap[touchscreenRotate], + .i2c{.i2c_addr = (uint8_t)settingsMap[touchscreenI2CAddr]}}); + } + } + deviceScreen = &DeviceScreen::create(&displayConfig); + PacketAPI::create(PacketServer::init()); + deviceScreen->init(new PacketClient); + } else { + LOG_INFO("Running without TFT display!"); + } +#endif + +#ifdef ARCH_ESP32 + tftSleepObserver.observe(¬ifyLightSleep); + endSleepObserver.observe(¬ifyLightSleepEnd); + xTaskCreatePinnedToCore(tft_task_handler, "tft", 8192, NULL, 1, NULL, 0); +#endif +} + +#endif \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index e31ece106..2160d73e4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -115,6 +115,24 @@ AccelerometerThread *accelerometerThread = nullptr; AudioThread *audioThread = nullptr; #endif +#if HAS_TFT +extern void tftSetup(void); +#endif + +#ifdef HAS_UDP_MULTICAST +#include "mesh/udp/UdpMulticastThread.h" +UdpMulticastThread *udpThread = nullptr; +#endif + +#if defined(TCXO_OPTIONAL) +float tcxoVoltage = SX126X_DIO3_TCXO_VOLTAGE; // if TCXO is optional, put this here so it can be changed further down. +#endif + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS +void setupNicheGraphics(); +#include "nicheGraphics.h" +#endif + using namespace concurrency; volatile static const char slipstreamTZString[] = {USERPREFS_TZ_STRING}; @@ -131,6 +149,9 @@ meshtastic::GPSStatus *gpsStatus = new meshtastic::GPSStatus(); // Global Node status meshtastic::NodeStatus *nodeStatus = new meshtastic::NodeStatus(); +// Global Bluetooth status +meshtastic::BluetoothStatus *bluetoothStatus = new meshtastic::BluetoothStatus(); + // Scan for I2C Devices /// The I2C address of our display (if found) @@ -249,6 +270,15 @@ void setup() // TF Card , Display backlight(AW9364DNR) , AN48841B(Trackball) , ES7210(Decoder) pinMode(KB_POWERON, OUTPUT); digitalWrite(KB_POWERON, HIGH); + // T-Deck has all three SPI peripherals (TFT, SD, LoRa) attached to the same SPI bus + // We need to initialize all CS pins in advance otherwise there will be SPI communication issues + // e.g. when detecting the SD card + pinMode(LORA_CS, OUTPUT); + digitalWrite(LORA_CS, HIGH); + pinMode(SDCARD_CS, OUTPUT); + digitalWrite(SDCARD_CS, HIGH); + pinMode(TFT_CS, OUTPUT); + digitalWrite(TFT_CS, HIGH); delay(100); #endif @@ -426,6 +456,10 @@ void setup() digitalWrite(AQ_SET_PIN, HIGH); #endif +#if HAS_TFT + tftSetup(); +#endif + // Currently only the tbeam has a PMU // PMU initialization needs to be placed before i2c scanning power = new Power(); @@ -644,9 +678,9 @@ void setup() // but we need to do this after main cpu init (esp32setup), because we need the random seed set nodeDB = new NodeDB; - // If we're taking on the repeater role, use flood router and turn off 3V3_S rail because peripherals are not needed + // If we're taking on the repeater role, use NextHopRouter and turn off 3V3_S rail because peripherals are not needed if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER) { - router = new FloodingRouter(); + router = new NextHopRouter(); #ifdef PIN_3V3_EN digitalWrite(PIN_3V3_EN, LOW); #endif @@ -731,8 +765,9 @@ void setup() #endif // Initialize the screen first so we can show the logo while we start up everything else. +#if HAS_SCREEN screen = new graphics::Screen(screen_found, screen_model, screen_geometry); - +#endif // setup TZ prior to time actions. #if !MESHTASTIC_EXCLUDE_TZ LOG_DEBUG("Use compiled/slipstreamed %s", slipstreamTZString); // important, removing this clobbers our magic string @@ -781,12 +816,22 @@ void setup() LOG_DEBUG("Start audio thread"); audioThread = new AudioThread(); #endif + +#ifdef HAS_UDP_MULTICAST + LOG_DEBUG("Start multicast thread"); + udpThread = new UdpMulticastThread(); +#endif service = new MeshService(); service->init(); // Now that the mesh service is created, create any modules setupModules(); +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + // After modules are setup, so we can observe modules + setupNicheGraphics(); +#endif + #ifdef LED_PIN // Turn LED off after boot, if heartbeat by config if (config.device.led_heartbeat_disabled) @@ -1124,7 +1169,15 @@ void setup() // This must be _after_ service.init because we need our preferences loaded from flash to have proper timeout values PowerFSM_setup(); // we will transition to ON in a couple of seconds, FIXME, only do this for cold boots, not waking from SDS powerFSMthread = new PowerFSMThread(); + +#if !HAS_TFT setCPUFast(false); // 80MHz is fine for our slow peripherals +#endif + +#ifdef ARDUINO_ARCH_ESP32 + LOG_DEBUG("Free heap : %7d bytes", ESP.getFreeHeap()); + LOG_DEBUG("Free PSRAM : %7d bytes", ESP.getFreePsram()); +#endif } #endif uint32_t rebootAtMsec; // If not zero we will reboot at this time (used to reboot shortly after the update completes) @@ -1221,4 +1274,5 @@ void loop() mainDelay.delay(delayMsec); } } -#endif + +#endif \ No newline at end of file diff --git a/src/main.h b/src/main.h index b3f58ae4b..3b71cfeea 100644 --- a/src/main.h +++ b/src/main.h @@ -1,5 +1,6 @@ #pragma once +#include "BluetoothStatus.h" #include "GPSStatus.h" #include "NodeStatus.h" #include "PowerStatus.h" @@ -49,6 +50,11 @@ extern Adafruit_DRV2605 drv; extern AudioThread *audioThread; #endif +#ifdef HAS_UDP_MULTICAST +#include "mesh/udp/UdpMulticastThread.h" +extern UdpMulticastThread *udpThread; +#endif + // Global Screen singleton. extern graphics::Screen *screen; diff --git a/src/mesh/Channels.cpp b/src/mesh/Channels.cpp index 19c0ff347..f1d4926db 100644 --- a/src/mesh/Channels.cpp +++ b/src/mesh/Channels.cpp @@ -93,6 +93,35 @@ void Channels::initDefaultLoraConfig() #endif } +bool Channels::ensureLicensedOperation() +{ + if (!owner.is_licensed) { + return false; + } + bool hasEncryptionOrAdmin = false; + for (uint8_t i = 0; i < MAX_NUM_CHANNELS; i++) { + auto channel = channels.getByIndex(i); + if (!channel.has_settings) { + continue; + } + auto &channelSettings = channel.settings; + if (strcasecmp(channelSettings.name, Channels::adminChannel) == 0) { + channel.role = meshtastic_Channel_Role_DISABLED; + channelSettings.psk.bytes[0] = 0; + channelSettings.psk.size = 0; + hasEncryptionOrAdmin = true; + channels.setChannel(channel); + + } else if (channelSettings.psk.size > 0) { + channelSettings.psk.bytes[0] = 0; + channelSettings.psk.size = 0; + hasEncryptionOrAdmin = true; + channels.setChannel(channel); + } + } + return hasEncryptionOrAdmin; +} + /** * Write a default channel to the specified channel index */ diff --git a/src/mesh/Channels.h b/src/mesh/Channels.h index b0c9b3d07..7873a306a 100644 --- a/src/mesh/Channels.h +++ b/src/mesh/Channels.h @@ -92,6 +92,8 @@ class Channels // Returns true if any of our channels have enabled MQTT uplink or downlink bool anyMqttEnabled(); + bool ensureLicensedOperation(); + private: /** Given a channel index, change to use the crypto key specified by that index * diff --git a/src/mesh/FloodingRouter.cpp b/src/mesh/FloodingRouter.cpp index f94540905..142ada806 100644 --- a/src/mesh/FloodingRouter.cpp +++ b/src/mesh/FloodingRouter.cpp @@ -13,7 +13,8 @@ FloodingRouter::FloodingRouter() {} ErrorCode FloodingRouter::send(meshtastic_MeshPacket *p) { // Add any messages _we_ send to the seen message list (so we will ignore all retransmissions we see) - wasSeenRecently(p); // FIXME, move this to a sniffSent method + p->relay_node = nodeDB->getLastByteOfNodeNum(getNodeNum()); // First set the relayer to us + wasSeenRecently(p); // FIXME, move this to a sniffSent method return Router::send(p); } @@ -23,26 +24,17 @@ bool FloodingRouter::shouldFilterReceived(const meshtastic_MeshPacket *p) if (wasSeenRecently(p)) { // Note: this will also add a recent packet record printPacket("Ignore dupe incoming msg", p); rxDupe++; - if (config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER && - config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER && - config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER_LATE) { - // cancel rebroadcast of this message *if* there was already one, unless we're a router/repeater! - if (Router::cancelSending(p->from, p->id)) - txRelayCanceled++; - } - if (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER_LATE && iface) { - iface->clampToLateRebroadcastWindow(getFrom(p), p->id); - } /* If the original transmitter is doing retransmissions (hopStart equals hopLimit) for a reliable transmission, e.g., when - the ACK got lost, we will handle the packet again to make sure it gets an ACK to its packet. */ + the ACK got lost, we will handle the packet again to make sure it gets an implicit ACK. */ bool isRepeated = p->hop_start > 0 && p->hop_start == p->hop_limit; if (isRepeated) { LOG_DEBUG("Repeated reliable tx"); - if (!perhapsRebroadcast(p) && isToUs(p) && p->want_ack) { - // FIXME - channel index should be used, but the packet is still encrypted here - sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, 0, 0); - } + // Check if it's still in the Tx queue, if not, we have to relay it again + if (!findInTxQueue(p->from, p->id)) + perhapsRebroadcast(p); + } else { + perhapsCancelDupe(p); } return true; @@ -51,13 +43,27 @@ bool FloodingRouter::shouldFilterReceived(const meshtastic_MeshPacket *p) return Router::shouldFilterReceived(p); } +void FloodingRouter::perhapsCancelDupe(const meshtastic_MeshPacket *p) +{ + if (config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER && + config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER && + config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER_LATE) { + // cancel rebroadcast of this message *if* there was already one, unless we're a router/repeater! + if (Router::cancelSending(p->from, p->id)) + txRelayCanceled++; + } + if (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER_LATE && iface) { + iface->clampToLateRebroadcastWindow(getFrom(p), p->id); + } +} + bool FloodingRouter::isRebroadcaster() { return config.device.role != meshtastic_Config_DeviceConfig_Role_CLIENT_MUTE && config.device.rebroadcast_mode != meshtastic_Config_DeviceConfig_RebroadcastMode_NONE; } -bool FloodingRouter::perhapsRebroadcast(const meshtastic_MeshPacket *p) +void FloodingRouter::perhapsRebroadcast(const meshtastic_MeshPacket *p) { if (!isToUs(p) && (p->hop_limit > 0) && !isFromUs(p)) { if (p->id != 0) { @@ -72,13 +78,12 @@ bool FloodingRouter::perhapsRebroadcast(const meshtastic_MeshPacket *p) tosend->hop_limit = 2; } #endif + tosend->next_hop = NO_NEXT_HOP_PREFERENCE; // this should already be the case, but just in case LOG_INFO("Rebroadcast received floodmsg"); // Note: we are careful to resend using the original senders node id // We are careful not to call our hooked version of send() - because we don't want to check this again Router::send(tosend); - - return true; } else { LOG_DEBUG("No rebroadcast: Role = CLIENT_MUTE or Rebroadcast Mode = NONE"); } @@ -86,13 +91,12 @@ bool FloodingRouter::perhapsRebroadcast(const meshtastic_MeshPacket *p) LOG_DEBUG("Ignore 0 id broadcast"); } } - - return false; } void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c) { - bool isAckorReply = (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) && (p->decoded.request_id != 0); + bool isAckorReply = (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) && + (p->decoded.request_id != 0 || p->decoded.reply_id != 0); if (isAckorReply && !isToUs(p) && !isBroadcast(p->to)) { // do not flood direct message that is ACKed or replied to LOG_DEBUG("Rxd an ACK/reply not for me, cancel rebroadcast"); diff --git a/src/mesh/FloodingRouter.h b/src/mesh/FloodingRouter.h index 52614f391..36c6ad8aa 100644 --- a/src/mesh/FloodingRouter.h +++ b/src/mesh/FloodingRouter.h @@ -1,6 +1,5 @@ #pragma once -#include "PacketHistory.h" #include "Router.h" /** @@ -26,14 +25,11 @@ Any entries in recentBroadcasts that are older than X seconds (longer than the max time a flood can take) will be discarded. */ -class FloodingRouter : public Router, protected PacketHistory +class FloodingRouter : public Router { private: - bool isRebroadcaster(); - - /** Check if we should rebroadcast this packet, and do so if needed - * @return true if rebroadcasted */ - bool perhapsRebroadcast(const meshtastic_MeshPacket *p); + /* Check if we should rebroadcast this packet, and do so if needed */ + void perhapsRebroadcast(const meshtastic_MeshPacket *p); public: /** @@ -62,4 +58,10 @@ class FloodingRouter : public Router, protected PacketHistory * Look for broadcasts we need to rebroadcast */ virtual void sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c) override; + + /* Call when receiving a duplicate packet to check whether we should cancel a packet in the Tx queue */ + void perhapsCancelDupe(const meshtastic_MeshPacket *p); + + // Return true if we are a rebroadcaster + bool isRebroadcaster(); }; \ No newline at end of file diff --git a/src/mesh/LR11x0Interface.cpp b/src/mesh/LR11x0Interface.cpp index 5a9a53d2d..2b060ad38 100644 --- a/src/mesh/LR11x0Interface.cpp +++ b/src/mesh/LR11x0Interface.cpp @@ -262,10 +262,17 @@ template void LR11x0Interface::startReceive() template bool LR11x0Interface::isChannelActive() { // check if we can detect a LoRa preamble on the current channel + ChannelScanConfig_t cfg = {.cad = {.symNum = NUM_SYM_CAD, + .detPeak = RADIOLIB_LR11X0_CAD_PARAM_DEFAULT, + .detMin = RADIOLIB_LR11X0_CAD_PARAM_DEFAULT, + .exitMode = RADIOLIB_LR11X0_CAD_PARAM_DEFAULT, + .timeout = 0, + .irqFlags = RADIOLIB_IRQ_CAD_DEFAULT_FLAGS, + .irqMask = RADIOLIB_IRQ_CAD_DEFAULT_MASK}}; int16_t result; setStandby(); - result = lora.scanChannel(); + result = lora.scanChannel(cfg); if (result == RADIOLIB_LORA_DETECTED) return true; diff --git a/src/mesh/MeshPacketQueue.cpp b/src/mesh/MeshPacketQueue.cpp index 7dd84639d..0c312fd1e 100644 --- a/src/mesh/MeshPacketQueue.cpp +++ b/src/mesh/MeshPacketQueue.cpp @@ -117,6 +117,19 @@ meshtastic_MeshPacket *MeshPacketQueue::remove(NodeNum from, PacketId id, bool t return NULL; } +/* Attempt to find a packet from this queue. Return true if it was found. */ +bool MeshPacketQueue::find(NodeNum from, PacketId id) +{ + for (auto it = queue.begin(); it != queue.end(); it++) { + auto p = (*it); + if (getFrom(p) == from && p->id == id) { + return true; + } + } + + return false; +} + /** * Attempt to find a lower-priority packet in the queue and replace it with the provided one. * @return True if the replacement succeeded, false otherwise diff --git a/src/mesh/MeshPacketQueue.h b/src/mesh/MeshPacketQueue.h index b41a214b9..6b2c3998a 100644 --- a/src/mesh/MeshPacketQueue.h +++ b/src/mesh/MeshPacketQueue.h @@ -37,4 +37,7 @@ class MeshPacketQueue /** Attempt to find and remove a packet from this queue. Returns the packet which was removed from the queue */ meshtastic_MeshPacket *remove(NodeNum from, PacketId id, bool tx_normal = true, bool tx_late = true); + + /* Attempt to find a packet from this queue. Return true if it was found. */ + bool find(NodeNum from, PacketId id); }; \ No newline at end of file diff --git a/src/mesh/MeshService.cpp b/src/mesh/MeshService.cpp index 773ab7053..0ef21d4ca 100644 --- a/src/mesh/MeshService.cpp +++ b/src/mesh/MeshService.cpp @@ -173,7 +173,9 @@ void MeshService::handleToRadio(meshtastic_MeshPacket &p) return; } #endif - p.from = 0; // We don't let phones assign nodenums to their sent messages + p.from = 0; // We don't let clients assign nodenums to their sent messages + p.next_hop = NO_NEXT_HOP_PREFERENCE; // We don't let clients assign next_hop to their sent messages + p.relay_node = NO_RELAY_NODE; // We don't let clients assign relay_node to their sent messages if (p.id == 0) p.id = generatePacketId(); // If the phone didn't supply one, then pick one diff --git a/src/mesh/MeshTypes.h b/src/mesh/MeshTypes.h index 1d6bd342d..680926d3c 100644 --- a/src/mesh/MeshTypes.h +++ b/src/mesh/MeshTypes.h @@ -40,6 +40,11 @@ enum RxSource { /// We normally just use max 3 hops for sending reliable messages #define HOP_RELIABLE 3 +// For old firmware or when falling back to flooding, there is no next-hop preference +#define NO_NEXT_HOP_PREFERENCE 0 +// For old firmware there is no relay node set +#define NO_RELAY_NODE 0 + typedef int ErrorCode; /// Alloc and free packets to our global, ISR safe pool diff --git a/src/mesh/NextHopRouter.cpp b/src/mesh/NextHopRouter.cpp new file mode 100644 index 000000000..f21974a2e --- /dev/null +++ b/src/mesh/NextHopRouter.cpp @@ -0,0 +1,272 @@ +#include "NextHopRouter.h" + +NextHopRouter::NextHopRouter() {} + +PendingPacket::PendingPacket(meshtastic_MeshPacket *p, uint8_t numRetransmissions) +{ + packet = p; + this->numRetransmissions = numRetransmissions - 1; // We subtract one, because we assume the user just did the first send +} + +/** + * Send a packet + */ +ErrorCode NextHopRouter::send(meshtastic_MeshPacket *p) +{ + // Add any messages _we_ send to the seen message list (so we will ignore all retransmissions we see) + p->relay_node = nodeDB->getLastByteOfNodeNum(getNodeNum()); // First set the relayer to us + wasSeenRecently(p); // FIXME, move this to a sniffSent method + + p->next_hop = getNextHop(p->to, p->relay_node); // set the next hop + LOG_DEBUG("Setting next hop for packet with dest %x to %x", p->to, p->next_hop); + + // If it's from us, ReliableRouter already handles retransmissions if want_ack is set. If a next hop is set and hop limit is + // not 0 or want_ack is set, start retransmissions + if ((!isFromUs(p) || !p->want_ack) && p->next_hop != NO_NEXT_HOP_PREFERENCE && (p->hop_limit > 0 || p->want_ack)) + startRetransmission(packetPool.allocCopy(*p)); // start retransmission for relayed packet + + return Router::send(p); +} + +bool NextHopRouter::shouldFilterReceived(const meshtastic_MeshPacket *p) +{ + bool wasFallback = false; + bool weWereNextHop = false; + if (wasSeenRecently(p, true, &wasFallback, &weWereNextHop)) { // Note: this will also add a recent packet record + printPacket("Ignore dupe incoming msg", p); + rxDupe++; + stopRetransmission(p->from, p->id); + + // If it was a fallback to flooding, try to relay again + if (wasFallback) { + LOG_INFO("Fallback to flooding from relay_node=0x%x", p->relay_node); + // Check if it's still in the Tx queue, if not, we have to relay it again + if (!findInTxQueue(p->from, p->id)) + perhapsRelay(p); + } else { + bool isRepeated = p->hop_start > 0 && p->hop_start == p->hop_limit; + // If repeated and not in Tx queue anymore, try relaying again, or if we are the destination, send the ACK again + if (isRepeated) { + if (!findInTxQueue(p->from, p->id) && !perhapsRelay(p) && isToUs(p) && p->want_ack) + sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, p->channel, 0); + } else if (!weWereNextHop) { + perhapsCancelDupe(p); // If it's a dupe, cancel relay if we were not explicitly asked to relay + } + } + return true; + } + + return Router::shouldFilterReceived(p); +} + +void NextHopRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c) +{ + NodeNum ourNodeNum = getNodeNum(); + uint8_t ourRelayID = nodeDB->getLastByteOfNodeNum(ourNodeNum); + bool isAckorReply = (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) && + (p->decoded.request_id != 0 || p->decoded.reply_id != 0); + if (isAckorReply) { + // Update next-hop for the original transmitter of this successful transmission to the relay node, but ONLY if "from" is + // not 0 (means implicit ACK) and original packet was also relayed by this node, or we sent it directly to the destination + if (p->from != 0) { + meshtastic_NodeInfoLite *origTx = nodeDB->getMeshNode(p->from); + if (origTx) { + // Either relayer of ACK was also a relayer of the packet, or we were the relayer and the ACK came directly from + // the destination + if (wasRelayer(p->relay_node, p->decoded.request_id, p->to) || + (wasRelayer(ourRelayID, p->decoded.request_id, p->to) && p->hop_start != 0 && p->hop_start == p->hop_limit)) { + if (origTx->next_hop != p->relay_node) { // Not already set + LOG_INFO("Update next hop of 0x%x to 0x%x based on ACK/reply", p->from, p->relay_node); + origTx->next_hop = p->relay_node; + } + } + } + } + if (!isToUs(p)) { + Router::cancelSending(p->to, p->decoded.request_id); // cancel rebroadcast for this DM + // stop retransmission for the original packet + stopRetransmission(p->to, p->decoded.request_id); // for original packet, from = to and id = request_id + } + } + + perhapsRelay(p); + + // handle the packet as normal + Router::sniffReceived(p, c); +} + +/* Check if we should be relaying this packet if so, do so. */ +bool NextHopRouter::perhapsRelay(const meshtastic_MeshPacket *p) +{ + if (!isToUs(p) && !isFromUs(p) && p->hop_limit > 0) { + if (p->next_hop == NO_NEXT_HOP_PREFERENCE || p->next_hop == nodeDB->getLastByteOfNodeNum(getNodeNum())) { + if (isRebroadcaster()) { + meshtastic_MeshPacket *tosend = packetPool.allocCopy(*p); // keep a copy because we will be sending it + LOG_INFO("Relaying received message coming from %x", p->relay_node); + + tosend->hop_limit--; // bump down the hop count + NextHopRouter::send(tosend); + + return true; + } else { + LOG_DEBUG("Not rebroadcasting: Role = CLIENT_MUTE or Rebroadcast Mode = NONE"); + } + } + } + + return false; +} + +/** + * Get the next hop for a destination, given the relay node + * @return the node number of the next hop, 0 if no preference (fallback to FloodingRouter) + */ +uint8_t NextHopRouter::getNextHop(NodeNum to, uint8_t relay_node) +{ + // When we're a repeater router->sniffReceived will call NextHopRouter directly without checking for broadcast + if (isBroadcast(to)) + return NO_NEXT_HOP_PREFERENCE; + + meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(to); + if (node && node->next_hop) { + // We are careful not to return the relay node as the next hop + if (node->next_hop != relay_node) { + // LOG_DEBUG("Next hop for 0x%x is 0x%x", to, node->next_hop); + return node->next_hop; + } else + LOG_WARN("Next hop for 0x%x is 0x%x, same as relayer; set no pref", to, node->next_hop); + } + return NO_NEXT_HOP_PREFERENCE; +} + +PendingPacket *NextHopRouter::findPendingPacket(GlobalPacketId key) +{ + auto old = pending.find(key); // If we have an old record, someone messed up because id got reused + if (old != pending.end()) { + return &old->second; + } else + return NULL; +} + +/** + * Stop any retransmissions we are doing of the specified node/packet ID pair + */ +bool NextHopRouter::stopRetransmission(NodeNum from, PacketId id) +{ + auto key = GlobalPacketId(from, id); + return stopRetransmission(key); +} + +bool NextHopRouter::stopRetransmission(GlobalPacketId key) +{ + auto old = findPendingPacket(key); + if (old) { + auto p = old->packet; + /* Only when we already transmitted a packet via LoRa, we will cancel the packet in the Tx queue + to avoid canceling a transmission if it was ACKed super fast via MQTT */ + if (old->numRetransmissions < NUM_RELIABLE_RETX - 1) { + // remove the 'original' (identified by originator and packet->id) from the txqueue and free it + cancelSending(getFrom(p), p->id); + // now free the pooled copy for retransmission too + packetPool.release(p); + } + auto numErased = pending.erase(key); + assert(numErased == 1); + return true; + } else + return false; +} + +/** + * Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting. + */ +PendingPacket *NextHopRouter::startRetransmission(meshtastic_MeshPacket *p, uint8_t numReTx) +{ + auto id = GlobalPacketId(p); + auto rec = PendingPacket(p, numReTx); + + stopRetransmission(getFrom(p), p->id); + + setNextTx(&rec); + pending[id] = rec; + + return &pending[id]; +} + +/** + * Do any retransmissions that are scheduled (FIXME - for the time being called from loop) + */ +int32_t NextHopRouter::doRetransmissions() +{ + uint32_t now = millis(); + int32_t d = INT32_MAX; + + // FIXME, we should use a better datastructure rather than walking through this map. + // for(auto el: pending) { + for (auto it = pending.begin(), nextIt = it; it != pending.end(); it = nextIt) { + ++nextIt; // we use this odd pattern because we might be deleting it... + auto &p = it->second; + + bool stillValid = true; // assume we'll keep this record around + + // FIXME, handle 51 day rolloever here!!! + if (p.nextTxMsec <= now) { + if (p.numRetransmissions == 0) { + if (isFromUs(p.packet)) { + LOG_DEBUG("Reliable send failed, returning a nak for fr=0x%x,to=0x%x,id=0x%x", p.packet->from, p.packet->to, + p.packet->id); + sendAckNak(meshtastic_Routing_Error_MAX_RETRANSMIT, getFrom(p.packet), p.packet->id, p.packet->channel); + } + // Note: we don't stop retransmission here, instead the Nak packet gets processed in sniffReceived + stopRetransmission(it->first); + stillValid = false; // just deleted it + } else { + LOG_DEBUG("Sending retransmission fr=0x%x,to=0x%x,id=0x%x, tries left=%d", p.packet->from, p.packet->to, + p.packet->id, p.numRetransmissions); + + if (!isBroadcast(p.packet->to)) { + if (p.numRetransmissions == 1) { + // Last retransmission, reset next_hop (fallback to FloodingRouter) + p.packet->next_hop = NO_NEXT_HOP_PREFERENCE; + // Also reset it in the nodeDB + meshtastic_NodeInfoLite *sentTo = nodeDB->getMeshNode(p.packet->to); + if (sentTo) { + LOG_INFO("Resetting next hop for packet with dest 0x%x\n", p.packet->to); + sentTo->next_hop = NO_NEXT_HOP_PREFERENCE; + } + FloodingRouter::send(packetPool.allocCopy(*p.packet)); + } else { + NextHopRouter::send(packetPool.allocCopy(*p.packet)); + } + } else { + // Note: we call the superclass version because we don't want to have our version of send() add a new + // retransmission record + FloodingRouter::send(packetPool.allocCopy(*p.packet)); + } + + // Queue again + --p.numRetransmissions; + setNextTx(&p); + } + } + + if (stillValid) { + // Update our desired sleep delay + int32_t t = p.nextTxMsec - now; + + d = min(t, d); + } + } + + return d; +} + +void NextHopRouter::setNextTx(PendingPacket *pending) +{ + assert(iface); + auto d = iface->getRetransmissionMsec(pending->packet); + pending->nextTxMsec = millis() + d; + LOG_DEBUG("Setting next retransmission in %u msecs: ", d); + printPacket("", pending->packet); + setReceivedMessage(); // Run ASAP, so we can figure out our correct sleep time +} \ No newline at end of file diff --git a/src/mesh/NextHopRouter.h b/src/mesh/NextHopRouter.h new file mode 100644 index 000000000..6c2764aff --- /dev/null +++ b/src/mesh/NextHopRouter.h @@ -0,0 +1,151 @@ +#pragma once + +#include "FloodingRouter.h" +#include + +/** + * An identifier for a globally unique message - a pair of the sending nodenum and the packet id assigned + * to that message + */ +struct GlobalPacketId { + NodeNum node; + PacketId id; + + bool operator==(const GlobalPacketId &p) const { return node == p.node && id == p.id; } + + explicit GlobalPacketId(const meshtastic_MeshPacket *p) + { + node = getFrom(p); + id = p->id; + } + + GlobalPacketId(NodeNum _from, PacketId _id) + { + node = _from; + id = _id; + } +}; + +/** + * A packet queued for retransmission + */ +struct PendingPacket { + meshtastic_MeshPacket *packet; + + /** The next time we should try to retransmit this packet */ + uint32_t nextTxMsec = 0; + + /** Starts at NUM_RETRANSMISSIONS -1 and counts down. Once zero it will be removed from the list */ + uint8_t numRetransmissions = 0; + + PendingPacket() {} + explicit PendingPacket(meshtastic_MeshPacket *p, uint8_t numRetransmissions); +}; + +class GlobalPacketIdHashFunction +{ + public: + size_t operator()(const GlobalPacketId &p) const { return (std::hash()(p.node)) ^ (std::hash()(p.id)); } +}; + +/* + Router for direct messages, which only relays if it is the next hop for a packet. The next hop is set by the current + relayer of a packet, which bases this on information from a previous successful delivery to the destination via flooding. + Namely, in the PacketHistory, we keep track of (up to 3) relayers of a packet. When the ACK is delivered back to us via a node + that also relayed the original packet, we use that node as next hop for the destination from then on. This makes sure that only + when there’s a two-way connection, we assign a next hop. Both the ReliableRouter and NextHopRouter will do retransmissions (the + NextHopRouter only 1 time). For the final retry, if no one actually relayed the packet, it will reset the next hop in order to + fall back to the FloodingRouter again. Note that thus also intermediate hops will do a single retransmission if the intended + next-hop didn’t relay, in order to fix changes in the middle of the route. +*/ +class NextHopRouter : public FloodingRouter +{ + public: + /** + * Constructor + * + */ + NextHopRouter(); + + /** + * Send a packet + * @return an error code + */ + virtual ErrorCode send(meshtastic_MeshPacket *p) override; + + /** Do our retransmission handling */ + virtual int32_t runOnce() override + { + // Note: We must doRetransmissions FIRST, because it might queue up work for the base class runOnce implementation + doRetransmissions(); + + int32_t r = FloodingRouter::runOnce(); + + // Also after calling runOnce there might be new packets to retransmit + auto d = doRetransmissions(); + return min(d, r); + } + + // The number of retransmissions intermediate nodes will do (actually 1 less than this) + constexpr static uint8_t NUM_INTERMEDIATE_RETX = 2; + // The number of retransmissions the original sender will do + constexpr static uint8_t NUM_RELIABLE_RETX = 3; + + protected: + /** + * Pending retransmissions + */ + std::unordered_map pending; + + /** + * Should this incoming filter be dropped? + * + * Called immediately on reception, before any further processing. + * @return true to abandon the packet + */ + virtual bool shouldFilterReceived(const meshtastic_MeshPacket *p) override; + + /** + * Look for packets we need to relay + */ + virtual void sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c) override; + + /** + * Try to find the pending packet record for this ID (or NULL if not found) + */ + PendingPacket *findPendingPacket(NodeNum from, PacketId id) { return findPendingPacket(GlobalPacketId(from, id)); } + PendingPacket *findPendingPacket(GlobalPacketId p); + + /** + * Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting. + */ + PendingPacket *startRetransmission(meshtastic_MeshPacket *p, uint8_t numReTx = NUM_INTERMEDIATE_RETX); + + /** + * Stop any retransmissions we are doing of the specified node/packet ID pair + * + * @return true if we found and removed a transmission with this ID + */ + bool stopRetransmission(NodeNum from, PacketId id); + bool stopRetransmission(GlobalPacketId p); + + /** + * Do any retransmissions that are scheduled (FIXME - for the time being called from loop) + * + * @return the number of msecs until our next retransmission or MAXINT if none scheduled + */ + int32_t doRetransmissions(); + + void setNextTx(PendingPacket *pending); + + private: + /** + * Get the next hop for a destination, given the relay node + * @return the node number of the next hop, 0 if no preference (fallback to FloodingRouter) + */ + uint8_t getNextHop(NodeNum to, uint8_t relay_node); + + /** Check if we should be relaying this packet if so, do so. + * @return true if we did relay */ + bool perhapsRelay(const meshtastic_MeshPacket *p); +}; \ No newline at end of file diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index c06b5df83..6588ca46b 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -56,6 +56,7 @@ NodeDB *nodeDB = nullptr; // we have plenty of ram so statically alloc this tempbuf (for now) EXT_RAM_BSS_ATTR meshtastic_DeviceState devicestate; meshtastic_MyNodeInfo &myNodeInfo = devicestate.my_node; +meshtastic_NodeDatabase nodeDatabase; meshtastic_LocalConfig config; meshtastic_DeviceUIConfig uiconfig{.screen_brightness = 153, .screen_timeout = 30}; meshtastic_LocalModuleConfig moduleConfig; @@ -143,7 +144,7 @@ uint32_t get_st7789_id(uint8_t cs, uint8_t sck, uint8_t mosi, uint8_t dc, uint8_ #endif -bool meshtastic_DeviceState_callback(pb_istream_t *istream, pb_ostream_t *ostream, const pb_field_iter_t *field) +bool meshtastic_NodeDatabase_callback(pb_istream_t *istream, pb_ostream_t *ostream, const pb_field_iter_t *field) { if (ostream) { std::vector const *vec = (std::vector *)field->pData; @@ -192,6 +193,7 @@ NodeDB::NodeDB() cleanupMeshDB(); uint32_t devicestateCRC = crc32Buffer(&devicestate, sizeof(devicestate)); + uint32_t nodeDatabaseCRC = crc32Buffer(&nodeDatabase, sizeof(nodeDatabase)); uint32_t configCRC = crc32Buffer(&config, sizeof(config)); uint32_t channelFileCRC = crc32Buffer(&channelFile, sizeof(channelFile)); @@ -246,15 +248,15 @@ NodeDB::NodeDB() // Ensure macaddr is set to our macaddr as it will be copied in our info below memcpy(owner.macaddr, ourMacAddr, sizeof(owner.macaddr)); - // Include our owner in the node db under our nodenum - meshtastic_NodeInfoLite *info = getOrCreateMeshNode(getNodeNum()); if (!config.has_security) { config.has_security = true; + config.security = meshtastic_Config_SecurityConfig_init_default; config.security.serial_enabled = config.device.serial_enabled; config.security.is_managed = config.device.is_managed; } #if !(MESHTASTIC_EXCLUDE_PKI_KEYGEN || MESHTASTIC_EXCLUDE_PKI) + if (!owner.is_licensed) { bool keygenSuccess = false; if (config.security.private_key.size == 32) { @@ -281,10 +283,18 @@ NodeDB::NodeDB() crypto->setDHPrivateKey(config.security.private_key.bytes); } #endif - + // Include our owner in the node db under our nodenum + meshtastic_NodeInfoLite *info = getOrCreateMeshNode(getNodeNum()); info->user = TypeConversions::ConvertToUserLite(owner); info->has_user = true; + // If node database has not been saved for the first time, save it now +#ifdef FSCom + if (!FSCom.exists(nodeDatabaseFileName)) { + saveNodeDatabaseToDisk(); + } +#endif + #ifdef ARCH_ESP32 Preferences preferences; preferences.begin("meshtastic", false); @@ -296,6 +306,9 @@ NodeDB::NodeDB() resetRadioConfig(); // If bogus settings got saved, then fix them // nodeDB->LOG_DEBUG("region=%d, NODENUM=0x%x, dbsize=%d", config.lora.region, myNodeInfo.my_node_num, numMeshNodes); + // Uncomment below to always enable UDP broadcasts + // config.network.enabled_protocols = meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST; + // If we are setup to broadcast on the default channel, ensure that the telemetry intervals are coerced to the minimum value // of 30 minutes or more if (channels.isDefaultChannel(channels.getPrimaryIndex())) { @@ -315,8 +328,15 @@ NodeDB::NodeDB() moduleConfig.neighbor_info.update_interval = Default::getConfiguredOrMinimumValue(moduleConfig.neighbor_info.update_interval, min_neighbor_info_broadcast_secs); + // Don't let licensed users to rebroadcast encrypted packets + if (owner.is_licensed) { + config.device.rebroadcast_mode = meshtastic_Config_DeviceConfig_RebroadcastMode_LOCAL_ONLY; + } + if (devicestateCRC != crc32Buffer(&devicestate, sizeof(devicestate))) saveWhat |= SEGMENT_DEVICESTATE; + if (nodeDatabaseCRC != crc32Buffer(&nodeDatabase, sizeof(nodeDatabase))) + saveWhat |= SEGMENT_NODEDATABASE; if (configCRC != crc32Buffer(&config, sizeof(config))) saveWhat |= SEGMENT_CONFIG; if (channelFileCRC != crc32Buffer(&channelFile, sizeof(channelFile))) @@ -407,13 +427,6 @@ bool NodeDB::resetRadioConfig(bool factory_reset) rebootAtMsec = millis() + (5 * 1000); } -#if (defined(T_DECK) || defined(T_WATCH_S3) || defined(UNPHONE) || defined(PICOMPUTER_S3)) && HAS_TFT - // as long as PhoneAPI shares BT and TFT app switch BT off - config.bluetooth.enabled = false; - if (moduleConfig.external_notification.nag_timeout == 60) - moduleConfig.external_notification.nag_timeout = 0; -#endif - return didFactoryReset; } @@ -431,6 +444,7 @@ bool NodeDB::factoryReset(bool eraseBleBonds) #endif spiLock->unlock(); // second, install default state (this will deal with the duplicate mac address issue) + installDefaultNodeDatabase(); installDefaultDeviceState(); installDefaultConfig(!eraseBleBonds); // Also preserve the private key if we're not erasing BLE bonds installDefaultModuleConfig(); @@ -455,6 +469,15 @@ bool NodeDB::factoryReset(bool eraseBleBonds) return true; } +void NodeDB::installDefaultNodeDatabase() +{ + LOG_DEBUG("Install default NodeDatabase"); + nodeDatabase.version = DEVICESTATE_CUR_VER; + nodeDatabase.nodes = std::vector(MAX_NUM_NODES); + numMeshNodes = 0; + meshNodes = &nodeDatabase.nodes; +} + void NodeDB::installDefaultConfig(bool preserveKey = false) { uint8_t private_key_temp[32]; @@ -568,9 +591,17 @@ void NodeDB::installDefaultConfig(bool preserveKey = false) config.security.admin_channel_enabled = false; resetRadioConfig(); strncpy(config.network.ntp_server, "meshtastic.pool.ntp.org", 32); - // FIXME: Default to bluetooth capability of platform as default + +#if (defined(T_DECK) || defined(T_WATCH_S3) || defined(UNPHONE) || defined(PICOMPUTER_S3) || defined(SENSECAP_INDICATOR)) && \ + HAS_TFT + // switch BT off by default; use TFT programming mode or hotkey to enable + config.bluetooth.enabled = false; +#else + // default to bluetooth capability of platform as default config.bluetooth.enabled = true; +#endif config.bluetooth.fixed_pin = defaultBLEPin; + #if defined(ST7735_CS) || defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || defined(ST7789_CS) || \ defined(HX8357_CS) || defined(USE_ST7789) bool hasScreen = true; @@ -586,9 +617,12 @@ void NodeDB::installDefaultConfig(bool preserveKey = false) hasScreen = true; else hasScreen = screen_found.port != ScanI2C::I2CPort::NO_I2C; +#elif MESHTASTIC_INCLUDE_NICHE_GRAPHICS // See "src/graphics/niche" + bool hasScreen = true; // Use random pin for Bluetooth pairing #else bool hasScreen = screen_found.port != ScanI2C::I2CPort::NO_I2C; #endif + #ifdef USERPREFS_FIXED_BLUETOOTH config.bluetooth.fixed_pin = USERPREFS_FIXED_BLUETOOTH; config.bluetooth.mode = meshtastic_Config_BluetoothConfig_PairingMode_FIXED_PIN; @@ -612,10 +646,6 @@ void NodeDB::installDefaultConfig(bool preserveKey = false) config.display.screen_on_secs = 30; config.display.wake_on_tap_or_motion = true; #endif -#ifdef HELTEC_VISION_MASTER_E290 - // Orient so that LoRa antenna faces up - config.display.flip_screen = true; -#endif initConfigIntervals(); } @@ -681,8 +711,13 @@ void NodeDB::installDefaultModuleConfig() moduleConfig.external_notification.enabled = true; moduleConfig.external_notification.use_i2s_as_buzzer = true; moduleConfig.external_notification.alert_message_buzzer = true; +#if HAS_TFT + if (moduleConfig.external_notification.nag_timeout == 60) + moduleConfig.external_notification.nag_timeout = 0; +#else moduleConfig.external_notification.nag_timeout = 60; #endif +#endif #ifdef NANO_G2_ULTRA moduleConfig.external_notification.enabled = true; moduleConfig.external_notification.alert_message = true; @@ -794,9 +829,10 @@ void NodeDB::resetNodes() if (!config.position.fixed_position) clearLocalPosition(); numMeshNodes = 1; - std::fill(devicestate.node_db_lite.begin() + 1, devicestate.node_db_lite.end(), meshtastic_NodeInfoLite()); + std::fill(nodeDatabase.nodes.begin() + 1, nodeDatabase.nodes.end(), meshtastic_NodeInfoLite()); devicestate.has_rx_text_message = false; devicestate.has_rx_waypoint = false; + saveNodeDatabaseToDisk(); saveDeviceStateToDisk(); if (neighborInfoModule && moduleConfig.neighbor_info.enabled) neighborInfoModule->resetNeighbors(); @@ -812,10 +848,10 @@ void NodeDB::removeNodeByNum(NodeNum nodeNum) removed++; } numMeshNodes -= removed; - std::fill(devicestate.node_db_lite.begin() + numMeshNodes, devicestate.node_db_lite.begin() + numMeshNodes + 1, + std::fill(nodeDatabase.nodes.begin() + numMeshNodes, nodeDatabase.nodes.begin() + numMeshNodes + 1, meshtastic_NodeInfoLite()); LOG_DEBUG("NodeDB::removeNodeByNum purged %d entries. Save changes", removed); - saveDeviceStateToDisk(); + saveNodeDatabaseToDisk(); } void NodeDB::clearLocalPosition() @@ -844,7 +880,7 @@ void NodeDB::cleanupMeshDB() } } numMeshNodes -= removed; - std::fill(devicestate.node_db_lite.begin() + numMeshNodes, devicestate.node_db_lite.begin() + numMeshNodes + removed, + std::fill(nodeDatabase.nodes.begin() + numMeshNodes, nodeDatabase.nodes.begin() + numMeshNodes + removed, meshtastic_NodeInfoLite()); LOG_DEBUG("cleanupMeshDB purged %d entries", removed); } @@ -854,13 +890,9 @@ void NodeDB::installDefaultDeviceState() LOG_INFO("Install default DeviceState"); // memset(&devicestate, 0, sizeof(meshtastic_DeviceState)); - numMeshNodes = 0; - meshNodes = &devicestate.node_db_lite; - // init our devicestate with valid flags so protobuf writing/reading will work devicestate.has_my_node = true; devicestate.has_owner = true; - // devicestate.node_db_lite_count = 0; devicestate.version = DEVICESTATE_CUR_VER; devicestate.receive_queue_count = 0; // Not yet implemented FIXME devicestate.has_rx_waypoint = false; @@ -914,12 +946,6 @@ void NodeDB::pickNewNodeNum() myNodeInfo.my_node_num = nodeNum; } -static const char *prefFileName = "/prefs/db.proto"; -static const char *configFileName = "/prefs/config.proto"; -static const char *uiconfigFileName = "/prefs/uiconfig.proto"; -static const char *moduleConfigFileName = "/prefs/module.proto"; -static const char *channelFileName = "/prefs/channels.proto"; - /** Load a protobuf from a file, return LoadFileResult */ LoadFileResult NodeDB::loadProto(const char *filename, size_t protoSize, size_t objSize, const pb_msgdesc_t *fields, void *dest_struct) @@ -955,20 +981,58 @@ LoadFileResult NodeDB::loadProto(const char *filename, size_t protoSize, size_t void NodeDB::loadFromDisk() { - devicestate.version = - 0; // Mark the current device state as completely unusable, so that if we fail reading the entire file from + // Mark the current device state as completely unusable, so that if we fail reading the entire file from // disk we will still factoryReset to restore things. + devicestate.version = 0; + + meshtastic_Config_SecurityConfig backupSecurity = meshtastic_Config_SecurityConfig_init_zero; #ifdef ARCH_ESP32 spiLock->lock(); + // If the legacy deviceState exists, start over with a factory reset if (FSCom.exists("/static/static")) rmDir("/static/static"); // Remove bad static web files bundle from initial 2.5.13 release spiLock->unlock(); #endif +#ifdef FSCom + spiLock->lock(); + if (FSCom.exists(legacyPrefFileName)) { + spiLock->unlock(); + LOG_WARN("Legacy prefs version found, factory resetting"); + if (loadProto(configFileName, meshtastic_LocalConfig_size, sizeof(meshtastic_LocalConfig), &meshtastic_LocalConfig_msg, + &config) == LoadFileResult::LOAD_SUCCESS && + config.has_security && config.security.private_key.size > 0) { + LOG_DEBUG("Saving backup of security config and keys"); + backupSecurity = config.security; + } + spiLock->lock(); + rmDir("/prefs"); + spiLock->unlock(); + } else { + spiLock->unlock(); + } + +#endif + auto state = loadProto(nodeDatabaseFileName, getMaxNodesAllocatedSize(), sizeof(meshtastic_NodeDatabase), + &meshtastic_NodeDatabase_msg, &nodeDatabase); + if (nodeDatabase.version < DEVICESTATE_MIN_VER) { + LOG_WARN("NodeDatabase %d is old, discard", nodeDatabase.version); + installDefaultNodeDatabase(); + } else { + meshNodes = &nodeDatabase.nodes; + numMeshNodes = nodeDatabase.nodes.size(); + LOG_INFO("Loaded saved nodedatabase version %d, with nodes count: %d", nodeDatabase.version, nodeDatabase.nodes.size()); + } + + if (numMeshNodes > MAX_NUM_NODES) { + LOG_WARN("Node count %d exceeds MAX_NUM_NODES %d, truncating", numMeshNodes, MAX_NUM_NODES); + numMeshNodes = MAX_NUM_NODES; + } + meshNodes->resize(MAX_NUM_NODES); // static DeviceState scratch; We no longer read into a tempbuf because this structure is 15KB of valuable RAM - auto state = loadProto(prefFileName, sizeof(meshtastic_DeviceState) + MAX_NUM_NODES_FS * meshtastic_NodeInfoLite_size, - sizeof(meshtastic_DeviceState), &meshtastic_DeviceState_msg, &devicestate); + state = loadProto(deviceStateFileName, meshtastic_DeviceState_size, sizeof(meshtastic_DeviceState), + &meshtastic_DeviceState_msg, &devicestate); // See https://github.com/meshtastic/firmware/issues/4184#issuecomment-2269390786 // It is very important to try and use the saved prefs even if we fail to read meshtastic_DeviceState. Because most of our @@ -982,15 +1046,8 @@ void NodeDB::loadFromDisk() LOG_WARN("Devicestate %d is old, discard", devicestate.version); installDefaultDeviceState(); } else { - LOG_INFO("Loaded saved devicestate version %d, with nodecount: %d", devicestate.version, devicestate.node_db_lite.size()); - meshNodes = &devicestate.node_db_lite; - numMeshNodes = devicestate.node_db_lite.size(); + LOG_INFO("Loaded saved devicestate version %d", devicestate.version); } - if (numMeshNodes > MAX_NUM_NODES) { - LOG_WARN("Node count %d exceeds MAX_NUM_NODES %d, truncating", numMeshNodes, MAX_NUM_NODES); - numMeshNodes = MAX_NUM_NODES; - } - meshNodes->resize(MAX_NUM_NODES); state = loadProto(configFileName, meshtastic_LocalConfig_size, sizeof(meshtastic_LocalConfig), &meshtastic_LocalConfig_msg, &config); @@ -1004,6 +1061,11 @@ void NodeDB::loadFromDisk() LOG_INFO("Loaded saved config version %d", config.version); } } + if (backupSecurity.private_key.size > 0) { + LOG_DEBUG("Restoring backup of security config"); + config.security = backupSecurity; + saveToDisk(SEGMENT_CONFIG); + } // Make sure we load hard coded admin keys even when the configuration file has none. // Initialize admin_key_count to zero @@ -1156,15 +1218,24 @@ bool NodeDB::saveDeviceStateToDisk() #endif // Note: if MAX_NUM_NODES=100 and meshtastic_NodeInfoLite_size=166, so will be approximately 17KB // Because so huge we _must_ not use fullAtomic, because the filesystem is probably too small to hold two copies of this - size_t deviceStateSize; - pb_get_encoded_size(&deviceStateSize, meshtastic_DeviceState_fields, &devicestate); - return saveProto(prefFileName, deviceStateSize, &meshtastic_DeviceState_msg, &devicestate, false); + return saveProto(deviceStateFileName, meshtastic_DeviceState_size, &meshtastic_DeviceState_msg, &devicestate, true); +} + +bool NodeDB::saveNodeDatabaseToDisk() +{ +#ifdef FSCom + spiLock->lock(); + FSCom.mkdir("/prefs"); + spiLock->unlock(); +#endif + size_t nodeDatabaseSize; + pb_get_encoded_size(&nodeDatabaseSize, meshtastic_NodeDatabase_fields, &nodeDatabase); + return saveProto(nodeDatabaseFileName, nodeDatabaseSize, &meshtastic_NodeDatabase_msg, &nodeDatabase, false); } bool NodeDB::saveToDiskNoRetry(int saveWhat) { bool success = true; - #ifdef FSCom spiLock->lock(); FSCom.mkdir("/prefs"); @@ -1209,11 +1280,16 @@ bool NodeDB::saveToDiskNoRetry(int saveWhat) success &= saveDeviceStateToDisk(); } + if (saveWhat & SEGMENT_NODEDATABASE) { + success &= saveNodeDatabaseToDisk(); + } + return success; } bool NodeDB::saveToDisk(int saveWhat) { + LOG_DEBUG("Save to disk %d", saveWhat); bool success = saveToDiskNoRetry(saveWhat); if (!success) { @@ -1394,8 +1470,9 @@ bool NodeDB::updateUser(uint32_t nodeId, meshtastic_User &p, uint8_t channelInde // We just changed something about a User, // store our DB unless we just did so less than a minute ago + if (!Throttle::isWithinTimespanMs(lastNodeDbSave, ONE_MINUTE_MS)) { - saveToDisk(SEGMENT_DEVICESTATE); + saveToDisk(SEGMENT_NODEDATABASE); lastNodeDbSave = millis(); } else { LOG_DEBUG("Defer NodeDB saveToDisk for now"); @@ -1409,6 +1486,10 @@ bool NodeDB::updateUser(uint32_t nodeId, meshtastic_User &p, uint8_t channelInde /// we updateGUI and updateGUIforNode if we think our this change is big enough for a redraw void NodeDB::updateFrom(const meshtastic_MeshPacket &mp) { + // if (mp.from == getNodeNum()) { + // LOG_DEBUG("Ignore update from self"); + // return; + // } if (mp.which_payload_variant == meshtastic_MeshPacket_decoded_tag && mp.from) { LOG_DEBUG("Update DB node 0x%x, rx_time=%u", mp.from, mp.rx_time); @@ -1518,6 +1599,17 @@ bool NodeDB::hasValidPosition(const meshtastic_NodeInfoLite *n) return n->has_position && (n->position.latitude_i != 0 || n->position.longitude_i != 0); } +/// If we have a node / user and they report is_licensed = true +/// we consider them licensed +UserLicenseStatus NodeDB::getLicenseStatus(uint32_t nodeNum) +{ + meshtastic_NodeInfoLite *info = getMeshNode(nodeNum); + if (!info || !info->has_user) { + return UserLicenseStatus::NotKnown; + } + return info->user.is_licensed ? UserLicenseStatus::Licensed : UserLicenseStatus::NotLicensed; +} + /// Record an error that should be reported via analytics void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, const char *filename) { @@ -1540,4 +1632,4 @@ void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, co LOG_ERROR("A critical failure occurred, portduino is exiting"); exit(2); #endif -} +} \ No newline at end of file diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index d244a94ba..44e2ebcc8 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include "MeshTypes.h" @@ -12,6 +13,10 @@ #include "mesh-pb-constants.h" #include "mesh/generated/meshtastic/mesh.pb.h" // For CriticalErrorCode +#if ARCH_PORTDUINO +#include "PortduinoGlue.h" +#endif + /* DeviceState versions used to be defined in the .proto file but really only this function cares. So changed to a #define here. @@ -21,11 +26,13 @@ DeviceState versions used to be defined in the .proto file but really only this #define SEGMENT_MODULECONFIG 2 #define SEGMENT_DEVICESTATE 4 #define SEGMENT_CHANNELS 8 +#define SEGMENT_NODEDATABASE 16 -#define DEVICESTATE_CUR_VER 23 -#define DEVICESTATE_MIN_VER 22 +#define DEVICESTATE_CUR_VER 24 +#define DEVICESTATE_MIN_VER 24 extern meshtastic_DeviceState devicestate; +extern meshtastic_NodeDatabase nodeDatabase; extern meshtastic_ChannelFile channelFile; extern meshtastic_MyNodeInfo &myNodeInfo; extern meshtastic_LocalConfig config; @@ -34,6 +41,14 @@ extern meshtastic_LocalModuleConfig moduleConfig; extern meshtastic_User &owner; extern meshtastic_Position localPosition; +static constexpr const char *deviceStateFileName = "/prefs/device.proto"; +static constexpr const char *legacyPrefFileName = "/prefs/db.proto"; +static constexpr const char *nodeDatabaseFileName = "/prefs/nodes.proto"; +static constexpr const char *configFileName = "/prefs/config.proto"; +static constexpr const char *uiconfigFileName = "/prefs/uiconfig.proto"; +static constexpr const char *moduleConfigFileName = "/prefs/module.proto"; +static constexpr const char *channelFileName = "/prefs/channels.proto"; + /// Given a node, return how many seconds in the past (vs now) that we last heard from it uint32_t sinceLastSeen(const meshtastic_NodeInfoLite *n); @@ -53,6 +68,8 @@ enum LoadFileResult { OTHER_FAILURE = 5 }; +enum UserLicenseStatus { NotKnown, NotLicensed, Licensed }; + class NodeDB { // NodeNum provisionalNodeNum; // if we are trying to find a node num this is our current attempt @@ -75,7 +92,8 @@ class NodeDB /// write to flash /// @return true if the save was successful - bool saveToDisk(int saveWhat = SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS); + bool saveToDisk(int saveWhat = SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS | + SEGMENT_NODEDATABASE); /** Reinit radio config if needed, because either: * a) sometimes a buggy android app might send us bogus settings or @@ -104,6 +122,9 @@ class NodeDB /// @return our node number NodeNum getNodeNum() { return myNodeInfo.my_node_num; } + // @return last byte of a NodeNum, 0xFF if it ended at 0x00 + uint8_t getLastByteOfNodeNum(NodeNum num) { return (uint8_t)((num & 0xFF) ? (num & 0xFF) : 0xFF); } + /// if returns false, that means our node should send a DenyNodeNum response. If true, we think the number is okay for use // bool handleWantNodeNum(NodeNum n); @@ -148,6 +169,17 @@ class NodeDB virtual meshtastic_NodeInfoLite *getMeshNode(NodeNum n); size_t getNumMeshNodes() { return numMeshNodes; } + UserLicenseStatus getLicenseStatus(uint32_t nodeNum); + + size_t getMaxNodesAllocatedSize() + { + meshtastic_NodeDatabase emptyNodeDatabase; + emptyNodeDatabase.version = DEVICESTATE_CUR_VER; + size_t nodeDatabaseSize; + pb_get_encoded_size(&nodeDatabaseSize, meshtastic_NodeDatabase_fields, &emptyNodeDatabase); + return nodeDatabaseSize + (MAX_NUM_NODES * meshtastic_NodeInfoLite_size); + } + // returns true if the maximum number of nodes is reached or we are running low on memory bool isFull(); @@ -188,8 +220,8 @@ class NodeDB void cleanupMeshDB(); /// Reinit device state from scratch (not loading from disk) - void installDefaultDeviceState(), installDefaultChannels(), installDefaultConfig(bool preserveKey), - installDefaultModuleConfig(); + void installDefaultDeviceState(), installDefaultNodeDatabase(), installDefaultChannels(), + installDefaultConfig(bool preserveKey), installDefaultModuleConfig(); /// write to flash /// @return true if the save was successful @@ -197,6 +229,7 @@ class NodeDB bool saveChannelsToDisk(); bool saveDeviceStateToDisk(); + bool saveNodeDatabaseToDisk(); }; extern NodeDB *nodeDB; diff --git a/src/mesh/PacketHistory.cpp b/src/mesh/PacketHistory.cpp index 6eb4b6ea1..15fa9cdcd 100644 --- a/src/mesh/PacketHistory.cpp +++ b/src/mesh/PacketHistory.cpp @@ -16,7 +16,7 @@ PacketHistory::PacketHistory() /** * Update recentBroadcasts and return true if we have already seen this packet */ -bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpdate) +bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpdate, bool *wasFallback, bool *weWereNextHop) { if (p->id == 0) { LOG_DEBUG("Ignore message with zero id"); @@ -27,6 +27,9 @@ bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpd r.id = p->id; r.sender = getFrom(p); r.rxTimeMsec = millis(); + r.next_hop = p->next_hop; + r.relayed_by[0] = p->relay_node; + // LOG_INFO("Add relayed_by 0x%x for id=0x%x", p->relay_node, r.id); auto found = recentPackets.find(r); bool seenRecently = (found != recentPackets.end()); // found not equal to .end() means packet was seen recently @@ -40,14 +43,36 @@ bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpd if (seenRecently) { LOG_DEBUG("Found existing packet record for fr=0x%x,to=0x%x,id=0x%x", p->from, p->to, p->id); + uint8_t ourRelayID = nodeDB->getLastByteOfNodeNum(nodeDB->getNodeNum()); + if (wasFallback) { + // If it was seen with a next-hop not set to us and now it's NO_NEXT_HOP_PREFERENCE, and the relayer relayed already + // before, it's a fallback to flooding. If we didn't already relay and the next-hop neither, we might need to handle + // it now. + if (found->sender != nodeDB->getNodeNum() && found->next_hop != NO_NEXT_HOP_PREFERENCE && + found->next_hop != ourRelayID && p->next_hop == NO_NEXT_HOP_PREFERENCE && wasRelayer(p->relay_node, found) && + !wasRelayer(ourRelayID, found) && !wasRelayer(found->next_hop, found)) { + *wasFallback = true; + } + } + + // Check if we were the next hop for this packet + if (weWereNextHop) { + *weWereNextHop = found->next_hop == ourRelayID; + } } if (withUpdate) { - if (found != recentPackets.end()) { // delete existing to updated timestamp (re-insert) - recentPackets.erase(found); // as unsorted_set::iterator is const (can't update timestamp - so re-insert..) + if (found != recentPackets.end()) { // delete existing to updated timestamp and relayed_by (re-insert) + // Add the existing relayed_by to the new record + for (uint8_t i = 0; i < NUM_RELAYERS - 1; i++) { + if (found->relayed_by[i]) + r.relayed_by[i + 1] = found->relayed_by[i]; + } + r.next_hop = found->next_hop; // keep the original next_hop (such that we check whether we were originally asked) + recentPackets.erase(found); // as unsorted_set::iterator is const (can't update - so re-insert..) } recentPackets.insert(r); - printPacket("Add packet record", p); + LOG_DEBUG("Add packet record fr=0x%x, id=0x%x", p->from, p->id); } // Capacity is reerved, so only purge expired packets if recentPackets fills past 90% capacity @@ -75,4 +100,59 @@ void PacketHistory::clearExpiredRecentPackets() } LOG_DEBUG("recentPackets size=%ld (after clearing expired packets)", recentPackets.size()); +} + +/* Check if a certain node was a relayer of a packet in the history given an ID and sender + * @return true if node was indeed a relayer, false if not */ +bool PacketHistory::wasRelayer(const uint8_t relayer, const uint32_t id, const NodeNum sender) +{ + if (relayer == 0) + return false; + + PacketRecord r = {.sender = sender, .id = id, .rxTimeMsec = 0, .next_hop = 0}; + auto found = recentPackets.find(r); + + if (found == recentPackets.end()) { + return false; + } + + return wasRelayer(relayer, found); +} + +/* Check if a certain node was a relayer of a packet in the history given iterator + * @return true if node was indeed a relayer, false if not */ +bool PacketHistory::wasRelayer(const uint8_t relayer, std::unordered_set::iterator r) +{ + for (uint8_t i = 0; i < NUM_RELAYERS; i++) { + if (r->relayed_by[i] == relayer) { + return true; + } + } + return false; +} + +// Remove a relayer from the list of relayers of a packet in the history given an ID and sender +void PacketHistory::removeRelayer(const uint8_t relayer, const uint32_t id, const NodeNum sender) +{ + PacketRecord r = {.sender = sender, .id = id, .rxTimeMsec = 0, .next_hop = 0}; + auto found = recentPackets.find(r); + + if (found == recentPackets.end()) { + return; + } + // Make a copy of the found record + r.next_hop = found->next_hop; + r.rxTimeMsec = found->rxTimeMsec; + + // Only add the relayers that are not the one we want to remove + uint8_t j = 0; + for (uint8_t i = 0; i < NUM_RELAYERS; i++) { + if (found->relayed_by[i] != relayer) { + r.relayed_by[j] = found->relayed_by[i]; + j++; + } + } + + recentPackets.erase(found); + recentPackets.insert(r); } \ No newline at end of file diff --git a/src/mesh/PacketHistory.h b/src/mesh/PacketHistory.h index 0417d0997..db7698f5b 100644 --- a/src/mesh/PacketHistory.h +++ b/src/mesh/PacketHistory.h @@ -1,6 +1,6 @@ #pragma once -#include "Router.h" +#include "NodeDB.h" #include /// We clear our old flood record 10 minutes after we see the last of it @@ -10,13 +10,18 @@ #define FLOOD_EXPIRE_TIME (10 * 60 * 1000L) #endif +#define NUM_RELAYERS \ + 3 // Number of relayer we keep track of. Use 3 to be efficient with memory alignment of PacketRecord to 16 bytes + /** * A record of a recent message broadcast */ struct PacketRecord { NodeNum sender; PacketId id; - uint32_t rxTimeMsec; // Unix time in msecs - the time we received it + uint32_t rxTimeMsec; // Unix time in msecs - the time we received it + uint8_t next_hop; // The next hop asked for this packet + uint8_t relayed_by[NUM_RELAYERS]; // Array of nodes that relayed this packet bool operator==(const PacketRecord &p) const { return sender == p.sender && id == p.id; } }; @@ -44,6 +49,20 @@ class PacketHistory * Update recentBroadcasts and return true if we have already seen this packet * * @param withUpdate if true and not found we add an entry to recentPackets + * @param wasFallback if not nullptr, packet will be checked for fallback to flooding and value will be set to true if so + * @param weWereNextHop if not nullptr, packet will be checked for us being the next hop and value will be set to true if so */ - bool wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpdate = true); -}; + bool wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpdate = true, bool *wasFallback = nullptr, + bool *weWereNextHop = nullptr); + + /* Check if a certain node was a relayer of a packet in the history given an ID and sender + * @return true if node was indeed a relayer, false if not */ + bool wasRelayer(const uint8_t relayer, const uint32_t id, const NodeNum sender); + + /* Check if a certain node was a relayer of a packet in the history given iterator + * @return true if node was indeed a relayer, false if not */ + bool wasRelayer(const uint8_t relayer, std::unordered_set::iterator r); + + // Remove a relayer from the list of relayers of a packet in the history given an ID and sender + void removeRelayer(const uint8_t relayer, const uint32_t id, const NodeNum sender); +}; \ No newline at end of file diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 699e6e0e4..204886be5 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -12,6 +12,7 @@ #include "PhoneAPI.h" #include "PowerFSM.h" #include "RadioInterface.h" +#include "Router.h" #include "SPILock.h" #include "TypeConversions.h" #include "main.h" diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index d91cba116..695c5be77 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -261,7 +261,7 @@ uint8_t RadioInterface::getCWsize(float snr) const uint32_t SNR_MIN = -20; // The maximum value for a LoRa SNR - const uint32_t SNR_MAX = 15; + const uint32_t SNR_MAX = 10; return map(snr, SNR_MIN, SNR_MAX, CWmin, CWmax); } @@ -340,6 +340,10 @@ void printPacket(const char *prefix, const meshtastic_MeshPacket *p) out += DEBUG_PORT.mt_sprintf(" via MQTT"); if (p->hop_start != 0) out += DEBUG_PORT.mt_sprintf(" hopStart=%d", p->hop_start); + if (p->next_hop != 0) + out += DEBUG_PORT.mt_sprintf(" nextHop=0x%x", p->next_hop); + if (p->relay_node != 0) + out += DEBUG_PORT.mt_sprintf(" relay=0x%x", p->relay_node); if (p->priority != 0) out += DEBUG_PORT.mt_sprintf(" priority=%d", p->priority); @@ -566,7 +570,7 @@ void RadioInterface::applyModemConfig() saveChannelNum(channel_num); saveFreq(freq + loraConfig.frequency_offset); - slotTimeMsec = computeSlotTimeMsec(bw, sf); + slotTimeMsec = computeSlotTimeMsec(); preambleTimeMsec = getPacketTime((uint32_t)0); maxPacketTimeMsec = getPacketTime(meshtastic_Constants_DATA_PAYLOAD_LEN + sizeof(PacketHeader)); @@ -581,6 +585,25 @@ void RadioInterface::applyModemConfig() LOG_INFO("Slot time: %u msec", slotTimeMsec); } +/** Slottime is the time to detect a transmission has started, consisting of: + - CAD duration; + - roundtrip air propagation time (assuming max. 30km between nodes); + - Tx/Rx turnaround time (maximum of SX126x and SX127x); + - MAC processing time (measured on T-beam) */ +uint32_t RadioInterface::computeSlotTimeMsec() +{ + float sumPropagationTurnaroundMACTime = 0.2 + 0.4 + 7; // in milliseconds + float symbolTime = pow(2, sf) / bw; // in milliseconds + + if (myRegion->wideLora) { + // CAD duration derived from AN1200.22 of SX1280 + return (NUM_SYM_CAD_24GHZ + (2 * sf + 3) / 32) * symbolTime + sumPropagationTurnaroundMACTime; + } else { + // CAD duration for SX127x is max. 2.25 symbols, for SX126x it is number of symbols + 0.5 symbol + return max(2.25, NUM_SYM_CAD + 0.5) * symbolTime + sumPropagationTurnaroundMACTime; + } +} + /** * Some regulatory regions limit xmit power. * This function should be called by subclasses after setting their desired power. It might lower it @@ -620,8 +643,8 @@ size_t RadioInterface::beginSending(meshtastic_MeshPacket *p) radioBuffer.header.to = p->to; radioBuffer.header.id = p->id; radioBuffer.header.channel = p->channel; - radioBuffer.header.next_hop = 0; // *** For future use *** - radioBuffer.header.relay_node = 0; // *** For future use *** + radioBuffer.header.next_hop = p->next_hop; + radioBuffer.header.relay_node = p->relay_node; if (p->hop_limit > HOP_MAX) { LOG_WARN("hop limit %d is too high, setting to %d", p->hop_limit, HOP_RELIABLE); p->hop_limit = HOP_RELIABLE; diff --git a/src/mesh/RadioInterface.h b/src/mesh/RadioInterface.h index 652b2269c..68ae09635 100644 --- a/src/mesh/RadioInterface.h +++ b/src/mesh/RadioInterface.h @@ -38,10 +38,10 @@ typedef struct { /** The channel hash - used as a hint for the decoder to limit which channels we consider */ uint8_t channel; - // ***For future use*** Last byte of the NodeNum of the next-hop for this packet + // Last byte of the NodeNum of the next-hop for this packet uint8_t next_hop; - // ***For future use*** Last byte of the NodeNum of the node that will relay/relayed this packet + // Last byte of the NodeNum of the node that will relay/relayed this packet uint8_t relay_node; } PacketHeader; @@ -83,24 +83,22 @@ class RadioInterface float bw = 125; uint8_t sf = 9; uint8_t cr = 5; - /** Slottime is the minimum time to wait, consisting of: - - CAD duration (maximum of SX126x and SX127x); - - roundtrip air propagation time (assuming max. 30km between nodes); - - Tx/Rx turnaround time (maximum of SX126x and SX127x); - - MAC processing time (measured on T-beam) */ - uint32_t slotTimeMsec = computeSlotTimeMsec(bw, sf); + + const uint8_t NUM_SYM_CAD = 2; // Number of symbols used for CAD, 2 is the default since RadioLib 6.3.0 as per AN1200.48 + const uint8_t NUM_SYM_CAD_24GHZ = 4; // Number of symbols used for CAD in 2.4 GHz, 4 is recommended in AN1200.22 of SX1280 + uint32_t slotTimeMsec = computeSlotTimeMsec(); uint16_t preambleLength = 16; // 8 is default, but we use longer to increase the amount of sleep time when receiving uint32_t preambleTimeMsec = 165; // calculated on startup, this is the default for LongFast uint32_t maxPacketTimeMsec = 3246; // calculated on startup, this is the default for LongFast const uint32_t PROCESSING_TIME_MSEC = 4500; // time to construct, process and construct a packet again (empirically determined) - const uint8_t CWmin = 2; // minimum CWsize - const uint8_t CWmax = 7; // maximum CWsize + const uint8_t CWmin = 3; // minimum CWsize + const uint8_t CWmax = 8; // maximum CWsize meshtastic_MeshPacket *sendingPacket = NULL; // The packet we are currently sending uint32_t lastTxStart = 0L; - uint32_t computeSlotTimeMsec(float bw, float sf) { return 8.5 * pow(2, sf) / bw + 0.2 + 0.4 + 7; } + uint32_t computeSlotTimeMsec(); /** * A temporary buffer used for sending/receiving packets, sized to hold the biggest buffer we might need @@ -155,6 +153,9 @@ class RadioInterface /** Attempt to cancel a previously sent packet. Returns true if a packet was found we could cancel */ virtual bool cancelSending(NodeNum from, PacketId id) { return false; } + /** Attempt to find a packet in the TxQueue. Returns true if the packet was found. */ + virtual bool findInTxQueue(NodeNum from, PacketId id) { return false; } + // methods from radiohead /// Initialise the Driver transport hardware and software. diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index 69809b7a4..a6faebff4 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -222,6 +222,12 @@ bool RadioLibInterface::cancelSending(NodeNum from, PacketId id) return result; } +/** Attempt to find a packet in the TxQueue. Returns true if the packet was found. */ +bool RadioLibInterface::findInTxQueue(NodeNum from, PacketId id) +{ + return txQueue.find(from, id); +} + /** radio helper thread callback. We never immediately transmit after any operation (either Rx or Tx). Instead we should wait a random multiple of 'slotTimes' (see definition in RadioInterface.h) taken from a contention window (CW) to lower the chance of collision. @@ -445,6 +451,9 @@ void RadioLibInterface::handleReceiveInterrupt() mp->hop_start = (radioBuffer.header.flags & PACKET_FLAGS_HOP_START_MASK) >> PACKET_FLAGS_HOP_START_SHIFT; mp->want_ack = !!(radioBuffer.header.flags & PACKET_FLAGS_WANT_ACK_MASK); mp->via_mqtt = !!(radioBuffer.header.flags & PACKET_FLAGS_VIA_MQTT_MASK); + // If hop_start is not set, next_hop and relay_node are invalid (firmware <2.3) + mp->next_hop = mp->hop_start == 0 ? NO_NEXT_HOP_PREFERENCE : radioBuffer.header.next_hop; + mp->relay_node = mp->hop_start == 0 ? NO_RELAY_NODE : radioBuffer.header.relay_node; addReceiveMetadata(mp); diff --git a/src/mesh/RadioLibInterface.h b/src/mesh/RadioLibInterface.h index dff58c9ad..b24879eaf 100644 --- a/src/mesh/RadioLibInterface.h +++ b/src/mesh/RadioLibInterface.h @@ -135,6 +135,9 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified /** Attempt to cancel a previously sent packet. Returns true if a packet was found we could cancel */ virtual bool cancelSending(NodeNum from, PacketId id) override; + /** Attempt to find a packet in the TxQueue. Returns true if the packet was found. */ + virtual bool findInTxQueue(NodeNum from, PacketId id) override; + private: /** if we have something waiting to send, start a short (random) timer so we can come check for collision before actually * doing the transmit */ diff --git a/src/mesh/ReliableRouter.cpp b/src/mesh/ReliableRouter.cpp index 3e2850bcf..6e5c6231b 100644 --- a/src/mesh/ReliableRouter.cpp +++ b/src/mesh/ReliableRouter.cpp @@ -23,7 +23,7 @@ ErrorCode ReliableRouter::send(meshtastic_MeshPacket *p) } auto copy = packetPool.allocCopy(*p); - startRetransmission(copy); + startRetransmission(copy, NUM_RELIABLE_RETX); } /* If we have pending retransmissions, add the airtime of this packet to it, because during that time we cannot receive an @@ -35,7 +35,7 @@ ErrorCode ReliableRouter::send(meshtastic_MeshPacket *p) } } - return FloodingRouter::send(p); + return isBroadcast(p->to) ? FloodingRouter::send(p) : NextHopRouter::send(p); } bool ReliableRouter::shouldFilterReceived(const meshtastic_MeshPacket *p) @@ -73,7 +73,7 @@ bool ReliableRouter::shouldFilterReceived(const meshtastic_MeshPacket *p) i->second.nextTxMsec += iface->getPacketTime(p); } - return FloodingRouter::shouldFilterReceived(p); + return isBroadcast(p->to) ? FloodingRouter::shouldFilterReceived(p) : NextHopRouter::shouldFilterReceived(p); } /** @@ -138,126 +138,5 @@ void ReliableRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas } // handle the packet as normal - FloodingRouter::sniffReceived(p, c); -} - -#define NUM_RETRANSMISSIONS 3 - -PendingPacket::PendingPacket(meshtastic_MeshPacket *p) -{ - packet = p; - numRetransmissions = NUM_RETRANSMISSIONS - 1; // We subtract one, because we assume the user just did the first send -} - -PendingPacket *ReliableRouter::findPendingPacket(GlobalPacketId key) -{ - auto old = pending.find(key); // If we have an old record, someone messed up because id got reused - if (old != pending.end()) { - return &old->second; - } else - return NULL; -} -/** - * Stop any retransmissions we are doing of the specified node/packet ID pair - */ -bool ReliableRouter::stopRetransmission(NodeNum from, PacketId id) -{ - auto key = GlobalPacketId(from, id); - return stopRetransmission(key); -} - -bool ReliableRouter::stopRetransmission(GlobalPacketId key) -{ - auto old = findPendingPacket(key); - if (old) { - auto p = old->packet; - /* Only when we already transmitted a packet via LoRa, we will cancel the packet in the Tx queue - to avoid canceling a transmission if it was ACKed super fast via MQTT */ - if (old->numRetransmissions < NUM_RETRANSMISSIONS - 1) { - // remove the 'original' (identified by originator and packet->id) from the txqueue and free it - cancelSending(getFrom(p), p->id); - } - // now free the pooled copy for retransmission too - packetPool.release(p); - auto numErased = pending.erase(key); - assert(numErased == 1); - return true; - } else - return false; -} - -/** - * Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting. - */ -PendingPacket *ReliableRouter::startRetransmission(meshtastic_MeshPacket *p) -{ - auto id = GlobalPacketId(p); - auto rec = PendingPacket(p); - - stopRetransmission(getFrom(p), p->id); - - setNextTx(&rec); - pending[id] = rec; - - return &pending[id]; -} - -/** - * Do any retransmissions that are scheduled (FIXME - for the time being called from loop) - */ -int32_t ReliableRouter::doRetransmissions() -{ - uint32_t now = millis(); - int32_t d = INT32_MAX; - - // FIXME, we should use a better datastructure rather than walking through this map. - // for(auto el: pending) { - for (auto it = pending.begin(), nextIt = it; it != pending.end(); it = nextIt) { - ++nextIt; // we use this odd pattern because we might be deleting it... - auto &p = it->second; - - bool stillValid = true; // assume we'll keep this record around - - // FIXME, handle 51 day rollover here!!! - if (p.nextTxMsec <= now) { - if (p.numRetransmissions == 0) { - LOG_DEBUG("Reliable send failed, return a nak for fr=0x%x,to=0x%x,id=0x%x", p.packet->from, p.packet->to, - p.packet->id); - sendAckNak(meshtastic_Routing_Error_MAX_RETRANSMIT, getFrom(p.packet), p.packet->id, p.packet->channel); - // Note: we don't stop retransmission here, instead the Nak packet gets processed in sniffReceived - stopRetransmission(it->first); - stillValid = false; // just deleted it - } else { - LOG_DEBUG("Send reliable retransmission fr=0x%x,to=0x%x,id=0x%x, tries left=%d", p.packet->from, p.packet->to, - p.packet->id, p.numRetransmissions); - - // Note: we call the superclass version because we don't want to have our version of send() add a new - // retransmission record - FloodingRouter::send(packetPool.allocCopy(*p.packet)); - - // Queue again - --p.numRetransmissions; - setNextTx(&p); - } - } - - if (stillValid) { - // Update our desired sleep delay - int32_t t = p.nextTxMsec - now; - - d = min(t, d); - } - } - - return d; -} - -void ReliableRouter::setNextTx(PendingPacket *pending) -{ - assert(iface); - auto d = iface->getRetransmissionMsec(pending->packet); - pending->nextTxMsec = millis() + d; - LOG_DEBUG("Set next retransmission in %u msecs: ", d); - printPacket("", pending->packet); - setReceivedMessage(); // Run ASAP, so we can figure out our correct sleep time + isBroadcast(p->to) ? FloodingRouter::sniffReceived(p, c) : NextHopRouter::sniffReceived(p, c); } \ No newline at end of file diff --git a/src/mesh/ReliableRouter.h b/src/mesh/ReliableRouter.h index ba9ab8c25..2cf10fb99 100644 --- a/src/mesh/ReliableRouter.h +++ b/src/mesh/ReliableRouter.h @@ -1,61 +1,12 @@ #pragma once -#include "FloodingRouter.h" -#include - -/** - * An identifier for a globally unique message - a pair of the sending nodenum and the packet id assigned - * to that message - */ -struct GlobalPacketId { - NodeNum node; - PacketId id; - - bool operator==(const GlobalPacketId &p) const { return node == p.node && id == p.id; } - - explicit GlobalPacketId(const meshtastic_MeshPacket *p) - { - node = getFrom(p); - id = p->id; - } - - GlobalPacketId(NodeNum _from, PacketId _id) - { - node = _from; - id = _id; - } -}; - -/** - * A packet queued for retransmission - */ -struct PendingPacket { - meshtastic_MeshPacket *packet; - - /** The next time we should try to retransmit this packet */ - uint32_t nextTxMsec = 0; - - /** Starts at NUM_RETRANSMISSIONS -1(normally 3) and counts down. Once zero it will be removed from the list */ - uint8_t numRetransmissions = 0; - - PendingPacket() {} - explicit PendingPacket(meshtastic_MeshPacket *p); -}; - -class GlobalPacketIdHashFunction -{ - public: - size_t operator()(const GlobalPacketId &p) const { return (std::hash()(p.node)) ^ (std::hash()(p.id)); } -}; +#include "NextHopRouter.h" /** * This is a mixin that extends Router with the ability to do (one hop only) reliable message sends. */ -class ReliableRouter : public FloodingRouter +class ReliableRouter : public NextHopRouter { - private: - std::unordered_map pending; - public: /** * Constructor @@ -70,54 +21,14 @@ class ReliableRouter : public FloodingRouter */ virtual ErrorCode send(meshtastic_MeshPacket *p) override; - /** Do our retransmission handling */ - virtual int32_t runOnce() override - { - // Note: We must doRetransmissions FIRST, because it might queue up work for the base class runOnce implementation - auto d = doRetransmissions(); - - int32_t r = FloodingRouter::runOnce(); - - return min(d, r); - } - protected: /** * Look for acks/naks or someone retransmitting us */ virtual void sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c) override; - /** - * Try to find the pending packet record for this ID (or NULL if not found) - */ - PendingPacket *findPendingPacket(NodeNum from, PacketId id) { return findPendingPacket(GlobalPacketId(from, id)); } - PendingPacket *findPendingPacket(GlobalPacketId p); - /** * We hook this method so we can see packets before FloodingRouter says they should be discarded */ virtual bool shouldFilterReceived(const meshtastic_MeshPacket *p) override; - - /** - * Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting. - */ - PendingPacket *startRetransmission(meshtastic_MeshPacket *p); - - private: - /** - * Stop any retransmissions we are doing of the specified node/packet ID pair - * - * @return true if we found and removed a transmission with this ID - */ - bool stopRetransmission(NodeNum from, PacketId id); - bool stopRetransmission(GlobalPacketId p); - - /** - * Do any retransmissions that are scheduled (FIXME - for the time being called from loop) - * - * @return the number of msecs until our next retransmission or MAXINT if none scheduled - */ - int32_t doRetransmissions(); - - void setNextTx(PendingPacket *pending); -}; +}; \ No newline at end of file diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index bfd4c45fd..9e1e41d53 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -249,6 +249,7 @@ ErrorCode Router::send(meshtastic_MeshPacket *p) // the lora we need to make sure we have replaced it with our local address p->from = getFrom(p); + p->relay_node = nodeDB->getLastByteOfNodeNum(getNodeNum()); // set the relayer to us // If we are the original transmitter, set the hop limit with which we start if (isFromUs(p)) p->hop_start = p->hop_limit; @@ -274,6 +275,11 @@ ErrorCode Router::send(meshtastic_MeshPacket *p) abortSendAndNak(encodeResult, p); return encodeResult; // FIXME - this isn't a valid ErrorCode } +#if HAS_UDP_MULTICAST + if (udpThread && config.network.enabled_protocols & meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST) { + udpThread->onSend(const_cast(p)); + } +#endif #if !MESHTASTIC_EXCLUDE_MQTT // Only publish to MQTT if we're the original transmitter of the packet if (moduleConfig.mqtt.enabled && isFromUs(p) && mqtt) { @@ -290,7 +296,18 @@ ErrorCode Router::send(meshtastic_MeshPacket *p) /** Attempt to cancel a previously sent packet. Returns true if a packet was found we could cancel */ bool Router::cancelSending(NodeNum from, PacketId id) { - return iface ? iface->cancelSending(from, id) : false; + if (iface && iface->cancelSending(from, id)) { + // We are not a relayer of this packet anymore + removeRelayer(nodeDB->getLastByteOfNodeNum(nodeDB->getNodeNum()), id, from); + return true; + } + return false; +} + +/** Attempt to find a packet in the TxQueue. Returns true if the packet was found. */ +bool Router::findInTxQueue(NodeNum from, PacketId id) +{ + return iface->findInTxQueue(from, id); } /** diff --git a/src/mesh/Router.h b/src/mesh/Router.h index 0fe2bc551..bf6b77226 100644 --- a/src/mesh/Router.h +++ b/src/mesh/Router.h @@ -4,6 +4,7 @@ #include "MemoryPool.h" #include "MeshTypes.h" #include "Observer.h" +#include "PacketHistory.h" #include "PointerQueue.h" #include "RadioInterface.h" #include "concurrency/OSThread.h" @@ -11,7 +12,7 @@ /** * A mesh aware router that supports multiple interfaces. */ -class Router : protected concurrency::OSThread +class Router : protected concurrency::OSThread, protected PacketHistory { private: /// Packets which have just arrived from the radio, ready to be processed by this service and possibly @@ -50,6 +51,9 @@ class Router : protected concurrency::OSThread /** Attempt to cancel a previously sent packet. Returns true if a packet was found we could cancel */ bool cancelSending(NodeNum from, PacketId id); + /** Attempt to find a packet in the TxQueue. Returns true if the packet was found. */ + bool findInTxQueue(NodeNum from, PacketId id); + /** Allocate and return a meshpacket which defaults as send to broadcast from the current node. * The returned packet is guaranteed to have a unique packet ID already assigned */ diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index 7c950bc8e..6a4be023b 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -294,10 +294,17 @@ template void SX126xInterface::startReceive() template bool SX126xInterface::isChannelActive() { // check if we can detect a LoRa preamble on the current channel + ChannelScanConfig_t cfg = {.cad = {.symNum = NUM_SYM_CAD, + .detPeak = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, + .detMin = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, + .exitMode = RADIOLIB_SX126X_CAD_PARAM_DEFAULT, + .timeout = 0, + .irqFlags = RADIOLIB_IRQ_CAD_DEFAULT_FLAGS, + .irqMask = RADIOLIB_IRQ_CAD_DEFAULT_MASK}}; int16_t result; setStandby(); - result = lora.scanChannel(); + result = lora.scanChannel(cfg); if (result == RADIOLIB_LORA_DETECTED) return true; if (result != RADIOLIB_CHANNEL_FREE) diff --git a/src/mesh/SX128xInterface.cpp b/src/mesh/SX128xInterface.cpp index 1032934b8..e06f274e7 100644 --- a/src/mesh/SX128xInterface.cpp +++ b/src/mesh/SX128xInterface.cpp @@ -278,10 +278,17 @@ template void SX128xInterface::startReceive() template bool SX128xInterface::isChannelActive() { // check if we can detect a LoRa preamble on the current channel + ChannelScanConfig_t cfg = {.cad = {.symNum = NUM_SYM_CAD_24GHZ, + .detPeak = 0, + .detMin = 0, + .exitMode = 0, + .timeout = 0, + .irqFlags = RADIOLIB_IRQ_CAD_DEFAULT_FLAGS, + .irqMask = RADIOLIB_IRQ_CAD_DEFAULT_MASK}}; int16_t result; setStandby(); - result = lora.scanChannel(); + result = lora.scanChannel(cfg); if (result == RADIOLIB_LORA_DETECTED) return true; if (result != RADIOLIB_CHANNEL_FREE) diff --git a/src/mesh/api/PacketAPI.cpp b/src/mesh/api/PacketAPI.cpp new file mode 100644 index 000000000..45bbe19d3 --- /dev/null +++ b/src/mesh/api/PacketAPI.cpp @@ -0,0 +1,127 @@ +#ifdef USE_PACKET_API + +#include "api/PacketAPI.h" +#include "MeshService.h" +#include "PowerFSM.h" +#include "RadioInterface.h" +#include "modules/NodeInfoModule.h" + +PacketAPI *packetAPI = nullptr; + +PacketAPI *PacketAPI::create(PacketServer *_server) +{ + if (!packetAPI) { + packetAPI = new PacketAPI(_server); + } + return packetAPI; +} + +PacketAPI::PacketAPI(PacketServer *_server) + : concurrency::OSThread("PacketAPI"), isConnected(false), programmingMode(false), server(_server) +{ +} + +int32_t PacketAPI::runOnce() +{ + bool success = false; +#ifndef ARCH_PORTDUINO + if (config.bluetooth.enabled) { + if (!programmingMode) { + // in programmingMode we don't send any packets to the client except this one notify + programmingMode = true; + success = notifyProgrammingMode(); + } + } else +#endif + { + success = sendPacket(); + } + success |= receivePacket(); + return success ? 10 : 50; +} + +bool PacketAPI::receivePacket(void) +{ + bool data_received = false; + while (server->hasData()) { + isConnected = true; + data_received = true; + + powerFSM.trigger(EVENT_CONTACT_FROM_PHONE); + lastContactMsec = millis(); + + meshtastic_ToRadio *mr; + auto p = server->receivePacket()->move(); + int id = p->getPacketId(); + LOG_DEBUG("Received packet id=%u", id); + mr = (meshtastic_ToRadio *)&static_cast *>(p.get())->getData(); + + switch (mr->which_payload_variant) { + case meshtastic_ToRadio_packet_tag: { + meshtastic_MeshPacket *mp = &mr->packet; + printPacket("PACKET FROM QUEUE", mp); + service->handleToRadio(*mp); + break; + } + case meshtastic_ToRadio_want_config_id_tag: { + uint32_t config_nonce = mr->want_config_id; + LOG_INFO("Screen wants config, nonce=%u", config_nonce); + handleStartConfig(); + break; + } + case meshtastic_ToRadio_heartbeat_tag: + if (mr->heartbeat.dummy_field == 1) { + if (nodeInfoModule) { + LOG_INFO("Broadcasting nodeinfo ping"); + nodeInfoModule->sendOurNodeInfo(NODENUM_BROADCAST, true, 0, true); + } + } else { + LOG_DEBUG("Got client heartbeat"); + } + break; + default: + LOG_ERROR("Error: unhandled meshtastic_ToRadio variant: %d", mr->which_payload_variant); + break; + } + } + return data_received; +} + +bool PacketAPI::sendPacket(void) +{ + // fill dummy buffer; we don't use it, we directly send the fromRadio structure + uint32_t len = getFromRadio(txBuf); + if (len != 0) { + static uint32_t id = 0; + fromRadioScratch.id = ++id; + bool result = server->sendPacket(DataPacket(id, fromRadioScratch)); + if (!result) { + LOG_ERROR("send queue full"); + } + return result; + } else + return false; +} + +bool PacketAPI::notifyProgrammingMode(void) +{ + // tell the client we are in programming mode by sending only the bluetooth config state + LOG_INFO("force client into programmingMode"); + memset(&fromRadioScratch, 0, sizeof(fromRadioScratch)); + fromRadioScratch.id = nodeDB->getNodeNum(); + fromRadioScratch.which_payload_variant = meshtastic_FromRadio_config_tag; + fromRadioScratch.config.which_payload_variant = meshtastic_Config_bluetooth_tag; + fromRadioScratch.config.payload_variant.bluetooth = config.bluetooth; + return server->sendPacket(DataPacket(0, fromRadioScratch)); +} + +/** + * return true if we got (once!) contact from our client and the server send queue is not full + */ +bool PacketAPI::checkIsConnected() +{ + isConnected |= server->hasData(); + return isConnected && server->available(); +} + +#endif \ No newline at end of file diff --git a/src/mesh/api/PacketAPI.h b/src/mesh/api/PacketAPI.h new file mode 100644 index 000000000..fc08ab209 --- /dev/null +++ b/src/mesh/api/PacketAPI.h @@ -0,0 +1,38 @@ +#pragma once + +#include "PhoneAPI.h" +#include "comms/PacketServer.h" +#include "concurrency/OSThread.h" + +/** + * A version of the phone API used for inter task communication based on protobuf packets, e.g. + * between two tasks running on CPU0 and CPU1, respectively. + * + */ +class PacketAPI : public PhoneAPI, public concurrency::OSThread +{ + public: + static PacketAPI *create(PacketServer *_server); + virtual ~PacketAPI(){}; + virtual int32_t runOnce(); + + protected: + PacketAPI(PacketServer *_server); + // Check the current underlying physical queue to see if the client is fetching packets + bool checkIsConnected() override; + + void onNowHasData(uint32_t fromRadioNum) override {} + void onConnectionChanged(bool connected) override {} + + private: + bool receivePacket(void); + bool sendPacket(void); + bool notifyProgrammingMode(void); + + bool isConnected; + bool programmingMode; + PacketServer *server; + uint8_t txBuf[MAX_TO_FROM_RADIO_SIZE] = {0}; // dummy buf to obey PhoneAPI +}; + +extern PacketAPI *packetAPI; \ No newline at end of file diff --git a/src/mesh/mesh-pb-constants.h b/src/mesh/mesh-pb-constants.h index 039b36d8d..f91c48560 100644 --- a/src/mesh/mesh-pb-constants.h +++ b/src/mesh/mesh-pb-constants.h @@ -23,8 +23,6 @@ #define MAX_NUM_NODES 100 #endif -#define MAX_NUM_NODES_FS 100 - /// Max number of channels allowed #define MAX_NUM_CHANNELS (member_size(meshtastic_ChannelFile, channels) / member_size(meshtastic_ChannelFile, channels[0])) diff --git a/src/mesh/udp/UdpMulticastThread.h b/src/mesh/udp/UdpMulticastThread.h new file mode 100644 index 000000000..9128d3b5c --- /dev/null +++ b/src/mesh/udp/UdpMulticastThread.h @@ -0,0 +1,70 @@ +#pragma once +#if HAS_UDP_MULTICAST +#include "configuration.h" +#include "main.h" +#include "mesh/Router.h" + +#include +#include + +#define UDP_MULTICAST_DEFAUL_PORT 4403 // Default port for UDP multicast is same as TCP api server +#define UDP_MULTICAST_THREAD_INTERVAL_MS 15000 + +class UdpMulticastThread : public concurrency::OSThread +{ + public: + UdpMulticastThread() : OSThread("UdpMulticast") { udpIpAddress = IPAddress(224, 0, 0, 69); } + + void start() + { + if (udp.listenMulticast(udpIpAddress, UDP_MULTICAST_DEFAUL_PORT)) { + LOG_DEBUG("UDP Listening on IP: %s", WiFi.localIP().toString().c_str()); + udp.onPacket([this](AsyncUDPPacket packet) { onReceive(packet); }); + } else { + LOG_DEBUG("Failed to listen on UDP"); + } + } + + void onReceive(AsyncUDPPacket packet) + { + size_t packetLength = packet.length(); + LOG_DEBUG("UDP broadcast from: %s, len=%u", packet.remoteIP().toString().c_str(), packetLength); + meshtastic_MeshPacket mp; + uint8_t bytes[meshtastic_MeshPacket_size]; // Allocate buffer for the data + size_t packetSize = packet.readBytes(bytes, packet.length()); + LOG_DEBUG("Decoding MeshPacket from UDP len=%u", packetSize); + bool isPacketDecoded = pb_decode_from_bytes(bytes, packetLength, &meshtastic_MeshPacket_msg, &mp); + if (isPacketDecoded && router) { + UniquePacketPoolPacket p = packetPool.allocUniqueCopy(mp); + // Unset received SNR/RSSI + p->rx_snr = 0; + p->rx_rssi = 0; + router->enqueueReceivedMessage(p.release()); + } + } + + bool onSend(const meshtastic_MeshPacket *mp) + { + if (!mp || WiFi.status() != WL_CONNECTED) { + return false; + } + LOG_DEBUG("Broadcasting packet over UDP (id=%u)", mp->id); + uint8_t buffer[meshtastic_MeshPacket_size]; + size_t encodedLength = pb_encode_to_bytes(buffer, sizeof(buffer), &meshtastic_MeshPacket_msg, mp); + udp.broadcastTo(buffer, encodedLength, UDP_MULTICAST_DEFAUL_PORT); + return true; + } + + protected: + int32_t runOnce() override + { + canSleep = true; + // TODO: Implement nodeinfo broadcast + return UDP_MULTICAST_THREAD_INTERVAL_MS; + } + + private: + IPAddress udpIpAddress; + AsyncUDP udp; +}; +#endif // ARCH_ESP32 \ No newline at end of file diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index d4a5dbf94..ee50ee56f 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -108,6 +108,12 @@ static void onNetworkConnected() #endif APStartupComplete = true; } + +#if HAS_UDP_MULTICAST + if (udpThread) { + udpThread->start(); + } +#endif } static int32_t reconnectWiFi() @@ -428,4 +434,4 @@ uint8_t getWifiDisconnectReason() { return wifiDisconnectReason; } -#endif +#endif \ No newline at end of file diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 631afd737..ac25f57a5 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -285,7 +285,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->set_favorite_node); if (node != NULL) { node->is_favorite = true; - saveChanges(SEGMENT_DEVICESTATE, false); + saveChanges(SEGMENT_NODEDATABASE, false); } break; } @@ -294,7 +294,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->remove_favorite_node); if (node != NULL) { node->is_favorite = false; - saveChanges(SEGMENT_DEVICESTATE, false); + saveChanges(SEGMENT_NODEDATABASE, false); } break; } @@ -307,7 +307,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta node->has_position = false; node->user.public_key.size = 0; node->user.public_key.bytes[0] = 0; - saveChanges(SEGMENT_DEVICESTATE, false); + saveChanges(SEGMENT_NODEDATABASE, false); } break; } @@ -316,7 +316,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->remove_ignored_node); if (node != NULL) { node->is_ignored = false; - saveChanges(SEGMENT_DEVICESTATE, false); + saveChanges(SEGMENT_NODEDATABASE, false); } break; } @@ -327,7 +327,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta node->position = TypeConversions::ConvertToPositionLite(r->set_fixed_position); nodeDB->setLocalPosition(r->set_fixed_position); config.position.fixed_position = true; - saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false); + saveChanges(SEGMENT_DEVICESTATE | SEGMENT_NODEDATABASE | SEGMENT_CONFIG, false); #if !MESHTASTIC_EXCLUDE_GPS if (gps != nullptr) gps->enable(); @@ -340,7 +340,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta LOG_INFO("Client received remove_fixed_position command"); nodeDB->clearLocalPosition(); config.position.fixed_position = false; - saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false); + saveChanges(SEGMENT_DEVICESTATE | SEGMENT_NODEDATABASE | SEGMENT_CONFIG, false); break; } case meshtastic_AdminMessage_set_time_only_tag: { @@ -450,11 +450,14 @@ void AdminModule::handleSetOwner(const meshtastic_User &o) if (owner.is_licensed != o.is_licensed) { changed = 1; owner.is_licensed = o.is_licensed; + if (channels.ensureLicensedOperation()) { + sendWarning(licensedModeMessage); + } } if (changed) { // If nothing really changed, don't broadcast on the network or write to flash service->reloadOwner(!hasOpenEditTransaction); - saveChanges(SEGMENT_DEVICESTATE); + saveChanges(SEGMENT_DEVICESTATE | SEGMENT_NODEDATABASE); } } @@ -740,6 +743,9 @@ bool AdminModule::handleSetModuleConfig(const meshtastic_ModuleConfig &c) void AdminModule::handleSetChannel(const meshtastic_Channel &cc) { channels.setChannel(cc); + if (channels.ensureLicensedOperation()) { + sendWarning(licensedModeMessage); + } channels.onConfigChanged(); // tell the radios about this change saveChanges(SEGMENT_CHANNELS, false); } @@ -1077,15 +1083,14 @@ void AdminModule::handleSetHamMode(const meshtastic_HamParameters &p) config.device.rebroadcast_mode = meshtastic_Config_DeviceConfig_RebroadcastMode_LOCAL_ONLY; // Remove PSK of primary channel for plaintext amateur usage - auto primaryChannel = channels.getByIndex(channels.getPrimaryIndex()); - auto &channelSettings = primaryChannel.settings; - channelSettings.psk.bytes[0] = 0; - channelSettings.psk.size = 0; - channels.setChannel(primaryChannel); + + if (channels.ensureLicensedOperation()) { + sendWarning(licensedModeMessage); + } channels.onConfigChanged(); service->reloadOwner(false); - saveChanges(SEGMENT_CONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS); + saveChanges(SEGMENT_CONFIG | SEGMENT_NODEDATABASE | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS); } AdminModule::AdminModule() : ProtobufModule("Admin", meshtastic_PortNum_ADMIN_APP, &meshtastic_AdminMessage_msg) diff --git a/src/modules/AdminModule.h b/src/modules/AdminModule.h index 12c857e04..246d39e37 100644 --- a/src/modules/AdminModule.h +++ b/src/modules/AdminModule.h @@ -64,6 +64,9 @@ class AdminModule : public ProtobufModule, public Obser void sendWarning(const char *message); }; +static constexpr const char *licensedModeMessage = + "Licensed mode activated, removing admin channel and encryption from all channels"; + extern AdminModule *adminModule; void disableBluetooth(); \ No newline at end of file diff --git a/src/modules/RoutingModule.cpp b/src/modules/RoutingModule.cpp index a501e319b..34ef2ddd1 100644 --- a/src/modules/RoutingModule.cpp +++ b/src/modules/RoutingModule.cpp @@ -20,6 +20,11 @@ bool RoutingModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, mesh if ((nodeDB->getMeshNode(mp.from) == NULL || !nodeDB->getMeshNode(mp.from)->has_user) && (nodeDB->getMeshNode(mp.to) == NULL || !nodeDB->getMeshNode(mp.to)->has_user)) return false; + } else if (owner.is_licensed && nodeDB->getLicenseStatus(mp.from) == UserLicenseStatus::NotLicensed) { + // Don't let licensed users to rebroadcast packets from unlicensed users + // If we know they are in-fact unlicensed + LOG_DEBUG("Packet from unlicensed user, ignoring packet"); + return false; } printPacket("Routing sniffing", &mp); diff --git a/src/modules/TraceRouteModule.cpp b/src/modules/TraceRouteModule.cpp index e9aaf9d30..41cb35649 100644 --- a/src/modules/TraceRouteModule.cpp +++ b/src/modules/TraceRouteModule.cpp @@ -109,7 +109,7 @@ void TraceRouteModule::appendMyIDandSNR(meshtastic_RouteDiscovery *updated, floa void TraceRouteModule::printRoute(meshtastic_RouteDiscovery *r, uint32_t origin, uint32_t dest, bool isTowardsDestination) { #ifdef DEBUG_PORT - std::string route = "Route traced:"; + std::string route = "Route traced:\n"; route += vformat("0x%x --> ", origin); for (uint8_t i = 0; i < r->route_count; i++) { if (i < r->snr_towards_count && r->snr_towards[i] != INT8_MIN) @@ -129,6 +129,7 @@ void TraceRouteModule::printRoute(meshtastic_RouteDiscovery *r, uint32_t origin, // If there's a route back (or we are the destination as then the route is complete), print it if (r->route_back_count > 0 || origin == nodeDB->getNodeNum()) { + route += "\n"; if (r->snr_towards_count > 0 && origin == nodeDB->getNodeNum()) route += vformat("(%.2fdB) 0x%x <-- ", (float)r->snr_back[r->snr_back_count - 1] / 4, origin); else diff --git a/src/nimble/NimbleBluetooth.cpp b/src/nimble/NimbleBluetooth.cpp index 6315fdec9..009439f25 100644 --- a/src/nimble/NimbleBluetooth.cpp +++ b/src/nimble/NimbleBluetooth.cpp @@ -91,7 +91,9 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks LOG_INFO("*** Enter passkey %d on the peer side ***", passkey); powerFSM.trigger(EVENT_BLUETOOTH_PAIR); -#if HAS_SCREEN + bluetoothStatus->updateStatus(new meshtastic::BluetoothStatus(std::to_string(passkey))); + +#if HAS_SCREEN // Todo: migrate this display code back into Screen class, and observe bluetoothStatus screen->startAlert([passkey](OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) -> void { char btPIN[16] = "888888"; snprintf(btPIN, sizeof(btPIN), "%06u", passkey); @@ -127,6 +129,9 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks { LOG_INFO("BLE authentication complete"); + bluetoothStatus->updateStatus(new meshtastic::BluetoothStatus(meshtastic::BluetoothStatus::ConnectionState::CONNECTED)); + + // Todo: migrate this display code back into Screen class, and observe bluetoothStatus if (passkeyShowing) { passkeyShowing = false; screen->endAlert(); @@ -137,6 +142,9 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks { LOG_INFO("BLE disconnect"); + bluetoothStatus->updateStatus( + new meshtastic::BluetoothStatus(meshtastic::BluetoothStatus::ConnectionState::DISCONNECTED)); + if (bluetoothPhoneAPI) { bluetoothPhoneAPI->close(); } diff --git a/src/platform/nrf52/NRF52Bluetooth.cpp b/src/platform/nrf52/NRF52Bluetooth.cpp index b98620f33..87d8adfa9 100644 --- a/src/platform/nrf52/NRF52Bluetooth.cpp +++ b/src/platform/nrf52/NRF52Bluetooth.cpp @@ -57,6 +57,9 @@ void onConnect(uint16_t conn_handle) char central_name[32] = {0}; connection->getPeerName(central_name, sizeof(central_name)); LOG_INFO("BLE Connected to %s", central_name); + + // Notify UI (or any other interested firmware components) + bluetoothStatus->updateStatus(new meshtastic::BluetoothStatus(meshtastic::BluetoothStatus::ConnectionState::CONNECTED)); } /** * Callback invoked when a connection is dropped @@ -69,6 +72,9 @@ void onDisconnect(uint16_t conn_handle, uint8_t reason) if (bluetoothPhoneAPI) { bluetoothPhoneAPI->close(); } + + // Notify UI (or any other interested firmware components) + bluetoothStatus->updateStatus(new meshtastic::BluetoothStatus(meshtastic::BluetoothStatus::ConnectionState::DISCONNECTED)); } void onCccd(uint16_t conn_hdl, BLECharacteristic *chr, uint16_t cccd_value) { @@ -319,7 +325,17 @@ bool NRF52Bluetooth::onPairingPasskey(uint16_t conn_handle, uint8_t const passke { LOG_INFO("BLE pair process started with passkey %.3s %.3s", passkey, passkey + 3); powerFSM.trigger(EVENT_BLUETOOTH_PAIR); -#if !defined(MESHTASTIC_EXCLUDE_SCREEN) + + // Get passkey as string + // Note: possible leading zeros + std::string textkey; + for (uint8_t i = 0; i < 6; i++) + textkey += (char)passkey[i]; + + // Notify UI (or other components) of pairing event and passkey + bluetoothStatus->updateStatus(new meshtastic::BluetoothStatus(textkey)); + +#if !defined(MESHTASTIC_EXCLUDE_SCREEN) // Todo: migrate this display code back into Screen class, and observe bluetoothStatus screen->startAlert([](OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) -> void { char btPIN[16] = "888888"; snprintf(btPIN, sizeof(btPIN), "%06u", configuredPasskey); @@ -358,10 +374,18 @@ bool NRF52Bluetooth::onPairingPasskey(uint16_t conn_handle, uint8_t const passke } void NRF52Bluetooth::onPairingCompleted(uint16_t conn_handle, uint8_t auth_status) { - if (auth_status == BLE_GAP_SEC_STATUS_SUCCESS) + if (auth_status == BLE_GAP_SEC_STATUS_SUCCESS) { LOG_INFO("BLE pair success"); - else + bluetoothStatus->updateStatus( + new meshtastic::BluetoothStatus(meshtastic::BluetoothStatus::ConnectionState::DISCONNECTED)); + } else { LOG_INFO("BLE pair failed"); + // Notify UI (or any other interested firmware components) + bluetoothStatus->updateStatus( + new meshtastic::BluetoothStatus(meshtastic::BluetoothStatus::ConnectionState::DISCONNECTED)); + } + + // Todo: migrate this display code back into Screen class, and observe bluetoothStatus screen->endAlert(); } diff --git a/src/platform/portduino/SimRadio.cpp b/src/platform/portduino/SimRadio.cpp index 7e63b995e..4e748c5f9 100644 --- a/src/platform/portduino/SimRadio.cpp +++ b/src/platform/portduino/SimRadio.cpp @@ -139,6 +139,12 @@ bool SimRadio::cancelSending(NodeNum from, PacketId id) return result; } +/** Attempt to find a packet in the TxQueue. Returns true if the packet was found. */ +bool SimRadio::findInTxQueue(NodeNum from, PacketId id) +{ + return txQueue.find(from, id); +} + void SimRadio::onNotify(uint32_t notification) { switch (notification) { diff --git a/src/platform/portduino/SimRadio.h b/src/platform/portduino/SimRadio.h index c082444e5..ea534bd65 100644 --- a/src/platform/portduino/SimRadio.h +++ b/src/platform/portduino/SimRadio.h @@ -33,6 +33,9 @@ class SimRadio : public RadioInterface, protected concurrency::NotifiedWorkerThr /** Attempt to cancel a previously sent packet. Returns true if a packet was found we could cancel */ virtual bool cancelSending(NodeNum from, PacketId id) override; + /** Attempt to find a packet in the TxQueue. Returns true if the packet was found. */ + virtual bool findInTxQueue(NodeNum from, PacketId id) override; + /** * Start waiting to receive a message * diff --git a/src/shutdown.h b/src/shutdown.h index 9e30e772c..c2ba6f670 100644 --- a/src/shutdown.h +++ b/src/shutdown.h @@ -3,6 +3,7 @@ #include "graphics/Screen.h" #include "main.h" #include "power.h" +#include "sleep.h" #if defined(ARCH_PORTDUINO) #include "api/WiFiServerAPI.h" #include "input/LinuxInputImpl.h" @@ -13,6 +14,7 @@ void powerCommandsCheck() { if (rebootAtMsec && millis() > rebootAtMsec) { LOG_INFO("Rebooting"); + notifyReboot.notifyObservers(NULL); #if defined(ARCH_ESP32) ESP.restart(); #elif defined(ARCH_NRF52) diff --git a/src/sleep.cpp b/src/sleep.cpp index 437d7b88b..202b8c354 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -4,7 +4,6 @@ #include "GPS.h" #endif -#include "ButtonThread.h" #include "Default.h" #include "Led.h" #include "MeshRadio.h" @@ -39,9 +38,19 @@ esp_sleep_source_t wakeCause; // the reason we booted this time /// Called to ask any observers if they want to veto sleep. Return 1 to veto or 0 to allow sleep to happen Observable preflightSleep; -/// Called to tell observers we are now entering sleep and you should prepare. Must return 0 -/// notifySleep will be called for light or deep sleep, notifyDeepSleep is only called for deep sleep -Observable notifySleep, notifyDeepSleep; +/// Called to tell observers we are now entering (deep) sleep and you should prepare. Must return 0 +Observable notifyDeepSleep; + +/// Called to tell observers we are rebooting ASAP. Must return 0 +Observable notifyReboot; + +#ifdef ARCH_ESP32 +/// Called to tell observers that light sleep is about to begin +Observable notifyLightSleep; + +/// Called to tell observers that light sleep has just ended, and why it ended +Observable notifyLightSleepEnd; +#endif // deep sleep support RTC_DATA_ATTR int bootCount = 0; @@ -183,8 +192,6 @@ static void waitEnterSleep(bool skipPreflight = false) // Code that still needs to be moved into notifyObservers console->flush(); // send all our characters before we stop cpu clock setBluetoothEnable(false); // has to be off before calling light sleep - - notifySleep.notifyObservers(NULL); } void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false, bool skipSaveNodeDb = false) @@ -206,11 +213,8 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false, bool skipSaveN #endif #ifdef ARCH_ESP32 - if (shouldLoraWake(msecToWake)) { - notifySleep.notifyObservers(NULL); - } else { + if (!shouldLoraWake(msecToWake)) notifyDeepSleep.notifyObservers(NULL); - } #else notifyDeepSleep.notifyObservers(NULL); #endif @@ -353,6 +357,7 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r #endif waitEnterSleep(false); + notifyLightSleep.notifyObservers(NULL); // Button interrupts are detached here uint64_t sleepUsec = sleepMsec * 1000LL; @@ -388,9 +393,6 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r // The enableLoraInterrupt() method is using ext0_wakeup, so we are forced to use GPIO wakeup gpio_num_t pin = (gpio_num_t)(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN); - // Have to *fully* detach the normal button-interrupts first - buttonThread->detachButtonInterrupts(); - gpio_wakeup_enable(pin, GPIO_INTR_LOW_LEVEL); esp_sleep_enable_gpio_wakeup(); #endif @@ -429,7 +431,6 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r #ifdef BUTTON_PIN // Disable wake-on-button interrupt. Re-attach normal button-interrupts gpio_wakeup_disable(pin); - buttonThread->attachButtonInterrupts(); #endif #ifdef T_WATCH_S3 @@ -448,6 +449,8 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r #endif esp_sleep_wakeup_cause_t cause = esp_sleep_get_wakeup_cause(); + notifyLightSleepEnd.notifyObservers(cause); // Button interrupts are reattached here + #ifdef BUTTON_PIN if (cause == ESP_SLEEP_WAKEUP_GPIO) { LOG_INFO("Exit light sleep gpio: btn=%d", diff --git a/src/sleep.h b/src/sleep.h index 8d3cb17e8..f780fb3c0 100644 --- a/src/sleep.h +++ b/src/sleep.h @@ -34,12 +34,20 @@ extern bool bluetoothOn; /// Called to ask any observers if they want to veto sleep. Return 1 to veto or 0 to allow sleep to happen extern Observable preflightSleep; -/// Called to tell observers we are now entering (light or deep) sleep and you should prepare. Must return 0 -extern Observable notifySleep; - /// Called to tell observers we are now entering (deep) sleep and you should prepare. Must return 0 extern Observable notifyDeepSleep; +/// Called to tell observers we are rebooting ASAP. Must return 0 +extern Observable notifyReboot; + +#ifdef ARCH_ESP32 +/// Called to tell observers that light sleep is about to begin +extern Observable notifyLightSleep; + +/// Called to tell observers that light sleep has just ended, and why it ended +extern Observable notifyLightSleepEnd; +#endif + void enableModemSleep(); #ifdef ARCH_ESP32 void enableLoraInterrupt(); diff --git a/variants/heltec_vision_master_e213/nicheGraphics.h b/variants/heltec_vision_master_e213/nicheGraphics.h new file mode 100644 index 000000000..f7a37fc61 --- /dev/null +++ b/variants/heltec_vision_master_e213/nicheGraphics.h @@ -0,0 +1,115 @@ +#pragma once + +#include "configuration.h" + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +// InkHUD-specific components +// --------------------------- +#include "graphics/niche/InkHUD/WindowManager.h" + +// Applets +#include "graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.h" +#include "graphics/niche/InkHUD/Applets/User/DM/DMApplet.h" +#include "graphics/niche/InkHUD/Applets/User/Heard/HeardApplet.h" +#include "graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.h" +#include "graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h" +#include "graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h" + +// #include "graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.h" +// #include "graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h" + +// Shared NicheGraphics components +// -------------------------------- +#include "graphics/niche/Drivers/EInk/LCMEN2R13EFC1.h" +#include "graphics/niche/Inputs/TwoButton.h" + +#include "graphics/niche/Fonts/FreeSans6pt7b.h" +#include "graphics/niche/Fonts/FreeSans6pt8bCyrillic.h" +#include + +void setupNicheGraphics() +{ + using namespace NicheGraphics; + + // SPI + // ----------------------------- + + // Display is connected to HSPI + SPIClass *hspi = new SPIClass(HSPI); + hspi->begin(PIN_EINK_SCLK, -1, PIN_EINK_MOSI, PIN_EINK_CS); + + // E-Ink Driver + // ----------------------------- + + // Use E-Ink driver + Drivers::EInk *driver = new Drivers::LCMEN213EFC1; + driver->begin(hspi, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES); + + // InkHUD + // ---------------------------- + + InkHUD::WindowManager *windowManager = InkHUD::WindowManager::getInstance(); + + // Set the driver + windowManager->setDriver(driver); + + // Set how many FAST updates per FULL update + // Set how unhealthy additional FAST updates beyond this number are + windowManager->setDisplayResilience(10, 1.5); + + // Prepare fonts + InkHUD::AppletFont largeFont(FreeSans9pt7b); + InkHUD::AppletFont smallFont(FreeSans6pt7b); + /* + // Font localization demo: Cyrillic + InkHUD::AppletFont smallFont(FreeSans6pt8bCyrillic); + smallFont.addSubstitutionsWin1251(); + */ + InkHUD::Applet::setDefaultFonts(largeFont, smallFont); + + // Init settings, and customize defaults + InkHUD::settings.userTiles.maxCount = 2; // How many tiles can the display handle? + InkHUD::settings.rotation = 3; // 270 degrees clockwise + InkHUD::settings.userTiles.count = 1; // One tile only by default, keep things simple for new users + InkHUD::settings.optionalMenuItems.nextTile = false; // Behavior handled by aux button instead + + // Pick applets + // Note: order of applets determines priority of "auto-show" feature + // Optional arguments for defaults: + // - is activated? + // - is autoshown? + // - is foreground on a specific tile (index)? + windowManager->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown + windowManager->addApplet("DMs", new InkHUD::DMApplet); + windowManager->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); + windowManager->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); + windowManager->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated + windowManager->addApplet("Recents List", new InkHUD::RecentsListApplet); + windowManager->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0 + // windowManager->addApplet("Basic", new InkHUD::BasicExampleApplet); + // windowManager->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet); + + // Start running window manager + windowManager->begin(); + + // Buttons + // -------------------------- + + Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // Shared NicheGraphics component + constexpr uint8_t MAIN_BUTTON = 0; + constexpr uint8_t AUX_BUTTON = 1; + + // Setup the main user button + buttons->setWiring(MAIN_BUTTON, BUTTON_PIN); + buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::WindowManager::getInstance()->handleButtonShort(); }); + buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::WindowManager::getInstance()->handleButtonLong(); }); + + // Setup the aux button + // Bonus feature of VME213 + buttons->setWiring(AUX_BUTTON, BUTTON_PIN_SECONDARY); + buttons->setHandlerShortPress(AUX_BUTTON, []() { InkHUD::WindowManager::getInstance()->nextTile(); }); + buttons->start(); +} + +#endif \ No newline at end of file diff --git a/variants/heltec_vision_master_e213/platformio.ini b/variants/heltec_vision_master_e213/platformio.ini index cc6f283b5..3d8f2e7cd 100644 --- a/variants/heltec_vision_master_e213/platformio.ini +++ b/variants/heltec_vision_master_e213/platformio.ini @@ -5,6 +5,7 @@ build_flags = ${esp32s3_base.build_flags} -Ivariants/heltec_vision_master_e213 -DHELTEC_VISION_MASTER_E213 + -DUSE_EINK -DEINK_DISPLAY_MODEL=GxEPD2_213_FC1 -DEINK_WIDTH=250 -DEINK_HEIGHT=122 @@ -16,4 +17,24 @@ lib_deps = ${esp32s3_base.lib_deps} https://github.com/meshtastic/GxEPD2#b202ebfec6a4821e098cf7a625ba0f6f2400292d lewisxhe/PCF8563_Library@^1.0.1 +upload_speed = 115200 + +; Using experimental InkHUD UI (work in progress) +[platformio] +extra_configs = src/graphics/niche/InkHUD/PlatformioConfig.ini +[env:heltec-vision-master-e213-inkhud] +extends = esp32s3_base, inkhud +board = heltec_vision_master_e213 +build_src_filter = + ${esp32_base.build_src_filter} + ${inkhud.build_src_filter} +build_flags = + ${esp32s3_base.build_flags} + ${inkhud.build_flags} + -I variants/heltec_vision_master_e213 + -D HELTEC_VISION_MASTER_E213 + -D MAX_THREADS=40 +lib_deps = + ${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot intead of AdafruitGFX + ${esp32s3_base.lib_deps} upload_speed = 115200 \ No newline at end of file diff --git a/variants/heltec_vision_master_e213/variant.h b/variants/heltec_vision_master_e213/variant.h index 386df6fcf..49b8e91f5 100644 --- a/variants/heltec_vision_master_e213/variant.h +++ b/variants/heltec_vision_master_e213/variant.h @@ -8,7 +8,6 @@ #define I2C_SCL SCL // Display (E-Ink) -#define USE_EINK #define PIN_EINK_CS 5 #define PIN_EINK_BUSY 1 #define PIN_EINK_DC 2 diff --git a/variants/heltec_vision_master_e290/nicheGraphics.h b/variants/heltec_vision_master_e290/nicheGraphics.h new file mode 100644 index 000000000..c55a84ec0 --- /dev/null +++ b/variants/heltec_vision_master_e290/nicheGraphics.h @@ -0,0 +1,129 @@ +/* + +Most of the Meshtastic firmware uses preprocessor macros throughout the code to support different hardware variants. +NicheGraphics attempts a different approach: + +Per-device config takes place in this setupNicheGraphics() method +(And a small amount in platformio.ini) + +This file sets up InkHUD for Heltec VM-E290. +Different NicheGraphics UIs and different hardware variants will each have their own setup procedure. + +*/ + +#pragma once + +#include "configuration.h" + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +// InkHUD-specific components +// --------------------------- +#include "graphics/niche/InkHUD/WindowManager.h" + +// Applets +#include "graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.h" +#include "graphics/niche/InkHUD/Applets/User/DM/DMApplet.h" +#include "graphics/niche/InkHUD/Applets/User/Heard/HeardApplet.h" +#include "graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.h" +#include "graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h" +#include "graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h" + +// #include "graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.h" +// #include "graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h" + +// Shared NicheGraphics components +// -------------------------------- +#include "graphics/niche/Drivers/EInk/DEPG0290BNS800.h" +#include "graphics/niche/Inputs/TwoButton.h" + +#include "graphics/niche/Fonts/FreeSans6pt7b.h" +#include "graphics/niche/Fonts/FreeSans6pt8bCyrillic.h" +#include + +void setupNicheGraphics() +{ + using namespace NicheGraphics; + + // SPI + // ----------------------------- + + // Display is connected to HSPI + SPIClass *hspi = new SPIClass(HSPI); + hspi->begin(PIN_EINK_SCLK, -1, PIN_EINK_MOSI, PIN_EINK_CS); + + // E-Ink Driver + // ----------------------------- + + // Use E-Ink driver + Drivers::EInk *driver = new Drivers::DEPG0290BNS800; + driver->begin(hspi, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY); + + // InkHUD + // ---------------------------- + + InkHUD::WindowManager *windowManager = InkHUD::WindowManager::getInstance(); + + // Set the driver + windowManager->setDriver(driver); + + // Set how many FAST updates per FULL update + // Set how unhealthy additional FAST updates beyond this number are + windowManager->setDisplayResilience(7, 1.5); + + // Prepare fonts + InkHUD::AppletFont largeFont(FreeSans9pt7b); + InkHUD::AppletFont smallFont(FreeSans6pt7b); + /* + // Font localization demo: Cyrillic + InkHUD::AppletFont smallFont(FreeSans6pt8bCyrillic); + smallFont.addSubstitutionsWin1251(); + */ + InkHUD::Applet::setDefaultFonts(largeFont, smallFont); + + // Init settings, and customize defaults + InkHUD::settings.userTiles.maxCount = 2; // How many tiles can the display handle? + InkHUD::settings.rotation = 1; // 90 degrees clockwise + InkHUD::settings.userTiles.count = 1; // One tile only by default, keep things simple for new users + InkHUD::settings.optionalMenuItems.nextTile = false; // Behavior handled by aux button instead + + // Pick applets + // Note: order of applets determines priority of "auto-show" feature + // Optional arguments for defaults: + // - is activated? + // - is autoshown? + // - is foreground on a specific tile (index)? + windowManager->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown + windowManager->addApplet("DMs", new InkHUD::DMApplet); + windowManager->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); + windowManager->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); + windowManager->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated + windowManager->addApplet("Recents List", new InkHUD::RecentsListApplet); + windowManager->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0 + // windowManager->addApplet("Basic", new InkHUD::BasicExampleApplet); + // windowManager->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet); + + // Start running window manager + windowManager->begin(); + + // Buttons + // -------------------------- + + Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // Shared NicheGraphics component + constexpr uint8_t MAIN_BUTTON = 0; + constexpr uint8_t AUX_BUTTON = 1; + + // Setup the main user button + buttons->setWiring(MAIN_BUTTON, BUTTON_PIN); + buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::WindowManager::getInstance()->handleButtonShort(); }); + buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::WindowManager::getInstance()->handleButtonLong(); }); + + // Setup the aux button + // Bonus feature of VME290 + buttons->setWiring(AUX_BUTTON, BUTTON_PIN_SECONDARY); + buttons->setHandlerShortPress(AUX_BUTTON, []() { InkHUD::WindowManager::getInstance()->nextTile(); }); + + buttons->start(); +} + +#endif \ No newline at end of file diff --git a/variants/heltec_vision_master_e290/platformio.ini b/variants/heltec_vision_master_e290/platformio.ini index 06804e4f2..d3aa85d65 100644 --- a/variants/heltec_vision_master_e290/platformio.ini +++ b/variants/heltec_vision_master_e290/platformio.ini @@ -1,14 +1,17 @@ +; Using the original screen class [env:heltec-vision-master-e290] extends = esp32s3_base board = heltec_vision_master_e290 build_flags = ${esp32s3_base.build_flags} -I variants/heltec_vision_master_e290 + -D DISPLAY_FLIP_SCREEN ; Orient so the LoRa antenna faces up -D HELTEC_VISION_MASTER_E290 -D BUTTON_CLICK_MS=200 -D EINK_DISPLAY_MODEL=GxEPD2_290_BN8 -D EINK_WIDTH=296 -D EINK_HEIGHT=128 + -D USE_EINK -D USE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk -D EINK_LIMIT_FASTREFRESH=10 ; How many consecutive fast-refreshes are permitted -D EINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting" @@ -18,4 +21,24 @@ lib_deps = ${esp32s3_base.lib_deps} https://github.com/meshtastic/GxEPD2#448c8538129fde3d02a7cb5e6fc81971ad92547f lewisxhe/PCF8563_Library@^1.0.1 +upload_speed = 115200 + +; Using experimental InkHUD UI (work in progress) +[platformio] +extra_configs = src/graphics/niche/InkHUD/PlatformioConfig.ini +[env:heltec-vision-master-e290-inkhud] +extends = esp32s3_base, inkhud +board = heltec_vision_master_e290 +build_src_filter = + ${esp32_base.build_src_filter} + ${inkhud.build_src_filter} +build_flags = + ${esp32s3_base.build_flags} + ${inkhud.build_flags} + -I variants/heltec_vision_master_e290 + -D HELTEC_VISION_MASTER_E290 + -D MAX_THREADS=40 +lib_deps = + ${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot intead of AdafruitGFX + ${esp32s3_base.lib_deps} upload_speed = 115200 \ No newline at end of file diff --git a/variants/heltec_vision_master_e290/variant.h b/variants/heltec_vision_master_e290/variant.h index 299186549..9d6041539 100644 --- a/variants/heltec_vision_master_e290/variant.h +++ b/variants/heltec_vision_master_e290/variant.h @@ -8,7 +8,6 @@ #define I2C_SCL SCL // Display (E-Ink) -#define USE_EINK #define PIN_EINK_CS 3 #define PIN_EINK_BUSY 6 #define PIN_EINK_DC 4 diff --git a/variants/heltec_wireless_paper/nicheGraphics.h b/variants/heltec_wireless_paper/nicheGraphics.h new file mode 100644 index 000000000..0c26f453c --- /dev/null +++ b/variants/heltec_wireless_paper/nicheGraphics.h @@ -0,0 +1,111 @@ +#pragma once + +#include "configuration.h" + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +// InkHUD-specific components +// --------------------------- +#include "graphics/niche/InkHUD/WindowManager.h" + +// Applets +#include "graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.h" +#include "graphics/niche/InkHUD/Applets/User/DM/DMApplet.h" +#include "graphics/niche/InkHUD/Applets/User/Heard/HeardApplet.h" +#include "graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.h" +#include "graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h" +#include "graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h" + +// #include "graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.h" +// #include "graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h" + +// Shared NicheGraphics components +// -------------------------------- +#include "graphics/niche/Drivers/EInk/LCMEN2R13EFC1.h" +#include "graphics/niche/Inputs/TwoButton.h" + +#include "graphics/niche/Fonts/FreeSans6pt7b.h" +#include "graphics/niche/Fonts/FreeSans6pt8bCyrillic.h" +#include + +void setupNicheGraphics() +{ + using namespace NicheGraphics; + + // SPI + // ----------------------------- + + // Display is connected to HSPI + SPIClass *hspi = new SPIClass(HSPI); + hspi->begin(PIN_EINK_SCLK, -1, PIN_EINK_MOSI, PIN_EINK_CS); + + // E-Ink Driver + // ----------------------------- + + // Use E-Ink driver + Drivers::EInk *driver = new Drivers::LCMEN213EFC1; + driver->begin(hspi, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES); + + // InkHUD + // ---------------------------- + + InkHUD::WindowManager *windowManager = InkHUD::WindowManager::getInstance(); + + // Set the driver + windowManager->setDriver(driver); + + // Set how many FAST updates per FULL update + // Set how unhealthy additional FAST updates beyond this number are + windowManager->setDisplayResilience(10, 1.5); + + // Prepare fonts + InkHUD::AppletFont largeFont(FreeSans9pt7b); + InkHUD::AppletFont smallFont(FreeSans6pt7b); + /* + // Font localization demo: Cyrillic + InkHUD::AppletFont smallFont(FreeSans6pt8bCyrillic); + smallFont.addSubstitutionsWin1251(); + */ + InkHUD::Applet::setDefaultFonts(largeFont, smallFont); + + // Init settings, and customize defaults + InkHUD::settings.userTiles.maxCount = 2; // How many tiles can the display handle? + InkHUD::settings.rotation = 3; // 270 degrees clockwise + InkHUD::settings.userTiles.count = 1; // One tile only by default, keep things simple for new users + + // Pick applets + // Note: order of applets determines priority of "auto-show" feature + // Optional arguments for defaults: + // - is activated? + // - is autoshown? + // - is foreground on a specific tile (index)? + windowManager->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown + windowManager->addApplet("DMs", new InkHUD::DMApplet); + windowManager->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); + windowManager->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); + windowManager->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated + windowManager->addApplet("Recents List", new InkHUD::RecentsListApplet); + windowManager->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0 + // windowManager->addApplet("Basic", new InkHUD::BasicExampleApplet); + // windowManager->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet); + + // Start running window manager + windowManager->begin(); + + // Buttons + // -------------------------- + + Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // Shared NicheGraphics component + constexpr uint8_t MAIN_BUTTON = 0; + + // Setup the main user button + buttons->setWiring(MAIN_BUTTON, BUTTON_PIN); + buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::WindowManager::getInstance()->handleButtonShort(); }); + buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::WindowManager::getInstance()->handleButtonLong(); }); + + // No aux button on this board + + buttons->start(); +} + +#endif \ No newline at end of file diff --git a/variants/heltec_wireless_paper/platformio.ini b/variants/heltec_wireless_paper/platformio.ini index a7045b182..36dbfd35b 100644 --- a/variants/heltec_wireless_paper/platformio.ini +++ b/variants/heltec_wireless_paper/platformio.ini @@ -1,3 +1,4 @@ +; Using the original screen class [env:heltec-wireless-paper] extends = esp32s3_base board = heltec_wifi_lora_32_V3 @@ -8,6 +9,7 @@ build_flags = -D EINK_DISPLAY_MODEL=GxEPD2_213_FC1 -D EINK_WIDTH=250 -D EINK_HEIGHT=122 + -D USE_EINK -D USE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk -D EINK_LIMIT_FASTREFRESH=10 ; How many consecutive fast-refreshes are permitted -D EINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached. @@ -16,4 +18,24 @@ lib_deps = ${esp32s3_base.lib_deps} https://github.com/meshtastic/GxEPD2#b202ebfec6a4821e098cf7a625ba0f6f2400292d lewisxhe/PCF8563_Library@^1.0.1 +upload_speed = 115200 + +; Using experimental InkHUD UI (work in progress) +[platformio] +extra_configs = src/graphics/niche/InkHUD/PlatformioConfig.ini +[env:heltec-wireless-paper-inkhud] +extends = esp32s3_base, inkhud +board = heltec_wifi_lora_32_V3 +build_src_filter = + ${esp32_base.build_src_filter} + ${inkhud.build_src_filter} +build_flags = + ${esp32s3_base.build_flags} + ${inkhud.build_flags} + -I variants/heltec_wireless_paper + -D HELTEC_WIRELESS_PAPER + -D MAX_THREADS=40 +lib_deps = + ${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot intead of AdafruitGFX + ${esp32s3_base.lib_deps} upload_speed = 115200 \ No newline at end of file diff --git a/variants/heltec_wireless_paper/variant.h b/variants/heltec_wireless_paper/variant.h index fe8f391df..0385945e6 100644 --- a/variants/heltec_wireless_paper/variant.h +++ b/variants/heltec_wireless_paper/variant.h @@ -6,7 +6,6 @@ #define I2C_SCL SCL // Display (E-Ink) -#define USE_EINK #define PIN_EINK_CS 4 #define PIN_EINK_BUSY 7 #define PIN_EINK_DC 5 diff --git a/variants/mesh-tab/platformio.ini b/variants/mesh-tab/platformio.ini index d6fd1a3ac..f76c36bdd 100644 --- a/variants/mesh-tab/platformio.ini +++ b/variants/mesh-tab/platformio.ini @@ -36,6 +36,7 @@ build_flags = ${esp32s3_base.build_flags} -D RAM_SIZE=1024 -D LGFX_DRIVER_TEMPLATE -D LGFX_DRIVER=LGFX_GENERIC + -D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_GENERIC.h\" -D LGFX_PIN_SCK=12 -D LGFX_PIN_MOSI=13 -D LGFX_PIN_MISO=11 diff --git a/variants/picomputer-s3/platformio.ini b/variants/picomputer-s3/platformio.ini index 5a05d7b90..b8de94f12 100644 --- a/variants/picomputer-s3/platformio.ini +++ b/variants/picomputer-s3/platformio.ini @@ -1,7 +1,7 @@ [env:picomputer-s3] extends = esp32s3_base board = bpi_picow_esp32_s3 - +board_check = true ;OpenOCD flash method ;upload_protocol = esp-builtin ;Normal method @@ -15,3 +15,50 @@ build_flags = lib_deps = ${esp32s3_base.lib_deps} lovyan03/LovyanGFX@^1.2.0 + +build_src_filter = + ${esp32s3_base.build_src_filter} + + +[env:picomputer-s3-tft] +extends = env:picomputer-s3 +board_build.partitions = default_8MB.csv ; just for test + +build_flags = + ${env:picomputer-s3.build_flags} + -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 + -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 + -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 + -D MESHTASTIC_EXCLUDE_WEBSERVER=1 + -D MESHTASTIC_EXCLUDE_SERIAL=1 + -D MESHTASTIC_EXCLUDE_SOCKETAPI=1 + -D INPUTDRIVER_MATRIX_TYPE=1 + -D USE_PIN_BUZZER=PIN_BUZZER + -D USE_SX127x + -D MAX_NUM_NODES=200 + -D HAS_SCREEN=0 + -D HAS_TFT=1 + -D RAM_SIZE=1024 + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE + -D LV_USE_SYSMON=0 + -D LV_USE_PROFILER=0 + -D LV_USE_PERF_MONITOR=0 + -D LV_USE_MEM_MONITOR=0 + -D LV_USE_LOG=0 + -D USE_LOG_DEBUG + -D LOG_DEBUG_INC=\"DebugConfiguration.h\" + -D LGFX_DRIVER=LGFX_PICOMPUTER_S3 + -D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_PICOMPUTER_S3.h\" + -D VIEW_320x240 +; -D USE_DOUBLE_BUFFER + -D USE_PACKET_API + -I lib/device-ui/generated/ui_320x240 + +build_src_filter = + ${env:picomputer-s3.build_src_filter} + +<../lib/device-ui/generated/ui_320x240> + +<../lib/device-ui/resources> + +<../lib/device-ui/locale> + +<../lib/device-ui/source> \ No newline at end of file diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 2c7030b5b..f77831ad7 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -1,15 +1,79 @@ -[env:native] +[native_base] extends = portduino_base -; The pkg-config commands below optionally add link flags. -; the || : is just a "or run the null command" to avoid returning an error code -build_flags = ${portduino_base.build_flags} -O0 -I variants/portduino +build_flags = ${portduino_base.build_flags} -I variants/portduino + -D ARCH_PORTDUINO -I /usr/include - !pkg-config --libs libulfius --silence-errors || : - !pkg-config --libs openssl --silence-errors || : board = cross_platform lib_deps = ${portduino_base.lib_deps} build_src_filter = ${portduino_base.build_src_filter} +[env:native] +extends = native_base +; The pkg-config commands below optionally add link flags. +; the || : is just a "or run the null command" to avoid returning an error code +build_flags = ${native_base.build_flags} + !pkg-config --libs libulfius --silence-errors || : + !pkg-config --libs openssl --silence-errors || : + +[env:native-tft] +extends = native_base +build_type = release +build_flags = ${native_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunction-sections -fdata-sections -Wl,--gc-sections + -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 + -D RAM_SIZE=16384 + -D USE_X11=1 + -D HAS_TFT=1 + -D HAS_SCREEN=0 + -D LV_BUILD_TEST=0 + -D LV_USE_LIBINPUT=1 + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE + -D USE_LOG_DEBUG + -D LOG_DEBUG_INC=\"DebugConfiguration.h\" + -D USE_PACKET_API + -I lib/device-ui/generated/ui_320x240 + !pkg-config --libs libulfius --silence-errors || : + !pkg-config --libs openssl --silence-errors || : +build_src_filter = ${native_base.build_src_filter} + - + +<../lib/device-ui/generated/ui_320x240> + +<../lib/device-ui/generated/ui_320x240/fonts> + +<../lib/device-ui/resources> + +<../lib/device-ui/portduino> + +<../lib/device-ui/locale> + +<../lib/device-ui/source> + +[env:native-tft-debug] +extends = native_base +build_type = debug +board_level = extra +build_flags = ${native_base.build_flags} -O0 -fsanitize=address -lX11 -linput -lxkbcommon + -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 + -D DEBUG_HEAP + -D RAM_SIZE=16384 + -D USE_X11=1 + -D HAS_TFT=1 + -D HAS_SCREEN=0 +; -D CALIBRATE_TOUCH=0 + -D LV_BUILD_TEST=0 + -D LV_USE_LOG=1 + -D LV_USE_SYSMON=1 + -D LV_USE_PERF_MONITOR=1 + -D LV_USE_MEM_MONITOR=0 + -D LV_USE_PROFILER=0 + -D LV_USE_LIBINPUT=1 + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE + -D USE_LOG_DEBUG + -D LOG_DEBUG_INC=\"DebugConfiguration.h\" + -D USE_PACKET_API + -I lib/device-ui/generated/ui_320x240 + !pkg-config --libs libulfius --silence-errors || : + !pkg-config --libs openssl --silence-errors || : +build_src_filter = ${env:native-tft.build_src_filter} + [env:coverage] extends = env:native build_flags = -lgcov --coverage -fprofile-abs-path -fsanitize=address ${env:native.build_flags} diff --git a/variants/portduino/variant.h b/variants/portduino/variant.h index b7b39d6e8..ce7dbd865 100644 --- a/variants/portduino/variant.h +++ b/variants/portduino/variant.h @@ -1,4 +1,6 @@ +#ifndef HAS_SCREEN #define HAS_SCREEN 1 +#endif #define CANNED_MESSAGE_MODULE_ENABLE 1 #define HAS_GPS 1 #define MAX_RX_TOPHONE settingsMap[maxtophone] diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 1b64ed6e1..31566edbe 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -26,3 +26,57 @@ lib_deps = ${esp32s3_base.lib_deps} https://github.com/mverch67/LovyanGFX#develop earlephilhower/ESP8266Audio@^1.9.9 earlephilhower/ESP8266SAM@^1.0.1 + + +[env:seeed-sensecap-indicator-tft] +extends = env:seeed-sensecap-indicator +board_level = main +upload_speed = 460800 +board_build.partitions = default_8MB.csv ; must be here for some reason, board.json is not enough !? + +build_flags = + ${env:seeed-sensecap-indicator.build_flags} + -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 + -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 + -D MESHTASTIC_EXCLUDE_SCREEN=1 + -D MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR=1 + -D MESHTASTIC_EXCLUDE_WEBSERVER=1 + -D MESHTASTIC_EXCLUDE_SERIAL=1 + -D MESHTASTIC_EXCLUDE_SOCKETAPI=1 + -D INPUTDRIVER_BUTTON_TYPE=38 + -D HAS_TELEMETRY=0 + -D CONFIG_DISABLE_HAL_LOCKS=1 + -D MAX_NUM_NODES=250 + -D HAS_SCREEN=0 + -D HAS_TFT=1 + -D DISPLAY_SET_RESOLUTION + -D USE_I2S_BUZZER + -D RAM_SIZE=4096 + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE + -D LV_USE_SYSMON=0 + -D LV_USE_PROFILER=0 + -D LV_USE_PERF_MONITOR=0 + -D LV_USE_MEM_MONITOR=0 + -D LV_USE_LOG=0 + -D USE_LOG_DEBUG + -D LOG_DEBUG_INC=\"DebugConfiguration.h\" + -D CUSTOM_TOUCH_DRIVER + -D LGFX_DRIVER=LGFX_INDICATOR + -D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_INDICATOR.h\" + -D VIEW_320x240 +; -D USE_DOUBLE_BUFFER + -D USE_PACKET_API + -I lib/device-ui/generated/ui_320x240 + +build_src_filter = + ${env:seeed-sensecap-indicator.build_src_filter} + +<../lib/device-ui/generated/ui_320x240> + +<../lib/device-ui/resources> + +<../lib/device-ui/locale> + +<../lib/device-ui/source> + +lib_deps = + ${env:seeed-sensecap-indicator.lib_deps} + https://github.com/bitbank2/bb_captouch.git#8f2f06462ff597847921739376a299db93612417 ; alternative touch library supporting FT6x36 \ No newline at end of file diff --git a/variants/seeed-sensecap-indicator/variant.h b/variants/seeed-sensecap-indicator/variant.h index 58eed7d96..1010e04c8 100644 --- a/variants/seeed-sensecap-indicator/variant.h +++ b/variants/seeed-sensecap-indicator/variant.h @@ -7,7 +7,9 @@ #define SENSOR_PORT_NUM 2 #define SENSOR_BAUD_RATE 115200 +#if !HAS_TFT #define BUTTON_PIN 38 +#endif // #define BUTTON_NEED_PULLUP // #define BATTERY_PIN 27 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 003dd184d..1eb8a1abd 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -4,7 +4,6 @@ extends = esp32s3_base board = t-deck board_check = true upload_protocol = esptool -#upload_port = COM29 build_flags = ${esp32s3_base.build_flags} -DT_DECK @@ -17,3 +16,64 @@ lib_deps = ${esp32s3_base.lib_deps} lovyan03/LovyanGFX@^1.2.0 earlephilhower/ESP8266Audio@^1.9.9 earlephilhower/ESP8266SAM@^1.0.1 + + +[env:t-deck-tft] +extends = env:t-deck +board_build.partitions = default_16MB.csv + +build_flags = + ${env:t-deck.build_flags} + -D CONFIG_DISABLE_HAL_LOCKS=1 ; "feels" to be a bit more stable without locks + -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 + -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 + -D MESHTASTIC_EXCLUDE_WEBSERVER=1 + -D MESHTASTIC_EXCLUDE_SERIAL=1 + -D MESHTASTIC_EXCLUDE_SOCKETAPI=1 + -D INPUTDRIVER_I2C_KBD_TYPE=0x55 + -D INPUTDRIVER_ENCODER_TYPE=3 + -D INPUTDRIVER_ENCODER_LEFT=1 + -D INPUTDRIVER_ENCODER_RIGHT=2 + -D INPUTDRIVER_ENCODER_UP=3 + -D INPUTDRIVER_ENCODER_DOWN=15 + -D INPUTDRIVER_ENCODER_BTN=0 + -D INPUTDRIVER_BUTTON_TYPE=0 + -D MAX_NUM_NODES=250 + -D HAS_SCREEN=0 + -D HAS_TFT=1 + -D USE_I2S_BUZZER + -D RAM_SIZE=4096 + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE + -D LV_USE_SYSMON=0 + -D LV_USE_PROFILER=0 + -D LV_USE_PERF_MONITOR=0 + -D LV_USE_MEM_MONITOR=0 + -D LV_USE_LOG=0 + -D USE_LOG_DEBUG + -D LOG_DEBUG_INC=\"DebugConfiguration.h\" + -D RADIOLIB_DEBUG_BASIC=0 + -D RADIOLIB_DEBUG_SPI=0 + -D RADIOLIB_DEBUG_PROTOCOL=0 + -D RADIOLIB_SPI_PARANOID=0 + -D CALIBRATE_TOUCH=0 + -D LGFX_DRIVER=LGFX_TDECK + -D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_T_DECK.h\" +; -D LVGL_DRIVER=LVGL_TDECK +; -D GFX_DRIVER_INC=\"graphics/LVGL/LVGL_T_DECK.h\" +; -D LV_USE_ST7789=1 + -D VIEW_320x240 +; -D USE_DOUBLE_BUFFER + -D USE_PACKET_API + -I lib/device-ui/generated/ui_320x240 + +build_src_filter = + ${env:t-deck.build_src_filter} + +<../lib/device-ui/generated/ui_320x240> + +<../lib/device-ui/resources> + +<../lib/device-ui/locale> + +<../lib/device-ui/source> + +lib_deps = + ${env:t-deck.lib_deps} diff --git a/variants/t-deck/variant.h b/variants/t-deck/variant.h index 4aeeb7ca8..8ffc4ea44 100644 --- a/variants/t-deck/variant.h +++ b/variants/t-deck/variant.h @@ -1,5 +1,10 @@ + +#define TFT_CS 12 +#ifndef HAS_TFT // for TFT-UI the definitions are in device-ui +#define BUTTON_PIN 0 + // ST7789 TFT LCD -#define ST7789_CS 12 +#define ST7789_CS TFT_CS #define ST7789_RS 11 // DC #define ST7789_SDA 41 // MOSI #define ST7789_SCK 40 @@ -19,6 +24,7 @@ #define SCREEN_ROTATE #define SCREEN_TRANSITION_FRAMERATE 5 #define BRIGHTNESS_DEFAULT 130 // Medium Low Brightness +#endif #define HAS_TOUCHSCREEN 1 #define SCREEN_TOUCH_INT 16 @@ -42,6 +48,7 @@ #define SPI_MISO (38) #define SPI_CS (39) #define SDCARD_CS SPI_CS +#define SD_SPI_FREQUENCY 75000000U #define BATTERY_PIN 4 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage // ratio of voltage divider = 2.0 (RD2=100k, RD3=100k) diff --git a/variants/t-echo/nicheGraphics.h b/variants/t-echo/nicheGraphics.h new file mode 100644 index 000000000..44d8ef4c3 --- /dev/null +++ b/variants/t-echo/nicheGraphics.h @@ -0,0 +1,126 @@ +#pragma once + +#include "configuration.h" + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +// InkHUD-specific components +// --------------------------- +#include "graphics/niche/InkHUD/WindowManager.h" + +// Applets +#include "graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.h" +#include "graphics/niche/InkHUD/Applets/User/DM/DMApplet.h" +#include "graphics/niche/InkHUD/Applets/User/Heard/HeardApplet.h" +#include "graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.h" +#include "graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h" +#include "graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h" + +// #include "graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.h" +// #include "graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h" + +// Shared NicheGraphics components +// -------------------------------- +#include "graphics/niche/Drivers/Backlight/LatchingBacklight.h" +#include "graphics/niche/Drivers/EInk/GDEY0154D67.h" +#include "graphics/niche/Inputs/TwoButton.h" + +#include "graphics/niche/Fonts/FreeSans6pt7b.h" +#include "graphics/niche/Fonts/FreeSans6pt8bCyrillic.h" +#include + +void setupNicheGraphics() +{ + using namespace NicheGraphics; + + // SPI + // ----------------------------- + + // For NRF52 platforms, SPI pins are defined in variant.h, not passed to begin() + SPIClass *inkSPI = &SPI1; + inkSPI->begin(); + + // Driver + // ----------------------------- + + // Use E-Ink driver + Drivers::EInk *driver = new Drivers::GDEY0154D67; + driver->begin(inkSPI, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES); + + // InkHUD + // ---------------------------- + + InkHUD::WindowManager *windowManager = InkHUD::WindowManager::getInstance(); + + // Set the driver + windowManager->setDriver(driver); + + // Set how many FAST updates per FULL update + // Set how unhealthy additional FAST updates beyond this number are + windowManager->setDisplayResilience(20, 1.5); + + // Prepare fonts + InkHUD::AppletFont largeFont(FreeSans9pt7b); + InkHUD::AppletFont smallFont(FreeSans6pt7b); + /* + // Font localization demo: Cyrillic + InkHUD::AppletFont smallFont(FreeSans6pt8bCyrillic); + smallFont.addSubstitutionsWin1251(); + */ + InkHUD::Applet::setDefaultFonts(largeFont, smallFont); + + // Init settings, and customize defaults + // Values ignored individually if found saved to flash + InkHUD::settings.userTiles.maxCount = 2; // Two applets side-by-side + InkHUD::settings.rotation = 3; // 270 degrees clockwise + InkHUD::settings.optionalFeatures.batteryIcon = true; // Device definitely has a battery + InkHUD::settings.optionalMenuItems.backlight = true; // Until proven (by touch) that user still has the capacitive button + + // Setup backlight + // Note: AUX button behavior configured further down + Drivers::LatchingBacklight *backlight = Drivers::LatchingBacklight::getInstance(); + backlight->setPin(PIN_EINK_EN); + + // Pick applets + // Note: order of applets determines priority of "auto-show" feature + windowManager->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown + windowManager->addApplet("DMs", new InkHUD::DMApplet); + windowManager->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); + windowManager->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); + windowManager->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated + windowManager->addApplet("Recents List", new InkHUD::RecentsListApplet); + windowManager->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, no autoshow, default on tile 0 + // windowManager->addApplet("Basic", new InkHUD::BasicExampleApplet); + // windowManager->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet); + + // Start running window manager + windowManager->begin(); + + // Buttons + // -------------------------- + + Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // Shared NicheGraphics component + constexpr uint8_t MAIN_BUTTON = 0; + constexpr uint8_t TOUCH_BUTTON = 1; + + // Setup the main user button + buttons->setWiring(MAIN_BUTTON, BUTTON_PIN, LOW); + buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::WindowManager::getInstance()->handleButtonShort(); }); + buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::WindowManager::getInstance()->handleButtonLong(); }); + + // Setup the capacitive touch button + // - short: momentary backlight + // - long: latch backlight on + buttons->setWiring(TOUCH_BUTTON, PIN_BUTTON_TOUCH, LOW); + buttons->setTiming(TOUCH_BUTTON, 50, 5000); // 5 seconds before latch - limited by T-Echo's capacitive touch IC + buttons->setHandlerDown(TOUCH_BUTTON, [backlight]() { + backlight->peek(); + InkHUD::settings.optionalMenuItems.backlight = false; // We've proved user still has the button. No need for menu entry. + }); + buttons->setHandlerLongPress(TOUCH_BUTTON, [backlight]() { backlight->latch(); }); + buttons->setHandlerShortPress(TOUCH_BUTTON, [backlight]() { backlight->off(); }); + + buttons->start(); +} + +#endif \ No newline at end of file diff --git a/variants/t-echo/platformio.ini b/variants/t-echo/platformio.ini index ce58c0b88..e0e26fe6a 100644 --- a/variants/t-echo/platformio.ini +++ b/variants/t-echo/platformio.ini @@ -1,4 +1,4 @@ -; First prototype eink/nrf52840/sx1262 device +; Using original screen class [env:t-echo] extends = nrf52840_base board = t-echo @@ -12,6 +12,7 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/t-echo -DEINK_DISPLAY_MODEL=GxEPD2_154_D67 -DEINK_WIDTH=200 -DEINK_HEIGHT=200 + -DUSE_EINK -DUSE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk -DEINK_LIMIT_FASTREFRESH=20 ; How many consecutive fast-refreshes are permitted -DEINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached. @@ -21,4 +22,26 @@ lib_deps = ${nrf52840_base.lib_deps} https://github.com/meshtastic/GxEPD2#55f618961db45a23eff0233546430f1e5a80f63a lewisxhe/PCF8563_Library@^1.0.1 -;upload_protocol = fs \ No newline at end of file +;upload_protocol = fs + +; Using experimental InkHUD UI (work in progress) +[platformio] +extra_configs = src/graphics/niche/InkHUD/PlatformioConfig.ini +[env:t-echo-inkhud] +extends = nrf52840_base, inkhud +board = t-echo +board_check = true +debug_tool = jlink +build_flags = + ${nrf52840_base.build_flags} + ${inkhud.build_flags} + -I variants/t-echo + -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" +build_src_filter = + ${nrf52_base.build_src_filter} + ${inkhud.build_src_filter} + +<../variants/t-echo> +lib_deps = + ${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot intead of AdafruitGFX + ${nrf52840_base.lib_deps} + lewisxhe/PCF8563_Library@^1.0.1 \ No newline at end of file diff --git a/variants/t-echo/variant.h b/variants/t-echo/variant.h index 365dfd804..38b7f4743 100644 --- a/variants/t-echo/variant.h +++ b/variants/t-echo/variant.h @@ -162,8 +162,6 @@ External serial flash WP25R1635FZUIL0 #define PIN_POWER_EN (0 + 12) // #define PIN_POWER_EN1 (0 + 13) -#define USE_EINK - #define PIN_SPI1_MISO \ (32 + 7) // FIXME not really needed, but for now the SPI code requires something to be defined, pick an used GPIO #define PIN_SPI1_MOSI PIN_EINK_MOSI diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini index e21e9ed77..e17d3e373 100644 --- a/variants/unphone/platformio.ini +++ b/variants/unphone/platformio.ini @@ -1,18 +1,14 @@ ; platformio.ini for unphone meshtastic [env:unphone] - extends = esp32s3_base -board = unphone9 +board = unphone upload_speed = 921600 monitor_speed = 115200 monitor_filters = esp32_exception_decoder -build_unflags = - ${esp32s3_base.build_unflags} - -D ARDUINO_USB_MODE - -build_flags = ${esp32_base.build_flags} +build_flags = + ${esp32s3_base.build_flags} -D UNPHONE -I variants/unphone -D ARDUINO_USB_MODE=0 @@ -22,8 +18,11 @@ build_flags = ${esp32_base.build_flags} -D UNPHONE_UI0=0 -D UNPHONE_LORA=0 -D UNPHONE_FACTORY_MODE=0 + -D USE_SX127x -build_src_filter = ${esp32_base.build_src_filter} +<../variants/unphone> +build_src_filter = + ${esp32s3_base.build_src_filter} + +<../variants/unphone> lib_deps = ${esp32s3_base.lib_deps} lovyan03/LovyanGFX@ 1.2.0 @@ -32,46 +31,43 @@ lib_deps = ${esp32s3_base.lib_deps} [env:unphone-tft] -extends = esp32s3_base -board_level = extra -board = unphone +extends = env:unphone board_build.partitions = default_8MB.csv -monitor_speed = 115200 -monitor_filters = esp32_exception_decoder -build_flags = ${esp32_base.build_flags} - -D UNPHONE - -D UNPHONE_ACCEL=0 - -D UNPHONE_TOUCHS=0 - -D UNPHONE_SDCARD=0 - -D UNPHONE_UI0=0 - -D UNPHONE_LORA=0 - -D UNPHONE_FACTORY_MODE=0 +build_flags = + ${env:unphone.build_flags} + -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 + -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 + -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 + -D MESHTASTIC_EXCLUDE_WEBSERVER=1 + -D MESHTASTIC_EXCLUDE_SERIAL=1 + -D MESHTASTIC_EXCLUDE_SOCKETAPI=1 + -D INPUTDRIVER_BUTTON_TYPE=21 + -D MAX_NUM_NODES=200 -D MAX_THREADS=40 -D HAS_SCREEN=0 -D HAS_TFT=1 - -D RAM_SIZE=512 + -D DISPLAY_SET_RESOLUTION + -D RAM_SIZE=3072 -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE -D LV_COMP_CONF_INCLUDE_SIMPLE -D LV_BUILD_TEST=0 + -D LV_USE_SYSMON=0 + -D LV_USE_PROFILER=0 -D LV_USE_PERF_MONITOR=0 -D LV_USE_MEM_MONITOR=0 + -D LV_USE_LOG=0 -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -; -D CALIBRATE_TOUCH=0 -D LGFX_DRIVER=LGFX_UNPHONE_V9 + -D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_UNPHONE.h\" -D VIEW_320x240 -; -D USE_DOUBLE_BUFFER -D USE_PACKET_API -I lib/device-ui/generated/ui_320x240 - -I variants/unphone -build_src_filter = ${esp32_base.build_src_filter} +<../variants/unphone> +build_src_filter = + ${env:unphone.build_src_filter} +<../lib/device-ui/generated/ui_320x240> +<../lib/device-ui/resources> - +<../lib/device-ui/source> - -lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@^1.2.0 - https://gitlab.com/hamishcunningham/unphonelibrary#meshtastic@9.0.0 - adafruit/Adafruit NeoPixel@1.12.0 + +<../lib/device-ui/locale> + +<../lib/device-ui/source> \ No newline at end of file diff --git a/variants/unphone/variant.h b/variants/unphone/variant.h index 0a94c5987..e846b064a 100644 --- a/variants/unphone/variant.h +++ b/variants/unphone/variant.h @@ -48,7 +48,8 @@ #undef GPS_RX_PIN #undef GPS_TX_PIN -// #define HAS_SDCARD 1 // causes hang if defined +#define HAS_SDCARD 1 +#define SD_SPI_FREQUENCY 25000000 #define SDCARD_CS 43 #define LED_PIN 13 // the red part of the RGB LED diff --git a/version.properties b/version.properties index 55a220b4b..4cb750c2c 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 -minor = 5 -build = 23 +minor = 6 +build = 0 \ No newline at end of file From baef8dce7918c71cfb3e9b053d51d72c2076ae20 Mon Sep 17 00:00:00 2001 From: Austin Date: Sat, 1 Mar 2025 07:56:49 -0500 Subject: [PATCH 216/381] Switch pio_deps to `native-tft` for flatpak (#6187) Consumed in flatpak for "offline" builds. --- .github/workflows/main_matrix.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index ef0ab81a6..da4b4e6f3 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -135,10 +135,10 @@ jobs: build_location: local secrets: inherit - package-pio-deps-native: + package-pio-deps-native-tft: uses: ./.github/workflows/package_pio_deps.yml with: - pio_env: native + pio_env: native-tft secrets: inherit test-native: @@ -288,7 +288,7 @@ jobs: needs: - gather-artifacts - build-debian-src - - package-pio-deps-native + - package-pio-deps-native-tft steps: - name: Checkout uses: actions/checkout@v4 @@ -324,10 +324,10 @@ jobs: merge-multiple: true path: ./output/debian-src - - name: Download native pio deps + - name: Download `native-tft` pio deps uses: actions/download-artifact@v4 with: - pattern: platformio-deps-native-${{ steps.version.outputs.long }} + pattern: platformio-deps-native-tft-${{ steps.version.outputs.long }} merge-multiple: true path: ./output/pio-deps-native From ab61cd65d1ec9af8a12102d2a729545a4339e1d3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 1 Mar 2025 06:57:12 -0600 Subject: [PATCH 217/381] Upgrade trunk (#6178) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index f35554a72..1fda38c8f 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -17,7 +17,7 @@ lint: - trivy@0.59.1 - taplo@0.9.3 - ruff@0.9.7 - - isort@6.0.0 + - isort@6.0.1 - markdownlint@0.44.0 - oxipng@9.1.4 - svgo@3.3.2 From 9893d24c625b8e3a926031ddb19d60c73bafc63e Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sat, 1 Mar 2025 13:57:44 +0100 Subject: [PATCH 218/381] Only request all NodeInfo/Position on fresh install (#6184) Co-authored-by: Ben Meadors --- src/mesh/NodeDB.cpp | 8 +++++--- src/mesh/NodeDB.h | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 6588ca46b..62ab675bc 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -400,11 +400,13 @@ bool isBroadcast(uint32_t dest) return dest == NODENUM_BROADCAST || dest == NODENUM_BROADCAST_NO_LORA; } -bool NodeDB::resetRadioConfig(bool factory_reset) +bool NodeDB::resetRadioConfig(bool factory_reset, bool is_fresh_install) { bool didFactoryReset = false; - radioGeneration++; + if (is_fresh_install) { + radioGeneration++; + } if (factory_reset) { didFactoryReset = factoryReset(); @@ -589,7 +591,7 @@ void NodeDB::installDefaultConfig(bool preserveKey = false) config.device.node_info_broadcast_secs = default_node_info_broadcast_secs; config.security.serial_enabled = true; config.security.admin_channel_enabled = false; - resetRadioConfig(); + resetRadioConfig(false, true); // This also triggers NodeInfo/Position requests since we're fresh strncpy(config.network.ntp_server, "meshtastic.pool.ntp.org", 32); #if (defined(T_DECK) || defined(T_WATCH_S3) || defined(UNPHONE) || defined(PICOMPUTER_S3) || defined(SENSECAP_INDICATOR)) && \ diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index 44e2ebcc8..25f1e9083 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -99,9 +99,11 @@ class NodeDB * a) sometimes a buggy android app might send us bogus settings or * b) the client set factory_reset * + * @param factory_reset if true, reset all settings to factory defaults + * @param is_fresh_install set to true after a fresh install, to trigger NodeInfo/Position requests * @return true if the config was completely reset, in that case, we should send it back to the client */ - bool resetRadioConfig(bool factory_reset = false); + bool resetRadioConfig(bool factory_reset = false, bool is_fresh_install = false); /// given a subpacket sniffed from the network, update our DB state /// we updateGUI and updateGUIforNode if we think our this change is big enough for a redraw From d5ec205572d1e2176c3497d8982a5769b3a78ec5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 1 Mar 2025 06:58:39 -0600 Subject: [PATCH 219/381] Upgrade trunk (#6188) Co-authored-by: vidplace7 <1779290+vidplace7@users.noreply.github.com> --- .trunk/trunk.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 1fda38c8f..f3cb3d354 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -9,10 +9,10 @@ plugins: lint: enabled: - prettier@3.5.2 - - trufflehog@3.88.13 + - trufflehog@3.88.14 - yamllint@1.35.1 - bandit@1.8.3 - - checkov@3.2.377 + - checkov@3.2.378 - terrascan@1.19.9 - trivy@0.59.1 - taplo@0.9.3 From ce38ac10d158695a6e21bb751f287942500ecd43 Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Sat, 1 Mar 2025 15:14:04 +0200 Subject: [PATCH 220/381] Create lora-starter-edition-sx1262-i2c.yaml and lora-ws-raspberry-pi-pico-to-rpi-adapter.yaml (#6162) * Create lora-ws-raspberry-pi-pico-to-rpi-adapter.yaml * Create lora-starter-edition-sx1262-i2c.yaml * Update lora-ws-raspberry-pi-pico-to-rpi-adapter.yaml * Update lora-ws-raspberry-pi-pico-to-rpi-adapter.yaml * Update lora-starter-edition-sx1262-i2c.yaml --- bin/config.d/lora-starter-edition-sx1262-i2c.yaml | 10 ++++++++++ .../lora-ws-raspberry-pi-pico-to-rpi-adapter.yaml | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 bin/config.d/lora-starter-edition-sx1262-i2c.yaml create mode 100644 bin/config.d/lora-ws-raspberry-pi-pico-to-rpi-adapter.yaml diff --git a/bin/config.d/lora-starter-edition-sx1262-i2c.yaml b/bin/config.d/lora-starter-edition-sx1262-i2c.yaml new file mode 100644 index 000000000..d9b64c7da --- /dev/null +++ b/bin/config.d/lora-starter-edition-sx1262-i2c.yaml @@ -0,0 +1,10 @@ +# https://www.waveshare.com/core1262-868m.htm +# https://github.com/markbirss/lora-starter-edition-sx1262-i2c +Lora: + Module: sx1262 # Starter Edition SX1262 I2C Raspberry Pi HAT + DIO2_AS_RF_SWITCH: true + DIO3_TCXO_VOLTAGE: true + CS: 8 + IRQ: 22 + Busy: 4 + Reset: 18 diff --git a/bin/config.d/lora-ws-raspberry-pi-pico-to-rpi-adapter.yaml b/bin/config.d/lora-ws-raspberry-pi-pico-to-rpi-adapter.yaml new file mode 100644 index 000000000..1e1c325e7 --- /dev/null +++ b/bin/config.d/lora-ws-raspberry-pi-pico-to-rpi-adapter.yaml @@ -0,0 +1,10 @@ +# https://www.waveshare.com/pico-lora-sx1262-868m.htm +# https://github.com/markbirss/lora-ws-raspberry-pi-pico-to-rpi-adapter +Lora: + Module: sx1262 # Waveshare Raspberry Pi Pico to Raspberry Pi HAT Adapter + DIO2_AS_RF_SWITCH: true + DIO3_TCXO_VOLTAGE: true + CS: 21 + IRQ: 16 + Busy: 20 + Reset: 18 From 5c8f1fb46b4c80d1fba6324c2bc6d952d1ad494d Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 1 Mar 2025 08:27:43 -0600 Subject: [PATCH 221/381] Enable external (UART) GPS support on WM1110 tracker dev board (#6189) --- variants/wio-tracker-wm1110/variant.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/variants/wio-tracker-wm1110/variant.h b/variants/wio-tracker-wm1110/variant.h index 32e84485d..807ca8dbb 100644 --- a/variants/wio-tracker-wm1110/variant.h +++ b/variants/wio-tracker-wm1110/variant.h @@ -103,6 +103,11 @@ extern "C" { #define LR1110_GNSS_ANT_PIN (32 + 5) // P1.05 37 +#define GPS_RX_PIN PIN_SERIAL1_RX +#define GPS_TX_PIN PIN_SERIAL1_TX + +#define HAS_GPS 1 + #ifdef __cplusplus } #endif From 12fde696c1488e71f7315bb95e1498eaf13ea027 Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 2 Mar 2025 05:27:53 -0500 Subject: [PATCH 222/381] Trunk: Add clang-tidy (#6171) --- .trunk/configs/.clang-tidy | 39 ++++++++++++++++++++++++++++++++++++++ .trunk/trunk.yaml | 1 + 2 files changed, 40 insertions(+) create mode 100644 .trunk/configs/.clang-tidy diff --git a/.trunk/configs/.clang-tidy b/.trunk/configs/.clang-tidy new file mode 100644 index 000000000..e4bd819fa --- /dev/null +++ b/.trunk/configs/.clang-tidy @@ -0,0 +1,39 @@ +Checks: >- + bugprone-*, + cppcoreguidelines-*, + google-*, + misc-*, + modernize-*, + performance-*, + readability-*, + -bugprone-lambda-function-name, + -bugprone-reserved-identifier, + -cppcoreguidelines-avoid-goto, + -cppcoreguidelines-avoid-magic-numbers, + -cppcoreguidelines-avoid-non-const-global-variables, + -cppcoreguidelines-pro-bounds-array-to-pointer-decay, + -cppcoreguidelines-pro-type-vararg, + -google-readability-braces-around-statements, + -google-readability-function-size, + -misc-no-recursion, + -modernize-return-braced-init-list, + -modernize-use-nodiscard, + -modernize-use-trailing-return-type, + -performance-unnecessary-value-param, + -readability-magic-numbers, + +CheckOptions: + - key: readability-function-cognitive-complexity.Threshold + value: 100 + - key: readability-function-cognitive-complexity.IgnoreMacros + value: true + # Set naming conventions for your style below (there are dozens of naming settings possible): + # See https://clang.llvm.org/extra/clang-tidy/checks/readability/identifier-naming.html + # - key: readability-identifier-naming.ClassCase + # value: CamelCase + # - key: readability-identifier-naming.NamespaceCase + # value: lower_case + # - key: readability-identifier-naming.PrivateMemberSuffix + # value: _ + # - key: readability-identifier-naming.StructCase + # value: CamelCase diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index f3cb3d354..78fdb8e45 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -30,6 +30,7 @@ lint: - git-diff-check - gitleaks@8.24.0 - clang-format@16.0.3 + - clang-tidy@16.0.3 ignore: - linters: [ALL] paths: From 63b20e358fc232ec446b95bec235b803997b33b8 Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Sun, 2 Mar 2025 14:14:07 +0200 Subject: [PATCH 223/381] Create lora-raxda-rock2f-starter-edition-hat.yaml (#6192) * Create lora-raxda-rock2f-starter-edition-hat.yaml * Update lora-raxda-rock2f-starter-edition-hat.yaml --- ...lora-raxda-rock2f-starter-edition-hat.yaml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 bin/config.d/lora-raxda-rock2f-starter-edition-hat.yaml diff --git a/bin/config.d/lora-raxda-rock2f-starter-edition-hat.yaml b/bin/config.d/lora-raxda-rock2f-starter-edition-hat.yaml new file mode 100644 index 000000000..ea86a3728 --- /dev/null +++ b/bin/config.d/lora-raxda-rock2f-starter-edition-hat.yaml @@ -0,0 +1,49 @@ +Lora: + +### Raxda Rock 2F running Armbian Linux 6.1.99-vendor-rk35xx +### https://github.com/markbirss/rock-2f +### https://github.com/markbirss/lora-starter-edition-sx1262-i2c +### https://github.com/radxa-pkg/radxa-overlays/blob/main/arch/arm64/boot/dts/rockchip/overlays/rk3528-spi0-cs1-spidev.dts +### Require install of https://github.com/radxa-pkg/radxa-overlays and rk3528-spi0-cs1-spidev.dtbo copied to /boot/dtb/rockchip/overlay and enabled +### in /boot/armbianEnv.txt - overlays=rk3528-spi0-cs1-spidev +### The Radxa Rock 2F employs multiple gpio chips. +### Each gpio pin must be unique, but can be assigned to a specific gpio chip and line. +### In case solely a no. is given, the default gpio chip and pin == line will be employed. +### + Module: sx1262 # Radxa Rock 2F + Starter Edition SX1262 HAT by Mark Birss + DIO2_AS_RF_SWITCH: true + DIO3_TCXO_VOLTAGE: 1.8 + spidev: spidev0.1 + CS: # NSS PIN_24 -> chip 4, line 14 + pin: 24 + gpiochip: 4 + line: 14 + SCK: # SCK PIN_23 -> chip 4, line 12 + pin: 23 + gpiochip: 4 + line: 12 + Busy: # BUSY PIN_7 -> chip 4, line 6 + pin: 7 + gpiochip: 4 + line: 6 + MOSI: # MOSI PIN_19 -> chip 4, line 10 + pin: 19 + gpiochip: 4 + line: 10 + MISO: # MISO PIN_21 -> chip 4, line 11 + pin: 21 + gpiochip: 4 + line: 11 + Reset: # NRST PIN_12 -> chip 1, line 13 + pin: 12 + gpiochip: 1 + line: 13 + IRQ: # DIO1 PIN_15 -> chip 4, line 22 + pin: 15 + gpiochip: 4 + line: 22 +# RXen: # RXEN PIN_22 -> chip 3!, line 17 +# pin: 22 +# gpiochip: 3 +# line: 17 +# TXen: RADIOLIB_NC # TXEN no PIN, no line, fallback to default gpio chip From 43a6e711dad034125f4994fe52795f7df99932a2 Mon Sep 17 00:00:00 2001 From: Mictronics Date: Sun, 2 Mar 2025 13:15:30 +0100 Subject: [PATCH 224/381] RAK11310: Update to last building platform package and possibly fix for #5361 (#6202) --- variants/rak11310/platformio.ini | 2 +- variants/rak11310/variant.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/variants/rak11310/platformio.ini b/variants/rak11310/platformio.ini index d1da962ca..6dab54893 100644 --- a/variants/rak11310/platformio.ini +++ b/variants/rak11310/platformio.ini @@ -4,7 +4,7 @@ board = wiscore_rak11300 upload_protocol = picotool # keep an old SDK to use less memory. platform = https://github.com/maxgerhardt/platform-raspberrypi.git#v1.2.0-gcc12 -platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#3.7.2 +platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#4.0.1 # add our variants files to the include and src paths build_flags = ${rp2040_base.build_flags} diff --git a/variants/rak11310/variant.h b/variants/rak11310/variant.h index bc8d2d71b..2400d56a7 100644 --- a/variants/rak11310/variant.h +++ b/variants/rak11310/variant.h @@ -4,6 +4,12 @@ #define ARDUINO_ARCH_AVR +// Define I2C pins to ensure correct usage of both ports +#define I2C_SDA 20 +#define I2C_SCL 21 +#define I2C_SDA1 2 +#define I2C_SCL1 3 + #define LED_CONN PIN_LED2 #define LED_PIN LED_BUILTIN #define ledOff(pin) pinMode(pin, INPUT) From f89f916f966bc0dece39c3d0ad3324e8f326092c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sun, 2 Mar 2025 13:58:37 +0100 Subject: [PATCH 225/381] Revert "Trunk: Add clang-tidy (#6171)" (#6203) This reverts commit 12fde696c1488e71f7315bb95e1498eaf13ea027. --- .trunk/configs/.clang-tidy | 39 -------------------------------------- .trunk/trunk.yaml | 1 - 2 files changed, 40 deletions(-) delete mode 100644 .trunk/configs/.clang-tidy diff --git a/.trunk/configs/.clang-tidy b/.trunk/configs/.clang-tidy deleted file mode 100644 index e4bd819fa..000000000 --- a/.trunk/configs/.clang-tidy +++ /dev/null @@ -1,39 +0,0 @@ -Checks: >- - bugprone-*, - cppcoreguidelines-*, - google-*, - misc-*, - modernize-*, - performance-*, - readability-*, - -bugprone-lambda-function-name, - -bugprone-reserved-identifier, - -cppcoreguidelines-avoid-goto, - -cppcoreguidelines-avoid-magic-numbers, - -cppcoreguidelines-avoid-non-const-global-variables, - -cppcoreguidelines-pro-bounds-array-to-pointer-decay, - -cppcoreguidelines-pro-type-vararg, - -google-readability-braces-around-statements, - -google-readability-function-size, - -misc-no-recursion, - -modernize-return-braced-init-list, - -modernize-use-nodiscard, - -modernize-use-trailing-return-type, - -performance-unnecessary-value-param, - -readability-magic-numbers, - -CheckOptions: - - key: readability-function-cognitive-complexity.Threshold - value: 100 - - key: readability-function-cognitive-complexity.IgnoreMacros - value: true - # Set naming conventions for your style below (there are dozens of naming settings possible): - # See https://clang.llvm.org/extra/clang-tidy/checks/readability/identifier-naming.html - # - key: readability-identifier-naming.ClassCase - # value: CamelCase - # - key: readability-identifier-naming.NamespaceCase - # value: lower_case - # - key: readability-identifier-naming.PrivateMemberSuffix - # value: _ - # - key: readability-identifier-naming.StructCase - # value: CamelCase diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 78fdb8e45..f3cb3d354 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -30,7 +30,6 @@ lint: - git-diff-check - gitleaks@8.24.0 - clang-format@16.0.3 - - clang-tidy@16.0.3 ignore: - linters: [ALL] paths: From b6562e175fe90e0eeb069d6dda9e6a70ff18c096 Mon Sep 17 00:00:00 2001 From: Mictronics Date: Mon, 3 Mar 2025 11:08:02 +0100 Subject: [PATCH 226/381] RAK11310 support for RAK12002 RTC added. (#6210) --- variants/rak11310/platformio.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/variants/rak11310/platformio.ini b/variants/rak11310/platformio.ini index 6dab54893..10bbe1620 100644 --- a/variants/rak11310/platformio.ini +++ b/variants/rak11310/platformio.ini @@ -11,11 +11,13 @@ build_flags = ${rp2040_base.build_flags} -DRAK11310 -Ivariants/rak11310 -DDEBUG_RP2040_PORT=Serial + -DRV3028_RTC=0x52 -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" build_src_filter = ${rp2040_base.build_src_filter} +<../variants/rak11310> + + + lib_deps = ${rp2040_base.lib_deps} ${networking_base.lib_deps} + melopero/Melopero RV3028@^1.1.0 https://github.com/RAKWireless/RAK13800-W5100S.git#1.0.2 debug_build_flags = ${rp2040_base.build_flags}, -g debug_tool = cmsis-dap ; for e.g. Picotool \ No newline at end of file From 671566228111a7e83330e0544a25df55bc0da58a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 3 Mar 2025 16:10:47 +0100 Subject: [PATCH 227/381] don't build the niche* stuff for non-inkHUD builds. (#6217) --- platformio.ini | 4 +++- src/graphics/niche/InkHUD/PlatformioConfig.ini | 3 +-- variants/heltec_vision_master_e213/platformio.ini | 3 --- variants/heltec_vision_master_e290/platformio.ini | 3 --- variants/heltec_wireless_paper/platformio.ini | 3 --- variants/t-echo/platformio.ini | 3 --- 6 files changed, 4 insertions(+), 15 deletions(-) diff --git a/platformio.ini b/platformio.ini index 98b93c34d..e8348e002 100644 --- a/platformio.ini +++ b/platformio.ini @@ -7,6 +7,8 @@ default_envs = tbeam extra_configs = arch/*/*.ini variants/*/platformio.ini + src/graphics/niche/InkHUD/PlatformioConfig.ini + description = Meshtastic [env] @@ -77,7 +79,7 @@ lib_deps = ${env.lib_deps} end2endzone/NonBlockingRTTTL@1.3.0 build_flags = ${env.build_flags} -Os -build_src_filter = ${env.build_src_filter} - +build_src_filter = ${env.build_src_filter} - - ; Common libs for communicating over TCP/IP networks such as MQTT [networking_base] diff --git a/src/graphics/niche/InkHUD/PlatformioConfig.ini b/src/graphics/niche/InkHUD/PlatformioConfig.ini index 7eb1d34e9..0a70f1d0e 100644 --- a/src/graphics/niche/InkHUD/PlatformioConfig.ini +++ b/src/graphics/niche/InkHUD/PlatformioConfig.ini @@ -1,6 +1,5 @@ [inkhud] -board_level = extra -build_src_filter = +<../variants/$PIOENV> ; Include nicheGraphics.h +build_src_filter = +<../variants/$PIOENV> +; Include nicheGraphics.h build_flags = -D MESHTASTIC_INCLUDE_NICHE_GRAPHICS ; Use NicheGraphics -D MESHTASTIC_INCLUDE_INKHUD ; Use InkHUD (a NicheGraphics UI) diff --git a/variants/heltec_vision_master_e213/platformio.ini b/variants/heltec_vision_master_e213/platformio.ini index 3d8f2e7cd..00fffdfd9 100644 --- a/variants/heltec_vision_master_e213/platformio.ini +++ b/variants/heltec_vision_master_e213/platformio.ini @@ -19,9 +19,6 @@ lib_deps = lewisxhe/PCF8563_Library@^1.0.1 upload_speed = 115200 -; Using experimental InkHUD UI (work in progress) -[platformio] -extra_configs = src/graphics/niche/InkHUD/PlatformioConfig.ini [env:heltec-vision-master-e213-inkhud] extends = esp32s3_base, inkhud board = heltec_vision_master_e213 diff --git a/variants/heltec_vision_master_e290/platformio.ini b/variants/heltec_vision_master_e290/platformio.ini index d3aa85d65..232b13559 100644 --- a/variants/heltec_vision_master_e290/platformio.ini +++ b/variants/heltec_vision_master_e290/platformio.ini @@ -23,9 +23,6 @@ lib_deps = lewisxhe/PCF8563_Library@^1.0.1 upload_speed = 115200 -; Using experimental InkHUD UI (work in progress) -[platformio] -extra_configs = src/graphics/niche/InkHUD/PlatformioConfig.ini [env:heltec-vision-master-e290-inkhud] extends = esp32s3_base, inkhud board = heltec_vision_master_e290 diff --git a/variants/heltec_wireless_paper/platformio.ini b/variants/heltec_wireless_paper/platformio.ini index 36dbfd35b..b32b60dd5 100644 --- a/variants/heltec_wireless_paper/platformio.ini +++ b/variants/heltec_wireless_paper/platformio.ini @@ -20,9 +20,6 @@ lib_deps = lewisxhe/PCF8563_Library@^1.0.1 upload_speed = 115200 -; Using experimental InkHUD UI (work in progress) -[platformio] -extra_configs = src/graphics/niche/InkHUD/PlatformioConfig.ini [env:heltec-wireless-paper-inkhud] extends = esp32s3_base, inkhud board = heltec_wifi_lora_32_V3 diff --git a/variants/t-echo/platformio.ini b/variants/t-echo/platformio.ini index e0e26fe6a..bca760453 100644 --- a/variants/t-echo/platformio.ini +++ b/variants/t-echo/platformio.ini @@ -24,9 +24,6 @@ lib_deps = lewisxhe/PCF8563_Library@^1.0.1 ;upload_protocol = fs -; Using experimental InkHUD UI (work in progress) -[platformio] -extra_configs = src/graphics/niche/InkHUD/PlatformioConfig.ini [env:t-echo-inkhud] extends = nrf52840_base, inkhud board = t-echo From 050f0016c4d3ae8828319bba8c44abf1386b829f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 01:56:35 +0100 Subject: [PATCH 228/381] [create-pull-request] automated change (#6221) --- protobufs | 2 +- .../generated/meshtastic/interdevice.pb.cpp | 17 +++ .../generated/meshtastic/interdevice.pb.h | 105 ++++++++++++++++++ 3 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 src/mesh/generated/meshtastic/interdevice.pb.cpp create mode 100644 src/mesh/generated/meshtastic/interdevice.pb.h diff --git a/protobufs b/protobufs index 2a3a67f04..eb42f6d26 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 2a3a67f0431926dc3f32a8b216d264daab09b9bf +Subproject commit eb42f6d262400fb32f8c242985af1acf12d9e7a9 diff --git a/src/mesh/generated/meshtastic/interdevice.pb.cpp b/src/mesh/generated/meshtastic/interdevice.pb.cpp new file mode 100644 index 000000000..e3913f78c --- /dev/null +++ b/src/mesh/generated/meshtastic/interdevice.pb.cpp @@ -0,0 +1,17 @@ +/* Automatically generated nanopb constant definitions */ +/* Generated by nanopb-0.4.9.1 */ + +#include "meshtastic/interdevice.pb.h" +#if PB_PROTO_HEADER_VERSION != 40 +#error Regenerate this file with the current version of nanopb generator. +#endif + +PB_BIND(meshtastic_SensorData, meshtastic_SensorData, AUTO) + + +PB_BIND(meshtastic_InterdeviceMessage, meshtastic_InterdeviceMessage, 2) + + + + + diff --git a/src/mesh/generated/meshtastic/interdevice.pb.h b/src/mesh/generated/meshtastic/interdevice.pb.h new file mode 100644 index 000000000..c381438eb --- /dev/null +++ b/src/mesh/generated/meshtastic/interdevice.pb.h @@ -0,0 +1,105 @@ +/* Automatically generated nanopb header */ +/* Generated by nanopb-0.4.9.1 */ + +#ifndef PB_MESHTASTIC_MESHTASTIC_INTERDEVICE_PB_H_INCLUDED +#define PB_MESHTASTIC_MESHTASTIC_INTERDEVICE_PB_H_INCLUDED +#include + +#if PB_PROTO_HEADER_VERSION != 40 +#error Regenerate this file with the current version of nanopb generator. +#endif + +/* Enum definitions */ +typedef enum _meshtastic_MessageType { + meshtastic_MessageType_ACK = 0, + meshtastic_MessageType_COLLECT_INTERVAL = 160, /* in ms */ + meshtastic_MessageType_BEEP_ON = 161, /* duration ms */ + meshtastic_MessageType_BEEP_OFF = 162, /* cancel prematurely */ + meshtastic_MessageType_SHUTDOWN = 163, + meshtastic_MessageType_POWER_ON = 164, + meshtastic_MessageType_SCD41_TEMP = 176, + meshtastic_MessageType_SCD41_HUMIDITY = 177, + meshtastic_MessageType_SCD41_CO2 = 178, + meshtastic_MessageType_AHT20_TEMP = 179, + meshtastic_MessageType_AHT20_HUMIDITY = 180, + meshtastic_MessageType_TVOC_INDEX = 181 +} meshtastic_MessageType; + +/* Struct definitions */ +typedef struct _meshtastic_SensorData { + /* The message type */ + meshtastic_MessageType type; + pb_size_t which_data; + union { + float float_value; + uint32_t uint32_value; + } data; +} meshtastic_SensorData; + +typedef struct _meshtastic_InterdeviceMessage { + pb_size_t which_data; + union { + char nmea[1024]; + meshtastic_SensorData sensor; + } data; +} meshtastic_InterdeviceMessage; + + +#ifdef __cplusplus +extern "C" { +#endif + +/* Helper constants for enums */ +#define _meshtastic_MessageType_MIN meshtastic_MessageType_ACK +#define _meshtastic_MessageType_MAX meshtastic_MessageType_TVOC_INDEX +#define _meshtastic_MessageType_ARRAYSIZE ((meshtastic_MessageType)(meshtastic_MessageType_TVOC_INDEX+1)) + +#define meshtastic_SensorData_type_ENUMTYPE meshtastic_MessageType + + + +/* Initializer values for message structs */ +#define meshtastic_SensorData_init_default {_meshtastic_MessageType_MIN, 0, {0}} +#define meshtastic_InterdeviceMessage_init_default {0, {""}} +#define meshtastic_SensorData_init_zero {_meshtastic_MessageType_MIN, 0, {0}} +#define meshtastic_InterdeviceMessage_init_zero {0, {""}} + +/* Field tags (for use in manual encoding/decoding) */ +#define meshtastic_SensorData_type_tag 1 +#define meshtastic_SensorData_float_value_tag 2 +#define meshtastic_SensorData_uint32_value_tag 3 +#define meshtastic_InterdeviceMessage_nmea_tag 1 +#define meshtastic_InterdeviceMessage_sensor_tag 2 + +/* Struct field encoding specification for nanopb */ +#define meshtastic_SensorData_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, UENUM, type, 1) \ +X(a, STATIC, ONEOF, FLOAT, (data,float_value,data.float_value), 2) \ +X(a, STATIC, ONEOF, UINT32, (data,uint32_value,data.uint32_value), 3) +#define meshtastic_SensorData_CALLBACK NULL +#define meshtastic_SensorData_DEFAULT NULL + +#define meshtastic_InterdeviceMessage_FIELDLIST(X, a) \ +X(a, STATIC, ONEOF, STRING, (data,nmea,data.nmea), 1) \ +X(a, STATIC, ONEOF, MESSAGE, (data,sensor,data.sensor), 2) +#define meshtastic_InterdeviceMessage_CALLBACK NULL +#define meshtastic_InterdeviceMessage_DEFAULT NULL +#define meshtastic_InterdeviceMessage_data_sensor_MSGTYPE meshtastic_SensorData + +extern const pb_msgdesc_t meshtastic_SensorData_msg; +extern const pb_msgdesc_t meshtastic_InterdeviceMessage_msg; + +/* Defines for backwards compatibility with code written before nanopb-0.4.0 */ +#define meshtastic_SensorData_fields &meshtastic_SensorData_msg +#define meshtastic_InterdeviceMessage_fields &meshtastic_InterdeviceMessage_msg + +/* Maximum encoded size of messages (where known) */ +#define MESHTASTIC_MESHTASTIC_INTERDEVICE_PB_H_MAX_SIZE meshtastic_InterdeviceMessage_size +#define meshtastic_InterdeviceMessage_size 1026 +#define meshtastic_SensorData_size 9 + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif From 95bcd7ab0ba53000f7ad46e0881b967605e113d3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 09:45:02 -0600 Subject: [PATCH 229/381] Upgrade trunk (#6223) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index f3cb3d354..b1df7e417 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -8,15 +8,15 @@ plugins: uri: https://github.com/trunk-io/plugins lint: enabled: - - prettier@3.5.2 + - prettier@3.5.3 - trufflehog@3.88.14 - yamllint@1.35.1 - bandit@1.8.3 - - checkov@3.2.378 + - checkov@3.2.379 - terrascan@1.19.9 - trivy@0.59.1 - taplo@0.9.3 - - ruff@0.9.7 + - ruff@0.9.9 - isort@6.0.1 - markdownlint@0.44.0 - oxipng@9.1.4 From 41875d245ed944aa36bc7cdb25cc001882a5ad14 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 09:45:29 -0600 Subject: [PATCH 230/381] Bump lib/device-ui from `5c6156d` to `22f9ac0` (#6215) Bumps [lib/device-ui](https://github.com/meshtastic/device-ui) from `5c6156d` to `22f9ac0`. - [Commits](https://github.com/meshtastic/device-ui/compare/5c6156d2aa10d62cca3e57ffc117b934ef2fbffe...22f9ac01ea319b88dd93af89418691402ee51bcd) --- updated-dependencies: - dependency-name: lib/device-ui dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- lib/device-ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/device-ui b/lib/device-ui index 5c6156d2a..22f9ac01e 160000 --- a/lib/device-ui +++ b/lib/device-ui @@ -1 +1 @@ -Subproject commit 5c6156d2aa10d62cca3e57ffc117b934ef2fbffe +Subproject commit 22f9ac01ea319b88dd93af89418691402ee51bcd From 2391982c1d9cc96c8baa19e77cea95093a007779 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Tue, 4 Mar 2025 23:47:06 +0800 Subject: [PATCH 231/381] Only call GPS Probe commands once per family (#6114) In the GPS probe code we write commands on the serial line and determine which GPS we have based on the result. GPS units in the same family sometimes use the same command, but return different results (eg AG3335 and AG3332 both use $PAIR021*39). Currently we run the command once per GPS. Instead we should run each command only once per family, record the result, and select the GNSS MODEL based on the result, which is what this patch does. Before the change, we put 12 commands on the serial bus. Now we only put 6. This should markedly improve the speed and reliability of GPS detection. Fixes https://github.com/meshtastic/firmware/issues/5193 Co-authored-by: Ben Meadors --- src/gps/GPS.cpp | 82 +++++++++++++++++++++++++++++++++++++++---------- src/gps/GPS.h | 7 +++++ 2 files changed, 73 insertions(+), 16 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 2989a59bd..7dcb77fcc 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -1,3 +1,7 @@ +#include // Include for strstr +#include +#include + #include "configuration.h" #if !MESHTASTIC_EXCLUDE_GPS #include "Default.h" @@ -1117,7 +1121,7 @@ int GPS::prepareDeepSleep(void *unused) } static const char *PROBE_MESSAGE = "Trying %s (%s)..."; -static const char *DETECTED_MESSAGE = "%s detected, using %s Module"; +static const char *DETECTED_MESSAGE = "%s detected"; #define PROBE_SIMPLE(CHIP, TOWRITE, RESPONSE, DRIVER, TIMEOUT, ...) \ do { \ @@ -1125,11 +1129,22 @@ static const char *DETECTED_MESSAGE = "%s detected, using %s Module"; clearBuffer(); \ _serial_gps->write(TOWRITE "\r\n"); \ if (getACK(RESPONSE, TIMEOUT) == GNSS_RESPONSE_OK) { \ - LOG_INFO(DETECTED_MESSAGE, CHIP, #DRIVER); \ + LOG_INFO(DETECTED_MESSAGE, CHIP); \ return DRIVER; \ } \ } while (0) +#define PROBE_FAMILY(FAMILY_NAME, COMMAND, RESPONSE_MAP, TIMEOUT) \ + do { \ + LOG_DEBUG(PROBE_MESSAGE, COMMAND, FAMILY_NAME); \ + clearBuffer(); \ + _serial_gps->write(COMMAND "\r\n"); \ + GnssModel_t detectedDriver = getProbeResponse(TIMEOUT, RESPONSE_MAP); \ + if (detectedDriver != GNSS_MODEL_UNKNOWN) { \ + return detectedDriver; \ + } \ + } while (0) + GnssModel_t GPS::probe(int serialSpeed) { #if defined(ARCH_NRF52) || defined(ARCH_PORTDUINO) || defined(ARCH_STM32WL) @@ -1160,31 +1175,34 @@ GnssModel_t GPS::probe(int serialSpeed) delay(20); // Unicore UFirebirdII Series: UC6580, UM620, UM621, UM670A, UM680A, or UM681A - PROBE_SIMPLE("UC6580", "$PDTINFO", "UC6580", GNSS_MODEL_UC6580, 500); - PROBE_SIMPLE("UM600", "$PDTINFO", "UM600", GNSS_MODEL_UC6580, 500); - PROBE_SIMPLE("ATGM336H", "$PCAS06,1*1A", "$GPTXT,01,01,02,HW=ATGM336H", GNSS_MODEL_ATGM336H, 500); - /* ATGM332D series (-11(GPS), -21(BDS), -31(GPS+BDS), -51(GPS+GLONASS), -71-0(GPS+BDS+GLONASS)) - based on AT6558 */ - PROBE_SIMPLE("ATGM332D", "$PCAS06,1*1A", "$GPTXT,01,01,02,HW=ATGM332D", GNSS_MODEL_ATGM336H, 500); + std::vector unicore = {{"UC6580", "UC6580", GNSS_MODEL_UC6580}, {"UM600", "UM600", GNSS_MODEL_UC6580}}; + PROBE_FAMILY("Unicore Family", "$PDTINFO", unicore, 500); + + std::vector atgm = { + {"ATGM336H", "$GPTXT,01,01,02,HW=ATGM336H", GNSS_MODEL_ATGM336H}, + /* ATGM332D series (-11(GPS), -21(BDS), -31(GPS+BDS), -51(GPS+GLONASS), -71-0(GPS+BDS+GLONASS)) based on AT6558 */ + {"ATGM332D", "$GPTXT,01,01,02,HW=ATGM332D", GNSS_MODEL_ATGM336H}}; + PROBE_FAMILY("ATGM33xx Family", "$PCAS06,1*1A", atgm, 500); /* Airoha (Mediatek) AG3335A/M/S, A3352Q, Quectel L89 2.0, SimCom SIM65M */ _serial_gps->write("$PAIR062,2,0*3C\r\n"); // GSA OFF to reduce volume _serial_gps->write("$PAIR062,3,0*3D\r\n"); // GSV OFF to reduce volume _serial_gps->write("$PAIR513*3D\r\n"); // save configuration - PROBE_SIMPLE("AG3335", "$PAIR021*39", "$PAIR021,AG3335", GNSS_MODEL_AG3335, 500); - PROBE_SIMPLE("AG3352", "$PAIR021*39", "$PAIR021,AG3352", GNSS_MODEL_AG3352, 500); - PROBE_SIMPLE("LC86", "$PQTMVERNO*58", "$PQTMVERNO,LC86", GNSS_MODEL_AG3352, 500); + std::vector airoha = {{"AG3335", "$PAIR021,AG3335", GNSS_MODEL_AG3335}, + {"AG3352", "$PAIR021,AG3352", GNSS_MODEL_AG3352}, + {"RYS3520", "$PAIR021,REYAX_RYS3520_V2", GNSS_MODEL_AG3352}}; + PROBE_FAMILY("Airoha Family", "$PAIR021*39", airoha, 1000); + PROBE_SIMPLE("LC86", "$PQTMVERNO*58", "$PQTMVERNO,LC86", GNSS_MODEL_AG3352, 500); PROBE_SIMPLE("L76K", "$PCAS06,0*1B", "$GPTXT,01,01,02,SW=", GNSS_MODEL_MTK, 500); // Close all NMEA sentences, valid for L76B MTK platform (Waveshare Pico GPS) _serial_gps->write("$PMTK514,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*2E\r\n"); delay(20); - - PROBE_SIMPLE("L76B", "$PMTK605*31", "Quectel-L76B", GNSS_MODEL_MTK_L76B, 500); - PROBE_SIMPLE("PA1616S", "$PMTK605*31", "1616S", GNSS_MODEL_MTK_PA1616S, 500); - - PROBE_SIMPLE("LS20031", "$PMTK605*31", "MC-1513", GNSS_MODEL_LS20031, 500); + std::vector mtk = {{"L76B", "Quectel-L76B", GNSS_MODEL_MTK_L76B}, + {"PA1616S", "1616S", GNSS_MODEL_MTK_PA1616S}, + {"LS20031", "MC-1513", GNSS_MODEL_LS20031}}; + PROBE_FAMILY("MTK Family", "$PMTK605*31", mtk, 500); uint8_t cfg_rate[] = {0xB5, 0x62, 0x06, 0x08, 0x00, 0x00, 0x00, 0x00}; UBXChecksum(cfg_rate, sizeof(cfg_rate)); @@ -1281,6 +1299,38 @@ GnssModel_t GPS::probe(int serialSpeed) return GNSS_MODEL_UNKNOWN; } +GnssModel_t GPS::getProbeResponse(unsigned long timeout, const std::vector &responseMap) +{ + String response = ""; + unsigned long start = millis(); + while (millis() - start < timeout) { + if (_serial_gps->available()) { + response += (char)_serial_gps->read(); + + if (response.endsWith(",") || response.endsWith("\r\n")) { +#ifdef GPS_DEBUG + LOG_DEBUG(response.c_str()); +#endif + // check if we can see our chips + for (const auto &chipInfo : responseMap) { + if (strstr(response.c_str(), chipInfo.detectionString.c_str()) != nullptr) { + LOG_INFO("%s detected", chipInfo.chipName.c_str()); + return chipInfo.driver; + } + } + } + if (response.endsWith("\r\n")) { + response.trim(); + response = ""; // Reset the response string for the next potential message + } + } + } +#ifdef GPS_DEBUG + LOG_DEBUG(response.c_str()); +#endif + return GNSS_MODEL_UNKNOWN; // Return empty string on timeout +} + GPS *GPS::createGps() { int8_t _rx_gpio = config.position.rx_gpio; diff --git a/src/gps/GPS.h b/src/gps/GPS.h index 01a4fe745..240cf66d2 100644 --- a/src/gps/GPS.h +++ b/src/gps/GPS.h @@ -48,6 +48,11 @@ enum GPSPowerState : uint8_t { GPS_OFF // Powered off indefinitely }; +struct ChipInfo { + String chipName; // The name of the chip (for logging) + String detectionString; // The string to match in the response + GnssModel_t driver; // The driver to use +}; /** * A gps class that only reads from the GPS periodically and keeps the gps powered down except when reading * @@ -230,6 +235,8 @@ class GPS : private concurrency::OSThread virtual int32_t runOnce() override; + GnssModel_t getProbeResponse(unsigned long timeout, const std::vector &responseMap); + // Get GNSS model GnssModel_t probe(int serialSpeed); From fdbadc992cb1bbe0a4be0625eebf2f5c4aa0defa Mon Sep 17 00:00:00 2001 From: Matt Andreko Date: Tue, 4 Mar 2025 15:27:57 -0500 Subject: [PATCH 232/381] Enable GPS functionality for RAK4631_eth_gw variant (#6229) --- variants/rak4631_eth_gw/platformio.ini | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/variants/rak4631_eth_gw/platformio.ini b/variants/rak4631_eth_gw/platformio.ini index 62b7e737d..a624d0381 100644 --- a/variants/rak4631_eth_gw/platformio.ini +++ b/variants/rak4631_eth_gw/platformio.ini @@ -10,7 +10,6 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/rak4631_eth_gw -D RAK_4631 -DEINK_WIDTH=250 -DEINK_HEIGHT=122 -DNRF52_USE_JSON=1 - -DMESHTASTIC_EXCLUDE_GPS=1 -DMESHTASTIC_EXCLUDE_WIFI=1 -DMESHTASTIC_EXCLUDE_SCREEN=1 ; -DMESHTASTIC_EXCLUDE_PKI=1 @@ -63,4 +62,4 @@ lib_deps = upload_protocol = stlink ; eventually use platformio/tool-pyocd@^2.3600.0 instad ;upload_protocol = custom -;upload_command = pyocd flash -t nrf52840 $UPLOADERFLAGS $SOURCE \ No newline at end of file +;upload_command = pyocd flash -t nrf52840 $UPLOADERFLAGS $SOURCE From f0f2cd0e0e3d2245bd02a20580232ca96bd3a86b Mon Sep 17 00:00:00 2001 From: Mictronics Date: Tue, 4 Mar 2025 21:39:10 +0100 Subject: [PATCH 233/381] RAK11310 Fix build with latest Arduino framework (#6227) --- arch/rp2xx0/rp2040.ini | 4 ++-- boards/wiscore_rak11300.json | 40 -------------------------------- variants/rak11310/platformio.ini | 5 +--- 3 files changed, 3 insertions(+), 46 deletions(-) delete mode 100644 boards/wiscore_rak11300.json diff --git a/arch/rp2xx0/rp2040.ini b/arch/rp2xx0/rp2040.ini index 74644800d..1542dbee7 100644 --- a/arch/rp2xx0/rp2040.ini +++ b/arch/rp2xx0/rp2040.ini @@ -1,8 +1,8 @@ ; Common settings for rp2040 Processor based targets [rp2040_base] -platform = https://github.com/maxgerhardt/platform-raspberrypi.git#19e30129fb1428b823be585c787dcb4ac0d9014c ; For arduino-pico >=4.2.1 +platform = https://github.com/maxgerhardt/platform-raspberrypi.git#76ecf3c7e9dd4503af0331154c4ca1cddc4b03e5 ; For arduino-pico >= 4.4.3 extends = arduino_base -platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#6024e9a7e82a72e38dd90f42029ba3748835eb2e ; 4.3.0 with fix MDNS +platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#4.4.3 board_build.core = earlephilhower board_build.filesystem_size = 0.5m diff --git a/boards/wiscore_rak11300.json b/boards/wiscore_rak11300.json deleted file mode 100644 index 19beee74d..000000000 --- a/boards/wiscore_rak11300.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "build": { - "arduino": { - "earlephilhower": { - "boot2_source": "boot2_w25q080_2_padded_checksum.S", - "usb_vid": "0x2E8A", - "usb_pid": "0x000A" - } - }, - "core": "earlephilhower", - "cpu": "cortex-m0plus", - "extra_flags": "-DARDUINO_GENERIC_RP2040 -DRASPBERRY_PI_PICO -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250", - "f_cpu": "133000000L", - "hwids": [ - ["0x2E8A", "0x00C0"], - ["0x2E8A", "0x000A"] - ], - "mcu": "rp2040", - "variant": "WisBlock_RAK11300_Board" - }, - "debug": { - "jlink_device": "RP2040_M0_0", - "openocd_target": "rp2040.cfg", - "svd_path": "rp2040.svd" - }, - "frameworks": ["arduino"], - "name": "WisBlock RAK11300", - "upload": { - "maximum_ram_size": 270336, - "maximum_size": 2097152, - "require_upload_port": true, - "native_usb": true, - "use_1200bps_touch": true, - "wait_for_upload_port": false, - "protocol": "picotool", - "protocols": ["cmsis-dap", "raspberrypi-swd", "picotool", "picoprobe"] - }, - "url": "https://docs.rakwireless.com/", - "vendor": "RAKwireless" -} diff --git a/variants/rak11310/platformio.ini b/variants/rak11310/platformio.ini index 10bbe1620..6e718a651 100644 --- a/variants/rak11310/platformio.ini +++ b/variants/rak11310/platformio.ini @@ -1,10 +1,7 @@ [env:rak11310] extends = rp2040_base -board = wiscore_rak11300 +board = rakwireless_rak11300 upload_protocol = picotool -# keep an old SDK to use less memory. -platform = https://github.com/maxgerhardt/platform-raspberrypi.git#v1.2.0-gcc12 -platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#4.0.1 # add our variants files to the include and src paths build_flags = ${rp2040_base.build_flags} From ede3f7b702603a525a028f2e3d78f924176b3fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gjels=C3=B8?= <36234524+gjelsoe@users.noreply.github.com> Date: Wed, 5 Mar 2025 20:07:26 +0100 Subject: [PATCH 234/381] Changes for 2.6 device_install (#6206) * Changes for 2.6 device_install For #6186 Added 2 new arguments --tft and -tft-16mb Some checks are added. Before it would try to write all files to the device, if there was more than ONE littlefs-* or littlefswebui-* in the directory. Added OTA Offsets for 8 and 16mb (fix) Thanks to @caveman99 for spotting it. * The missing SET Added a missing SET. Thanks to @ThatKalle * Fix and more checks. Added Checks to make sure, that --tft and --tft-16mb can't be used with a non tft bin file. Added error messages on files not found. Removed a "ECHO" that shouldn't be there. * Fixes to device-install.sh Replace /bin/sh with /bin/bash for better string handling. Removed a SET that doesn't belong in the .sh file. Better checking for TFT and non TFT build, based on filename. Corrected a mix of TAB & SPACE indent. * Update device-install.bat Corrected a mix of TAB & SPACE indent. * Update device-install.bat Double ELSE block at the end of file, one removed. * Update device-install.bat Added more reliable method to display the scripts own name in help menu. Fixed case sensitive options -p and -P Added some VAR cleanup. Changed the detect method on BLEOTA. Changed some wording. --------- Co-authored-by: Ben Meadors --- bin/device-install.bat | 135 +++++++++++++++++++++++++------- bin/device-install.sh | 173 ++++++++++++++++++++++++++++------------- 2 files changed, 226 insertions(+), 82 deletions(-) diff --git a/bin/device-install.bat b/bin/device-install.bat index c18be89a8..4d13d9f3b 100755 --- a/bin/device-install.bat +++ b/bin/device-install.bat @@ -1,7 +1,12 @@ @ECHO OFF - -set PYTHON=python -set WEB_APP=0 +SETLOCAL EnableDelayedExpansion +set "SCRIPTNAME=%~nx0" +set "PYTHON=python" +set "WEB_APP=0" +set "TFT8=0" +set "TFT16=0" +SET "TFT_BUILD=0" +SET "DO_SPECIAL_OTA=0" :: Determine the correct esptool command to use where esptool >nul 2>&1 @@ -13,7 +18,7 @@ if %ERRORLEVEL% EQU 0 ( goto GETOPTS :HELP -echo Usage: %~nx0 [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME^|FILENAME] [--web] +echo Usage: %SCRIPTNAME% [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME] [--web] [--tft] [--tft-16mb] echo Flash image file to device, but first erasing and writing system information echo. echo -h Display this help and exit @@ -21,52 +26,124 @@ echo -p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not echo -P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: %PYTHON%) echo -f FILENAME The .bin file to flash. Custom to your device type and region. echo --web Flash WEB APP. +echo --tft Flash MUI 8mb +echo --tft-16mb Flash MUI 16mb goto EOF :GETOPTS -if /I "%1"=="-h" goto HELP -if /I "%1"=="--help" goto HELP -if /I "%1"=="-F" set "FILENAME=%2" & SHIFT -if /I "%1"=="-p" set ESPTOOL_PORT=%2 & SHIFT -if /I "%1"=="-P" set PYTHON=%2 & SHIFT -if /I "%1"=="--web" set WEB_APP=1 & SHIFT +if /I "%~1"=="-h" goto HELP & exit /b +if /I "%~1"=="--help" goto HELP & exit /b +if "%~1"=="-p" set "ESPTOOL_PORT=%~2" & SHIFT & SHIFT & goto GETOPTS +if "%~1"=="-P" set "PYTHON=%~2" & SHIFT & SHIFT & goto GETOPTS +if /I "%~1"=="-f" set "FILENAME=%~2" & SHIFT & SHIFT & goto GETOPTS +if /I "%~1"=="--web" set "WEB_APP=1" & SHIFT & goto GETOPTS +if /I "%~1"=="--tft" set "TFT8=1" & SHIFT & goto GETOPTS +if /I "%~1"=="--tft-16mb" set "TFT16=1" & SHIFT & goto GETOPTS SHIFT -IF NOT "__%1__"=="____" goto GETOPTS +IF NOT "%~1"=="" goto GETOPTS IF "__%FILENAME%__" == "____" ( echo "Missing FILENAME" goto HELP ) + +:: Check if FILENAME contains "-tft-" and either TFT8 or TFT16 is 1 (--tft, -tft-16mb) +IF NOT "%FILENAME:-tft-=%"=="%FILENAME%" ( + SET "TFT_BUILD=1" + IF NOT "%TFT8%"=="1" IF NOT "%TFT16%"=="1" ( + echo Error: Either --tft or --tft-16mb must be set to use a TFT build. + goto EOF + ) + IF "%TFT8%"=="1" IF "%TFT16%"=="1" ( + echo Error: Both --tft and --tft-16mb must NOT be set at the same time. + goto EOF + ) +) + +:: Extract BASENAME from %FILENAME% for later use. +SET BASENAME=%FILENAME:firmware-=% + IF EXIST %FILENAME% IF x%FILENAME:update=%==x%FILENAME% ( + @REM Default littlefs* offset (--web). + SET "OFFSET=0x300000" + + @REM Default OTA Offset + SET "OTA_OFFSET=0x260000" + + @REM littlefs* offset for MUI 8mb (--tft) and OTA OFFSET. + IF "%TFT8%"=="1" IF "%TFT_BUILD%"=="1" ( + SET "OFFSET=0x670000" + SET "OTA_OFFSET=0x340000" + ) else ( + echo Ignoring --tft, not a TFT Build. + ) + + @REM littlefs* offset for MUI 16mb (--tft-16mb) and OTA OFFSET. + IF "%TFT16%"=="1" IF "%TFT_BUILD%"=="1" ( + SET "OFFSET=0xc90000" + SET "OTA_OFFSET=0x650000" + ) else ( + echo Ignoring --tft-16mb, not a TFT Build. + ) + echo Trying to flash update %FILENAME%, but first erasing and writing system information" %ESPTOOL_CMD% --baud 115200 erase_flash - %ESPTOOL_CMD% --baud 115200 write_flash 0x00 %FILENAME% - + %ESPTOOL_CMD% --baud 115200 write_flash 0x00 "%FILENAME%" + @REM Account for S3 and C3 board's different OTA partition - IF x%FILENAME:s3=%==x%FILENAME% IF x%FILENAME:v3=%==x%FILENAME% IF x%FILENAME:t-deck=%==x%FILENAME% IF x%FILENAME:wireless-paper=%==x%FILENAME% IF x%FILENAME:wireless-tracker=%==x%FILENAME% IF x%FILENAME:station-g2=%==x%FILENAME% IF x%FILENAME:unphone=%==x%FILENAME% ( - IF x%FILENAME:esp32c3=%==x%FILENAME% ( - %ESPTOOL_CMD% --baud 115200 write_flash 0x260000 bleota.bin + IF NOT "%FILENAME%"=="%FILENAME:s3=%" SET "DO_SPECIAL_OTA=1" + IF NOT "%FILENAME%"=="%FILENAME:v3=%" SET "DO_SPECIAL_OTA=1" + IF NOT "%FILENAME%"=="%FILENAME:t-deck=%" SET "DO_SPECIAL_OTA=1" + IF NOT "%FILENAME%"=="%FILENAME:wireless-paper=%" SET "DO_SPECIAL_OTA=1" + IF NOT "%FILENAME%"=="%FILENAME:wireless-tracker=%" SET "DO_SPECIAL_OTA=1" + IF NOT "%FILENAME%"=="%FILENAME:station-g2=%" SET "DO_SPECIAL_OTA=1" + IF NOT "%FILENAME%"=="%FILENAME:unphone=%" SET "DO_SPECIAL_OTA=1" + IF NOT "%FILENAME%"=="%FILENAME:esp32c3=%" SET "DO_SPECIAL_OTA=1" + + IF "!DO_SPECIAL_OTA!"=="1" ( + IF NOT "%FILENAME%"=="%FILENAME:esp32c3=%" ( + %ESPTOOL_CMD% --baud 115200 write_flash !OTA_OFFSET! bleota-c3.bin + ) ELSE ( + %ESPTOOL_CMD% --baud 115200 write_flash !OTA_OFFSET! bleota-s3.bin + ) + ) ELSE ( + %ESPTOOL_CMD% --baud 115200 write_flash !OTA_OFFSET! bleota.bin + ) + + @REM Check if WEB_APP (--web) is enabled and add "littlefswebui-" to BASENAME else "littlefs-". + IF "%WEB_APP%"=="1" ( + @REM Check it the file exist before trying to write it. + IF EXIST "littlefswebui-%BASENAME%" ( + %ESPTOOL_CMD% --baud 115200 write_flash !OFFSET! "littlefswebui-%BASENAME%" ) else ( - %ESPTOOL_CMD% --baud 115200 write_flash 0x260000 bleota-c3.bin + echo Error: file "littlefswebui-%BASENAME%" wasn't found, littlefswebui not written. + goto EOF ) ) else ( - %ESPTOOL_CMD% --baud 115200 write_flash 0x260000 bleota-s3.bin - ) - IF %WEB_APP%==1 ( - for %%f in (littlefswebui-*.bin) do ( - %ESPTOOL_CMD% --baud 115200 write_flash 0x300000 %%f - ) - ) else ( - for %%f in (littlefs-*.bin) do ( - %ESPTOOL_CMD% --baud 115200 write_flash 0x300000 %%f + @REM Check it the file exist before trying to write it. + IF EXIST "littlefs-%BASENAME%" ( + %ESPTOOL_CMD% --baud 115200 write_flash !OFFSET! "littlefs-%BASENAME%" + ) else ( + echo Error: file "littlefs-%BASENAME%" wasn't found, littlefs not written. + goto EOF ) ) ) else ( echo "Invalid file: %FILENAME%" goto HELP -) else ( - echo "Invalid file: %FILENAME%" - goto HELP ) :EOF +@REM Cleanup vars. +SET "SCRIPTNAME=" +SET "PYTHON=" +SET "WEB_APP=" +SET "TFT8=" +Set "TFT16=" +SET "OFFSET=" +SET "OTA_OFFSET=" +SET "DO_SPECIAL_OTA=" +SET "FILENAME=" +SET "BASENAME=" +endlocal +exit /b 0 \ No newline at end of file diff --git a/bin/device-install.sh b/bin/device-install.sh index 4698b88e5..96a204a5a 100755 --- a/bin/device-install.sh +++ b/bin/device-install.sh @@ -1,7 +1,10 @@ -#!/bin/sh +#!/bin/bash PYTHON=${PYTHON:-$(which python3 python | head -n 1)} WEB_APP=false +TFT8=false +TFT16=false +TFT_BUILD=false # Determine the correct esptool command to use if "$PYTHON" -m esptool version >/dev/null 2>&1; then @@ -19,8 +22,8 @@ set -e # Usage info show_help() { - cat <&2 + exit 1 ;; esac + shift # Move to the next argument done -while getopts ":hp:P:f:" opt; do - case "${opt}" in - h) - show_help - exit 0 - ;; - p) - export ESPTOOL_PORT=${OPTARG} - ;; - P) - PYTHON=${OPTARG} - ;; - f) - FILENAME=${OPTARG} - ;; - *) - echo "Invalid flag." - show_help >&2 - exit 1 - ;; - esac -done -shift "$((OPTIND - 1))" - [ -z "$FILENAME" -a -n "$1" ] && { - FILENAME=$1 - shift + FILENAME=$1 + shift } +# Check if FILENAME contains "-tft-" and either TFT8 or TFT16 is 1 (--tft, -tft-16mb) +if [[ "${FILENAME//-tft-/}" != "$FILENAME" ]]; then + TFT_BUILD=true + if [[ "$TFT8" != true && "$TFT16" != true ]]; then + echo "Error: Either --tft or --tft-16mb must be set to use a TFT build." + exit 1 + fi + if [[ "$TFT8" == true && "$TFT16" == true ]]; then + echo "Error: Both --tft and --tft-16mb must NOT be set at the same time." + exit 1 + fi +fi + +# Extract BASENAME from %FILENAME% for later use. +BASENAME="${FILENAME/firmware-/}" + if [ -f "${FILENAME}" ] && [ -n "${FILENAME##*"update"*}" ]; then - echo "Trying to flash ${FILENAME}, but first erasing and writing system information" - $ESPTOOL_CMD erase_flash - $ESPTOOL_CMD write_flash 0x00 "${FILENAME}" - # Account for S3 board's different OTA partition - if [ -n "${FILENAME##*"s3"*}" ] && [ -n "${FILENAME##*"-v3"*}" ] && [ -n "${FILENAME##*"t-deck"*}" ] && [ -n "${FILENAME##*"wireless-paper"*}" ] && [ -n "${FILENAME##*"wireless-tracker"*}" ] && [ -n "${FILENAME##*"station-g2"*}" ] && [ -n "${FILENAME##*"unphone"*}" ]; then - if [ -n "${FILENAME##*"esp32c3"*}" ]; then - $ESPTOOL_CMD write_flash 0x260000 bleota.bin - else - $ESPTOOL_CMD write_flash 0x260000 bleota-c3.bin - fi - else - $ESPTOOL_CMD write_flash 0x260000 bleota-s3.bin - fi - if [ "$WEB_APP" = true ]; then - $ESPTOOL_CMD write_flash 0x300000 littlefswebui-*.bin - else - $ESPTOOL_CMD write_flash 0x300000 littlefs-*.bin - fi + # Default littlefs* offset (--web). + OFFSET=0x300000 + + # Default OTA Offset + OTA_OFFSET=0x260000 + + # littlefs* offset for MUI 8mb (--tft) and OTA OFFSET. + if [ "$TFT8" = true ]; then + if [ "$TFT_BUILD" = true ]; then + OFFSET=0x670000 + OTA_OFFSET=0x340000 + else + echo "Ignoring --tft, not a TFT Build." + fi + fi + + # littlefs* offset for MUI 16mb (--tft-16mb) and OTA OFFSET. + if [ "$TFT16" = true ]; then + if [ "$TFT_BUILD" = true ]; then + OFFSET=0xc90000 + OTA_OFFSET=0x650000 + else + echo "Ignoring --tft-16mb, not a TFT Build." + fi + fi + + echo "Trying to flash ${FILENAME}, but first erasing and writing system information" + $ESPTOOL_CMD erase_flash + $ESPTOOL_CMD write_flash 0x00 "${FILENAME}" + # Account for S3 board's different OTA partition + if [ -n "${FILENAME##*"s3"*}" ] && [ -n "${FILENAME##*"-v3"*}" ] && [ -n "${FILENAME##*"t-deck"*}" ] && [ -n "${FILENAME##*"wireless-paper"*}" ] && [ -n "${FILENAME##*"wireless-tracker"*}" ] && [ -n "${FILENAME##*"station-g2"*}" ] && [ -n "${FILENAME##*"unphone"*}" ]; then + if [ -n "${FILENAME##*"esp32c3"*}" ]; then + $ESPTOOL_CMD write_flash $OTA_OFFSET bleota.bin + else + $ESPTOOL_CMD write_flash $OTA_OFFSET bleota-c3.bin + fi + else + $ESPTOOL_CMD write_flash $OTA_OFFSET bleota-s3.bin + fi + + # Check if WEB_APP (--web) is enabled and add "littlefswebui-" to BASENAME else "littlefs-". + if [ "$WEB_APP" = true ]; then + # Check it the file exist before trying to write it. + if [ -f "littlefswebui-${BASENAME}" ]; then + $ESPTOOL_CMD write_flash $OFFSET "littlefswebui-${BASENAME}" + else + echo "Error: file "littlefswebui-${BASENAME}" wasn't found, littlefs not written." + exit 1 + fi + else + # Check it the file exist before trying to write it. + if [ -f "littlefs-${BASENAME}" ]; then + $ESPTOOL_CMD write_flash $OFFSET "littlefs-${BASENAME}" + else + echo "Error: file "littlefs-${BASENAME}" wasn't found, littlefs not written." + exit 1 + fi + fi else - show_help - echo "Invalid file: ${FILENAME}" + show_help + echo "Invalid file: ${FILENAME}" fi exit 0 From 239e5412b3b44f9269d6974f9a47fde7e2d3b61e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 5 Mar 2025 14:53:51 -0600 Subject: [PATCH 235/381] [create-pull-request] automated change (#6235) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/mesh.pb.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/protobufs b/protobufs index eb42f6d26..1cddedce8 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit eb42f6d262400fb32f8c242985af1acf12d9e7a9 +Subproject commit 1cddedce83fe056dff5441a7cd468a6f4826b51a diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 3353a020f..193a61901 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -226,6 +226,8 @@ typedef enum _meshtastic_HardwareModel { /* MeshLink board developed by LoraItalia. NRF52840, eByte E22900M22S (Will also come with other frequencies), 25w MPPT solar charger (5v,12v,18v selectable), support for gps, buzzer, oled or e-ink display, 10 gpios, hardware watchdog https://www.loraitalia.it */ meshtastic_HardwareModel_MESHLINK = 87, + /* Seeed XIAO nRF52840 + Wio SX1262 kit */ + meshtastic_HardwareModel_XIAO_NRF52_KIT = 88, /* ------------------------------------------------------------------------------------------------------------------------------------------ Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. ------------------------------------------------------------------------------------------------------------------------------------------ */ From b96b0279268008173abd11a2755763e8f71508aa Mon Sep 17 00:00:00 2001 From: Austin Date: Wed, 5 Mar 2025 17:19:59 -0500 Subject: [PATCH 236/381] Consume device-ui as a pio library (#6193) --- .gitmodules | 3 --- bin/platformio-custom.py | 7 ++++++- lib/device-ui | 1 - platformio.ini | 4 ++++ variants/mesh-tab/platformio.ini | 9 +++------ variants/picomputer-s3/platformio.ini | 10 +++------- variants/portduino/platformio.ini | 19 ++++++++++--------- .../seeed-sensecap-indicator/platformio.ini | 11 ++--------- variants/t-deck/platformio.ini | 9 +-------- variants/unphone/platformio.ini | 10 +++------- 10 files changed, 32 insertions(+), 51 deletions(-) delete mode 160000 lib/device-ui diff --git a/.gitmodules b/.gitmodules index 964204476..7c54ad513 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "protobufs"] path = protobufs url = https://github.com/meshtastic/protobufs.git -[submodule "lib/device-ui"] - path = lib/device-ui - url = https://github.com/meshtastic/device-ui.git [submodule "meshtestic"] path = meshtestic url = https://github.com/meshtastic/meshTestic diff --git a/bin/platformio-custom.py b/bin/platformio-custom.py index 09e8e6d83..af228899f 100644 --- a/bin/platformio-custom.py +++ b/bin/platformio-custom.py @@ -125,4 +125,9 @@ for flag in flags: projenv.Append( CCFLAGS=flags, -) \ No newline at end of file +) + +for lb in env.GetLibBuilders(): + if lb.name == "meshtastic-device-ui": + lb.env.Append(CPPDEFINES=[("APP_VERSION", verObj["long"])]) + break diff --git a/lib/device-ui b/lib/device-ui deleted file mode 160000 index 22f9ac01e..000000000 --- a/lib/device-ui +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 22f9ac01ea319b88dd93af89418691402ee51bcd diff --git a/platformio.ini b/platformio.ini index e8348e002..61c9c6ed0 100644 --- a/platformio.ini +++ b/platformio.ini @@ -92,6 +92,10 @@ lib_deps = lib_deps = jgromes/RadioLib@7.1.2 +[device-ui_base] +lib_deps = + https://github.com/meshtastic/device-ui.git#8c3183e177a1d6452ce12b4f328bd3357bf7e21b + ; Common libs for environmental measurements in telemetry module ; (not included in native / portduino) [environmental_base] diff --git a/variants/mesh-tab/platformio.ini b/variants/mesh-tab/platformio.ini index f76c36bdd..9e3429ac5 100644 --- a/variants/mesh-tab/platformio.ini +++ b/variants/mesh-tab/platformio.ini @@ -47,14 +47,11 @@ build_flags = ${esp32s3_base.build_flags} -D LGFX_TOUCH_INT=41 -D VIEW_320x240 -D USE_PACKET_API - -I lib/device-ui/generated/ui_320x240 -I variants/mesh-tab build_src_filter = ${esp32_base.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> - +<../lib/device-ui/resources> - +<../lib/device-ui/locale> - +<../lib/device-ui/source> -lib_deps = ${esp32_base.lib_deps} +lib_deps = + ${esp32_base.lib_deps} + ${device-ui_base.lib_deps} lovyan03/LovyanGFX@^1.2.0 [mesh_tab_xpt2046] diff --git a/variants/picomputer-s3/platformio.ini b/variants/picomputer-s3/platformio.ini index b8de94f12..7f769253c 100644 --- a/variants/picomputer-s3/platformio.ini +++ b/variants/picomputer-s3/platformio.ini @@ -54,11 +54,7 @@ build_flags = -D VIEW_320x240 ; -D USE_DOUBLE_BUFFER -D USE_PACKET_API - -I lib/device-ui/generated/ui_320x240 -build_src_filter = - ${env:picomputer-s3.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> - +<../lib/device-ui/resources> - +<../lib/device-ui/locale> - +<../lib/device-ui/source> \ No newline at end of file +lib_deps = + ${env:picomputer-s3.lib_deps} + ${device-ui_base.lib_deps} diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index f77831ad7..9bf3313ce 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -18,6 +18,9 @@ build_flags = ${native_base.build_flags} [env:native-tft] extends = native_base build_type = release +lib_deps = + ${native_base.lib_deps} + ${device-ui_base.lib_deps} build_flags = ${native_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunction-sections -fdata-sections -Wl,--gc-sections -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D RAM_SIZE=16384 @@ -32,21 +35,19 @@ build_flags = ${native_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunctio -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D USE_PACKET_API - -I lib/device-ui/generated/ui_320x240 + -D VIEW_320x240 !pkg-config --libs libulfius --silence-errors || : !pkg-config --libs openssl --silence-errors || : -build_src_filter = ${native_base.build_src_filter} +build_src_filter = + ${native_base.build_src_filter} - - +<../lib/device-ui/generated/ui_320x240> - +<../lib/device-ui/generated/ui_320x240/fonts> - +<../lib/device-ui/resources> - +<../lib/device-ui/portduino> - +<../lib/device-ui/locale> - +<../lib/device-ui/source> [env:native-tft-debug] extends = native_base build_type = debug +lib_deps = + ${native_base.lib_deps} + ${device-ui_base.lib_deps} board_level = extra build_flags = ${native_base.build_flags} -O0 -fsanitize=address -lX11 -linput -lxkbcommon -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 @@ -69,7 +70,7 @@ build_flags = ${native_base.build_flags} -O0 -fsanitize=address -lX11 -linput -l -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D USE_PACKET_API - -I lib/device-ui/generated/ui_320x240 + -D VIEW_320x240 !pkg-config --libs libulfius --silence-errors || : !pkg-config --libs openssl --silence-errors || : build_src_filter = ${env:native-tft.build_src_filter} diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index 31566edbe..d351713d7 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -68,15 +68,8 @@ build_flags = -D VIEW_320x240 ; -D USE_DOUBLE_BUFFER -D USE_PACKET_API - -I lib/device-ui/generated/ui_320x240 - -build_src_filter = - ${env:seeed-sensecap-indicator.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> - +<../lib/device-ui/resources> - +<../lib/device-ui/locale> - +<../lib/device-ui/source> lib_deps = ${env:seeed-sensecap-indicator.lib_deps} - https://github.com/bitbank2/bb_captouch.git#8f2f06462ff597847921739376a299db93612417 ; alternative touch library supporting FT6x36 \ No newline at end of file + ${device-ui_base.lib_deps} + https://github.com/bitbank2/bb_captouch.git#8f2f06462ff597847921739376a299db93612417 ; alternative touch library supporting FT6x36 diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 1eb8a1abd..0761e3251 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -66,14 +66,7 @@ build_flags = -D VIEW_320x240 ; -D USE_DOUBLE_BUFFER -D USE_PACKET_API - -I lib/device-ui/generated/ui_320x240 - -build_src_filter = - ${env:t-deck.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> - +<../lib/device-ui/resources> - +<../lib/device-ui/locale> - +<../lib/device-ui/source> lib_deps = ${env:t-deck.lib_deps} + ${device-ui_base.lib_deps} diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini index e17d3e373..d436314c3 100644 --- a/variants/unphone/platformio.ini +++ b/variants/unphone/platformio.ini @@ -63,11 +63,7 @@ build_flags = -D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_UNPHONE.h\" -D VIEW_320x240 -D USE_PACKET_API - -I lib/device-ui/generated/ui_320x240 -build_src_filter = - ${env:unphone.build_src_filter} - +<../lib/device-ui/generated/ui_320x240> - +<../lib/device-ui/resources> - +<../lib/device-ui/locale> - +<../lib/device-ui/source> \ No newline at end of file +lib_deps = + ${env:unphone.lib_deps} + ${device-ui_base.lib_deps} From 445efe9e21051051c689b367c1df9bc20eee712b Mon Sep 17 00:00:00 2001 From: dylanli Date: Thu, 6 Mar 2025 06:22:25 +0800 Subject: [PATCH 237/381] Add support for seeed_xiao_nrf52840_kit (#6231) * add support for seeed_xiao_nrf52840_kit * Update platformio.ini remove board level define --- boards/seeed_xiao_nrf52840_kit.json | 56 ++++++ .../seeed_xiao_nrf52840_kit/platformio.ini | 13 ++ variants/seeed_xiao_nrf52840_kit/variant.cpp | 95 ++++++++++ variants/seeed_xiao_nrf52840_kit/variant.h | 173 ++++++++++++++++++ 4 files changed, 337 insertions(+) create mode 100644 boards/seeed_xiao_nrf52840_kit.json create mode 100644 variants/seeed_xiao_nrf52840_kit/platformio.ini create mode 100644 variants/seeed_xiao_nrf52840_kit/variant.cpp create mode 100644 variants/seeed_xiao_nrf52840_kit/variant.h diff --git a/boards/seeed_xiao_nrf52840_kit.json b/boards/seeed_xiao_nrf52840_kit.json new file mode 100644 index 000000000..4c5fdbeda --- /dev/null +++ b/boards/seeed_xiao_nrf52840_kit.json @@ -0,0 +1,56 @@ +{ + "build": { + "arduino": { + "ldscript": "nrf52840_s140_v7.ld" + }, + "core": "nRF5", + "cpu": "cortex-m4", + "extra_flags": "-DARDUINO_MDBT50Q_RX -DNRF52840_XXAA", + "f_cpu": "64000000L", + "hwids": [ + ["0x2886", "0x0166"] + ], + "usb_product": "XIAO-BOOT", + "mcu": "nrf52840", + "variant": "seeed_xiao_nrf52840_kit", + "bsp": { + "name": "adafruit" + }, + "softdevice": { + "sd_flags": "-DS140", + "sd_name": "s140", + "sd_version": "7.3.0", + "sd_fwid": "0x0123" + }, + "bootloader": { + "settings_addr": "0xFF000" + } + }, + "connectivity": ["bluetooth"], + "debug": { + "jlink_device": "nRF52840_xxAA", + "svd_path": "nrf52840.svd", + "openocd_target": "nrf52840-mdk-rs" + }, + "frameworks": ["arduino"], + "name": "seeed_xiao_nrf52840_kit", + "upload": { + "maximum_ram_size": 248832, + "maximum_size": 815104, + "speed": 115200, + "protocol": "nrfutil", + "protocols": [ + "jlink", + "nrfjprog", + "nrfutil", + "stlink", + "cmsis-dap", + "blackmagic" + ], + "use_1200bps_touch": true, + "require_upload_port": true, + "wait_for_upload_port": true + }, + "url": "https://www.seeedstudio.com/XIAO-nRF52840-Wio-SX1262-Kit-for-Meshtastic-p-6400.html", + "vendor": "seeed" +} diff --git a/variants/seeed_xiao_nrf52840_kit/platformio.ini b/variants/seeed_xiao_nrf52840_kit/platformio.ini new file mode 100644 index 000000000..a0fe60ae1 --- /dev/null +++ b/variants/seeed_xiao_nrf52840_kit/platformio.ini @@ -0,0 +1,13 @@ +; Seeed Xiao BLE: https://www.digikey.com/en/products/detail/seeed-technology-co-ltd/102010448/16652893 +[env:seeed_xiao_nrf52840_kit] +extends = nrf52840_base +board = xiao_ble_sense +build_flags = ${nrf52840_base.build_flags} -Ivariants/seeed_xiao_nrf52840_kit -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -Dseeed_xiao_nrf52840_kit + -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" +board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/seeed_xiao_nrf52840_kit> +lib_deps = + ${nrf52840_base.lib_deps} +debug_tool = jlink +; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) +;upload_protocol = jlink diff --git a/variants/seeed_xiao_nrf52840_kit/variant.cpp b/variants/seeed_xiao_nrf52840_kit/variant.cpp new file mode 100644 index 000000000..f7e175f2d --- /dev/null +++ b/variants/seeed_xiao_nrf52840_kit/variant.cpp @@ -0,0 +1,95 @@ +#include "variant.h" +#include "nrf.h" +#include "wiring_constants.h" +#include "wiring_digital.h" +#include "configuration.h" +#include +#include +#include +#include +const uint32_t g_ADigitalPinMap[] = { + // D0 .. D13 + 2, // D0 is P0.02 (A0) + 3, // D1 is P0.03 (A1) + 28, // D2 is P0.28 (A2) + 29, // D3 is P0.29 (A3) + 4, // D4 is P0.04 (A4,SDA) + 5, // D5 is P0.05 (A5,SCL) + 43, // D6 is P1.11 (TX) + 44, // D7 is P1.12 (RX) + 45, // D8 is P1.13 (SCK) + 46, // D9 is P1.14 (MISO) + 47, // D10 is P1.15 (MOSI) + + // LEDs + 26, // D11 is P0.26 (LED RED) + 6, // D12 is P0.06 (LED BLUE) + 30, // D13 is P0.30 (LED GREEN) + 14, // D14 is P0.14 (READ_BAT) + + // LSM6DS3TR + 40, // D15 is P1.08 (6D_PWR) + 27, // D16 is P0.27 (6D_I2C_SCL) + 7, // D17 is P0.07 (6D_I2C_SDA) + 11, // D18 is P0.11 (6D_INT1) + + // MIC + 42, // 17,//42, // D19 is P1.10 (MIC_PWR) + 32, // 26,//32, // D20 is P1.00 (PDM_CLK) + 16, // 25,//16, // D21 is P0.16 (PDM_DATA) + + // BQ25100 + 13, // D22 is P0.13 (HICHG) + 17, // D23 is P0.17 (~CHG) + + // + 21, // D24 is P0.21 (QSPI_SCK) + 25, // D25 is P0.25 (QSPI_CSN) + 20, // D26 is P0.20 (QSPI_SIO_0 DI) + 24, // D27 is P0.24 (QSPI_SIO_1 DO) + 22, // D28 is P0.22 (QSPI_SIO_2 WP) + 23, // D29 is P0.23 (QSPI_SIO_3 HOLD) + + // NFC + 9, // D30 is P0.09 (NFC1) + 10, // D31 is P0.10 (NFC2) + + // VBAT + 31, // D32 is P0.10 (VBAT) +}; + + + +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + +void initVariant() +{ + // LED1 & LED2 + pinMode(21, OUTPUT); + digitalWrite(21, LOW); + // LED1 & LED2 + pinMode(22, OUTPUT); + digitalWrite(22, LOW); + + pinMode(PIN_WIRE_SDA, INPUT_PULLUP); + pinMode(PIN_WIRE_SCL, INPUT_PULLUP); +} \ No newline at end of file diff --git a/variants/seeed_xiao_nrf52840_kit/variant.h b/variants/seeed_xiao_nrf52840_kit/variant.h new file mode 100644 index 000000000..eae5e04fd --- /dev/null +++ b/variants/seeed_xiao_nrf52840_kit/variant.h @@ -0,0 +1,173 @@ +#ifndef _SEEED_XIAO_NRF52840_SENSE_H_ +#define _SEEED_XIAO_NRF52840_SENSE_H_ + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF +// #define USE_LFRC // Board uses RC for LF + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +#define PINS_COUNT (33) +#define NUM_DIGITAL_PINS (33) +#define NUM_ANALOG_INPUTS (8) // A6 is used for battery, A7 is analog reference +#define NUM_ANALOG_OUTPUTS (0) + +// LEDs + +#define LED_RED 11 +#define LED_BLUE 12 +#define LED_GREEN 13 + +#define PIN_LED1 LED_GREEN +#define PIN_LED2 LED_BLUE +#define PIN_LED3 LED_RED + +#define PIN_LED PIN_LED1 +#define LED_PWR (PINS_COUNT) + +#define LED_BUILTIN PIN_LED + +#define LED_STATE_ON 1 // State when LED is lit + +/* + * Buttons + */ + + +// Digital PINs +#define D0 (0ul) +#define D1 (1ul) +#define D2 (2ul) +#define D3 (3ul) +#define D4 (4ul) +#define D5 (5ul) +#define D6 (6ul) +#define D7 (7ul) +#define D8 (8ul) +#define D9 (9ul) +#define D10 (10ul) + + +#define BUTTON_PIN D0 // This is the Program Button +// #define BUTTON_NEED_PULLUP 1 +#define BUTTON_ACTIVE_LOW true +#define BUTTON_ACTIVE_PULLUP false +/* + * Analog pins + */ +#define PIN_A0 (0) +#define PIN_A1 (1) +#define PIN_A2 (32) +#define PIN_A3 (3) +#define PIN_A4 (4) +#define PIN_A5 (5) +#define PIN_VBAT (32) +#define VBAT_ENABLE (14) + +static const uint8_t A0 = PIN_A0; +static const uint8_t A1 = PIN_A1; +static const uint8_t A2 = PIN_A2; +static const uint8_t A3 = PIN_A3; +static const uint8_t A4 = PIN_A4; +static const uint8_t A5 = PIN_A5; +#define ADC_RESOLUTION 12 + + +#define PIN_SERIAL2_RX (-1) +#define PIN_SERIAL2_TX (-1) + +/* + * SPI Interfaces + */ +#define SPI_INTERFACES_COUNT 1 + +#define PIN_SPI_MISO (9) +#define PIN_SPI_MOSI (10) +#define PIN_SPI_SCK (8) + + +static const uint8_t SS = D4; +static const uint8_t MOSI = PIN_SPI_MOSI; +static const uint8_t MISO = PIN_SPI_MISO; +static const uint8_t SCK = PIN_SPI_SCK; + +// supported modules list +#define USE_SX1262 + +// common pinouts for SX126X modules + +#define SX126X_CS D4 +#define SX126X_DIO1 D1 +#define SX126X_BUSY D3 +#define SX126X_RESET D2 + +#define SX126X_TXEN RADIOLIB_NC + + +#define SX126X_RXEN D4 +#define SX126X_DIO2_AS_RF_SWITCH // DIO2 is used to control the RF switch really necessary!!! +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 + +/* + * Wire Interfaces + */ + +#define I2C_NO_RESCAN // I2C is a bit finicky, don't scan too much +#define WIRE_INTERFACES_COUNT 1 // 2 + +#define PIN_WIRE_SDA (24) //change to use the correct pins if needed +#define PIN_WIRE_SCL (25) //change to use the correct pins if needed + +static const uint8_t SDA = PIN_WIRE_SDA; +static const uint8_t SCL = PIN_WIRE_SCL; + + +// GPS L76KB +#define GPS_L76K +#ifdef GPS_L76K +#define PIN_GPS_RX 32+12 // 44 +#define PIN_GPS_TX 32+11 // 43 +#define HAS_GPS 1 +#define GPS_BAUDRATE 9600 +#define GPS_THREAD_INTERVAL 50 +#define PIN_SERIAL1_RX PIN_GPS_TX +#define PIN_SERIAL1_TX PIN_GPS_RX +#define PIN_GPS_STANDBY 2 +#endif + + + +// Battery + +#define BAT_READ \ + 14 // P0_14 = 14 Reads battery voltage from divider on signal board. (PIN_VBAT is reading voltage divider on XIAO and is + // program pin 32 / or P0.31) +#define BATTERY_SENSE_RESOLUTION_BITS 10 +#define CHARGE_LED 23 // P0_17 = 17 D23 YELLOW CHARGE LED +#define HICHG 22 // P0_13 = 13 D22 Charge-select pin for Lipo for 100 mA instead of default 50mA charge + +// The battery sense is hooked to pin A0 (5) +#define BATTERY_PIN PIN_VBAT // PIN_A0 + +// ratio of voltage divider = 3.0 (R17=1M, R18=510k) +#define ADC_MULTIPLIER 3 // 3.0 + a bit for being optimistic + +#ifdef __cplusplus +} +#endif + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#endif From 6c8058e1d8e2d71a4af078dc10e6eb9bacaeb653 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 5 Mar 2025 19:44:22 -0600 Subject: [PATCH 238/381] Update SEEED_XIAO_NRF52840_KIT (#6239) --- src/platform/nrf52/architecture.h | 2 ++ variants/seeed_xiao_nrf52840_kit/platformio.ini | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/platform/nrf52/architecture.h b/src/platform/nrf52/architecture.h index 3e4397686..2c51dc1cc 100644 --- a/src/platform/nrf52/architecture.h +++ b/src/platform/nrf52/architecture.h @@ -75,6 +75,8 @@ #define HW_VENDOR meshtastic_HardwareModel_PRIVATE_HW #elif defined(HELTEC_T114) #define HW_VENDOR meshtastic_HardwareModel_HELTEC_MESH_NODE_T114 +#elif defined(SEEED_XIAO_NRF52840_KIT) +#define HW_VENDOR meshtastic_HardwareModel_SEEED_XIAO_NRF52840_KIT #else #define HW_VENDOR meshtastic_HardwareModel_NRF52_UNKNOWN #endif diff --git a/variants/seeed_xiao_nrf52840_kit/platformio.ini b/variants/seeed_xiao_nrf52840_kit/platformio.ini index a0fe60ae1..41956249b 100644 --- a/variants/seeed_xiao_nrf52840_kit/platformio.ini +++ b/variants/seeed_xiao_nrf52840_kit/platformio.ini @@ -2,7 +2,7 @@ [env:seeed_xiao_nrf52840_kit] extends = nrf52840_base board = xiao_ble_sense -build_flags = ${nrf52840_base.build_flags} -Ivariants/seeed_xiao_nrf52840_kit -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -Dseeed_xiao_nrf52840_kit +build_flags = ${nrf52840_base.build_flags} -Ivariants/seeed_xiao_nrf52840_kit -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -DSEEED_XIAO_NRF52840_KIT -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld build_src_filter = ${nrf52_base.build_src_filter} +<../variants/seeed_xiao_nrf52840_kit> From a3a9b2fe843f1d1e64fdc75122ef4ec619d4531f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 5 Mar 2025 20:50:20 -0600 Subject: [PATCH 239/381] [create-pull-request] automated change (#6240) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/telemetry.pb.h | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/protobufs b/protobufs index 1cddedce8..c261bd71a 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 1cddedce83fe056dff5441a7cd468a6f4826b51a +Subproject commit c261bd71aaf416f3bcef5dbc774d06b797fc58c6 diff --git a/src/mesh/generated/meshtastic/telemetry.pb.h b/src/mesh/generated/meshtastic/telemetry.pb.h index bb612d870..aa39a1ce4 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.h +++ b/src/mesh/generated/meshtastic/telemetry.pb.h @@ -83,7 +83,9 @@ typedef enum _meshtastic_TelemetrySensorType { /* High accuracy current and voltage */ meshtastic_TelemetrySensorType_INA226 = 34, /* DFRobot Gravity tipping bucket rain gauge */ - meshtastic_TelemetrySensorType_DFROBOT_RAIN = 35 + meshtastic_TelemetrySensorType_DFROBOT_RAIN = 35, + /* Infineon DPS310 High accuracy pressure and temperature */ + meshtastic_TelemetrySensorType_DPS310 = 36 } meshtastic_TelemetrySensorType; /* Struct definitions */ @@ -314,8 +316,8 @@ extern "C" { /* Helper constants for enums */ #define _meshtastic_TelemetrySensorType_MIN meshtastic_TelemetrySensorType_SENSOR_UNSET -#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_DFROBOT_RAIN -#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_DFROBOT_RAIN+1)) +#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_DPS310 +#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_DPS310+1)) From f5e0e282b68ab8bb25cce32d3ac92287de657e0d Mon Sep 17 00:00:00 2001 From: Chris Danis Date: Wed, 5 Mar 2025 22:58:18 -0500 Subject: [PATCH 240/381] environment: add DPS310 high-accuracy barometer (#6237) * dps310: initial scan support * dps310 sensor support * new protobufs * new protobufs * address cr --------- Co-authored-by: Ben Meadors --- platformio.ini | 1 + src/detect/ScanI2C.h | 1 + src/detect/ScanI2CTwoWire.cpp | 10 +++++ src/main.cpp | 1 + .../Telemetry/EnvironmentTelemetry.cpp | 13 ++++++ src/modules/Telemetry/Sensor/DPS310Sensor.cpp | 45 +++++++++++++++++++ src/modules/Telemetry/Sensor/DPS310Sensor.h | 23 ++++++++++ 7 files changed, 94 insertions(+) create mode 100644 src/modules/Telemetry/Sensor/DPS310Sensor.cpp create mode 100644 src/modules/Telemetry/Sensor/DPS310Sensor.h diff --git a/platformio.ini b/platformio.ini index 61c9c6ed0..f41726503 100644 --- a/platformio.ini +++ b/platformio.ini @@ -106,6 +106,7 @@ lib_deps = adafruit/Adafruit BMP085 Library@1.2.4 adafruit/Adafruit BME280 Library@2.2.4 adafruit/Adafruit BMP3XX Library@2.1.5 + adafruit/Adafruit DPS310@1.1.5 adafruit/Adafruit MCP9808 Library@2.0.2 adafruit/Adafruit INA260 Library@1.5.2 adafruit/Adafruit INA219@1.2.3 diff --git a/src/detect/ScanI2C.h b/src/detect/ScanI2C.h index faa94c7d3..6828169a8 100644 --- a/src/detect/ScanI2C.h +++ b/src/detect/ScanI2C.h @@ -67,6 +67,7 @@ class ScanI2C INA226, NXP_SE050, DFROBOT_RAIN, + DPS310, } DeviceType; // typedef uint8_t DeviceAddress; diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index 41cfe1517..0eca5cad3 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -237,6 +237,16 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) logFoundDevice("BMP085/BMP180", (uint8_t)addr.address); type = BMP_085; break; + case 0x00: + // do we have a DPS310 instead? + registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x0D), 1); + switch (registerValue) { + case 0x10: + logFoundDevice("DPS310", (uint8_t)addr.address); + type = DPS310; + break; + } + break; default: registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x00), 1); // GET_ID switch (registerValue) { diff --git a/src/main.cpp b/src/main.cpp index 2160d73e4..a82fde4be 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -641,6 +641,7 @@ void setup() scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::MAX30102, meshtastic_TelemetrySensorType_MAX30102); scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::CGRADSENS, meshtastic_TelemetrySensorType_RADSENS); scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::DFROBOT_RAIN, meshtastic_TelemetrySensorType_DFROBOT_RAIN); + scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::DPS310, meshtastic_TelemetrySensorType_DPS310); i2cScanner.reset(); #endif diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index 3fa3e848a..8835c985d 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -29,6 +29,7 @@ #include "Sensor/CGRadSensSensor.h" #include "Sensor/DFRobotGravitySensor.h" #include "Sensor/DFRobotLarkSensor.h" +#include "Sensor/DPS310Sensor.h" #include "Sensor/LPS22HBSensor.h" #include "Sensor/MCP9808Sensor.h" #include "Sensor/MLX90632Sensor.h" @@ -45,6 +46,7 @@ BMP085Sensor bmp085Sensor; BMP280Sensor bmp280Sensor; BME280Sensor bme280Sensor; BME680Sensor bme680Sensor; +DPS310Sensor dps310Sensor; MCP9808Sensor mcp9808Sensor; SHTC3Sensor shtc3Sensor; LPS22HBSensor lps22hbSensor; @@ -127,6 +129,8 @@ int32_t EnvironmentTelemetryModule::runOnce() result = bmp3xxSensor.runOnce(); if (bme680Sensor.hasSensor()) result = bme680Sensor.runOnce(); + if (dps310Sensor.hasSensor()) + result = dps310Sensor.runOnce(); if (mcp9808Sensor.hasSensor()) result = mcp9808Sensor.runOnce(); if (shtc3Sensor.hasSensor()) @@ -418,6 +422,10 @@ bool EnvironmentTelemetryModule::getEnvironmentTelemetry(meshtastic_Telemetry *m valid = valid && bme680Sensor.getMetrics(m); hasSensor = true; } + if (dps310Sensor.hasSensor()) { + valid = valid && dps310Sensor.getMetrics(m); + hasSensor = true; + } if (mcp9808Sensor.hasSensor()) { valid = valid && mcp9808Sensor.getMetrics(m); hasSensor = true; @@ -632,6 +640,11 @@ AdminMessageHandleResult EnvironmentTelemetryModule::handleAdminMessageForModule if (result != AdminMessageHandleResult::NOT_HANDLED) return result; } + if (dps310Sensor.hasSensor()) { + result = dps310Sensor.handleAdminMessage(mp, request, response); + if (result != AdminMessageHandleResult::NOT_HANDLED) + return result; + } if (mcp9808Sensor.hasSensor()) { result = mcp9808Sensor.handleAdminMessage(mp, request, response); if (result != AdminMessageHandleResult::NOT_HANDLED) diff --git a/src/modules/Telemetry/Sensor/DPS310Sensor.cpp b/src/modules/Telemetry/Sensor/DPS310Sensor.cpp new file mode 100644 index 000000000..dc5dc4fdf --- /dev/null +++ b/src/modules/Telemetry/Sensor/DPS310Sensor.cpp @@ -0,0 +1,45 @@ +#include "configuration.h" + +#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR + +#include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "DPS310Sensor.h" +#include "TelemetrySensor.h" +#include + +DPS310Sensor::DPS310Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_DPS310, "DPS310") {} + +int32_t DPS310Sensor::runOnce() +{ + LOG_INFO("Init sensor: %s", sensorName); + if (!hasSensor()) { + return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; + } + status = dps310.begin_I2C(nodeTelemetrySensorsMap[sensorType].first, nodeTelemetrySensorsMap[sensorType].second); + + dps310.configurePressure(DPS310_1HZ, DPS310_4SAMPLES); + dps310.configureTemperature(DPS310_1HZ, DPS310_4SAMPLES); + dps310.setMode(DPS310_CONT_PRESTEMP); + + return initI2CSensor(); +} + +void DPS310Sensor::setup() {} + +bool DPS310Sensor::getMetrics(meshtastic_Telemetry *measurement) +{ + sensors_event_t temp, press; + + if (!dps310.getEvents(&temp, &press)) { + LOG_DEBUG("DPS310 getEvents no data"); + return false; + } + + measurement->variant.environment_metrics.has_temperature = true; + measurement->variant.environment_metrics.has_barometric_pressure = true; + measurement->variant.environment_metrics.temperature = temp.temperature; + measurement->variant.environment_metrics.barometric_pressure = press.pressure; + + return true; +} +#endif \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/DPS310Sensor.h b/src/modules/Telemetry/Sensor/DPS310Sensor.h new file mode 100644 index 000000000..452975806 --- /dev/null +++ b/src/modules/Telemetry/Sensor/DPS310Sensor.h @@ -0,0 +1,23 @@ +#include "configuration.h" + +#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR + +#include "../mesh/generated/meshtastic/telemetry.pb.h" +#include "TelemetrySensor.h" +#include + +class DPS310Sensor : public TelemetrySensor +{ + private: + Adafruit_DPS310 dps310; + + protected: + virtual void setup() override; + + public: + DPS310Sensor(); + virtual int32_t runOnce() override; + virtual bool getMetrics(meshtastic_Telemetry *measurement) override; +}; + +#endif \ No newline at end of file From a924b9d94a163d826bfe5aa6fb20340ca3db61fd Mon Sep 17 00:00:00 2001 From: Austin Date: Thu, 6 Mar 2025 03:36:27 -0500 Subject: [PATCH 241/381] Small Fix: Don't run Dependabot on protobufs (#6241) --- .github/dependabot.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a7b4a0f1b..b14290be2 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -19,6 +19,8 @@ updates: interval: daily time: "05:00" timezone: US/Pacific + ignore: + - dependency-name: protobufs - package-ecosystem: github-actions directory: /.github/workflows schedule: From b25db1f42c95f7b578fbe526c8c464e3bf2d5599 Mon Sep 17 00:00:00 2001 From: Andrik45719 Date: Thu, 6 Mar 2025 10:44:53 +0200 Subject: [PATCH 242/381] E22-400M SX126X_DIO3_TCXO_VOLTAGE fix (#6232) Added TCXO voltage setting for SX1268 based module to fix error: Calibration failed, device errors: 0x20 SX126x init result -707 --- src/main.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index a82fde4be..e5e1a2537 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1017,6 +1017,22 @@ void setup() #endif #if defined(USE_SX1268) +#if defined(SX126X_DIO3_TCXO_VOLTAGE) && defined(TCXO_OPTIONAL) + if ((!rIf) && (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_LORA_24)) { + // try using the specified TCXO voltage + auto *sxIf = new SX1268Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY); + sxIf->setTCXOVoltage(SX126X_DIO3_TCXO_VOLTAGE); + if (!sxIf->init()) { + LOG_WARN("No SX1268 radio with TCXO, Vref %fV", SX126X_DIO3_TCXO_VOLTAGE); + delete sxIf; + rIf = NULL; + } else { + LOG_INFO("SX1268 init success, TCXO, Vref %fV", SX126X_DIO3_TCXO_VOLTAGE); + rIf = sxIf; + radioType = SX1268_RADIO; + } + } +#endif if ((!rIf) && (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_LORA_24)) { rIf = new SX1268Interface(RadioLibHAL, SX126X_CS, SX126X_DIO1, SX126X_RESET, SX126X_BUSY); if (!rIf->init()) { @@ -1276,4 +1292,4 @@ void loop() } } -#endif \ No newline at end of file +#endif From b2ef92a3286a5faffab33c49ee90896ac6514ef3 Mon Sep 17 00:00:00 2001 From: Tavis Date: Wed, 5 Mar 2025 23:55:08 -1000 Subject: [PATCH 243/381] add rain data from ws85 (#6242) add rain data as 1h and 24h --- src/modules/SerialModule.cpp | 37 +++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/src/modules/SerialModule.cpp b/src/modules/SerialModule.cpp index c6a95912b..811d1ec91 100644 --- a/src/modules/SerialModule.cpp +++ b/src/modules/SerialModule.cpp @@ -435,6 +435,10 @@ void SerialModule::processWXSerial() static float batVoltageF = 0; static float capVoltageF = 0; static float temperatureF = 0; + + static char rainStr[] = "5780860000"; + static int rainSum = 0; + static float rain = 0; bool gotwind = false; while (Serial2.available()) { @@ -448,6 +452,9 @@ void SerialModule::processWXSerial() // WindSpeed = 0.5 // WindGust = 0.6 // GXTS04Temp = 24.4 + + // RainIntSum = 0 + // Rain = 0.0 if (serialPayloadSize > 0) { // Define variables for line processing int lineStart = 0; @@ -462,7 +469,6 @@ void SerialModule::processWXSerial() char line[meshtastic_Constants_DATA_PAYLOAD_LEN]; memset(line, '\0', sizeof(line)); memcpy(line, &serialBytes[lineStart], lineEnd - lineStart); - if (strstr(line, "Wind") != NULL) // we have a wind line { gotwind = true; @@ -515,6 +521,24 @@ void SerialModule::processWXSerial() strcpy(temperature, tempPos + 15); // 15 spaces for ws85 temperatureF = strtof(temperature, nullptr); } + + } else if (strstr(line, "RainIntSum") != NULL) { // we have a rainsum line + // LOG_INFO(line); + char *pos = strstr(line, "RainIntSum = "); + if (pos != NULL) { + strcpy(rainStr, pos + 17); // 17 spaces for ws85 + rainSum = int(strtof(rainStr, nullptr)); + } + + } else if (strstr(line, "Rain") != NULL) { // we have a rain line + if (strstr(line, "WaveRain") == NULL) { // skip WaveRain lines though. + // LOG_INFO(line); + char *pos = strstr(line, "Rain = "); + if (pos != NULL) { + strcpy(rainStr, pos + 17); // 17 spaces for ws85 + rain = strtof(rainStr, nullptr); + } + } } // Update lineStart for the next line @@ -530,8 +554,8 @@ void SerialModule::processWXSerial() } if (gotwind) { - LOG_INFO("WS85 : %i %.1fg%.1f %.1fv %.1fv %.1fC", atoi(windDir), strtof(windVel, nullptr), strtof(windGust, nullptr), - batVoltageF, capVoltageF, temperatureF); + LOG_INFO("WS85 : %i %.1fg%.1f %.1fv %.1fv %.1fC rain: %.1f, %i sum", atoi(windDir), strtof(windVel, nullptr), + strtof(windGust, nullptr), batVoltageF, capVoltageF, temperatureF, rain, rainSum); } if (gotwind && !Throttle::isWithinTimespanMs(lastAveraged, averageIntervalMillis)) { // calculate averages and send to the mesh @@ -568,6 +592,13 @@ void SerialModule::processWXSerial() m.variant.environment_metrics.wind_gust = gust; m.variant.environment_metrics.has_wind_gust = true; + m.variant.environment_metrics.rainfall_24h = rainSum; + m.variant.environment_metrics.has_rainfall_24h = true; + + // not sure if this value is actually the 1hr sum so needs to do some testing + m.variant.environment_metrics.rainfall_1h = rain; + m.variant.environment_metrics.has_rainfall_1h = true; + if (lull == -1) lull = 0; m.variant.environment_metrics.wind_lull = lull; From e6a98b1d6b953a312cb892bfdbd5ed6872561f8f Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Thu, 6 Mar 2025 23:25:41 +1300 Subject: [PATCH 244/381] InkHUD refactoring (#6216) * chore: todo.txt * chore: comments * fix: no fast refresh on VME290 Reverts a line of code which was accidentally committed * refactor: god class Divide the behavior from the old WindowManager class into several subclasses which each have a clear role. * refactor: cppcheck medium warnings Enough to pass github CI for now * refactor: updateType selection * refactor: don't use a setter for the shared AppletFonts * fix: update prioritization forceUpdate calls weren't being prioritized * refactor: remove unhelpful logging getTimeString is used for parsing our own time, but also the timestamps of messages. The "one time only" log printing will likely fire in unhelpful situations. * fix: " " * refactor: get rid of types.h file for enums * Keep that sneaky todo file out of commits --- src/BluetoothStatus.h | 4 +- .../Drivers/Backlight/LatchingBacklight.cpp | 8 +- src/graphics/niche/Drivers/EInk/EInk.cpp | 2 +- src/graphics/niche/Drivers/EInk/EInk.h | 6 +- .../niche/Drivers/EInk/GDEY0154D67.cpp | 2 +- .../niche/Drivers/EInk/LCMEN2R13EFC1.cpp | 8 +- .../niche/Drivers/EInk/LCMEN2R13EFC1.h | 19 +- src/graphics/niche/Drivers/EInk/README.md | 11 +- src/graphics/niche/Drivers/EInk/SSD16XX.cpp | 9 +- src/graphics/niche/Drivers/EInk/SSD16XX.h | 19 +- src/graphics/niche/Drivers/README.md | 2 +- src/graphics/niche/FlashData.h | 2 +- .../niche/Fonts/FreeSans6pt8bCyrillic.h | 2 +- src/graphics/niche/InkHUD/Applet.cpp | 211 ++- src/graphics/niche/InkHUD/Applet.h | 200 +-- src/graphics/niche/InkHUD/AppletFont.cpp | 21 +- src/graphics/niche/InkHUD/AppletFont.h | 10 +- .../InkHUD/Applets/Bases/Map/MapApplet.cpp | 17 +- .../InkHUD/Applets/Bases/Map/MapApplet.h | 9 +- .../Applets/Bases/NodeList/NodeListApplet.cpp | 32 +- .../Applets/Bases/NodeList/NodeListApplet.h | 29 +- .../NewMsgExample/NewMsgExampleApplet.cpp | 2 - .../NewMsgExample/NewMsgExampleApplet.h | 2 +- .../System/BatteryIcon/BatteryIconApplet.cpp | 12 +- .../System/BatteryIcon/BatteryIconApplet.h | 12 +- .../InkHUD/Applets/System/Logo/LogoApplet.cpp | 68 +- .../InkHUD/Applets/System/Logo/LogoApplet.h | 13 +- .../InkHUD/Applets/System/Menu/MenuApplet.cpp | 109 +- .../InkHUD/Applets/System/Menu/MenuApplet.h | 14 +- .../Notification/NotificationApplet.cpp | 56 +- .../System/Notification/NotificationApplet.h | 18 +- .../Applets/System/Pairing/PairingApplet.cpp | 37 +- .../Applets/System/Pairing/PairingApplet.h | 10 +- .../System/Placeholder/PlaceholderApplet.cpp | 8 - .../System/Placeholder/PlaceholderApplet.h | 7 +- .../InkHUD/Applets/System/Tips/TipsApplet.cpp | 107 +- .../InkHUD/Applets/System/Tips/TipsApplet.h | 5 +- .../User/AllMessage/AllMessageApplet.cpp | 8 +- .../niche/InkHUD/Applets/User/DM/DMApplet.cpp | 14 +- .../Applets/User/Positions/PositionsApplet.h | 12 +- .../User/RecentsList/RecentsListApplet.cpp | 4 +- .../ThreadedMessage/ThreadedMessageApplet.cpp | 2 - .../ThreadedMessage/ThreadedMessageApplet.h | 2 +- .../{UpdateMediator.cpp => DisplayHealth.cpp} | 79 +- .../{UpdateMediator.h => DisplayHealth.h} | 24 +- src/graphics/niche/InkHUD/Events.cpp | 179 +++ src/graphics/niche/InkHUD/Events.h | 63 + src/graphics/niche/InkHUD/InkHUD.cpp | 218 ++++ src/graphics/niche/InkHUD/InkHUD.h | 110 ++ src/graphics/niche/InkHUD/MessageStore.h | 2 +- src/graphics/niche/InkHUD/Persistence.cpp | 50 +- src/graphics/niche/InkHUD/Persistence.h | 171 +-- .../niche/InkHUD/PlatformioConfig.ini | 4 +- src/graphics/niche/InkHUD/Renderer.cpp | 412 ++++++ src/graphics/niche/InkHUD/Renderer.h | 96 ++ src/graphics/niche/InkHUD/SystemApplet.h | 41 + src/graphics/niche/InkHUD/Tile.cpp | 48 +- src/graphics/niche/InkHUD/Tile.h | 39 +- src/graphics/niche/InkHUD/Types.h | 62 - src/graphics/niche/InkHUD/WindowManager.cpp | 1157 ++++------------- src/graphics/niche/InkHUD/WindowManager.h | 179 +-- src/graphics/niche/Inputs/TwoButton.cpp | 16 +- .../heltec_vision_master_e213/nicheGraphics.h | 53 +- .../heltec_vision_master_e213/platformio.ini | 6 +- .../heltec_vision_master_e290/nicheGraphics.h | 63 +- .../heltec_vision_master_e290/platformio.ini | 6 +- .../heltec_wireless_paper/nicheGraphics.h | 49 +- variants/heltec_wireless_paper/platformio.ini | 6 +- variants/t-echo/nicheGraphics.h | 56 +- variants/t-echo/platformio.ini | 2 +- 70 files changed, 2381 insertions(+), 1955 deletions(-) rename src/graphics/niche/InkHUD/{UpdateMediator.cpp => DisplayHealth.cpp} (61%) rename src/graphics/niche/InkHUD/{UpdateMediator.h => DisplayHealth.h} (56%) create mode 100644 src/graphics/niche/InkHUD/Events.cpp create mode 100644 src/graphics/niche/InkHUD/Events.h create mode 100644 src/graphics/niche/InkHUD/InkHUD.cpp create mode 100644 src/graphics/niche/InkHUD/InkHUD.h create mode 100644 src/graphics/niche/InkHUD/Renderer.cpp create mode 100644 src/graphics/niche/InkHUD/Renderer.h create mode 100644 src/graphics/niche/InkHUD/SystemApplet.h delete mode 100644 src/graphics/niche/InkHUD/Types.h diff --git a/src/BluetoothStatus.h b/src/BluetoothStatus.h index e29139001..526b6f243 100644 --- a/src/BluetoothStatus.h +++ b/src/BluetoothStatus.h @@ -30,7 +30,7 @@ class BluetoothStatus : public Status BluetoothStatus() { statusType = STATUS_TYPE_BLUETOOTH; } // New BluetoothStatus: connected or disconnected - BluetoothStatus(ConnectionState state) + explicit BluetoothStatus(ConnectionState state) { assert(state != ConnectionState::PAIRING); // If pairing, use constructor which specifies passkey statusType = STATUS_TYPE_BLUETOOTH; @@ -38,7 +38,7 @@ class BluetoothStatus : public Status } // New BluetoothStatus: pairing, with passkey - BluetoothStatus(std::string passkey) : Status() + explicit BluetoothStatus(const std::string &passkey) : Status() { statusType = STATUS_TYPE_BLUETOOTH; this->state = ConnectionState::PAIRING; diff --git a/src/graphics/niche/Drivers/Backlight/LatchingBacklight.cpp b/src/graphics/niche/Drivers/Backlight/LatchingBacklight.cpp index 7e4f0b709..6d9b709b1 100644 --- a/src/graphics/niche/Drivers/Backlight/LatchingBacklight.cpp +++ b/src/graphics/niche/Drivers/Backlight/LatchingBacklight.cpp @@ -40,13 +40,11 @@ void LatchingBacklight::setPin(uint8_t pin, bool activeWhen) // Ensures the backlight is off int LatchingBacklight::beforeDeepSleep(void *unused) { - // We shouldn't need to guard the block like this - // Contingency for: - // - settings corruption: settings.optionalMenuItems.backlight guards backlight code in MenuApplet - // - improper use in the future + // Contingency only + // - pin wasn't set if (pin != (uint8_t)-1) { off(); - pinMode(pin, INPUT); // High impedence - unnecessary? + pinMode(pin, INPUT); // High impedance - unnecessary? } else LOG_WARN("LatchingBacklight instantiated, but pin not set"); return 0; // Continue with deep sleep diff --git a/src/graphics/niche/Drivers/EInk/EInk.cpp b/src/graphics/niche/Drivers/EInk/EInk.cpp index 0abe20bf9..043788b13 100644 --- a/src/graphics/niche/Drivers/EInk/EInk.cpp +++ b/src/graphics/niche/Drivers/EInk/EInk.cpp @@ -12,7 +12,7 @@ EInk::EInk(uint16_t width, uint16_t height, UpdateTypes supported) } // Used by NicheGraphics implementations to check if a display supports a specific refresh operation. -// Whether or the update type is supported is specified in the constructor +// Whether or not the update type is supported is specified in the constructor bool EInk::supports(UpdateTypes type) { // The EInkUpdateTypes enum assigns each type a unique bit. We are checking if that bit is set. diff --git a/src/graphics/niche/Drivers/EInk/EInk.h b/src/graphics/niche/Drivers/EInk/EInk.h index 1fbc25a14..facb8ce72 100644 --- a/src/graphics/niche/Drivers/EInk/EInk.h +++ b/src/graphics/niche/Drivers/EInk/EInk.h @@ -31,7 +31,7 @@ class EInk : private concurrency::OSThread virtual void begin(SPIClass *spi, uint8_t pin_dc, uint8_t pin_cs, uint8_t pin_busy, uint8_t pin_rst = -1) = 0; virtual void update(uint8_t *imageData, UpdateTypes type) = 0; // Change the display image void await(); // Wait for an in-progress update to complete before proceeding - bool supports(UpdateTypes type); // Can display perfom a certain update type + bool supports(UpdateTypes type); // Can display perform a certain update type bool busy() { return updateRunning; } // Display able to update right now? const uint16_t width; // Public so that NicheGraphics implementations can access. Safe because const. @@ -47,8 +47,8 @@ class EInk : private concurrency::OSThread const UpdateTypes supportedUpdateTypes; // Capabilities of a derived display class bool updateRunning = false; // see EInk::busy() - uint32_t updateBegunAt; // For initial pause before polling for update completion - uint32_t pollingInterval; // How often to check if update complete (ms) + uint32_t updateBegunAt = 0; // For initial pause before polling for update completion + uint32_t pollingInterval = 0; // How often to check if update complete (ms) }; } // namespace NicheGraphics::Drivers diff --git a/src/graphics/niche/Drivers/EInk/GDEY0154D67.cpp b/src/graphics/niche/Drivers/EInk/GDEY0154D67.cpp index bfc5ac681..2cab179b9 100644 --- a/src/graphics/niche/Drivers/EInk/GDEY0154D67.cpp +++ b/src/graphics/niche/Drivers/EInk/GDEY0154D67.cpp @@ -4,7 +4,7 @@ using namespace NicheGraphics::Drivers; -// Map the display controller IC's output to the conected panel +// Map the display controller IC's output to the connected panel void GDEY0154D67::configScanning() { // "Driver output control" diff --git a/src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.cpp b/src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.cpp index c54769fc2..c843c4694 100644 --- a/src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.cpp +++ b/src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.cpp @@ -98,6 +98,7 @@ void LCMEN213EFC1::begin(SPIClass *spi, uint8_t pin_dc, uint8_t pin_cs, uint8_t reset(); } +// Display an image on the display void LCMEN213EFC1::update(uint8_t *imageData, UpdateTypes type) { this->updateType = type; @@ -161,13 +162,6 @@ void LCMEN213EFC1::sendCommand(const uint8_t command) void LCMEN213EFC1::sendData(uint8_t data) { - // spi->beginTransaction(spiSettings); - // digitalWrite(pin_dc, HIGH); // DC pin HIGH indicates data, instead of command - // digitalWrite(pin_cs, LOW); - // spi->transfer(data); - // digitalWrite(pin_cs, HIGH); - // digitalWrite(pin_dc, HIGH); - // spi->endTransaction(); sendData(&data, 1); } diff --git a/src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.h b/src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.h index 5c801c014..f9da202aa 100644 --- a/src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.h +++ b/src/graphics/niche/Drivers/EInk/LCMEN2R13EFC1.h @@ -45,21 +45,24 @@ class LCMEN213EFC1 : public EInk void configFull(); // Configure display for FULL refresh void configFast(); // Configure display for FAST refresh void writeNewImage(); - void writeOldImage(); + void writeOldImage(); // Used for "differential update", aka FAST refresh void detachFromUpdate(); bool isUpdateDone(); void finalizeUpdate(); protected: - uint8_t bufferOffsetX; // In bytes. Panel x=0 does not always align with controller x=0. Quirky internal wiring? - uint8_t bufferRowSize; // In bytes. Rows store 8 pixels per byte. Rounded up to fit (e.g. 122px would require 16 bytes) - uint32_t bufferSize; // In bytes. Rows * Columns - uint8_t *buffer; - UpdateTypes updateType; + uint8_t bufferOffsetX = 0; // In bytes. Panel x=0 does not always align with controller x=0. Quirky internal wiring? + uint8_t bufferRowSize = 0; // In bytes. Rows store 8 pixels per byte. Rounded up to fit (e.g. 122px would require 16 bytes) + uint32_t bufferSize = 0; // In bytes. Rows * Columns + uint8_t *buffer = nullptr; + UpdateTypes updateType = UpdateTypes::UNSPECIFIED; - uint8_t pin_dc, pin_cs, pin_busy, pin_rst; - SPIClass *spi; + uint8_t pin_dc = -1; + uint8_t pin_cs = -1; + uint8_t pin_busy = -1; + uint8_t pin_rst = -1; + SPIClass *spi = nullptr; SPISettings spiSettings = SPISettings(6000000, MSBFIRST, SPI_MODE0); }; diff --git a/src/graphics/niche/Drivers/EInk/README.md b/src/graphics/niche/Drivers/EInk/README.md index ffe21e507..04a23a31f 100644 --- a/src/graphics/niche/Drivers/EInk/README.md +++ b/src/graphics/niche/Drivers/EInk/README.md @@ -3,7 +3,7 @@ A driver for E-Ink SPI displays. Suitable for re-use by various NicheGraphics UIs. Your UI should use the class `NicheGraphics::Drivers::EInk` . -When you set up a hardware variant, you will use one of specific display model classes, which extend the EInk class. +When you set up a hardware variant, you will use one of the specific display model classes, which extend the EInk class. An example setup might look like this: @@ -30,7 +30,7 @@ void setupNicheGraphics() ## Methods -### `update(uint8_t *imageData, UpdateTypes type, bool async=true)` +### `update(uint8_t *imageData, UpdateTypes type)` Update the image on the display @@ -39,7 +39,6 @@ Update the image on the display - `FULL` - `FAST` - (Other custom types may be possible) -- _`async`_ whether to wait for update to complete, or continue code execution The imageData is a 1-bit image. X-Pixels are 8-per byte, with the MSB being the leftmost pixel. This was not an InkHUD design decision; it is the raw format accepted by the E-Ink display controllers ICs. @@ -63,6 +62,10 @@ uint8_t xBits = (7-x) % 8; image[yByte + xByte] |= (1 << xBits); // Set pixel x=12, y=2 ``` +### `await()` + +Wait for an in-progress update to complete before continuing + ### `supports(UpdateTypes type)` Check if display supports a specific update type. `true` if supported. @@ -75,7 +78,7 @@ Check if display is already performing an `update()`. `true` if already updating ### `width()` -Width of the display, in pixels. Note: most displays are portait. Your UI will need to implement rotation in software. +Width of the display, in pixels. Note: most displays are portrait. Your UI will need to implement rotation in software. ### `height()` diff --git a/src/graphics/niche/Drivers/EInk/SSD16XX.cpp b/src/graphics/niche/Drivers/EInk/SSD16XX.cpp index d58e5b37a..07d02a2ae 100644 --- a/src/graphics/niche/Drivers/EInk/SSD16XX.cpp +++ b/src/graphics/niche/Drivers/EInk/SSD16XX.cpp @@ -30,7 +30,7 @@ void SSD16XX::begin(SPIClass *spi, uint8_t pin_dc, uint8_t pin_cs, uint8_t pin_b pinMode(pin_busy, INPUT); // If using a reset pin, hold high - // Reset is active low for solmon systech ICs + // Reset is active low for Solomon Systech ICs if (pin_rst != 0xFF) pinMode(pin_rst, INPUT_PULLUP); @@ -72,13 +72,6 @@ void SSD16XX::sendCommand(const uint8_t command) void SSD16XX::sendData(uint8_t data) { - // spi->beginTransaction(spiSettings); - // digitalWrite(pin_dc, HIGH); // DC pin HIGH indicates data, instead of command - // digitalWrite(pin_cs, LOW); - // spi->transfer(data); - // digitalWrite(pin_cs, HIGH); - // digitalWrite(pin_dc, HIGH); - // spi->endTransaction(); sendData(&data, 1); } diff --git a/src/graphics/niche/Drivers/EInk/SSD16XX.h b/src/graphics/niche/Drivers/EInk/SSD16XX.h index f9077f188..88fe4dc25 100644 --- a/src/graphics/niche/Drivers/EInk/SSD16XX.h +++ b/src/graphics/niche/Drivers/EInk/SSD16XX.h @@ -39,21 +39,24 @@ class SSD16XX : public EInk virtual void configUpdateSequence(); // Tell controller IC which operations to run virtual void writeNewImage(); - virtual void writeOldImage(); + virtual void writeOldImage(); // Image which can be used at *next* update for "differential refresh" virtual void detachFromUpdate(); virtual bool isUpdateDone() override; virtual void finalizeUpdate() override; protected: - uint8_t bufferOffsetX; // In bytes. Panel x=0 does not always align with controller x=0. Quirky internal wiring? - uint8_t bufferRowSize; // In bytes. Rows store 8 pixels per byte. Rounded up to fit (e.g. 122px would require 16 bytes) - uint32_t bufferSize; // In bytes. Rows * Columns - uint8_t *buffer; - UpdateTypes updateType; + uint8_t bufferOffsetX = 0; // In bytes. Panel x=0 does not always align with controller x=0. Quirky internal wiring? + uint8_t bufferRowSize = 0; // In bytes. Rows store 8 pixels per byte. Rounded up to fit (e.g. 122px would require 16 bytes) + uint32_t bufferSize = 0; // In bytes. Rows * Columns + uint8_t *buffer = nullptr; + UpdateTypes updateType = UpdateTypes::UNSPECIFIED; - uint8_t pin_dc, pin_cs, pin_busy, pin_rst; - SPIClass *spi; + uint8_t pin_dc = -1; + uint8_t pin_cs = -1; + uint8_t pin_busy = -1; + uint8_t pin_rst = -1; + SPIClass *spi = nullptr; SPISettings spiSettings = SPISettings(4000000, MSBFIRST, SPI_MODE0); }; diff --git a/src/graphics/niche/Drivers/README.md b/src/graphics/niche/Drivers/README.md index 566558658..14a9edd0b 100644 --- a/src/graphics/niche/Drivers/README.md +++ b/src/graphics/niche/Drivers/README.md @@ -1,3 +1,3 @@ # NicheGraphics - Drivers -Common drivers which can be used by various NicheGrapihcs UIs +Common drivers which can be used by various NicheGraphics UIs diff --git a/src/graphics/niche/FlashData.h b/src/graphics/niche/FlashData.h index 4a436d387..8a63c6108 100644 --- a/src/graphics/niche/FlashData.h +++ b/src/graphics/niche/FlashData.h @@ -119,7 +119,7 @@ template class FlashData // Calculate a hash of the data uint32_t hash = getHash(data); - f.write((uint8_t *)data, sizeof(T)); // Write the actualy data + f.write((uint8_t *)data, sizeof(T)); // Write the actual data f.write((uint8_t *)&hash, sizeof(hash)); // Append the hash // f.flush(); diff --git a/src/graphics/niche/Fonts/FreeSans6pt8bCyrillic.h b/src/graphics/niche/Fonts/FreeSans6pt8bCyrillic.h index 49f03d4e1..d222cd1c3 100644 --- a/src/graphics/niche/Fonts/FreeSans6pt8bCyrillic.h +++ b/src/graphics/niche/Fonts/FreeSans6pt8bCyrillic.h @@ -4,7 +4,7 @@ Uses Windows-1251 encoding to map translingual Cyrillic characters to range betw https://en.wikipedia.org/wiki/Windows-1251 Cyrillic characters present to the firmware as UTF8. -A Niche Graphics implementation needs to identify these, and subsitute the appropriate Windows-1251 char value. +A NicheGraphics implementation needs to identify these, and substitute the appropriate Windows-1251 char value. */ diff --git a/src/graphics/niche/InkHUD/Applet.cpp b/src/graphics/niche/InkHUD/Applet.cpp index ebd0acc78..9fda9a87e 100644 --- a/src/graphics/niche/InkHUD/Applet.cpp +++ b/src/graphics/niche/InkHUD/Applet.cpp @@ -2,6 +2,8 @@ #include "./Applet.h" +#include "main.h" + #include "RTC.h" using namespace NicheGraphics; @@ -16,10 +18,15 @@ InkHUD::Applet::Applet() : GFX(0, 0) // The width and height will change dynamically, depending on Applet tiling // If you're getting a "divide by zero error", consider it an assert: // WindowManager should be the only one controlling the rendering + + inkhud = InkHUD::getInstance(); + settings = &inkhud->persistence->settings; + latestMessage = &inkhud->persistence->latestMessage; } -// The raw pixel output generated by AdafruitGFX drawing -// Hand off to the applet's tile, which will in-turn pass to the window manager +// Draw a single pixel +// The raw pixel output generated by AdafruitGFX drawing all passes through here +// Hand off to the applet's tile, which will in-turn pass to the renderer void InkHUD::Applet::drawPixel(int16_t x, int16_t y, uint16_t color) { // Only render pixels if they fall within user's cropped region @@ -27,9 +34,10 @@ void InkHUD::Applet::drawPixel(int16_t x, int16_t y, uint16_t color) assignedTile->handleAppletPixel(x, y, (Color)color); } -// Sets which tile the applet renders for +// Link our applet to a tile +// This can only be called by Tile::assignApplet +// The tile determines the applets dimensions // Pixel output is passed to tile during render() -// This should only be called by Tile::assignApplet void InkHUD::Applet::setTile(Tile *t) { // If we're setting (not clearing), make sure the link is "reciprocal" @@ -39,25 +47,32 @@ void InkHUD::Applet::setTile(Tile *t) assignedTile = t; } -// Which tile will the applet render() to? +// The tile to which our applet is assigned InkHUD::Tile *InkHUD::Applet::getTile() { return assignedTile; } +// Draw the applet void InkHUD::Applet::render() { assert(assignedTile); // Ensure that we have a tile assert(assignedTile->getAssignedApplet() == this); // Ensure that we have a reciprocal link with the tile - wantRender = false; // Clear the flag set by requestUpdate - wantAutoshow = false; // If we're rendering now, it means our request was considered. It may or may not have been granted. - wantUpdateType = Drivers::EInk::UpdateTypes::UNSPECIFIED; // Our requested type has been considered by now. Tidy up. + // WindowManager::update has now consumed the info about our update request + // Clear everything for future requests + wantRender = false; // Flag set by requestUpdate + wantAutoshow = false; // Flag set by requestAutoShow. May or may not have been honored. + wantUpdateType = Drivers::EInk::UpdateTypes::UNSPECIFIED; // Update type we wanted. May on may not have been granted. updateDimensions(); resetDrawingSpace(); onRender(); // Derived applet's drawing takes place here + // Handle "Tile Highlighting" + // Some devices may use an auxiliary button to switch between tiles + // When this happens, we temporarily highlight the newly focused tile with a border + // If our tile is (or was) highlighted, to indicate a change in focus if (Tile::highlightTarget == assignedTile) { // Draw the highlight @@ -77,7 +92,8 @@ void InkHUD::Applet::render() } // Does the applet want to render now? -// Checks whether the applet called requestUpdate() recently, in response to an event +// Checks whether the applet called requestUpdate recently, in response to an event +// Used by WindowManager::update bool InkHUD::Applet::wantsToRender() { return wantRender; @@ -85,18 +101,21 @@ bool InkHUD::Applet::wantsToRender() // Does the applet want to be moved to foreground before next render, to show new data? // User specifies whether an applet has permission for this, using the on-screen menu +// Used by WindowManager::update bool InkHUD::Applet::wantsToAutoshow() { return wantAutoshow; } // Which technique would this applet prefer that the display use to change the image? +// Used by WindowManager::update Drivers::EInk::UpdateTypes InkHUD::Applet::wantsUpdateType() { return wantUpdateType; } // Get size of the applet's drawing space from its tile +// Performed immediately before derived applet's drawing code runs void InkHUD::Applet::updateDimensions() { assert(assignedTile); @@ -113,19 +132,20 @@ void InkHUD::Applet::resetDrawingSpace() setTextColor(BLACK); // Reset text params setCursor(0, 0); setTextWrap(false); - setFont(AppletFont()); // Restore the default AdafruitGFX font + setFont(fontSmall); } -// Tell the window manager that we want to render now +// Tell InkHUD::Renderer that we want to render now // Applets should internally listen for events they are interested in, via MeshModule, CallbackObserver etc // When an applet decides it has heard something important, and wants to redraw, it calls this method -// Once the window manager has given other applets a chance to process whatever event we just detected, -// it will run Applet::render(), which may draw our applet to screen, if it is shown (forgeround) +// Once the renderer has given other applets a chance to process whatever event we just detected, +// it will run Applet::render(), which may draw our applet to screen, if it is shown (foreground) +// We should requestUpdate even if our applet is currently background, because this might be changed by autoshow void InkHUD::Applet::requestUpdate(Drivers::EInk::UpdateTypes type) { wantRender = true; wantUpdateType = type; - WindowManager::getInstance()->requestUpdate(); + inkhud->requestUpdate(); } // Ask window manager to move this applet to foreground at start of next render @@ -138,7 +158,7 @@ void InkHUD::Applet::requestAutoshow() // Called when an Applet begins running // Active applets are considered "enabled" // They should now listen for events, and request their own updates -// They may also be force rendered by the window manager at any time +// They may also be unexpectedly renderer at any time by other InkHUD components // Applets can be activated at run-time through the on-screen menu void InkHUD::Applet::activate() { @@ -146,7 +166,7 @@ void InkHUD::Applet::activate() active = true; } -// Called when an Applet stop running +// Called when an Applet stops running // Inactive applets are considered "disabled" // They should not listen for events, process data // They will not be rendered @@ -173,7 +193,7 @@ bool InkHUD::Applet::isActive() // Begin showing the Applet // It will be rendered immediately to whichever tile it is assigned -// The window manager will also now honor requestUpdate() calls from this applet +// The Renderer will also now honor requestUpdate() calls from this applet void InkHUD::Applet::bringToForeground() { if (!foreground) { @@ -186,7 +206,7 @@ void InkHUD::Applet::bringToForeground() // Stop showing the Applet // Calls to requestUpdate() will no longer be honored -// When one applet moves to background, another should move to foreground +// When one applet moves to background, another should move to foreground (exception: some system applets) void InkHUD::Applet::sendToBackground() { if (foreground) { @@ -196,6 +216,10 @@ void InkHUD::Applet::sendToBackground() } // Is the applet currently displayed on a tile +// Note: in some uncommon situations, an applet may be "foreground", and still not visible. +// This can occur when a system applet is covering the screen (e.g. during BLE pairing) +// This is not our applets responsibility to handle, +// as in those situations, the system applet will have "locked" rendering bool InkHUD::Applet::isForeground() { return foreground; @@ -248,7 +272,7 @@ void InkHUD::Applet::printAt(int16_t x, int16_t y, std::string text, HorizontalA // Custom font // - set with AppletFont::addSubstitution // - find certain UTF8 chars - // - replace with glpyh from custom font (or suitable ASCII addSubstitution?) + // - replace with glyph from custom font (or suitable ASCII addSubstitution?) getFont().applySubstitutions(&text); // We do still have to run getTextBounds to find the width @@ -271,8 +295,7 @@ void InkHUD::Applet::printAt(int16_t x, int16_t y, std::string text, HorizontalA break; } - // We're using a fixed line height (getFontDimensions), rather than sizing to text (getTextBounds) - // Note: the FontDimensions values for this are unsigned + // We're using a fixed line height, rather than sizing to text (getTextBounds) switch (va) { case TOP: @@ -291,7 +314,7 @@ void InkHUD::Applet::printAt(int16_t x, int16_t y, std::string text, HorizontalA } // Set which font should be used for subsequent drawing -// This is AppletFont type, which is a wrapper for AdfruitGFX font, with some precalculated dimension data +// This is AppletFont type, which is a wrapper for AdafruitGFX font, with some precalculated dimension data void InkHUD::Applet::setFont(AppletFont f) { GFX::setFont(f.gfxFont); @@ -299,20 +322,12 @@ void InkHUD::Applet::setFont(AppletFont f) } // Get which font is currently being used for drawing -// This is AppletFont type, which is a wrapper for AdfruitGFX font, with some precalculated dimension data +// This is AppletFont type, which is a wrapper for AdafruitGFX font, with some precalculated dimension data InkHUD::AppletFont InkHUD::Applet::getFont() { return currentFont; } -// Set two general-purpose fonts, which are reused by many applets -// Applets are also permitted to use other fonts, if they can justify the flash usage -void InkHUD::Applet::setDefaultFonts(AppletFont large, AppletFont small) -{ - Applet::fontSmall = small; - Applet::fontLarge = large; -} - // Gets rendered width of a string // Wrapper for getTextBounds uint16_t InkHUD::Applet::getTextWidth(const char *text) @@ -327,7 +342,7 @@ uint16_t InkHUD::Applet::getTextWidth(const char *text) } // Gets rendered width of a string -// Wrappe for getTextBounds +// Wrapper for getTextBounds uint16_t InkHUD::Applet::getTextWidth(std::string text) { getFont().applySubstitutions(&text); @@ -338,7 +353,7 @@ uint16_t InkHUD::Applet::getTextWidth(std::string text) // Evaluate SNR and RSSI to qualify signal strength at one of four discrete levels // Roughly comparable to values used by the iOS app; // I didn't actually go look up the code, just fit to a sample graphic I have of the iOS signal indicator -InkHUD::SignalStrength InkHUD::Applet::getSignalStrength(float snr, float rssi) +InkHUD::Applet::SignalStrength InkHUD::Applet::getSignalStrength(float snr, float rssi) { uint8_t score = 0; @@ -376,12 +391,14 @@ std::string InkHUD::Applet::hexifyNodeNum(NodeNum num) return std::string(nodeIdHex); } +// Print text, with word wrapping +// Avoids splitting words in half, instead moving the entire word to a new line wherever possible void InkHUD::Applet::printWrapped(int16_t left, int16_t top, uint16_t width, std::string text) { // Custom font glyphs // - set with AppletFont::addSubstitution // - find certain UTF8 chars - // - replace with glpyh from custom font (or suitable ASCII addSubstitution?) + // - replace with glyph from custom font (or suitable ASCII addSubstitution?) getFont().applySubstitutions(&text); // Place the AdafruitGFX cursor to suit our "top" coord @@ -528,7 +545,7 @@ std::string InkHUD::Applet::getTimeString(uint32_t epochSeconds) #ifdef BUILD_EPOCH constexpr uint32_t validAfterEpoch = BUILD_EPOCH - (SEC_PER_DAY * 30 * 6); // 6 Months prior to build #else - constexpr uint32_t validAfterEpoch = 1727740800 - (SEC_PER_DAY * 30 * 6); // 6 Months prior to October 1, 2024 12:00:00 AM GMT + constexpr uint32_t validAfterEpoch = 1738368000 - (SEC_PER_DAY * 30 * 6); // 6 Months prior to Feb 1, 2025 12:00:00 AM GMT #endif uint32_t epochNow = getValidTime(RTCQuality::RTCQualityDevice, true); @@ -538,23 +555,17 @@ std::string InkHUD::Applet::getTimeString(uint32_t epochSeconds) // Times are invalid: rtc is much older than when code was built // Don't give any human readable string - if (epochNow <= validAfterEpoch) { - LOG_DEBUG("RTC prior to buildtime"); + if (epochNow <= validAfterEpoch) return ""; - } // Times are invalid: argument time is significantly ahead of RTC // Don't give any human readable string - if (daysAgo < -2) { - LOG_DEBUG("RTC in future"); + if (daysAgo < -2) return ""; - } // Times are probably invalid: more than 6 months ago - if (daysAgo > 6 * 30) { - LOG_DEBUG("RTC val > 6 months old"); + if (daysAgo > 6 * 30) return ""; - } if (daysAgo > 1) return to_string(daysAgo) + " days ago"; @@ -602,7 +613,7 @@ uint16_t InkHUD::Applet::getActiveNodeCount() meshtastic_NodeInfoLite *node = nodeDB->getMeshNodeByIndex(i); // Check if heard recently, and not our own node - if (sinceLastSeen(node) < settings.recentlyActiveSeconds && node->num != nodeDB->getNodeNum()) + if (sinceLastSeen(node) < settings->recentlyActiveSeconds && node->num != nodeDB->getNodeNum()) count++; } @@ -619,7 +630,7 @@ std::string InkHUD::Applet::localizeDistance(uint32_t meters) // Resulting string std::string localized; - // Imeperial + // Imperial if (config.display.units == meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL) { uint32_t feet = meters * FEET_PER_METER; // Distant (miles, rounded) @@ -651,6 +662,7 @@ std::string InkHUD::Applet::localizeDistance(uint32_t meters) return localized; } +// Print text with a "faux bold" effect, by drawing it multiple times, offsetting slightly void InkHUD::Applet::printThick(int16_t xCenter, int16_t yCenter, std::string text, uint8_t thicknessX, uint8_t thicknessY) { // How many times to draw along x axis @@ -703,17 +715,24 @@ void InkHUD::Applet::printThick(int16_t xCenter, int16_t yCenter, std::string te // Asked before a notification is shown via the NotificationApplet // An applet might want to suppress a notification if the applet itself already displays this info // Example: AllMessageApplet should not approve notifications for messages, if it is in foreground -bool InkHUD::Applet::approveNotification(InkHUD::Notification &n) +bool InkHUD::Applet::approveNotification(NicheGraphics::InkHUD::Notification &n) { // By default, no objection return true; } // Draw the standard header, used by most Applets +/* +┌───────────────────────────────┠+│ Applet::name here │ +│ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ +│ │ +│ │ +│ │ +└───────────────────────────────┘ +*/ void InkHUD::Applet::drawHeader(std::string text) { - setFont(fontSmall); - // Y position for divider // - between header text and messages constexpr int16_t padDivH = 2; @@ -771,6 +790,15 @@ uint16_t InkHUD::Applet::getLogoHeight(uint16_t limitWidth, uint16_t limitHeight // Draw a scalable Meshtastic logo // Make sure to provide dimensions which have the correct aspect ratio (~2) // Three paths, drawn thick using quads, with one corner "radiused" +/* + - ^ + /- /-\ + // // \\ + // // \\ + // // \\ + // // \\ + +*/ void InkHUD::Applet::drawLogo(int16_t centerX, int16_t centerY, uint16_t width, uint16_t height) { struct Point { @@ -788,6 +816,17 @@ void InkHUD::Applet::drawLogo(int16_t centerX, int16_t centerY, uint16_t width, int16_t logoB = logoT + logoH - 1; // Points for paths (a, b, and c) + /* + +-----------------------------+ + --| a2 b2/c1 | + | | + | | + | | + --| a1 b1 c2 | + +-----------------------------+ + | | | | + */ + Point a1 = {map(0, 0, 3, logoL, logoR), logoB}; Point a2 = {map(1, 0, 3, logoL, logoR), logoT}; Point b1 = {map(1, 0, 3, logoL, logoR), logoB}; @@ -795,17 +834,72 @@ void InkHUD::Applet::drawLogo(int16_t centerX, int16_t centerY, uint16_t width, Point c1 = {map(2, 0, 3, logoL, logoR), logoT}; Point c2 = {map(3, 0, 3, logoL, logoR), logoB}; - // Find right-angle to the path + // Find angle of the path(s) // Used to thicken the single pixel paths + /* + +-------------------------------+ + | a2 | + | -| | + | -/ | | + | -/ | | + | -/# | | + | -/ # | | + | / # | | + | a1---------- | + +-------------------------------+ + */ + Distance deltaA = {abs(a2.x - a1.x), abs(a2.y - a1.y)}; float angle = tanh((float)deltaA.y / deltaA.x); - // Distance {at right angle from the paths), which will give corners for our "quads" + // Distance (at right angle to the paths), which will give corners for our "quads" // The distance is unsigned. We will vary the signedness of the x and y components to suit the path and corner + /* + | a2 + | . + | .. + | aq1 .. + | # .. + | | # .. + |fromPath.y | # .. + | +----a1 + | + | fromPath.x + +-------------------------------- + */ + Distance fromPath; fromPath.x = cos(radians(90) - angle) * logoTh * 0.5; fromPath.y = sin(radians(90) - angle) * logoTh * 0.5; + // Make the paths thick + // Corner points for the rectangles (quads): + /* + + aq2 + a2 + / aq3 + / + / + aq1 / + a1 + aq3 + */ + + // Filled as two triangles per quad: + /* + aq2 # + # ### + ## # aq3 + ## ### - + ## #### -/ + ## ### -/ + ## #### -/ + aq1 ## -/ + --- -/ + \---aq4 + */ + // Make the path thick: path a becomes quad a Point aq1{a1.x - fromPath.x, a1.y - fromPath.y}; Point aq2{a2.x - fromPath.x, a2.y - fromPath.y}; @@ -822,7 +916,7 @@ void InkHUD::Applet::drawLogo(int16_t centerX, int16_t centerY, uint16_t width, fillTriangle(bq1.x, bq1.y, bq2.x, bq2.y, bq3.x, bq3.y, BLACK); fillTriangle(bq1.x, bq1.y, bq3.x, bq3.y, bq4.x, bq4.y, BLACK); - // Make the path hick: path c becomes quad c + // Make the path thick: path c becomes quad c Point cq1{c1.x - fromPath.x, c1.y + fromPath.y}; Point cq2{c2.x - fromPath.x, c2.y + fromPath.y}; Point cq3{c2.x + fromPath.x, c2.y - fromPath.y}; @@ -831,10 +925,21 @@ void InkHUD::Applet::drawLogo(int16_t centerX, int16_t centerY, uint16_t width, fillTriangle(cq1.x, cq1.y, cq3.x, cq3.y, cq4.x, cq4.y, BLACK); // Radius the intersection of quad b and quad c + /* + b2 / c1 + #### + ## ## + / \ + / \/ \ + / /\ \ + / / \ \ + + */ + // Don't attempt if logo is tiny if (logoTh > 3) { // The radius for the cap *should* be the same as logoTh, but it's not, due to accumulated rounding - // We get better results just rederiving it + // We get better results just re-deriving it int16_t capRad = sqrt(pow(fromPath.x, 2) + pow(fromPath.y, 2)); fillCircle(b2.x, b2.y, capRad, BLACK); } diff --git a/src/graphics/niche/InkHUD/Applet.h b/src/graphics/niche/InkHUD/Applet.h index 30c1bdcdc..028b24f9c 100644 --- a/src/graphics/niche/InkHUD/Applet.h +++ b/src/graphics/niche/InkHUD/Applet.h @@ -7,103 +7,21 @@ An applet is one "program" which may show info on the display. - =================================== - Preliminary notes, for the curious - =================================== - - (This info to be streamlined, and moved to a more official documentation) - - User Applets vs System Applets - ------------------------------- - - There are either "User Applets", or "System Applets". - This concept is only for our understanding; as far at the code is concerned, both are just "Applets" - - User applets are the "normal" applets. - User applets are applets like "AllMessageApplet", or "MapApplet". - User applets may be enabled / disabled by user, via the on-screen menu. - Incorporating new UserApplets is easy: just add them during setupNicheGraphics - If a UserApplet is not added during setupNicheGraphics, it will not be built. - The set of available UserApplets is allowed to vary from device to device. - - - Examples of system applets include "NotificationApplet" and "MenuApplet". - For their own reasons, system applets each require some amount of special handling. - - Drawing - -------- - - *All* drawing must be performed by an Applet. - Applets implement the onRender() method, where all drawing takes place. - Applets are told how wide and tall they are, and are expected to draw to suit this size. - When an applet draws, it uses co-ordinates in "Applet Space": between 0 and applet width/height. - - Event-driven rendering - ----------------------- - - Applets don't render unless something on the display needs to change. - An applet is expected to determine for itself when it has new info to display. - It should interact with the firmware via the MeshModule API, via Observables, etc. - Please don't directly add hooks throughout the existing firmware code. - - When an applet decides it would like to update the display, it should call requestUpdate() - The WindowManager will shortly call the onRender() method for all affected applets - - An Applet may be unexpectedly asked to render at any point in time. - - Applets should cache their data, but not their pixel output: they should re-render when onRender runs. - An Applet's dimensions are not know until onRender is called, so pre-rendering of UI elements is prohibited. - - Tiles - ----- - - Applets are assigned to "Tiles". - Assigning an applet to a tile creates a reciprocal link between the two. - When an applet renders, it passes pixels to its tile. - The tile translates these to the correct position, to be placed into the fullscreen framebuffer. - User applets don't get to choose their own tile; the multiplexing is handled by the WindowManager. - System applets might do strange things though. - - Foreground and Background - ------------------------- - - The user can cycle between applets by short-pressing the user button. - Any applets which are currently displayed on the display are "foreground". - When the user button is short pressed, and an applet is hidden, it becomes "background". - - Although the WindowManager will not render background applets, they should still collect data, - so they are ready to display when they are brought to foreground again. - Even if they are in background, Applets should still request updates when an event affects them, - as the user may have given them permission to "autoshow"; bringing themselves foreground automatically - - Applets can implement the onForeground and onBackground methods to handle this change in state. - They can also check their state by calling isForeground() at any time. - - Active and Inactive - ------------------- - - The user can select which applets are available, using the onscreen applet selection menu. - Applets which are enabled in this menu are "active"; otherwise they are "inactive". - - An inactive applet is expected not collect data; not to consume resources. - Applets are activated at boot, or when enabled via the menu. - They are deactivated at shutdown, or when disabled via the menu. - - Applets can implement the onActivation and onDeactivation methods to handle this change in state. - */ #pragma once #include "configuration.h" -#include +#include // GFXRoot drawing lib + +#include "mesh/MeshTypes.h" #include "./AppletFont.h" -#include "./Applets/System/Notification/Notification.h" +#include "./Applets/System/Notification/Notification.h" // The notification object, not the applet +#include "./InkHUD.h" +#include "./Persistence.h" #include "./Tile.h" -#include "./Types.h" -#include "./WindowManager.h" #include "graphics/niche/Drivers/EInk/EInk.h" namespace NicheGraphics::InkHUD @@ -112,37 +30,57 @@ namespace NicheGraphics::InkHUD using NicheGraphics::Drivers::EInk; using std::to_string; -class Tile; -class WindowManager; - class Applet : public GFX { public: + // Which edge Applet::printAt will place on the Y parameter + enum VerticalAlignment : uint8_t { + TOP, + MIDDLE, + BOTTOM, + }; + + // Which edge Applet::printAt will place on the X parameter + enum HorizontalAlignment : uint8_t { + LEFT, + RIGHT, + CENTER, + }; + + // An easy-to-understand interpretation of SNR and RSSI + // Calculate with Applet::getSignalStrength + enum SignalStrength : int8_t { + SIGNAL_UNKNOWN = -1, + SIGNAL_NONE, + SIGNAL_BAD, + SIGNAL_FAIR, + SIGNAL_GOOD, + }; + Applet(); - void setTile(Tile *t); // Applets draw via a tile (for multiplexing) - Tile *getTile(); + void setTile(Tile *t); // Should only be called via Tile::setApplet + Tile *getTile(); // Tile with which this applet is linked - void render(); - bool wantsToRender(); // Check whether applet wants to render - bool wantsToAutoshow(); // Check whether applets wants to become foreground, to show new data, if permitted + // Rendering + + void render(); // Draw the applet + bool wantsToRender(); // Check whether applet wants to render + bool wantsToAutoshow(); // Check whether applet wants to become foreground Drivers::EInk::UpdateTypes wantsUpdateType(); // Check which display update type the applet would prefer void updateDimensions(); // Get current size from tile void resetDrawingSpace(); // Makes sure every render starts with same parameters - // Change the applet's state - - void activate(); - void deactivate(); - void bringToForeground(); - void sendToBackground(); - - // Info about applet's state + // State of the applet + void activate(); // Begin running + void deactivate(); // Stop running + void bringToForeground(); // Show + void sendToBackground(); // Hide bool isActive(); bool isForeground(); - // Allow derived applets to handle changes in state + // Event handlers virtual void onRender() = 0; // All drawing happens here virtual void onActivate() {} @@ -150,62 +88,62 @@ class Applet : public GFX virtual void onForeground() {} virtual void onBackground() {} virtual void onShutdown() {} - virtual void onButtonShortPress() {} // For use by System Applets only - virtual void onButtonLongPress() {} // For use by System Applets only - virtual void onLockAvailable() {} // For use by System Applets only + virtual void onButtonShortPress() {} // (System Applets only) + virtual void onButtonLongPress() {} // (System Applets only) virtual bool approveNotification(Notification &n); // Allow an applet to veto a notification - static void setDefaultFonts(AppletFont large, AppletFont small); // Set the general purpose fonts - static uint16_t getHeaderHeight(); // How tall is the "standard" applet header + static uint16_t getHeaderHeight(); // How tall the "standard" applet header is - const char *name = nullptr; // Shown in applet selection menu + static AppletFont fontSmall, fontLarge; // The general purpose fonts, used by all applets + + const char *name = nullptr; // Shown in applet selection menu. Also used as an identifier by InkHUD::getSystemApplet protected: - // Place a single pixel. All drawing methods output through here - void drawPixel(int16_t x, int16_t y, uint16_t color) override; + void drawPixel(int16_t x, int16_t y, uint16_t color) override; // Place a single pixel. All drawing output passes through here - // Tell WindowManager to update display - void requestUpdate(EInk::UpdateTypes type = EInk::UpdateTypes::UNSPECIFIED); - - // Ask for applet to be moved to foreground - void requestAutoshow(); + void requestUpdate(EInk::UpdateTypes type = EInk::UpdateTypes::UNSPECIFIED); // Ask WindowManager to schedule a display update + void requestAutoshow(); // Ask for applet to be moved to foreground uint16_t X(float f); // Map applet width, mapped from 0 to 1.0 uint16_t Y(float f); // Map applet height, mapped from 0 to 1.0 void setCrop(int16_t left, int16_t top, uint16_t width, uint16_t height); // Ignore pixels drawn outside a certain region void resetCrop(); // Removes setCrop() + // Text + void setFont(AppletFont f); AppletFont getFont(); - uint16_t getTextWidth(std::string text); uint16_t getTextWidth(const char *text); - + uint32_t getWrappedTextHeight(int16_t left, uint16_t width, std::string text); // Result of printWrapped void printAt(int16_t x, int16_t y, const char *text, HorizontalAlignment ha = LEFT, VerticalAlignment va = TOP); void printAt(int16_t x, int16_t y, std::string text, HorizontalAlignment ha = LEFT, VerticalAlignment va = TOP); - void printThick(int16_t xCenter, int16_t yCenter, std::string text, uint8_t thicknessX, uint8_t thicknessY); - - // Print text, with per-word line wrapping - void printWrapped(int16_t left, int16_t top, uint16_t width, std::string text); - uint32_t getWrappedTextHeight(int16_t left, uint16_t width, std::string text); + void printThick(int16_t xCenter, int16_t yCenter, std::string text, uint8_t thicknessX, uint8_t thicknessY); // Faux bold + void printWrapped(int16_t left, int16_t top, uint16_t width, std::string text); // Per-word line wrapping void hatchRegion(int16_t x, int16_t y, uint16_t w, uint16_t h, uint8_t spacing, Color color); // Fill with sparse lines void drawHeader(std::string text); // Draw the standard applet header + // Meshtastic Logo + static constexpr float LOGO_ASPECT_RATIO = 1.9; // Width:Height for drawing the Meshtastic logo uint16_t getLogoWidth(uint16_t limitWidth, uint16_t limitHeight); // Size Meshtastic logo to fit within region uint16_t getLogoHeight(uint16_t limitWidth, uint16_t limitHeight); // Size Meshtastic logo to fit within region void drawLogo(int16_t centerX, int16_t centerY, uint16_t width, uint16_t height); // Draw the meshtastic logo - std::string hexifyNodeNum(NodeNum num); + std::string hexifyNodeNum(NodeNum num); // Style as !0123abdc SignalStrength getSignalStrength(float snr, float rssi); // Interpret SNR and RSSI, as an easy to understand value std::string getTimeString(uint32_t epochSeconds); // Human readable std::string getTimeString(); // Current time, human readable uint16_t getActiveNodeCount(); // Duration determined by user, in onscreen menu std::string localizeDistance(uint32_t meters); // Human readable distance, imperial or metric - static AppletFont fontSmall, fontLarge; // General purpose fonts, used cross-applet + // Convenient references + + InkHUD *inkhud = nullptr; + Persistence::Settings *settings = nullptr; + Persistence::LatestMessage *latestMessage = nullptr; private: Tile *assignedTile = nullptr; // Rendered pixels are fed into a Tile object, which translates them, then passes to WM @@ -223,10 +161,10 @@ class Applet : public GFX AppletFont currentFont; // As passed to setFont // As set by setCrop - int16_t cropLeft; - int16_t cropTop; - uint16_t cropWidth; - uint16_t cropHeight; + int16_t cropLeft = 0; + int16_t cropTop = 0; + uint16_t cropWidth = 0; + uint16_t cropHeight = 0; }; }; // namespace NicheGraphics::InkHUD diff --git a/src/graphics/niche/InkHUD/AppletFont.cpp b/src/graphics/niche/InkHUD/AppletFont.cpp index bee9d33e6..25597c9b9 100644 --- a/src/graphics/niche/InkHUD/AppletFont.cpp +++ b/src/graphics/niche/InkHUD/AppletFont.cpp @@ -12,7 +12,7 @@ InkHUD::AppletFont::AppletFont() InkHUD::AppletFont::AppletFont(const GFXfont &adafruitGFXFont) : gfxFont(&adafruitGFXFont) { // AdafruitGFX fonts are drawn relative to a "cursor line"; - // they print as if the glyphs resting on the line of piece of ruled paper. + // they print as if the glyphs are resting on the line of piece of ruled paper. // The glyphs also each have a different height. // To simplify drawing, we will scan the entire font now, and determine an appropriate height for a line of text @@ -42,6 +42,19 @@ InkHUD::AppletFont::AppletFont(const GFXfont &adafruitGFXFont) : gfxFont(&adafru spaceCharWidth = gfxFont->glyph[(uint8_t)' ' - gfxFont->first].xAdvance; } +/* + + â–² ##### # â–² + │ # # │ + lineHeight │ ### # │ + │ # # # # │ heightAboveCursor + │ # # # # │ + │ # # #### │ + │ -----------------#---- + │ # │ heightBelowCursor + â–¼ ### â–¼ +*/ + uint8_t InkHUD::AppletFont::lineHeight() { return this->height; @@ -78,7 +91,7 @@ void InkHUD::AppletFont::addSubstitution(const char *from, const char *to) substitutions.push_back({.from = from, .to = to}); } -// Run all registered subtitutions on a string +// Run all registered substitutions on a string // Used to swap out UTF8 special chars void InkHUD::AppletFont::applySubstitutions(std::string *text) { @@ -87,7 +100,7 @@ void InkHUD::AppletFont::applySubstitutions(std::string *text) // Find and replace // - search for Substitution::from - // - replace with Subsitution::to + // - replace with Substitution::to size_t i = text->find(s.from); while (i != std::string::npos) { text->replace(i, strlen(s.from), s.to); @@ -97,7 +110,7 @@ void InkHUD::AppletFont::applySubstitutions(std::string *text) } // Apply a set of substitutions which remap UTF8 for a Windows-1251 font -// Windows-1251 is an 8-bit character encoding, designed to cover languages that use the Cyrillic script +// Windows-1251 is an 8-bit character encoding, suitable for several languages which use the Cyrillic script void InkHUD::AppletFont::addSubstitutionsWin1251() { addSubstitution("Ђ", "\x80"); diff --git a/src/graphics/niche/InkHUD/AppletFont.h b/src/graphics/niche/InkHUD/AppletFont.h index 89f901c94..504bd12b3 100644 --- a/src/graphics/niche/InkHUD/AppletFont.h +++ b/src/graphics/niche/InkHUD/AppletFont.h @@ -15,7 +15,7 @@ #include "configuration.h" -#include +#include // GFXRoot drawing lib namespace NicheGraphics::InkHUD { @@ -25,11 +25,12 @@ class AppletFont { public: AppletFont(); - AppletFont(const GFXfont &adafruitGFXFont); + explicit AppletFont(const GFXfont &adafruitGFXFont); + uint8_t lineHeight(); uint8_t heightAboveCursor(); uint8_t heightBelowCursor(); - uint8_t widthBetweenWords(); + uint8_t widthBetweenWords(); // Width of the space character void applySubstitutions(std::string *text); // Run all char-substitution operations, prior to printing void addSubstitution(const char *from, const char *to); // Register a find-replace action, for remapping UTF8 chars @@ -50,8 +51,7 @@ class AppletFont const char *to; }; - // List of all character substitutions to run, prior to printing a string - std::vector substitutions; + std::vector substitutions; // List of all character substitutions to run, prior to printing a string }; } // namespace NicheGraphics::InkHUD diff --git a/src/graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.cpp b/src/graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.cpp index 21f404349..ea7b74262 100644 --- a/src/graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.cpp @@ -6,8 +6,6 @@ using namespace NicheGraphics; void InkHUD::MapApplet::onRender() { - setFont(fontSmall); - // Abort if no markers to render if (!enoughMarkers()) { printAt(X(0.5), Y(0.5) - (getFont().lineHeight() / 2), "Node positions", CENTER, MIDDLE); @@ -27,6 +25,7 @@ void InkHUD::MapApplet::onRender() // Set the region shown on the map // - default: fit all nodes, plus padding // - maybe overriden by derived applet + // - getMapSize *sets* passed parameters (C-style) getMapSize(&widthMeters, &heightMeters); // Set the metersToPx conversion value @@ -71,7 +70,7 @@ void InkHUD::MapApplet::getMapCenter(float *lat, float *lng) // - uses tan to find angles for lat / long degrees // - longitude: triangle formed by x and y (on plane of the equator) // - latitude: triangle formed by z (north south), - // and the line along plane of equator which stetches from earth's axis to where point xyz intersects planet's surface + // and the line along plane of equator which stretches from earth's axis to where point xyz intersects planet's surface // Working totals, averaged after nodeDB processed uint32_t positionCount = 0; @@ -134,7 +133,7 @@ void InkHUD::MapApplet::getMapCenter(float *lat, float *lng) *lng = atan2(yAvg, xAvg) * RAD_TO_DEG; - // Latitude from cartesian cooods + // Latitude from cartesian coords // (Angle from 3D coords describing a point on the globe's surface) // As latitude increases, distance from the Earth's north-south axis out to our surface point decreases. // Means we need to first find the hypotenuse which becomes base of our triangle in the second step @@ -191,8 +190,8 @@ void InkHUD::MapApplet::getMapCenter(float *lat, float *lng) // Longitude is trickier float lng = node->position.longitude_i * 1e-7; - float degEastward = fmod(((lng - lngCenter) + 360), 360); // Degrees travelled east from lngCenter to reach node - float degWestward = abs(fmod(((lng - lngCenter) - 360), 360)); // Degrees travelled west from lngCenter to reach node + float degEastward = fmod(((lng - lngCenter) + 360), 360); // Degrees traveled east from lngCenter to reach node + float degWestward = abs(fmod(((lng - lngCenter) - 360), 360)); // Degrees traveled west from lngCenter to reach node if (degEastward < degWestward) easternmost = max(easternmost, lngCenter + degEastward); else @@ -258,7 +257,7 @@ void InkHUD::MapApplet::drawLabeledMarker(meshtastic_NodeInfoLite *node) // Find x and y position based on node's position in nodeDB assert(nodeDB->hasValidPosition(node)); Marker m = calculateMarker(node->position.latitude_i * 1e-7, // Lat, converted from Meshtastic's internal int32 style - node->position.longitude_i * 1e-7, // Long, convered from Meshtastic's internal int32 style + node->position.longitude_i * 1e-7, // Long, converted from Meshtastic's internal int32 style node->has_hops_away, // Is the hopsAway number valid node->hops_away // Hops away ); @@ -288,7 +287,7 @@ void InkHUD::MapApplet::drawLabeledMarker(meshtastic_NodeInfoLite *node) bool unknownHops = !node->has_hops_away && !isOurNode; // We will draw a left or right hand variant, to place text towards screen center - // Hopfully avoid text spilling off screen + // Hopefully avoid text spilling off screen // Most values are the same, regardless of left-right handedness // Pick emblem style @@ -388,7 +387,7 @@ void InkHUD::MapApplet::calculateAllMarkers() // Calculate marker and store it markers.push_back( calculateMarker(node->position.latitude_i * 1e-7, // Lat, converted from Meshtastic's internal int32 style - node->position.longitude_i * 1e-7, // Long, convered from Meshtastic's internal int32 style + node->position.longitude_i * 1e-7, // Long, converted from Meshtastic's internal int32 style node->has_hops_away, // Is the hopsAway number valid node->hops_away // Hops away )); diff --git a/src/graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.h b/src/graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.h index fd5245631..f45a36071 100644 --- a/src/graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.h +++ b/src/graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.h @@ -38,13 +38,12 @@ class MapApplet : public Applet void drawLabeledMarker(meshtastic_NodeInfoLite *node); // Highlight a specific marker private: - // Position of markers to be drawn, relative to map center - // HopsAway info used to determine marker size + // Position and size of a marker to be drawn struct Marker { - float eastMeters = 0; // Meters east of mapCenter. Negative if west. - float northMeters = 0; // Meters north of mapCenter. Negative if south. + float eastMeters = 0; // Meters east of map center. Negative if west. + float northMeters = 0; // Meters north of map center. Negative if south. bool hasHopsAway = false; - uint8_t hopsAway = 0; + uint8_t hopsAway = 0; // Determines marker size }; Marker calculateMarker(float lat, float lng, bool hasHopsAway, uint8_t hopsAway); diff --git a/src/graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.cpp b/src/graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.cpp index 5d60e6800..8ede40780 100644 --- a/src/graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.cpp @@ -12,7 +12,7 @@ using namespace NicheGraphics; InkHUD::NodeListApplet::NodeListApplet(const char *name) : MeshModule(name) { // We only need to be promiscuous in order to hear NodeInfo, apparently. See NodeInfoModule - // For all other packets, we manually reimplement isPromiscuous=false in wantPacket + // For all other packets, we manually act as if isPromiscuous=false, in wantPacket MeshModule::isPromiscuous = true; } @@ -25,17 +25,17 @@ bool InkHUD::NodeListApplet::wantPacket(const meshtastic_MeshPacket *p) && (isToUs(p) || isBroadcast(p->to) || // Either: intended for us, p->decoded.portnum == meshtastic_PortNum_NODEINFO_APP); // or nodeinfo - // Note: special handling of NodeInfo is to match NodeInfoModule // To match the behavior seen in the client apps: // - NodeInfoModule's ProtoBufModule base is "promiscuous" // - All other activity is *not* promiscuous - // To achieve this, our MeshModule *is* promiscious, and we're manually reimplementing non-promiscuous behavior here, + + // To achieve this, our MeshModule *is* promiscuous, and we're manually reimplementing non-promiscuous behavior here, // to match the code in MeshModule::callModules } // MeshModule packets arrive here // Extract the info and pass it to the derived applet -// Derived applet will store the CardInfo and perform any required sorting of the CardInfo collection +// Derived applet will store the CardInfo, and perform any required sorting of the CardInfo collection // Derived applet might also need to keep other tallies (active nodes count?) ProcessMessage InkHUD::NodeListApplet::handleReceived(const meshtastic_MeshPacket &mp) { @@ -76,8 +76,8 @@ ProcessMessage InkHUD::NodeListApplet::handleReceived(const meshtastic_MeshPacke return ProcessMessage::CONTINUE; // Let others look at this message also if they want } -// Maximum number of cards we may ever need to render, in our tallest layout config -// May be slightly in excess of the true value: header not accounted for +// Calculate maximum number of cards we may ever need to render, in our tallest layout config +// Number might be slightly in excess of the true value: applet header text not accounted for uint8_t InkHUD::NodeListApplet::maxCards() { // Cache result. Shouldn't change during execution @@ -87,7 +87,7 @@ uint8_t InkHUD::NodeListApplet::maxCards() const uint16_t height = Tile::maxDisplayDimension(); // Use a loop instead of arithmetic, because it's easier for my brain to follow - // Add cards one by one, until the latest card (without margin) extends below screen + // Add cards one by one, until the latest card extends below screen uint16_t y = cardH; // First card: no margin above cards = 1; @@ -102,7 +102,7 @@ uint8_t InkHUD::NodeListApplet::maxCards() return cards; } -// Draw using info which derived applet placed into NodeListApplet::cards for us +// Draw, using info which derived applet placed into NodeListApplet::cards for us void InkHUD::NodeListApplet::onRender() { @@ -120,9 +120,6 @@ void InkHUD::NodeListApplet::onRender() // Draw the main node list // ======================== - // const uint8_t cardMarginH = fontSmall.lineHeight() / 2; // Gap between cards - // const uint16_t cardH = fontLarge.lineHeight() + fontSmall.lineHeight() + cardMarginH; - // Imaginary vertical line dividing left-side and right-side info // Long-name will crop here const uint16_t dividerX = (width() - 1) - getTextWidth("X Hops"); @@ -215,9 +212,8 @@ void InkHUD::NodeListApplet::onRender() // Once we've run out of screen, stop drawing cards // Depending on tiles / rotation, this may be before we hit maxCards - if (cardTopY > height()) { + if (cardTopY > height()) break; - } } } @@ -246,20 +242,20 @@ void InkHUD::NodeListApplet::drawSignalIndicator(int16_t x, int16_t y, uint16_t constexpr float paddingW = 0.1; // Either side constexpr float paddingH = 0.1; // Above and below - constexpr float gutterX = 0.1; // Between bars + constexpr float gutterW = 0.1; // Between bars - constexpr float barHRel[] = {0.3, 0.5, 0.7, 1.0}; // Heights of the signal bars, relative to the talleest + constexpr float barHRel[] = {0.3, 0.5, 0.7, 1.0}; // Heights of the signal bars, relative to the tallest constexpr uint8_t barCount = 4; // How many bars we draw. Reference only: changing value won't change the count. // Dynamically calculate the width of the bars, and height of the rightmost, relative to other dimensions - float barW = (1.0 - (paddingW + ((barCount - 1) * gutterX) + paddingW)) / barCount; + float barW = (1.0 - (paddingW + ((barCount - 1) * gutterW) + paddingW)) / barCount; float barHMax = 1.0 - (paddingH + paddingH); // Draw signal bar rectangles, then placeholder lines once strength reached for (uint8_t i = 0; i < barCount; i++) { - // Co-ords for this specific bar + // Coords for this specific bar float barH = barHMax * barHRel[i]; - float barX = paddingW + (i * (gutterX + barW)); + float barX = paddingW + (i * (gutterW + barW)); float barY = paddingH + (barHMax - barH); // Rasterize to px coords at the last moment diff --git a/src/graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.h b/src/graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.h index 670dd9e9a..0abcad824 100644 --- a/src/graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.h +++ b/src/graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.h @@ -23,13 +23,16 @@ Used by the "Recents" and "Heard" applets. Possibly more in future? #include "graphics/niche/InkHUD/Applet.h" +#include "main.h" + namespace NicheGraphics::InkHUD { class NodeListApplet : public Applet, public MeshModule { protected: - // Info used to draw one card to the node list + // Info needed to draw a node card to the list + // - generated each time we hear a node struct CardInfo { static constexpr uint8_t HOPS_UNKNOWN = -1; static constexpr uint32_t DISTANCE_UNKNOWN = -1; @@ -37,31 +40,31 @@ class NodeListApplet : public Applet, public MeshModule NodeNum nodeNum = 0; SignalStrength signal = SignalStrength::SIGNAL_UNKNOWN; uint32_t distanceMeters = DISTANCE_UNKNOWN; - uint8_t hopsAway = HOPS_UNKNOWN; // Unknown + uint8_t hopsAway = HOPS_UNKNOWN; }; public: NodeListApplet(const char *name); + void onRender() override; - // MeshModule overrides - virtual bool wantPacket(const meshtastic_MeshPacket *p) override; - virtual ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override; + bool wantPacket(const meshtastic_MeshPacket *p) override; + ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override; protected: - virtual void handleParsed(CardInfo c) = 0; // Pass extracted info from a new packet to derived class, for sorting and storage - virtual std::string getHeaderText() = 0; // Title for the applet's header. Todo: get this info another way? + virtual void handleParsed(CardInfo c) = 0; // Tell derived applet that we heard a node + virtual std::string getHeaderText() = 0; // Ask derived class what the applet's title should be - uint8_t maxCards(); // Calculate the maximum number of cards an applet could ever display + uint8_t maxCards(); // Max number of cards which could ever fit on screen - std::deque cards; // Derived applet places cards here, for this base applet to render + std::deque cards; // Cards to be rendered. Derived applet fills this. private: - // UI element: a "mobile phone" style signal indicator - void drawSignalIndicator(int16_t x, int16_t y, uint16_t w, uint16_t h, SignalStrength signal); + void drawSignalIndicator(int16_t x, int16_t y, uint16_t w, uint16_t h, + SignalStrength signal); // Draw a "mobile phone" style signal indicator - // Dimensions for drawing - // Used for render, and also for maxCards calc + // Card Dimensions + // - for rendering and for maxCards calc const uint8_t cardMarginH = fontSmall.lineHeight() / 2; // Gap between cards const uint16_t cardH = fontLarge.lineHeight() + fontSmall.lineHeight() + cardMarginH; // Height of card }; diff --git a/src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.cpp b/src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.cpp index e0b2a4238..e31f534ac 100644 --- a/src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.cpp @@ -36,8 +36,6 @@ ProcessMessage InkHUD::NewMsgExampleApplet::handleReceived(const meshtastic_Mesh // We should always be ready to draw void InkHUD::NewMsgExampleApplet::onRender() { - setFont(fontSmall); - printAt(0, 0, "Example: NewMsg", LEFT, TOP); // Print top-left corner of text at (0,0) int16_t centerX = X(0.5); // Same as width() / 2 diff --git a/src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h b/src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h index edfb211d7..f280afcda 100644 --- a/src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h +++ b/src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h @@ -53,7 +53,7 @@ class NewMsgExampleApplet : public Applet, public SinglePortModule // Store info from handleReceived bool haveMessage = false; - NodeNum fromWho; + NodeNum fromWho = 0; }; } // namespace NicheGraphics::InkHUD diff --git a/src/graphics/niche/InkHUD/Applets/System/BatteryIcon/BatteryIconApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/BatteryIcon/BatteryIconApplet.cpp index e4432a7c2..4f99d99ee 100644 --- a/src/graphics/niche/InkHUD/Applets/System/BatteryIcon/BatteryIconApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/System/BatteryIcon/BatteryIconApplet.cpp @@ -4,10 +4,10 @@ using namespace NicheGraphics; -void InkHUD::BatteryIconApplet::onActivate() +InkHUD::BatteryIconApplet::BatteryIconApplet() { // Show at boot, if user has previously enabled the feature - if (settings.optionalFeatures.batteryIcon) + if (settings->optionalFeatures.batteryIcon) bringToForeground(); // Register to our have BatteryIconApplet::onPowerStatusUpdate method called when new power info is available @@ -15,12 +15,6 @@ void InkHUD::BatteryIconApplet::onActivate() powerStatusObserver.observe(&powerStatus->onNewStatus); } -void InkHUD::BatteryIconApplet::onDeactivate() -{ - // Stop having onPowerStatusUpdate called - powerStatusObserver.unobserve(&powerStatus->onNewStatus); -} - // We handle power status' even when the feature is disabled, // so that we have up to date data ready if the feature is enabled later. // Otherwise could be 30s before new status update, with weird battery value displayed @@ -41,7 +35,7 @@ int InkHUD::BatteryIconApplet::onPowerStatusUpdate(const meshtastic::Status *sta // If rounded value has changed, trigger a display update // It's okay to requestUpdate before we store the new value, as the update won't run until next loop() // Don't trigger an update if the feature is disabled - if (this->socRounded != newSocRounded && settings.optionalFeatures.batteryIcon) + if (this->socRounded != newSocRounded && settings->optionalFeatures.batteryIcon) requestUpdate(); // Store the new value diff --git a/src/graphics/niche/InkHUD/Applets/System/BatteryIcon/BatteryIconApplet.h b/src/graphics/niche/InkHUD/Applets/System/BatteryIcon/BatteryIconApplet.h index 765ca073f..e5b4172be 100644 --- a/src/graphics/niche/InkHUD/Applets/System/BatteryIcon/BatteryIconApplet.h +++ b/src/graphics/niche/InkHUD/Applets/System/BatteryIcon/BatteryIconApplet.h @@ -11,24 +11,22 @@ It should be optional, enabled by the on-screen menu #include "configuration.h" -#include "graphics/niche/InkHUD/Applet.h" +#include "graphics/niche/InkHUD/SystemApplet.h" #include "PowerStatus.h" namespace NicheGraphics::InkHUD { -class BatteryIconApplet : public Applet +class BatteryIconApplet : public SystemApplet { public: + BatteryIconApplet(); + void onRender() override; - - void onActivate() override; - void onDeactivate() override; - int onPowerStatusUpdate(const meshtastic::Status *status); // Called when new info about battery is available - protected: + private: // Get informed when new information about the battery is available (via onPowerStatusUpdate method) CallbackObserver powerStatusObserver = CallbackObserver(this, &BatteryIconApplet::onPowerStatusUpdate); diff --git a/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp index cc24417ab..24c2d88a4 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp @@ -2,15 +2,22 @@ #include "./LogoApplet.h" +#include "mesh/NodeDB.h" + using namespace NicheGraphics; InkHUD::LogoApplet::LogoApplet() : concurrency::OSThread("LogoApplet") { - // Don't autostart the runOnce() timer - OSThread::disable(); + OSThread::setIntervalFromNow(8 * 1000UL); + OSThread::enabled = true; - // Grab the WindowManager singleton, for convenience - windowManager = WindowManager::getInstance(); + textLeft = ""; + textRight = ""; + textTitle = xstr(APP_VERSION_SHORT); + fontTitle = fontSmall; + + bringToForeground(); + // This is then drawn with a FULL refresh by Renderer::begin } void InkHUD::LogoApplet::onRender() @@ -48,53 +55,24 @@ void InkHUD::LogoApplet::onRender() void InkHUD::LogoApplet::onForeground() { - // If another applet has locked the display, ask it to exit - Applet *other = windowManager->whoLocked(); - if (other != nullptr) - other->sendToBackground(); - - windowManager->claimFullscreen(this); // Take ownership of fullscreen tile - windowManager->lock(this); // Prevent other applets from requesting updates + SystemApplet::lockRendering = true; + SystemApplet::lockRequests = true; + SystemApplet::handleInput = true; // We don't actually use this input. Just blocking other applets from using it. } void InkHUD::LogoApplet::onBackground() { - OSThread::disable(); // Disable auto-dismiss timer, in case applet was dismissed early (sendToBackground from outside class) - - windowManager->releaseFullscreen(); // Relinquish ownership of fullscreen tile - windowManager->unlock(this); // Allow normal user applet update requests to resume + SystemApplet::lockRendering = false; + SystemApplet::lockRequests = false; + SystemApplet::handleInput = false; // Need to force an update, as a polite request wouldn't be honored, seeing how we are now in the background // Usually, onBackground is followed by another applet's onForeground (which requests update), but not in this case - windowManager->forceUpdate(EInk::UpdateTypes::FULL); -} - -int32_t InkHUD::LogoApplet::runOnce() -{ - LOG_DEBUG("Sent to background by timer"); - sendToBackground(); - return OSThread::disable(); -} - -// Begin displaying the screen which is shown at startup -// Suggest EInk::await after calling this method -void InkHUD::LogoApplet::showBootScreen() -{ - OSThread::setIntervalFromNow(8 * 1000UL); - OSThread::enabled = true; - - textLeft = ""; - textRight = ""; - textTitle = xstr(APP_VERSION_SHORT); - fontTitle = fontSmall; - - bringToForeground(); - requestUpdate(Drivers::EInk::UpdateTypes::FULL); // Already requested, just upgrading to FULL + inkhud->forceUpdate(EInk::UpdateTypes::FULL); } // Begin displaying the screen which is shown at shutdown -// Needs EInk::await after calling this method, to ensure display updates before shutdown -void InkHUD::LogoApplet::showShutdownScreen() +void InkHUD::LogoApplet::onShutdown() { textLeft = ""; textRight = ""; @@ -102,7 +80,13 @@ void InkHUD::LogoApplet::showShutdownScreen() fontTitle = fontLarge; bringToForeground(); - requestUpdate(Drivers::EInk::UpdateTypes::FULL); // Already requested, just upgrading to FULL + // This is then drawn by InkHUD::Events::onShutdown, with a blocking FULL update +} + +int32_t InkHUD::LogoApplet::runOnce() +{ + sendToBackground(); + return OSThread::disable(); } #endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.h b/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.h index aa1bf8b2c..b55d4a2d9 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.h +++ b/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.h @@ -12,24 +12,19 @@ #include "configuration.h" #include "concurrency/OSThread.h" -#include "graphics/niche/InkHUD/Applet.h" +#include "graphics/niche/InkHUD/SystemApplet.h" namespace NicheGraphics::InkHUD { -class LogoApplet : public Applet, public concurrency::OSThread +class LogoApplet : public SystemApplet, public concurrency::OSThread { public: LogoApplet(); void onRender() override; void onForeground() override; void onBackground() override; - - // Note: interacting directly with an applet like this is non-standard - // Only permitted because this is a "system applet", which has special behavior and interacts directly with WindowManager - - void showBootScreen(); - void showShutdownScreen(); + void onShutdown() override; protected: int32_t runOnce() override; @@ -38,8 +33,6 @@ class LogoApplet : public Applet, public concurrency::OSThread std::string textRight; std::string textTitle; AppletFont fontTitle; - - WindowManager *windowManager = nullptr; // For convenience }; } // namespace NicheGraphics::InkHUD diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp index d24ae59a5..7397f7e9f 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp @@ -2,9 +2,11 @@ #include "./MenuApplet.h" -#include "PowerStatus.h" #include "RTC.h" +#include "airtime.h" +#include "power.h" + using namespace NicheGraphics; static constexpr uint8_t MENU_TIMEOUT_SEC = 60; // How many seconds before menu auto-closes @@ -17,23 +19,16 @@ InkHUD::MenuApplet::MenuApplet() : concurrency::OSThread("MenuApplet") { // No timer tasks at boot OSThread::disable(); -} - -void InkHUD::MenuApplet::onActivate() -{ - // Grab pointers to some singleton components which the menu interacts with - // We could do this every time we needed them, in place, - // but this just makes the code tidier - - this->windowManager = WindowManager::getInstance(); // Note: don't get instance if we're not actually using the backlight, // or else you will unintentionally instantiate it - if (settings.optionalMenuItems.backlight) { + if (settings->optionalMenuItems.backlight) { backlight = Drivers::LatchingBacklight::getInstance(); } } +void InkHUD::MenuApplet::onActivate() {} + void InkHUD::MenuApplet::onForeground() { // We do need this before we render, but we can optimize by just calculating it once now @@ -45,21 +40,23 @@ void InkHUD::MenuApplet::onForeground() // If device has a backlight which isn't controlled by aux button: // backlight on always when menu opens. // Courtesy to T-Echo users who removed the capacitive touch button - if (settings.optionalMenuItems.backlight) { + if (settings->optionalMenuItems.backlight) { assert(backlight); if (!backlight->isOn()) backlight->peek(); } - // Prevent user applets requested update while menu is open - windowManager->lock(this); + // Prevent user applets requesting update while menu is open + // Handle button input with this applet + SystemApplet::lockRequests = true; + SystemApplet::handleInput = true; // Begin the auto-close timeout OSThread::setIntervalFromNow(MENU_TIMEOUT_SEC * 1000UL); OSThread::enabled = true; // Upgrade the refresh to FAST, for guaranteed responsiveness - windowManager->forceUpdate(EInk::UpdateTypes::FAST); + inkhud->forceUpdate(EInk::UpdateTypes::FAST); } void InkHUD::MenuApplet::onBackground() @@ -67,7 +64,7 @@ void InkHUD::MenuApplet::onBackground() // If device has a backlight which isn't controlled by aux button: // Item in options submenu allows keeping backlight on after menu is closed // If this item is deselected we will turn backlight off again, now that menu is closing - if (settings.optionalMenuItems.backlight) { + if (settings->optionalMenuItems.backlight) { assert(backlight); if (!backlight->isLatched()) backlight->off(); @@ -77,7 +74,8 @@ void InkHUD::MenuApplet::onBackground() OSThread::disable(); // Resume normal rendering and button behavior of user applets - windowManager->unlock(this); + SystemApplet::lockRequests = false; + SystemApplet::handleInput = false; // Restore the user applet whose tile we borrowed if (borrowedTileOwner) @@ -87,8 +85,8 @@ void InkHUD::MenuApplet::onBackground() borrowedTileOwner = nullptr; // Need to force an update, as a polite request wouldn't be honored, seeing how we are now in the background - // We're only updating here to ugrade from UNSPECIFIED to FAST, to ensure responsiveness when exiting menu - windowManager->forceUpdate(EInk::UpdateTypes::FAST); + // We're only updating here to upgrade from UNSPECIFIED to FAST, to ensure responsiveness when exiting menu + inkhud->forceUpdate(EInk::UpdateTypes::FAST); } // Open the menu @@ -140,43 +138,35 @@ void InkHUD::MenuApplet::execute(MenuItem item) break; case NEXT_TILE: - // Note performed manually; - // WindowManager::nextTile is raised by aux button press only, and will interact poorly with the menu - settings.userTiles.focused = (settings.userTiles.focused + 1) % settings.userTiles.count; - windowManager->changeLayout(); - cursor = 0; // No menu item selected, for quick exit after tile swap - cursorShown = false; + inkhud->nextTile(); break; case ROTATE: - settings.rotation = (settings.rotation + 1) % 4; - windowManager->changeLayout(); - // requestUpdate(Drivers::EInk::UpdateTypes::FULL); // Would update regardless; just selecting FULL + inkhud->rotate(); break; case LAYOUT: // Todo: smarter incrementing of tile count - settings.userTiles.count++; + settings->userTiles.count++; - if (settings.userTiles.count == 3) // Skip 3 tiles: not done yet - settings.userTiles.count++; + if (settings->userTiles.count == 3) // Skip 3 tiles: not done yet + settings->userTiles.count++; - if (settings.userTiles.count > settings.userTiles.maxCount) // Loop around if tile count now too high - settings.userTiles.count = 1; + if (settings->userTiles.count > settings->userTiles.maxCount) // Loop around if tile count now too high + settings->userTiles.count = 1; - windowManager->changeLayout(); - // requestUpdate(Drivers::EInk::UpdateTypes::FULL); // Would update regardless; just selecting FULL + inkhud->updateLayout(); break; case TOGGLE_APPLET: - settings.userApplets.active[cursor] = !settings.userApplets.active[cursor]; - windowManager->changeActivatedApplets(); + settings->userApplets.active[cursor] = !settings->userApplets.active[cursor]; + inkhud->updateAppletSelection(); // requestUpdate(Drivers::EInk::UpdateTypes::FULL); // Select FULL, seeing how this action doesn't auto exit break; case ACTIVATE_APPLETS: // Todo: remove this action? Already handled by TOGGLE_APPLET? - windowManager->changeActivatedApplets(); + inkhud->updateAppletSelection(); break; case TOGGLE_AUTOSHOW_APPLET: @@ -185,14 +175,14 @@ void InkHUD::MenuApplet::execute(MenuItem item) break; case TOGGLE_NOTIFICATIONS: - settings.optionalFeatures.notifications = !settings.optionalFeatures.notifications; + settings->optionalFeatures.notifications = !settings->optionalFeatures.notifications; break; case SET_RECENTS: // Set value of settings.recentlyActiveSeconds // Uses menu cursor to read RECENTS_OPTIONS_MINUTES array (defined at top of this file) assert(cursor < sizeof(RECENTS_OPTIONS_MINUTES) / sizeof(RECENTS_OPTIONS_MINUTES[0])); - settings.recentlyActiveSeconds = RECENTS_OPTIONS_MINUTES[cursor] * 60; // Menu items are in minutes + settings->recentlyActiveSeconds = RECENTS_OPTIONS_MINUTES[cursor] * 60; // Menu items are in minutes break; case SHUTDOWN: @@ -202,7 +192,7 @@ void InkHUD::MenuApplet::execute(MenuItem item) break; case TOGGLE_BATTERY_ICON: - windowManager->toggleBatteryIcon(); + inkhud->toggleBatteryIcon(); break; case TOGGLE_BACKLIGHT: @@ -233,13 +223,13 @@ void InkHUD::MenuApplet::showPage(MenuPage page) switch (page) { case ROOT: // Optional: next applet - if (settings.optionalMenuItems.nextTile && settings.userTiles.count > 1) + if (settings->optionalMenuItems.nextTile && settings->userTiles.count > 1) items.push_back(MenuItem("Next Tile", MenuAction::NEXT_TILE, MenuPage::ROOT)); // Only if multiple applets shown // items.push_back(MenuItem("Send", MenuPage::SEND)); // TODO items.push_back(MenuItem("Options", MenuPage::OPTIONS)); // items.push_back(MenuItem("Display Off", MenuPage::EXIT)); // TODO - items.push_back(MenuItem("Save & Shutdown", MenuAction::SHUTDOWN)); + items.push_back(MenuItem("Save & Shut Down", MenuAction::SHUTDOWN)); items.push_back(MenuItem("Exit", MenuPage::EXIT)); break; @@ -252,7 +242,7 @@ void InkHUD::MenuApplet::showPage(MenuPage page) case OPTIONS: // Optional: backlight - if (settings.optionalMenuItems.backlight) { + if (settings->optionalMenuItems.backlight) { assert(backlight); items.push_back(MenuItem(backlight->isLatched() ? "Backlight Off" : "Keep Backlight On", // Label MenuAction::TOGGLE_BACKLIGHT, // Action @@ -263,13 +253,13 @@ void InkHUD::MenuApplet::showPage(MenuPage page) items.push_back(MenuItem("Applets", MenuPage::APPLETS)); items.push_back(MenuItem("Auto-show", MenuPage::AUTOSHOW)); items.push_back(MenuItem("Recents Duration", MenuPage::RECENTS)); - if (settings.userTiles.maxCount > 1) + if (settings->userTiles.maxCount > 1) items.push_back(MenuItem("Layout", MenuAction::LAYOUT, MenuPage::OPTIONS)); items.push_back(MenuItem("Rotate", MenuAction::ROTATE, MenuPage::OPTIONS)); items.push_back(MenuItem("Notifications", MenuAction::TOGGLE_NOTIFICATIONS, MenuPage::OPTIONS, - &settings.optionalFeatures.notifications)); - items.push_back( - MenuItem("Battery Icon", MenuAction::TOGGLE_BATTERY_ICON, MenuPage::OPTIONS, &settings.optionalFeatures.batteryIcon)); + &settings->optionalFeatures.notifications)); + items.push_back(MenuItem("Battery Icon", MenuAction::TOGGLE_BATTERY_ICON, MenuPage::OPTIONS, + &settings->optionalFeatures.batteryIcon)); // TODO - GPS and Wifi switches /* @@ -329,9 +319,6 @@ void InkHUD::MenuApplet::onRender() if (items.size() == 0) LOG_ERROR("Empty Menu"); - // Testing only - setFont(fontSmall); - // Dimensions for the slots where we will draw menuItems const float padding = 0.05; const uint16_t itemH = fontSmall.lineHeight() * 2; @@ -397,7 +384,7 @@ void InkHUD::MenuApplet::onRender() // Testing only: circle instead of check box if (item.checkState) { - const uint16_t cbWH = fontSmall.lineHeight(); // Checbox: width / height + const uint16_t cbWH = fontSmall.lineHeight(); // Checkbox: width / height const int16_t cbL = itemR - X(padding) - cbWH; // Checkbox: left const int16_t cbT = center - (cbWH / 2); // Checkbox : top // Checkbox ticked @@ -463,9 +450,9 @@ void InkHUD::MenuApplet::populateAppletPage() { assert(items.size() == 0); - for (uint8_t i = 0; i < windowManager->getAppletCount(); i++) { - const char *name = windowManager->getAppletName(i); - bool *isActive = &(settings.userApplets.active[i]); + for (uint8_t i = 0; i < inkhud->userApplets.size(); i++) { + const char *name = inkhud->userApplets.at(i)->name; + bool *isActive = &(settings->userApplets.active[i]); items.push_back(MenuItem(name, MenuAction::TOGGLE_APPLET, MenuPage::APPLETS, isActive)); } } @@ -477,11 +464,11 @@ void InkHUD::MenuApplet::populateAutoshowPage() { assert(items.size() == 0); - for (uint8_t i = 0; i < windowManager->getAppletCount(); i++) { + for (uint8_t i = 0; i < inkhud->userApplets.size(); i++) { // Only add a menu item if applet is active - if (settings.userApplets.active[i]) { - const char *name = windowManager->getAppletName(i); - bool *isActive = &(settings.userApplets.autoshow[i]); + if (settings->userApplets.active[i]) { + const char *name = inkhud->userApplets.at(i)->name; + bool *isActive = &(settings->userApplets.autoshow[i]); items.push_back(MenuItem(name, MenuAction::TOGGLE_AUTOSHOW_APPLET, MenuPage::AUTOSHOW, isActive)); } } @@ -599,10 +586,10 @@ void InkHUD::MenuApplet::drawSystemInfoPanel(int16_t left, int16_t top, uint16_t // Get the height of the the panel drawn at the top of the menu // This is inefficient, as we do actually have to render the panel to determine the height -// It solves a catch-22 situtation, where slotCount needs to know panel height, and panel height needs to know slotCount +// It solves a catch-22 situation, where slotCount needs to know panel height, and panel height needs to know slotCount uint16_t InkHUD::MenuApplet::getSystemInfoPanelHeight() { - // Render *waay* off screen + // Render *far* off screen uint16_t height = 0; drawSystemInfoPanel(INT16_MIN, INT16_MIN, 1, &height); diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.h b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.h index f2e9b3947..fe72d826b 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.h +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.h @@ -3,8 +3,9 @@ #include "configuration.h" #include "graphics/niche/Drivers/Backlight/LatchingBacklight.h" -#include "graphics/niche/InkHUD/Applet.h" -#include "graphics/niche/InkHUD/WindowManager.h" +#include "graphics/niche/InkHUD/InkHUD.h" +#include "graphics/niche/InkHUD/Persistence.h" +#include "graphics/niche/InkHUD/SystemApplet.h" #include "./MenuItem.h" #include "./MenuPage.h" @@ -16,7 +17,7 @@ namespace NicheGraphics::InkHUD class Applet; -class MenuApplet : public Applet, public concurrency::OSThread +class MenuApplet : public SystemApplet, public concurrency::OSThread { public: MenuApplet(); @@ -30,6 +31,8 @@ class MenuApplet : public Applet, public concurrency::OSThread void show(Tile *t); // Open the menu, onto a user tile protected: + Drivers::LatchingBacklight *backlight = nullptr; // Convenient access to the backlight singleton + int32_t runOnce() override; void execute(MenuItem item); // Perform the MenuAction associated with a MenuItem, if any @@ -41,7 +44,7 @@ class MenuApplet : public Applet, public concurrency::OSThread void drawSystemInfoPanel(int16_t left, int16_t top, uint16_t width, uint16_t *height = nullptr); // Info panel at top of root menu - MenuPage currentPage; + MenuPage currentPage = MenuPage::ROOT; uint8_t cursor = 0; // Which menu item is currently highlighted bool cursorShown = false; // Is *any* item highlighted? (Root menu: no initial selection) @@ -50,9 +53,6 @@ class MenuApplet : public Applet, public concurrency::OSThread std::vector items; // MenuItems for the current page. Filled by ShowPage Applet *borrowedTileOwner = nullptr; // Which applet we have temporarily replaced while displaying menu - - WindowManager *windowManager = nullptr; // Convenient access to the InkHUD::WindowManager singleton - Drivers::LatchingBacklight *backlight = nullptr; // Convenient access to the backlight singleton }; } // namespace NicheGraphics::InkHUD diff --git a/src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.cpp index 886be84b5..aa702c032 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.cpp @@ -3,22 +3,20 @@ #include "./NotificationApplet.h" #include "./Notification.h" +#include "graphics/niche/InkHUD/Persistence.h" + +#include "meshUtils.h" +#include "modules/TextMessageModule.h" #include "RTC.h" using namespace NicheGraphics; -void InkHUD::NotificationApplet::onActivate() +InkHUD::NotificationApplet::NotificationApplet() { textMessageObserver.observe(textMessageModule); } -// Note: This applet probably won't ever be deactivated -void InkHUD::NotificationApplet::onDeactivate() -{ - textMessageObserver.unobserve(textMessageModule); -} - // Collect meta-info about the text message, and ask for approval for the notification // No need to save the message itself; we can use the cached InkHUD::latestMessage data during render() int InkHUD::NotificationApplet::onReceiveTextMessage(const meshtastic_MeshPacket *p) @@ -28,7 +26,7 @@ int InkHUD::NotificationApplet::onReceiveTextMessage(const meshtastic_MeshPacket // Abort if feature disabled // This is a bit clumsy, but avoids complicated handling when the feature is enabled / disabled - if (!settings.optionalFeatures.notifications) + if (!settings->optionalFeatures.notifications) return 0; // Abort if this is an outgoing message @@ -36,7 +34,7 @@ int InkHUD::NotificationApplet::onReceiveTextMessage(const meshtastic_MeshPacket return 0; // Abort if message was only an "emoji reaction" - // Possibly some implemetation of this in future? + // Possibly some implementation of this in future? if (p->decoded.emoji) return 0; @@ -55,13 +53,16 @@ int InkHUD::NotificationApplet::onReceiveTextMessage(const meshtastic_MeshPacket n.sender = p->from; } + // Close an old notification, if shown + dismiss(); + // Check if we should display the notification // A foreground applet might already be displaying this info hasNotification = true; currentNotification = n; if (isApproved()) { bringToForeground(); - WindowManager::getInstance()->forceUpdate(); + inkhud->forceUpdate(); } else hasNotification = false; // Clear the pending notification: it was rejected @@ -76,8 +77,6 @@ void InkHUD::NotificationApplet::onRender() // We do need to do this with the battery though, as it is an "overlay" fillRect(0, 0, width(), height(), WHITE); - setFont(fontSmall); - // Padding (horizontal) const uint16_t padW = 4; @@ -137,6 +136,28 @@ void InkHUD::NotificationApplet::onRender() printThick(textM, height() / 2, text, 2, 1); } +void InkHUD::NotificationApplet::onForeground() +{ + handleInput = true; // Intercept the button input for our applet, so we can dismiss the notification +} + +void InkHUD::NotificationApplet::onBackground() +{ + handleInput = false; +} + +void InkHUD::NotificationApplet::onButtonShortPress() +{ + dismiss(); + inkhud->forceUpdate(EInk::UpdateTypes::FULL); +} + +void InkHUD::NotificationApplet::onButtonLongPress() +{ + dismiss(); + inkhud->forceUpdate(EInk::UpdateTypes::FULL); +} + // Ask the WindowManager to check whether any displayed applets are already displaying the info from this notification // Called internally when we first get a "notifiable event", and then again before render, // in case autoshow swapped which applet was displayed @@ -148,7 +169,13 @@ bool InkHUD::NotificationApplet::isApproved() return false; } - return WindowManager::getInstance()->approveNotification(currentNotification); + // Ask all visible user applets for approval + for (Applet *ua : inkhud->userApplets) { + if (ua->isForeground() && !ua->approveNotification(currentNotification)) + return false; + } + + return true; } // Mark that the notification should no-longer be rendered @@ -180,7 +207,8 @@ std::string InkHUD::NotificationApplet::getNotificationText(uint16_t widthAvaila bool isBroadcast = currentNotification.type == Notification::Type::NOTIFICATION_MESSAGE_BROADCAST; // Pick source of message - MessageStore::Message *message = isBroadcast ? &latestMessage.broadcast : &latestMessage.dm; + MessageStore::Message *message = + isBroadcast ? &inkhud->persistence->latestMessage.broadcast : &inkhud->persistence->latestMessage.dm; // Find info about the sender meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(message->sender); diff --git a/src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.h b/src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.h index c4d36a4fd..66df784b4 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.h +++ b/src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.h @@ -3,7 +3,7 @@ /* Pop-up notification bar, on screen top edge -Displays information we feel is important, but which is not shown on currently focussed applet(s) +Displays information we feel is important, but which is not shown on currently focused applet(s) E.g.: messages, while viewing map, etc Feature should be optional; enable disable via on-screen menu @@ -16,17 +16,21 @@ Feature should be optional; enable disable via on-screen menu #include "concurrency/OSThread.h" -#include "graphics/niche/InkHUD/Applet.h" +#include "graphics/niche/InkHUD/SystemApplet.h" namespace NicheGraphics::InkHUD { -class NotificationApplet : public Applet +class NotificationApplet : public SystemApplet { public: + NotificationApplet(); + void onRender() override; - void onActivate() override; - void onDeactivate() override; + void onForeground() override; + void onBackground() override; + void onButtonShortPress() override; + void onButtonLongPress() override; int onReceiveTextMessage(const meshtastic_MeshPacket *p); @@ -40,8 +44,8 @@ class NotificationApplet : public Applet std::string getNotificationText(uint16_t widthAvailable); // Get text for notification, to suit screen width - bool hasNotification = false; // Only used for assert. Todo: remove? - Notification currentNotification; // Set when something notification-worthy happens. Used by render() + bool hasNotification = false; // Only used for assert. Todo: remove? + Notification currentNotification = Notification(); // Set when something notification-worthy happens. Used by render() }; } // namespace NicheGraphics::InkHUD diff --git a/src/graphics/niche/InkHUD/Applets/System/Pairing/PairingApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Pairing/PairingApplet.cpp index 457fa0f3f..81de05b30 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Pairing/PairingApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/System/Pairing/PairingApplet.cpp @@ -6,8 +6,7 @@ using namespace NicheGraphics; InkHUD::PairingApplet::PairingApplet() { - // Grab the window manager singleton, for convenience - windowManager = WindowManager::getInstance(); + bluetoothStatusObserver.observe(&bluetoothStatus->onNewStatus); } void InkHUD::PairingApplet::onRender() @@ -31,34 +30,22 @@ void InkHUD::PairingApplet::onRender() printAt(X(0.5), Y(0.75), name, CENTER, MIDDLE); } -void InkHUD::PairingApplet::onActivate() -{ - bluetoothStatusObserver.observe(&bluetoothStatus->onNewStatus); -} - -void InkHUD::PairingApplet::onDeactivate() -{ - bluetoothStatusObserver.unobserve(&bluetoothStatus->onNewStatus); -} - void InkHUD::PairingApplet::onForeground() { - // If another applet has locked the display, ask it to exit - Applet *other = windowManager->whoLocked(); - if (other != nullptr) - other->sendToBackground(); - - windowManager->claimFullscreen(this); // Take ownership of the fullscreen tile - windowManager->lock(this); // Prevent user applets from requesting update + // Prevent most other applets from requesting update, and skip their rendering entirely + // Another system applet with a higher precedence can potentially ignore this + SystemApplet::lockRendering = true; + SystemApplet::lockRequests = true; } void InkHUD::PairingApplet::onBackground() { - windowManager->releaseFullscreen(); // Relinquish ownership of the fullscreen tile - windowManager->unlock(this); // Allow normal user applet update requests to resume + // Allow normal update behavior to resume + SystemApplet::lockRendering = false; + SystemApplet::lockRequests = false; // Need to force an update, as a polite request wouldn't be honored, seeing how we are now in the background // Usually, onBackground is followed by another applet's onForeground (which requests update), but not in this case - windowManager->forceUpdate(EInk::UpdateTypes::FULL); + inkhud->forceUpdate(EInk::UpdateTypes::FULL); } int InkHUD::PairingApplet::onBluetoothStatusUpdate(const meshtastic::Status *status) @@ -75,12 +62,6 @@ int InkHUD::PairingApplet::onBluetoothStatusUpdate(const meshtastic::Status *sta // Store the passkey for rendering passkey = bluetoothStatus->getPasskey(); - // Make sure no other system applets have a lock on the display - // Boot screen, menu, etc - Applet *lockOwner = windowManager->whoLocked(); - if (lockOwner) - lockOwner->sendToBackground(); - // Show pairing screen bringToForeground(); } diff --git a/src/graphics/niche/InkHUD/Applets/System/Pairing/PairingApplet.h b/src/graphics/niche/InkHUD/Applets/System/Pairing/PairingApplet.h index ce420e68b..b89783a25 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Pairing/PairingApplet.h +++ b/src/graphics/niche/InkHUD/Applets/System/Pairing/PairingApplet.h @@ -10,19 +10,19 @@ #include "configuration.h" -#include "graphics/niche/InkHUD/Applet.h" +#include "graphics/niche/InkHUD/SystemApplet.h" + +#include "main.h" namespace NicheGraphics::InkHUD { -class PairingApplet : public Applet +class PairingApplet : public SystemApplet { public: PairingApplet(); void onRender() override; - void onActivate() override; - void onDeactivate() override; void onForeground() override; void onBackground() override; @@ -34,8 +34,6 @@ class PairingApplet : public Applet CallbackObserver(this, &PairingApplet::onBluetoothStatusUpdate); std::string passkey = ""; // Passkey. Six digits, possibly with leading zeros - - WindowManager *windowManager = nullptr; // For convenience. Set in constructor. }; } // namespace NicheGraphics::InkHUD diff --git a/src/graphics/niche/InkHUD/Applets/System/Placeholder/PlaceholderApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Placeholder/PlaceholderApplet.cpp index 4f66593b9..99cdeb0ac 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Placeholder/PlaceholderApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/System/Placeholder/PlaceholderApplet.cpp @@ -4,14 +4,6 @@ using namespace NicheGraphics; -InkHUD::PlaceholderApplet::PlaceholderApplet() -{ - // Because this applet sometimes gets processed as if it were a bonafide user applet, - // it's probably better that we do give it a human readable name, just in case it comes up later. - // For genuine user applets, this is set by WindowManager::addApplet - Applet::name = "Placeholder"; -} - void InkHUD::PlaceholderApplet::onRender() { // This placeholder applet fills its area with sparse diagonal lines diff --git a/src/graphics/niche/InkHUD/Applets/System/Placeholder/PlaceholderApplet.h b/src/graphics/niche/InkHUD/Applets/System/Placeholder/PlaceholderApplet.h index e5106105c..78ba5cd89 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Placeholder/PlaceholderApplet.h +++ b/src/graphics/niche/InkHUD/Applets/System/Placeholder/PlaceholderApplet.h @@ -9,20 +9,19 @@ Fills the area with diagonal lines #include "configuration.h" -#include "graphics/niche/InkHUD/Applet.h" +#include "graphics/niche/InkHUD/SystemApplet.h" namespace NicheGraphics::InkHUD { -class PlaceholderApplet : public Applet +class PlaceholderApplet : public SystemApplet { public: - PlaceholderApplet(); void onRender() override; // Note: onForeground, onBackground, and wantsToRender are not meaningful for this applet. // The window manager decides when and where it should be rendered - // It may be drawn to several different tiles during on WindowManager::render call + // It may be drawn to several different tiles during an Renderer::render call }; } // namespace NicheGraphics::InkHUD diff --git a/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.cpp index e6b5b5dc9..1abf3ccfa 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.cpp @@ -2,12 +2,44 @@ #include "./TipsApplet.h" +#include "graphics/niche/InkHUD/Persistence.h" + +#include "main.h" + using namespace NicheGraphics; InkHUD::TipsApplet::TipsApplet() { - // Grab the window manager singleton, for convenience - windowManager = WindowManager::getInstance(); + // Decide which tips (if any) should be shown to user after the boot screen + + // Welcome screen + if (settings->tips.firstBoot) + tipQueue.push_back(Tip::WELCOME); + + // Antenna, region, timezone + // Shown at boot if region not yet set + if (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET) + tipQueue.push_back(Tip::FINISH_SETUP); + + // Shutdown info + // Shown until user performs one valid shutdown + if (!settings->tips.safeShutdownSeen) + tipQueue.push_back(Tip::SAFE_SHUTDOWN); + + // Using the UI + if (settings->tips.firstBoot) { + tipQueue.push_back(Tip::CUSTOMIZATION); + tipQueue.push_back(Tip::BUTTONS); + } + + // Catch an incorrect attempt at rotating display + if (config.display.flip_screen) + tipQueue.push_back(Tip::ROTATION); + + // Applet is foreground immediately at boot, but is obscured by LogoApplet, which is also foreground + // LogoApplet can be considered to have a higher Z-index, because it is placed before TipsApplet in the systemApplets vector + if (!tipQueue.empty()) + bringToForeground(); } void InkHUD::TipsApplet::onRender() @@ -53,7 +85,7 @@ void InkHUD::TipsApplet::onRender() setFont(fontSmall); std::string shutdown; - shutdown += "Before removing power, please shutdown from InkHUD menu, or a client app. \n"; + shutdown += "Before removing power, please shut down from InkHUD menu, or a client app. \n"; shutdown += "\n"; shutdown += "This ensures data is saved."; printWrapped(0, fontLarge.lineHeight() * 1.5, width(), shutdown); @@ -153,51 +185,31 @@ void InkHUD::TipsApplet::renderWelcome() printAt(X(0.5), Y(1), "Press button to continue", CENTER, BOTTOM); } -// Grab fullscreen tile, and lock the window manager, when applet is shown void InkHUD::TipsApplet::onForeground() { - windowManager->lock(this); - windowManager->claimFullscreen(this); + // Prevent most other applets from requesting update, and skip their rendering entirely + // Another system applet with a higher precedence can potentially ignore this + SystemApplet::lockRendering = true; + SystemApplet::lockRequests = true; + + SystemApplet::handleInput = true; // Our applet should handle button input (unless another system applet grabs it first) } void InkHUD::TipsApplet::onBackground() { - windowManager->releaseFullscreen(); - windowManager->unlock(this); + // Allow normal update behavior to resume + SystemApplet::lockRendering = false; + SystemApplet::lockRequests = false; + SystemApplet::handleInput = false; + + // Need to force an update, as a polite request wouldn't be honored, seeing how we are now in the background + // Usually, onBackground is followed by another applet's onForeground (which requests update), but not in this case + inkhud->forceUpdate(EInk::UpdateTypes::FULL); } -void InkHUD::TipsApplet::onActivate() -{ - // Decide which tips (if any) should be shown to user after the boot screen +void InkHUD::TipsApplet::onActivate() {} - // Welcome screen - if (settings.tips.firstBoot) - tipQueue.push_back(Tip::WELCOME); - - // Antenna, region, timezone - // Shown at boot if region not yet set - if (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET) - tipQueue.push_back(Tip::FINISH_SETUP); - - // Shutdown info - // Shown until user performs one valid shutdown - if (!settings.tips.safeShutdownSeen) - tipQueue.push_back(Tip::SAFE_SHUTDOWN); - - // Using the UI - if (settings.tips.firstBoot) { - tipQueue.push_back(Tip::CUSTOMIZATION); - tipQueue.push_back(Tip::BUTTONS); - } - - // Catch an incorrect attempt at rotating display - if (config.display.flip_screen) - tipQueue.push_back(Tip::ROTATION); - - // Applet will be brought to foreground when boot screen closes, via TipsApplet::onLockAvailable -} - -// While our applet has the window manager locked, we will receive the button input +// While our SystemApplet::handleInput flag is true void InkHUD::TipsApplet::onButtonShortPress() { tipQueue.pop_front(); @@ -206,15 +218,15 @@ void InkHUD::TipsApplet::onButtonShortPress() if (tipQueue.empty()) { // Record that user has now seen the "tutorial" set of tips // Don't show them on subsequent boots - if (settings.tips.firstBoot) { - settings.tips.firstBoot = false; - saveDataToFlash(); + if (settings->tips.firstBoot) { + settings->tips.firstBoot = false; + inkhud->persistence->saveSettings(); } // Close applet, and full refresh to clean the screen // Need to force update, because our request would be ignored otherwise, as we are now background sendToBackground(); - windowManager->forceUpdate(EInk::UpdateTypes::FULL); + inkhud->forceUpdate(EInk::UpdateTypes::FULL); } // More tips left @@ -222,13 +234,4 @@ void InkHUD::TipsApplet::onButtonShortPress() requestUpdate(); } -// If the wm lock has just become availale (rendering, input), and we've still got tips, grab it! -// This situation would arise if bluetooth pairing occurs while TipsApplet was already shown (after pairing) -// Note: this event is only raised when *other* applets unlock the window manager -void InkHUD::TipsApplet::onLockAvailable() -{ - if (!tipQueue.empty()) - bringToForeground(); -} - #endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.h b/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.h index 29bcdfa8b..e7bb7bedc 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.h +++ b/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.h @@ -12,12 +12,12 @@ #include "configuration.h" -#include "graphics/niche/InkHUD/Applet.h" +#include "graphics/niche/InkHUD/SystemApplet.h" namespace NicheGraphics::InkHUD { -class TipsApplet : public Applet +class TipsApplet : public SystemApplet { protected: enum class Tip { @@ -37,7 +37,6 @@ class TipsApplet : public Applet void onForeground() override; void onBackground() override; void onButtonShortPress() override; - void onLockAvailable() override; // Reopen if interrupted by bluetooth pairing protected: void renderWelcome(); // Very first screen of tutorial diff --git a/src/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.cpp b/src/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.cpp index 1ae313d8a..f7e2a8e9d 100644 --- a/src/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.cpp @@ -41,14 +41,12 @@ int InkHUD::AllMessageApplet::onReceiveTextMessage(const meshtastic_MeshPacket * void InkHUD::AllMessageApplet::onRender() { - setFont(fontSmall); - // Find newest message, regardless of whether DM or broadcast MessageStore::Message *message; - if (latestMessage.wasBroadcast) - message = &latestMessage.broadcast; + if (latestMessage->wasBroadcast) + message = &latestMessage->broadcast; else - message = &latestMessage.dm; + message = &latestMessage->dm; // Short circuit: no text message if (!message->sender) { diff --git a/src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.cpp b/src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.cpp index 526b86901..7a1d14f32 100644 --- a/src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.cpp @@ -44,10 +44,8 @@ int InkHUD::DMApplet::onReceiveTextMessage(const meshtastic_MeshPacket *p) void InkHUD::DMApplet::onRender() { - setFont(fontSmall); - // Abort if no text message - if (!latestMessage.dm.sender) { + if (!latestMessage->dm.sender) { printAt(X(0.5), Y(0.5), "No DMs", CENTER, MIDDLE); return; } @@ -63,7 +61,7 @@ void InkHUD::DMApplet::onRender() // RX Time // - if valid - std::string timeString = getTimeString(latestMessage.dm.timestamp); + std::string timeString = getTimeString(latestMessage->dm.timestamp); if (timeString.length() > 0) { header += timeString; header += ": "; @@ -72,14 +70,14 @@ void InkHUD::DMApplet::onRender() // Sender's id // - shortname, if available, or // - node id - meshtastic_NodeInfoLite *sender = nodeDB->getMeshNode(latestMessage.dm.sender); + meshtastic_NodeInfoLite *sender = nodeDB->getMeshNode(latestMessage->dm.sender); if (sender && sender->has_user) { header += sender->user.short_name; header += " ("; header += sender->user.long_name; header += ")"; } else - header += hexifyNodeNum(latestMessage.dm.sender); + header += hexifyNodeNum(latestMessage->dm.sender); // Draw a "standard" applet header drawHeader(header); @@ -103,14 +101,14 @@ void InkHUD::DMApplet::onRender() // Determine size if printed large setFont(fontLarge); - uint32_t textHeight = getWrappedTextHeight(0, width(), latestMessage.dm.text); + uint32_t textHeight = getWrappedTextHeight(0, width(), latestMessage->dm.text); // If too large, swap to small font if (textHeight + textTop > (uint32_t)height()) // (compare signed and unsigned) setFont(fontSmall); // Print text - printWrapped(0, textTop, width(), latestMessage.dm.text); + printWrapped(0, textTop, width(), latestMessage->dm.text); } // Don't show notifications for direct messages when our applet is displayed diff --git a/src/graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.h b/src/graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.h index 5bcec339d..28a53cb0f 100644 --- a/src/graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.h +++ b/src/graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.h @@ -29,13 +29,13 @@ class PositionsApplet : public MapApplet, public SinglePortModule protected: ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override; - NodeNum lastFrom; // Sender of most recent (non-local) position packet - float lastLat; - float lastLng; - float lastHopsAway; + NodeNum lastFrom = 0; // Sender of most recent (non-local) position packet + float lastLat = 0.0; + float lastLng = 0.0; + float lastHopsAway = 0; - float ourLastLat; // Info about the most recent (non-local) position packet - float ourLastLng; // Info about most recent *local* position + float ourLastLat = 0.0; // Info about the most recent (non-local) position packet + float ourLastLng = 0.0; // Info about most recent *local* position }; } // namespace NicheGraphics::InkHUD diff --git a/src/graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.cpp b/src/graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.cpp index 54e67efef..02aa4a721 100644 --- a/src/graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.cpp @@ -122,7 +122,7 @@ bool InkHUD::RecentsListApplet::isActive(uint32_t seenAtMs) uint32_t now = millis(); uint32_t secsAgo = (now - seenAtMs) / 1000UL; // millis() overflow safe - return (secsAgo < settings.recentlyActiveSeconds); + return (secsAgo < settings->recentlyActiveSeconds); } // Text to be shown at top of applet @@ -134,7 +134,7 @@ std::string InkHUD::RecentsListApplet::getHeaderText() // Print the length of our "Recents" time-window text += "Last "; - text += to_string(settings.recentlyActiveSeconds / 60); + text += to_string(settings->recentlyActiveSeconds / 60); text += " mins"; // Print the node count diff --git a/src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.cpp b/src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.cpp index d81dd020c..d7d2e79c8 100644 --- a/src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.cpp @@ -23,8 +23,6 @@ InkHUD::ThreadedMessageApplet::ThreadedMessageApplet(uint8_t channelIndex) : cha void InkHUD::ThreadedMessageApplet::onRender() { - setFont(fontSmall); - // ============= // Draw a header // ============= diff --git a/src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h b/src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h index 5bb8bf96e..3e11a25f2 100644 --- a/src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h +++ b/src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h @@ -33,7 +33,7 @@ class Applet; class ThreadedMessageApplet : public Applet { public: - ThreadedMessageApplet(uint8_t channelIndex); + explicit ThreadedMessageApplet(uint8_t channelIndex); ThreadedMessageApplet() = delete; void onRender() override; diff --git a/src/graphics/niche/InkHUD/UpdateMediator.cpp b/src/graphics/niche/InkHUD/DisplayHealth.cpp similarity index 61% rename from src/graphics/niche/InkHUD/UpdateMediator.cpp rename to src/graphics/niche/InkHUD/DisplayHealth.cpp index 16fc21cef..e8849b72e 100644 --- a/src/graphics/niche/InkHUD/UpdateMediator.cpp +++ b/src/graphics/niche/InkHUD/DisplayHealth.cpp @@ -1,46 +1,73 @@ #ifdef MESHTASTIC_INCLUDE_INKHUD -#include "./UpdateMediator.h" - -#include "./WindowManager.h" +#include "./DisplayHealth.h" +#include "DisplayHealth.h" using namespace NicheGraphics; +// Timing for "maintenance" +// Paying off full-refresh debt with unprovoked updates, if the display is not very active static constexpr uint32_t MAINTENANCE_MS_INITIAL = 60 * 1000UL; static constexpr uint32_t MAINTENANCE_MS = 60 * 60 * 1000UL; -InkHUD::UpdateMediator::UpdateMediator() : concurrency::OSThread("Mediator") +InkHUD::DisplayHealth::DisplayHealth() : concurrency::OSThread("Mediator") { // Timer disabled by default OSThread::disable(); } -// Ask which type of update operation we should perform -// Even if we explicitly want a FAST or FULL update, we should pass it through this method, -// as it allows UpdateMediator to count the refreshes. -// Internal "maintenance" refreshes are not passed through evaluate, however. -Drivers::EInk::UpdateTypes InkHUD::UpdateMediator::evaluate(Drivers::EInk::UpdateTypes requested) +// Request which update type we would prefer, when the display image next changes +// DisplayHealth class will consider our suggestion, and weigh it against other requests +void InkHUD::DisplayHealth::requestUpdateType(Drivers::EInk::UpdateTypes type) +{ + // Update our "working decision", to decide if this request is important enough to change our plan + if (!forced) + workingDecision = prioritize(workingDecision, type); +} + +// Demand that a specific update type be used, when the display image next changes +// Note: multiple DisplayHealth::force calls should not be made, +// but if they are, the importance of the type will be weighed the same as if both calls were to DisplayHealth::request +void InkHUD::DisplayHealth::forceUpdateType(Drivers::EInk::UpdateTypes type) +{ + if (!forced) + workingDecision = type; + else + workingDecision = prioritize(workingDecision, type); + + forced = true; +} + +// Find out which update type the DisplayHealth has chosen for us +// Calling this method consumes the result, and resets for the next update +Drivers::EInk::UpdateTypes InkHUD::DisplayHealth::decideUpdateType() { LOG_DEBUG("FULL-update debt:%f", debt); - // For conveninece + // For convenience typedef Drivers::EInk::UpdateTypes UpdateTypes; + // Grab our final decision for the update type, so we can reset now, for the next update + // We do this at top of the method, so we can return early + UpdateTypes finalDecision = workingDecision; + workingDecision = UpdateTypes::UNSPECIFIED; + forced = false; + // Check whether we've paid off enough debt to stop unprovoked refreshing (if in progress) - // This maintenance behavior will also halt itself when the timer next fires, + // This maintenance behavior will also have opportunity to halt itself when the timer next fires, // but that could be an hour away, so we can stop it early here and free up resources if (OSThread::enabled && debt == 0.0) endMaintenance(); // Explicitly requested FULL - if (requested == UpdateTypes::FULL) { + if (finalDecision == UpdateTypes::FULL) { LOG_DEBUG("Explicit FULL"); debt = max(debt - 1.0, 0.0); // Record that we have paid back (some of) the FULL refresh debt return UpdateTypes::FULL; } // Explicitly requested FAST - if (requested == UpdateTypes::FAST) { + if (finalDecision == UpdateTypes::FAST) { LOG_DEBUG("Explicit FAST"); // Add to the FULL refresh debt if (debt < 1.0) @@ -49,7 +76,8 @@ Drivers::EInk::UpdateTypes InkHUD::UpdateMediator::evaluate(Drivers::EInk::Updat debt += stressMultiplier * (1.0 / fastPerFull); // More debt if too many consecutive FAST refreshes // If *significant debt*, begin occasionally refreshing *unprovoked* - // This maintenance behavior is only triggered here, during periods of user interaction + // This maintenance behavior is only triggered here, by periods of user interaction + // Debt would otherwise not be able to climb above 1.0 if (debt >= 2.0) beginMaintenance(); @@ -75,10 +103,8 @@ Drivers::EInk::UpdateTypes InkHUD::UpdateMediator::evaluate(Drivers::EInk::Updat // When maintenance begins, the first refresh happens shortly after user interaction ceases (a minute or so) // If we *are* given an opportunity to refresh before that, we'll skip that initial maintenance refresh // We were intending to use that initial refresh to redraw the screen as FULL, but we're doing that now, organically - if (OSThread::enabled && OSThread::interval == MAINTENANCE_MS_INITIAL) { - LOG_DEBUG("Initial maintenance skipped"); + if (OSThread::enabled && OSThread::interval == MAINTENANCE_MS_INITIAL) OSThread::setInterval(MAINTENANCE_MS); // Note: not intervalFromNow - } return UpdateTypes::FULL; } @@ -86,8 +112,9 @@ Drivers::EInk::UpdateTypes InkHUD::UpdateMediator::evaluate(Drivers::EInk::Updat // Determine which of two update types is more important to honor // Explicit FAST is more important than UNSPECIFIED - prioritize responsiveness -// Explicit FULL is more important than explicint FAST - prioritize image quality: explicit FULL is rare -Drivers::EInk::UpdateTypes InkHUD::UpdateMediator::prioritize(Drivers::EInk::UpdateTypes type1, Drivers::EInk::UpdateTypes type2) +// Explicit FULL is more important than explicit FAST - prioritize image quality: explicit FULL is rare +// Used when multiple applets have all requested update simultaneously, each with their own preferred UpdateType +Drivers::EInk::UpdateTypes InkHUD::DisplayHealth::prioritize(Drivers::EInk::UpdateTypes type1, Drivers::EInk::UpdateTypes type2) { switch (type1) { case Drivers::EInk::UpdateTypes::UNSPECIFIED: @@ -104,20 +131,20 @@ Drivers::EInk::UpdateTypes InkHUD::UpdateMediator::prioritize(Drivers::EInk::Upd } // We're using the timer to perform "maintenance" -// If signifcant FULL-refresh debt has accumulated, we will occasionally run FULL refreshes unprovoked. +// If significant FULL-refresh debt has accumulated, we will occasionally run FULL refreshes unprovoked. // This prevents gradual build-up of debt, -// in case we don't have enough UNSPECIFIED refreshes to pay the debt back organically. +// in case we aren't doing enough UNSPECIFIED refreshes to pay the debt back organically. // The first refresh takes place shortly after user finishes interacting with the device; this does the bulk of the restoration // Subsequent refreshes take place *much* less frequently. // Hopefully an applet will want to render before this, meaning we can cancel the maintenance. -int32_t InkHUD::UpdateMediator::runOnce() +int32_t InkHUD::DisplayHealth::runOnce() { if (debt > 0.0) { LOG_DEBUG("debt=%f: performing maintenance", debt); // Ask WindowManager to redraw everything, purely for the refresh // Todo: optimize? Could update without re-rendering - WindowManager::getInstance()->forceUpdate(EInk::UpdateTypes::FULL); + InkHUD::getInstance()->forceUpdate(Drivers::EInk::UpdateTypes::FULL); // Record that we have paid back (some of) the FULL refresh debt debt = max(debt - 1.0, 0.0); @@ -134,17 +161,15 @@ int32_t InkHUD::UpdateMediator::runOnce() // We do this in case user doesn't have enough activity to repay it organically, with UpdateTypes::UNSPECIFIED // After an initial refresh, to redraw as FULL, we only perform these maintenance refreshes very infrequently // This gives the display a chance to heal by evaluating UNSPECIFIED as FULL, which is preferable -void InkHUD::UpdateMediator::beginMaintenance() +void InkHUD::DisplayHealth::beginMaintenance() { - LOG_DEBUG("Maintenance enabled"); OSThread::setIntervalFromNow(MAINTENANCE_MS_INITIAL); OSThread::enabled = true; } // FULL-refresh debt is low enough that we no longer need to pay it back with periodic updates -int32_t InkHUD::UpdateMediator::endMaintenance() +int32_t InkHUD::DisplayHealth::endMaintenance() { - LOG_DEBUG("Maintenance disabled"); return OSThread::disable(); } diff --git a/src/graphics/niche/InkHUD/UpdateMediator.h b/src/graphics/niche/InkHUD/DisplayHealth.h similarity index 56% rename from src/graphics/niche/InkHUD/UpdateMediator.h rename to src/graphics/niche/InkHUD/DisplayHealth.h index e4c7c6786..2bd887f9d 100644 --- a/src/graphics/niche/InkHUD/UpdateMediator.h +++ b/src/graphics/niche/InkHUD/DisplayHealth.h @@ -2,7 +2,8 @@ /* -Responsible for display health +Responsible for maintaining display health, by optimizing the ratio of FAST vs FULL refreshes + - counts number of FULL vs FAST refresh - suggests whether to use FAST or FULL, when not explicitly specified - periodically requests update unprovoked, if required for display health @@ -13,21 +14,21 @@ Responsible for display health #include "configuration.h" +#include "InkHUD.h" + #include "graphics/niche/Drivers/EInk/EInk.h" namespace NicheGraphics::InkHUD { -class UpdateMediator : protected concurrency::OSThread +class DisplayHealth : protected concurrency::OSThread { public: - UpdateMediator(); + DisplayHealth(); - // Tell the mediator what we want, get told what we can have - Drivers::EInk::UpdateTypes evaluate(Drivers::EInk::UpdateTypes requested); - - // Determine which of two update types is more important to honor - Drivers::EInk::UpdateTypes prioritize(Drivers::EInk::UpdateTypes type1, Drivers::EInk::UpdateTypes type2); + void requestUpdateType(Drivers::EInk::UpdateTypes type); + void forceUpdateType(Drivers::EInk::UpdateTypes type); + Drivers::EInk::UpdateTypes decideUpdateType(); uint8_t fastPerFull = 5; // Ideal number of fast refreshes between full refreshes float stressMultiplier = 2.0; // How bad for the display are extra fast refreshes beyond fastPerFull? @@ -37,6 +38,13 @@ class UpdateMediator : protected concurrency::OSThread void beginMaintenance(); // Excessive debt: begin unprovoked refreshing of display, for health int32_t endMaintenance(); // End unprovoked refreshing: debt paid + Drivers::EInk::UpdateTypes + prioritize(Drivers::EInk::UpdateTypes type1, + Drivers::EInk::UpdateTypes type2); // Determine which of two update types is more important to honor + + bool forced = false; + Drivers::EInk::UpdateTypes workingDecision = Drivers::EInk::UpdateTypes::UNSPECIFIED; + float debt = 0.0; // How many full refreshes are due }; diff --git a/src/graphics/niche/InkHUD/Events.cpp b/src/graphics/niche/InkHUD/Events.cpp new file mode 100644 index 000000000..10072b302 --- /dev/null +++ b/src/graphics/niche/InkHUD/Events.cpp @@ -0,0 +1,179 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./Events.h" + +#include "RTC.h" +#include "modules/TextMessageModule.h" +#include "sleep.h" + +#include "./Applet.h" +#include "./SystemApplet.h" + +using namespace NicheGraphics; + +InkHUD::Events::Events() +{ + // Get convenient references + inkhud = InkHUD::getInstance(); + settings = &inkhud->persistence->settings; +} + +void InkHUD::Events::begin() +{ + // Register our callbacks for the various events + + deepSleepObserver.observe(¬ifyDeepSleep); + rebootObserver.observe(¬ifyReboot); + textMessageObserver.observe(textMessageModule); +#ifdef ARCH_ESP32 + lightSleepObserver.observe(¬ifyLightSleep); +#endif +} + +void InkHUD::Events::onButtonShort() +{ + // Check which system applet wants to handle the button press (if any) + SystemApplet *consumer = nullptr; + for (SystemApplet *sa : inkhud->systemApplets) { + if (sa->handleInput) { + consumer = sa; + break; + } + } + + // If no system applet is handling input, default behavior instead is to cycle applets + if (consumer) + consumer->onButtonShortPress(); + else + inkhud->nextApplet(); +} + +void InkHUD::Events::onButtonLong() +{ + // Check which system applet wants to handle the button press (if any) + SystemApplet *consumer = nullptr; + for (SystemApplet *sa : inkhud->systemApplets) { + if (sa->handleInput) { + consumer = sa; + break; + } + } + + // If no system applet is handling input, default behavior instead is to open the menu + if (consumer) + consumer->onButtonLongPress(); + else + inkhud->openMenu(); +} + +// Callback for deepSleepObserver +// Returns 0 to signal that we agree to sleep now +int InkHUD::Events::beforeDeepSleep(void *unused) +{ + // Notify all applets that we're shutting down + for (Applet *ua : inkhud->userApplets) { + ua->onDeactivate(); + ua->onShutdown(); + } + for (SystemApplet *sa : inkhud->systemApplets) { + // Note: no onDeactivate. System applets are always active. + sa->onShutdown(); + } + + // User has successful executed a safe shutdown + // We don't need to nag at boot anymore + settings->tips.safeShutdownSeen = true; + + inkhud->persistence->saveSettings(); + inkhud->persistence->saveLatestMessage(); + + // LogoApplet::onShutdown will have requested an update, to draw the shutdown screen + // Draw that now, and wait here until the update is complete + inkhud->forceUpdate(Drivers::EInk::UpdateTypes::FULL, false); + + return 0; // We agree: deep sleep now +} + +// Callback for rebootObserver +// Same as shutdown, without drawing the logoApplet +// Makes sure we don't lose message history / InkHUD config +int InkHUD::Events::beforeReboot(void *unused) +{ + + // Notify all applets that we're "shutting down" + // They don't need to know that it's really a reboot + for (Applet *a : inkhud->userApplets) { + a->onDeactivate(); + a->onShutdown(); + } + for (Applet *sa : inkhud->systemApplets) { + // Note: no onDeactivate. System applets are always active. + sa->onShutdown(); + } + + inkhud->persistence->saveSettings(); + inkhud->persistence->saveLatestMessage(); + + // Note: no forceUpdate call here + // Because OSThread will not be given another chance to run before reboot, this means that no display update will occur + + return 0; // No special status to report. Ignored anyway by this Observable +} + +// Callback when a new text message is received +// Caches the most recently received message, for use by applets +// Rx does not trigger a save to flash, however the data *will* be saved alongside other during shutdown, etc. +// Note: this is different from devicestate.rx_text_message, which may contain an *outgoing* message +int InkHUD::Events::onReceiveTextMessage(const meshtastic_MeshPacket *packet) +{ + // Short circuit: don't store outgoing messages + if (getFrom(packet) == nodeDB->getNodeNum()) + return 0; + + // Short circuit: don't store "emoji reactions" + // Possibly some implementation of this in future? + if (packet->decoded.emoji) + return 0; + + // Determine whether the message is broadcast or a DM + // Store this info to prevent confusion after a reboot + // Avoids need to compare timestamps, because of situation where "future" messages block newly received, if time not set + inkhud->persistence->latestMessage.wasBroadcast = isBroadcast(packet->to); + + // Pick the appropriate variable to store the message in + MessageStore::Message *storedMessage = inkhud->persistence->latestMessage.wasBroadcast + ? &inkhud->persistence->latestMessage.broadcast + : &inkhud->persistence->latestMessage.dm; + + // Store nodenum of the sender + // Applets can use this to fetch user data from nodedb, if they want + storedMessage->sender = packet->from; + + // Store the time (epoch seconds) when message received + storedMessage->timestamp = getValidTime(RTCQuality::RTCQualityDevice, true); // Current RTC time + + // Store the channel + // - (potentially) used to determine whether notification shows + // - (potentially) used to determine which applet to focus + storedMessage->channelIndex = packet->channel; + + // Store the text + // Need to specify manually how many bytes, because source not null-terminated + storedMessage->text = + std::string(&packet->decoded.payload.bytes[0], &packet->decoded.payload.bytes[packet->decoded.payload.size]); + + return 0; // Tell caller to continue notifying other observers. (No reason to abort this event) +} + +#ifdef ARCH_ESP32 +// Callback for lightSleepObserver +// Make sure the display is not partway through an update when we begin light sleep +// This is because some displays require active input from us to terminate the update process, and protect the panel hardware +int InkHUD::Events::beforeLightSleep(void *unused) +{ + inkhud->awaitUpdate(); + return 0; // No special status to report. Ignored anyway by this Observable +} +#endif + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Events.h b/src/graphics/niche/InkHUD/Events.h new file mode 100644 index 000000000..6a6e9d7a2 --- /dev/null +++ b/src/graphics/niche/InkHUD/Events.h @@ -0,0 +1,63 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#pragma once + +/* + +Handles non-specific events for InkHUD + +Individual applets are responsible for listening for their own events via the module api etc, +however this class handles general events which concern InkHUD as a whole, e.g. shutdown + +*/ + +#include "configuration.h" + +#include "Observer.h" + +#include "./InkHUD.h" +#include "./Persistence.h" + +namespace NicheGraphics::InkHUD +{ + +class Events +{ + public: + Events(); + void begin(); + + void onButtonShort(); // User button: short press + void onButtonLong(); // User button: long press + + int beforeDeepSleep(void *unused); // Prepare for shutdown + int beforeReboot(void *unused); // Prepare for reboot + int onReceiveTextMessage(const meshtastic_MeshPacket *packet); // Store most recent text message +#ifdef ARCH_ESP32 + int beforeLightSleep(void *unused); // Prepare for light sleep +#endif + + private: + // For convenience + InkHUD *inkhud = nullptr; + Persistence::Settings *settings = nullptr; + + // Get notified when the system is shutting down + CallbackObserver deepSleepObserver = CallbackObserver(this, &Events::beforeDeepSleep); + + // Get notified when the system is rebooting + CallbackObserver rebootObserver = CallbackObserver(this, &Events::beforeReboot); + + // Cache *incoming* text messages, for use by applets + CallbackObserver textMessageObserver = + CallbackObserver(this, &Events::onReceiveTextMessage); + +#ifdef ARCH_ESP32 + // Get notified when the system is entering light sleep + CallbackObserver lightSleepObserver = CallbackObserver(this, &Events::beforeLightSleep); +#endif +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/InkHUD.cpp b/src/graphics/niche/InkHUD/InkHUD.cpp new file mode 100644 index 000000000..90b6718e0 --- /dev/null +++ b/src/graphics/niche/InkHUD/InkHUD.cpp @@ -0,0 +1,218 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./InkHUD.h" + +#include "./Applet.h" +#include "./Events.h" +#include "./Persistence.h" +#include "./Renderer.h" +#include "./SystemApplet.h" +#include "./Tile.h" +#include "./WindowManager.h" + +using namespace NicheGraphics; + +// Get or create the singleton +InkHUD::InkHUD *InkHUD::InkHUD::getInstance() +{ + // Create the singleton instance of our class, if not yet done + static InkHUD *instance = nullptr; + if (!instance) { + instance = new InkHUD; + + instance->persistence = new Persistence; + instance->windowManager = new WindowManager; + instance->renderer = new Renderer; + instance->events = new Events; + } + + return instance; +} + +// Connect the (fully set-up) E-Ink driver to InkHUD +// Should happen in your variant's nicheGraphics.h file, before InkHUD::begin is called +void InkHUD::InkHUD::setDriver(Drivers::EInk *driver) +{ + renderer->setDriver(driver); +} + +// Set the target number of FAST display updates in a row, before a FULL update is used for display health +// This value applies only to updates with an UNSPECIFIED update type +// If explicitly requested FAST updates exceed this target, the stressMultiplier parameter determines how many +// subsequent FULL updates will be performed, in an attempt to restore the display's health +void InkHUD::InkHUD::setDisplayResilience(uint8_t fastPerFull, float stressMultiplier) +{ + renderer->setDisplayResilience(fastPerFull, stressMultiplier); +} + +// Register a user applet with InkHUD +// A variant's nicheGraphics.h file should instantiate your chosen applets, then pass them to this method +// Passing an applet to this method is all that is required to make it available to the user in your InkHUD build +void InkHUD::InkHUD::addApplet(const char *name, Applet *a, bool defaultActive, bool defaultAutoshow, uint8_t onTile) +{ + windowManager->addApplet(name, a, defaultActive, defaultAutoshow, onTile); +} + +// Start InkHUD! +// Call this only after you have configured InkHUD +void InkHUD::InkHUD::begin() +{ + persistence->loadSettings(); + persistence->loadLatestMessage(); + + windowManager->begin(); + events->begin(); + renderer->begin(); + // LogoApplet shows boot screen here +} + +// Call this when your user button gets a short press +// Should be connected to an input source in nicheGraphics.h (NicheGraphics::Inputs::TwoButton?) +void InkHUD::InkHUD::shortpress() +{ + events->onButtonShort(); +} + +// Call this when your user button gets a long press +// Should be connected to an input source in nicheGraphics.h (NicheGraphics::Inputs::TwoButton?) +void InkHUD::InkHUD::longpress() +{ + events->onButtonLong(); +} + +// Cycle the next user applet to the foreground +// Only activated applets are cycled +// If user has a multi-applet layout, the applets will cycle on the "focused tile" +void InkHUD::InkHUD::nextApplet() +{ + windowManager->nextApplet(); +} + +// Show the menu (on the the focused tile) +// The applet previously displayed there will be restored once the menu closes +void InkHUD::InkHUD::openMenu() +{ + windowManager->openMenu(); +} + +// In layouts where multiple applets are shown at once, change which tile is focused +// The focused tile in the one which cycles applets on button short press, and displays menu on long press +void InkHUD::InkHUD::nextTile() +{ + windowManager->nextTile(); +} + +// Rotate the display image by 90 degrees +void InkHUD::InkHUD::rotate() +{ + windowManager->rotate(); +} + +// Show / hide the battery indicator in top-right +void InkHUD::InkHUD::toggleBatteryIcon() +{ + windowManager->toggleBatteryIcon(); +} + +// An applet asking for the display to be updated +// This does not occur immediately +// Instead, rendering is scheduled ASAP, for the next Renderer::runOnce call +// This allows multiple applets to observe the same event, and then share the same opportunity to update +// Applets should requestUpdate, whether or not they are currently displayed ("foreground") +// This is because they *might* be automatically brought to foreground by WindowManager::autoshow +void InkHUD::InkHUD::requestUpdate() +{ + renderer->requestUpdate(); +} + +// Demand that the display be updated +// Ignores all diplomacy: +// - the display *will* update +// - the specified update type *will* be used +// If the async parameter is false, code flow is blocked while the update takes place +void InkHUD::InkHUD::forceUpdate(EInk::UpdateTypes type, bool async) +{ + renderer->forceUpdate(type, async); +} + +// Wait for any in-progress display update to complete before continuing +void InkHUD::InkHUD::awaitUpdate() +{ + renderer->awaitUpdate(); +} + +// Ask the window manager to potentially bring a different user applet to foreground +// An applet will be brought to foreground if it has just received new and relevant info +// For Example: AllMessagesApplet has just received a new text message +// Permission for this autoshow behavior is granted by the user, on an applet-by-applet basis +// If autoshow brings an applet to foreground, an InkHUD notification will not be generated for the same event +void InkHUD::InkHUD::autoshow() +{ + windowManager->autoshow(); +} + +// Tell the window manager that the Persistence::Settings value for applet activation has changed, +// and that it should reconfigure accordingly. +// This is triggered at boot, or when the user enables / disabled applets via the on-screen menu +void InkHUD::InkHUD::updateAppletSelection() +{ + windowManager->changeActivatedApplets(); +} + +// Tell the window manager that the Persistence::Settings value for layout or rotation has changed, +// and that it should reconfigure accordingly. +// This is triggered at boot, or by rotate / layout options in the on-screen menu +void InkHUD::InkHUD::updateLayout() +{ + windowManager->changeLayout(); +} + +// Width of the display, in the context of the current rotation +uint16_t InkHUD::InkHUD::width() +{ + return renderer->width(); +} + +// Height of the display, in the context of the current rotation +uint16_t InkHUD::InkHUD::height() +{ + return renderer->height(); +} + +// A collection of any user tiles which do not have a valid user applet +// This can occur in various situations, such as when a user enables fewer applets than their layout has tiles +// The tiles (and which regions the occupy) are private information of the window manager +// The renderer needs to know which regions (if any) are empty, +// in order to fill them with a "placeholder" pattern. +// -- There may be a tidier way to accomplish this -- +std::vector InkHUD::InkHUD::getEmptyTiles() +{ + return windowManager->getEmptyTiles(); +} + +// Get a system applet by its name +// This isn't particularly elegant, but it does avoid: +// - passing around a big set of references +// - having two sets of references (systemApplet vector for iteration) +InkHUD::SystemApplet *InkHUD::InkHUD::getSystemApplet(const char *name) +{ + for (SystemApplet *sa : systemApplets) { + if (strcmp(name, sa->name) == 0) + return sa; + } + + assert(false); // Invalid name +} + +// Place a pixel into the image buffer +// The x and y coordinates are in the context of the current display rotation +// - Applets pass "relative" pixels to tiles +// - Tiles pass translated pixels to this method +// - this methods (Renderer) places rotated pixels into the image buffer +// This method provides the final formatting step required. The image buffer is suitable for writing to display +void InkHUD::InkHUD::drawPixel(int16_t x, int16_t y, Color c) +{ + renderer->handlePixel(x, y, c); +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/InkHUD.h b/src/graphics/niche/InkHUD/InkHUD.h new file mode 100644 index 000000000..13839ea22 --- /dev/null +++ b/src/graphics/niche/InkHUD/InkHUD.h @@ -0,0 +1,110 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + + InkHUD's main class + - singleton + - mediator between the various components + +*/ + +#pragma once + +#include "configuration.h" + +#include "graphics/niche/Drivers/EInk/EInk.h" + +#include "./AppletFont.h" + +#include + +namespace NicheGraphics::InkHUD +{ + +// Color, understood by display controller IC (as bit values) +// Also suitable for use as AdafruitGFX colors +enum Color : uint8_t { + BLACK = 0, + WHITE = 1, +}; + +class Applet; +class Events; +class Persistence; +class Renderer; +class SystemApplet; +class Tile; +class WindowManager; + +class InkHUD +{ + public: + static InkHUD *getInstance(); // Access to this singleton class + + // Configuration + // - before InkHUD::begin, in variant nicheGraphics.h, + + void setDriver(Drivers::EInk *driver); + void setDisplayResilience(uint8_t fastPerFull = 5, float stressMultiplier = 2.0); + void addApplet(const char *name, Applet *a, bool defaultActive = false, bool defaultAutoshow = false, uint8_t onTile = -1); + + void begin(); + + // Handle user-button press + // - connected to an input source, in variant nicheGraphics.h + + void shortpress(); + void longpress(); + + // Trigger UI changes + // - called by various InkHUD components + // - suitable(?) for use by aux button, connected in variant nicheGraphics.h + + void nextApplet(); + void openMenu(); + void nextTile(); + void rotate(); + void toggleBatteryIcon(); + + // Updating the display + // - called by various InkHUD components + + void requestUpdate(); + void forceUpdate(Drivers::EInk::UpdateTypes type = Drivers::EInk::UpdateTypes::UNSPECIFIED, bool async = true); + void awaitUpdate(); + + // (Re)configuring WindowManager + + void autoshow(); // Bring an applet to foreground + void updateAppletSelection(); // Change which applets are active + void updateLayout(); // Change multiplexing (count, rotation) + + // Information passed between components + + uint16_t width(); // From E-Ink driver + uint16_t height(); // From E-Ink driver + std::vector getEmptyTiles(); // From WindowManager + + // Applets + + SystemApplet *getSystemApplet(const char *name); + std::vector userApplets; + std::vector systemApplets; + + // Pass drawing output to Renderer + void drawPixel(int16_t x, int16_t y, Color c); + + // Shared data which persists between boots + Persistence *persistence = nullptr; + + private: + InkHUD() {} // Constructor made private to force use of InkHUD::getInstance + + Events *events = nullptr; // Handle non-specific firmware events + Renderer *renderer = nullptr; // Co-ordinate display updates + WindowManager *windowManager = nullptr; // Multiplexing of applets +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/MessageStore.h b/src/graphics/niche/InkHUD/MessageStore.h index 3cf7d0f68..745c3b2eb 100644 --- a/src/graphics/niche/InkHUD/MessageStore.h +++ b/src/graphics/niche/InkHUD/MessageStore.h @@ -31,7 +31,7 @@ class MessageStore }; MessageStore() = delete; - MessageStore(std::string label); // Label determines filename in flash + explicit MessageStore(std::string label); // Label determines filename in flash void saveToFlash(); void loadFromFlash(); diff --git a/src/graphics/niche/InkHUD/Persistence.cpp b/src/graphics/niche/InkHUD/Persistence.cpp index 6e8ac0458..20909f2dc 100644 --- a/src/graphics/niche/InkHUD/Persistence.cpp +++ b/src/graphics/niche/InkHUD/Persistence.cpp @@ -5,17 +5,21 @@ using namespace NicheGraphics; // Load settings and latestMessage data -void InkHUD::loadDataFromFlash() +void InkHUD::Persistence::loadSettings() { // Load the InkHUD settings from flash, and check version number // We should only consider the version number if the InkHUD flashdata component reports that we *did* actually load flash data - InkHUD::Settings loadedSettings; + Settings loadedSettings; bool loadSucceeded = FlashData::load(&loadedSettings, "settings"); if (loadSucceeded && loadedSettings.meta.version == SETTINGS_VERSION && loadedSettings.meta.version != 0) settings = loadedSettings; // Version matched, replace the defaults with the loaded values else LOG_WARN("Settings version changed. Using defaults"); +} +// Load settings and latestMessage data +void InkHUD::Persistence::loadLatestMessage() +{ // Load previous "latestMessages" data from flash MessageStore store("latest"); store.loadFromFlash(); @@ -32,12 +36,15 @@ void InkHUD::loadDataFromFlash() } } -// Save settings and latestMessage data -void InkHUD::saveDataToFlash() +// Save the InkHUD settings to flash +void InkHUD::Persistence::saveSettings() { - // Save the InkHUD settings to flash FlashData::save(&settings, "settings"); +} +// Save latestMessage data to flash +void InkHUD::Persistence::saveLatestMessage() +{ // Number of strings saved determines whether last message was broadcast or dm MessageStore store("latest"); store.messages.push_back(latestMessage.dm); @@ -46,14 +53,31 @@ void InkHUD::saveDataToFlash() store.saveToFlash(); } -// Holds InkHUD settings while running -// Saved back to Flash at shutdown -// Accessed by including persistence.h -InkHUD::Settings InkHUD::settings; +/* +void InkHUD::Persistence::printSettings(Settings *settings) +{ + if (SETTINGS_VERSION != 2) + LOG_WARN("Persistence::printSettings was written for SETTINGS_VERSION=2, current is %d", SETTINGS_VERSION); -// Holds copies of the most recent broadcast and DM messages while running -// Saved to Flash at shutdown -// Accessed by including persistence.h -InkHUD::LatestMessage InkHUD::latestMessage; + LOG_DEBUG("meta.version=%d", settings->meta.version); + LOG_DEBUG("userTiles.count=%d", settings->userTiles.count); + LOG_DEBUG("userTiles.maxCount=%d", settings->userTiles.maxCount); + LOG_DEBUG("userTiles.focused=%d", settings->userTiles.focused); + for (uint8_t i = 0; i < MAX_TILES_GLOBAL; i++) + LOG_DEBUG("userTiles.displayedUserApplet[%d]=%d", i, settings->userTiles.displayedUserApplet[i]); + for (uint8_t i = 0; i < MAX_USERAPPLETS_GLOBAL; i++) + LOG_DEBUG("userApplets.active[%d]=%d", i, settings->userApplets.active[i]); + for (uint8_t i = 0; i < MAX_USERAPPLETS_GLOBAL; i++) + LOG_DEBUG("userApplets.autoshow[%d]=%d", i, settings->userApplets.autoshow[i]); + LOG_DEBUG("optionalFeatures.notifications=%d", settings->optionalFeatures.notifications); + LOG_DEBUG("optionalFeatures.batteryIcon=%d", settings->optionalFeatures.batteryIcon); + LOG_DEBUG("optionalMenuItems.nextTile=%d", settings->optionalMenuItems.nextTile); + LOG_DEBUG("optionalMenuItems.backlight=%d", settings->optionalMenuItems.backlight); + LOG_DEBUG("tips.firstBoot=%d", settings->tips.firstBoot); + LOG_DEBUG("tips.safeShutdownSeen=%d", settings->tips.safeShutdownSeen); + LOG_DEBUG("rotation=%d", settings->rotation); + LOG_DEBUG("recentlyActiveSeconds=%d", settings->recentlyActiveSeconds); +} +*/ #endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Persistence.h b/src/graphics/niche/InkHUD/Persistence.h index e2daa02d9..28841d4d9 100644 --- a/src/graphics/niche/InkHUD/Persistence.h +++ b/src/graphics/niche/InkHUD/Persistence.h @@ -14,110 +14,119 @@ The save / load mechanism is a shared NicheGraphics feature. #include "configuration.h" +#include "./InkHUD.h" #include "graphics/niche/FlashData.h" #include "graphics/niche/InkHUD/MessageStore.h" namespace NicheGraphics::InkHUD { -constexpr uint8_t MAX_TILES_GLOBAL = 4; -constexpr uint8_t MAX_USERAPPLETS_GLOBAL = 16; +class Persistence +{ + public: + static constexpr uint8_t MAX_TILES_GLOBAL = 4; + static constexpr uint8_t MAX_USERAPPLETS_GLOBAL = 16; -// Used to invalidate old settings, if needed -// Version 0 is reserved for testing, and will always load defaults -constexpr uint32_t SETTINGS_VERSION = 2; + // Used to invalidate old settings, if needed + // Version 0 is reserved for testing, and will always load defaults + static constexpr uint32_t SETTINGS_VERSION = 2; -struct Settings { - struct Meta { - // Used to invalidate old savefiles, if we make breaking changes - uint32_t version = SETTINGS_VERSION; - } meta; + struct Settings { + struct Meta { + // Used to invalidate old savefiles, if we make breaking changes + uint32_t version = SETTINGS_VERSION; + } meta; - struct UserTiles { - // How many tiles are shown - uint8_t count = 1; + struct UserTiles { + // How many tiles are shown + uint8_t count = 1; - // Maximum amount of tiles for this display - uint8_t maxCount = 4; + // Maximum amount of tiles for this display + uint8_t maxCount = 4; - // Which tile is focused (responding to user button input) - uint8_t focused = 0; + // Which tile is focused (responding to user button input) + uint8_t focused = 0; - // Which applet is displayed on which tile - // Index of array: which tile, as indexed in WindowManager::tiles - // Value of array: which applet, as indexed in WindowManager::activeApplets - uint8_t displayedUserApplet[MAX_TILES_GLOBAL] = {0, 1, 2, 3}; - } userTiles; + // Which applet is displayed on which tile + // Index of array: which tile, as indexed in WindowManager::userTiles + // Value of array: which applet, as indexed in InkHUD::userApplets + uint8_t displayedUserApplet[MAX_TILES_GLOBAL] = {0, 1, 2, 3}; + } userTiles; - struct UserApplets { - // Which applets are running (either displayed, or in the background) - // Index of array: which applet, as indexed in WindowManager::applets - // Initial value is set by the "activeByDefault" parameter of WindowManager::addApplet, in setupNicheGraphics() - bool active[MAX_USERAPPLETS_GLOBAL]; + struct UserApplets { + // Which applets are running (either displayed, or in the background) + // Index of array: which applet, as indexed in InkHUD::userApplets + // Initial value is set by the "activeByDefault" parameter of InkHUD::addApplet, in setupNicheGraphics method + bool active[MAX_USERAPPLETS_GLOBAL]{false}; - // Which user applets should be automatically shown when they have important data to show - // If none set, foreground applets should remain foreground without manual user input - // If multiple applets request this at once, - // priority is the order which they were passed to WindowManager::addApplets, in setupNicheGraphics() - bool autoshow[MAX_USERAPPLETS_GLOBAL]{false}; - } userApplets; + // Which user applets should be automatically shown when they have important data to show + // If none set, foreground applets should remain foreground without manual user input + // If multiple applets request this at once, + // priority is the order which they were passed to InkHUD::addApplets, in setupNicheGraphics method + bool autoshow[MAX_USERAPPLETS_GLOBAL]{false}; + } userApplets; - // Features which the use can enable / disable via the on-screen menu - struct OptionalFeatures { - bool notifications = true; - bool batteryIcon = false; - } optionalFeatures; + // Features which the user can enable / disable via the on-screen menu + struct OptionalFeatures { + bool notifications = true; + bool batteryIcon = false; + } optionalFeatures; - // Some menu items may not be required, based on device / configuration - // We can enable them only when needed, to de-clutter the menu - struct OptionalMenuItems { - // If aux button is used to swap between tiles, we have to need for this menu item - bool nextTile = true; + // Some menu items may not be required, based on device / configuration + // We can enable them only when needed, to de-clutter the menu + struct OptionalMenuItems { + // If aux button is used to swap between tiles, we have no need for this menu item + bool nextTile = true; - // Used if backlight present, and not controlled by AUX button - // If this item is added to menu: backlight is always active when menu is open - // The added menu items then allows the user to "Keep Backlight On", globally. - bool backlight = false; - } optionalMenuItems; + // Used if backlight present, and not controlled by AUX button + // If this item is added to menu: backlight is always active when menu is open + // The added menu items then allows the user to "Keep Backlight On", globally. + bool backlight = false; + } optionalMenuItems; - // Allows tips to be run once only - struct Tips { - // Enables the longer "tutorial" shown only on first boot - // Once tutorial has been completed, it is no longer shown - bool firstBoot = true; + // Allows tips to be run once only + struct Tips { + // Enables the longer "tutorial" shown only on first boot + // Once tutorial has been completed, it is no longer shown + bool firstBoot = true; - // User is advised to shutdown before removing device power - // Once user executes a shutdown (either via menu or client app), - // this tip is no longer shown - bool safeShutdownSeen = false; - } tips; + // User is advised to shut down before removing device power + // Once user executes a shutdown (either via menu or client app), + // this tip is no longer shown + bool safeShutdownSeen = false; + } tips; - // Rotation of the display - // Multiples of 90 degrees clockwise - // Most commonly: rotation is 0 when flex connector is oriented below display - uint8_t rotation = 1; + // Rotation of the display + // Multiples of 90 degrees clockwise + // Most commonly: rotation is 0 when flex connector is oriented below display + uint8_t rotation = 1; - // How long do we consider another node to be "active"? - // Used when applets want to filter for "active nodes" only - uint32_t recentlyActiveSeconds = 2 * 60; + // How long do we consider another node to be "active"? + // Used when applets want to filter for "active nodes" only + uint32_t recentlyActiveSeconds = 2 * 60; + }; + + // Most recently received text message + // Value is updated by InkHUD::WindowManager, as a courtesy to applets + // Note: different from devicestate.rx_text_message, + // which may contain an *outgoing message* to broadcast + struct LatestMessage { + MessageStore::Message broadcast; // Most recent message received broadcast + MessageStore::Message dm; // Most recent received DM + bool wasBroadcast; // True if most recent broadcast is newer than most recent dm + }; + + void loadSettings(); + void saveSettings(); + void loadLatestMessage(); + void saveLatestMessage(); + + // void printSettings(Settings *settings); // Debugging use only + + Settings settings; + LatestMessage latestMessage; }; -// Most recently received text message -// Value is updated by InkHUD::WindowManager, as a courtesty to applets -// Note: different from devicestate.rx_text_message, -// which may contain an *outgoing message* to broadcast -struct LatestMessage { - MessageStore::Message broadcast; // Most recent message received broadcast - MessageStore::Message dm; // Most recent received DM - bool wasBroadcast; // True if most recent broadcast is newer than most recent dm -}; - -extern Settings settings; -extern LatestMessage latestMessage; - -void loadDataFromFlash(); -void saveDataToFlash(); - } // namespace NicheGraphics::InkHUD #endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/PlatformioConfig.ini b/src/graphics/niche/InkHUD/PlatformioConfig.ini index 0a70f1d0e..cab0ea7bc 100644 --- a/src/graphics/niche/InkHUD/PlatformioConfig.ini +++ b/src/graphics/niche/InkHUD/PlatformioConfig.ini @@ -1,5 +1,7 @@ [inkhud] -build_src_filter = +<../variants/$PIOENV> +; Include nicheGraphics.h +build_src_filter = + +; Include the nicheGraphics directory + +<../variants/$PIOENV>; Include nicheGraphics.h from our variant folder build_flags = -D MESHTASTIC_INCLUDE_NICHE_GRAPHICS ; Use NicheGraphics -D MESHTASTIC_INCLUDE_INKHUD ; Use InkHUD (a NicheGraphics UI) diff --git a/src/graphics/niche/InkHUD/Renderer.cpp b/src/graphics/niche/InkHUD/Renderer.cpp new file mode 100644 index 000000000..c058c4126 --- /dev/null +++ b/src/graphics/niche/InkHUD/Renderer.cpp @@ -0,0 +1,412 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +#include "./Renderer.h" + +#include "main.h" + +#include "./Applet.h" +#include "./SystemApplet.h" +#include "./Tile.h" + +using namespace NicheGraphics; + +InkHUD::Renderer::Renderer() : concurrency::OSThread("Renderer") +{ + // Nothing for the timer to do just yet + OSThread::disable(); + + // Convenient references + inkhud = InkHUD::getInstance(); + settings = &inkhud->persistence->settings; +} + +// Connect the (fully set-up) E-Ink driver to InkHUD +// Should happen in your variant's nicheGraphics.h file, before InkHUD::begin is called +void InkHUD::Renderer::setDriver(Drivers::EInk *driver) +{ + // Make sure not already set + if (this->driver) { + LOG_ERROR("Driver already set"); + delay(2000); // Wait for native serial.. + assert(false); + } + + // Store the driver which was created in setupNicheGraphics() + this->driver = driver; + + // Determine the dimensions of the image buffer, in bytes. + // Along rows, pixels are stored 8 per byte. + // Not all display widths are divisible by 8. Need to make sure bytecount accommodates padding for these. + imageBufferWidth = ((driver->width - 1) / 8) + 1; + imageBufferHeight = driver->height; + + // Allocate the image buffer + imageBuffer = new uint8_t[imageBufferWidth * imageBufferHeight]; +} + +// Set the target number of FAST display updates in a row, before a FULL update is used for display health +// This value applies only to updates with an UNSPECIFIED update type +// If explicitly requested FAST updates exceed this target, the stressMultiplier parameter determines how many +// subsequent FULL updates will be performed, in an attempt to restore the display's health +void InkHUD::Renderer::setDisplayResilience(uint8_t fastPerFull, float stressMultiplier) +{ + displayHealth.fastPerFull = fastPerFull; + displayHealth.stressMultiplier = stressMultiplier; +} + +void InkHUD::Renderer::begin() +{ + forceUpdate(Drivers::EInk::UpdateTypes::FULL, false); +} + +// Set a flag, which will be picked up by runOnce, ASAP. +// Quite likely, multiple applets will all want to respond to one event (Observable, etc) +// Each affected applet can independently call requestUpdate(), and all share the one opportunity to render, at next runOnce +void InkHUD::Renderer::requestUpdate() +{ + requested = true; + + // We will run the thread as soon as we loop(), + // after all Applets have had a chance to observe whatever event set this off + OSThread::setIntervalFromNow(0); + OSThread::enabled = true; + runASAP = true; +} + +// requestUpdate will not actually update if no requests were made by applets which are actually visible +// This can occur, because applets requestUpdate even from the background, +// in case the user's autoshow settings permit them to be moved to foreground. +// Sometimes, however, we will want to trigger a display update manually, in the absence of any sort of applet event +// Display health, for example. +// In these situations, we use forceUpdate +void InkHUD::Renderer::forceUpdate(Drivers::EInk::UpdateTypes type, bool async) +{ + requested = true; + forced = true; + displayHealth.forceUpdateType(type); + + // Normally, we need to start the timer, in case the display is busy and we briefly defer the update + if (async) { + // We will run the thread as soon as we loop(), + // after all Applets have had a chance to observe whatever event set this off + OSThread::setIntervalFromNow(0); + OSThread::enabled = true; + runASAP = true; + } + + // If the update is *not* asynchronous, we begin the render process directly here + // so that it can block code flow while running + else + render(false); +} + +// Wait for any in-progress display update to complete before continuing +void InkHUD::Renderer::awaitUpdate() +{ + if (driver->busy()) { + LOG_INFO("Waiting for display"); + driver->await(); // Wait here for update to complete + } +} + +// Set a ready-to-draw pixel into the image buffer +// All rotations / translations have already taken place: this buffer data is formatted ready for the driver +void InkHUD::Renderer::handlePixel(int16_t x, int16_t y, Color c) +{ + rotatePixelCoords(&x, &y); + + uint32_t byteNum = (y * imageBufferWidth) + (x / 8); // X data is 8 pixels per byte + uint8_t bitNum = 7 - (x % 8); // Invert order: leftmost bit (most significant) is leftmost pixel of byte. + + bitWrite(imageBuffer[byteNum], bitNum, c); +} + +// Width of the display, relative to rotation +uint16_t InkHUD::Renderer::width() +{ + if (settings->rotation % 2) + return driver->height; + else + return driver->width; +} + +// Height of the display, relative to rotation +uint16_t InkHUD::Renderer::height() +{ + if (settings->rotation % 2) + return driver->width; + else + return driver->height; +} + +// Runs at regular intervals +// - postponing render: until next loop(), allowing all applets to be notified of some Mesh event before render +// - queuing another render: while one is already is progress +int32_t InkHUD::Renderer::runOnce() +{ + // If an applet asked to render, and hardware is able, lets try now + if (requested && !driver->busy()) { + render(); + } + + // If our render() call failed, try again shortly + // otherwise, stop our thread until next update due + if (requested) + return 250UL; + else + return OSThread::disable(); +} + +// Applies the system-wide rotation to pixel positions +// This step is applied to image data which has already been translated by a Tile object +// This is the final step before the pixel is placed into the image buffer +// No return: values of the *x and *y parameters are modified by the method +void InkHUD::Renderer::rotatePixelCoords(int16_t *x, int16_t *y) +{ + // Apply a global rotation to pixel locations + int16_t x1 = 0; + int16_t y1 = 0; + switch (settings->rotation) { + case 0: + x1 = *x; + y1 = *y; + break; + case 1: + x1 = (driver->width - 1) - *y; + y1 = *x; + break; + case 2: + x1 = (driver->width - 1) - *x; + y1 = (driver->height - 1) - *y; + break; + case 3: + x1 = *y; + y1 = (driver->height - 1) - *x; + break; + } + *x = x1; + *y = y1; +} + +// Make an attempt to gather image data from some / all applets, and update the display +// Might not be possible right now, if update already is progress. +void InkHUD::Renderer::render(bool async) +{ + // Make sure the display is ready for a new update + if (async) { + // Previous update still running, Will try again shortly, via runOnce() + if (driver->busy()) + return; + } else { + // Wait here for previous update to complete + driver->await(); + } + + // Determine if a system applet has requested exclusive rights to request an update, + // or exclusive rights to render + checkLocks(); + + // (Potentially) change applet to display new info, + // then check if this newly displayed applet makes a pending notification redundant + inkhud->autoshow(); + + // If an update is justified. + // We don't know this until after autoshow has run, as new applets may now be in foreground + if (shouldUpdate()) { + + // Decide which technique the display will use to change image + // Done early, as rendering resets the Applets' requested types + Drivers::EInk::UpdateTypes updateType = decideUpdateType(); + + // Render the new image + clearBuffer(); + renderUserApplets(); + renderPlaceholders(); + renderSystemApplets(); + + // Tell display to begin process of drawing new image + LOG_INFO("Updating display"); + driver->update(imageBuffer, updateType); + + // If not async, wait here until the update is complete + if (!async) + driver->await(); + } + + // Our part is done now. + // If update is async, the display hardware is still performing the update process, + // but that's all handled by NicheGraphics::Drivers::EInk + + // Tidy up, ready for a new request + requested = false; + forced = false; +} + +// Manually fill the image buffer with WHITE +// Clears any old drawing +// Note: benchmarking revealed that this is *much* faster than setting pixels individually +// So much so that it's more efficient to re-render all applets, +// rather than rendering selectively, and manually blanking a portion of the display +void InkHUD::Renderer::clearBuffer() +{ + memset(imageBuffer, 0xFF, imageBufferHeight * imageBufferWidth); +} + +void InkHUD::Renderer::checkLocks() +{ + lockRendering = nullptr; + lockRequests = nullptr; + + for (SystemApplet *sa : inkhud->systemApplets) { + if (!lockRendering && sa->lockRendering && sa->isForeground()) { + lockRendering = sa; + } + if (!lockRequests && sa->lockRequests && sa->isForeground()) { + lockRequests = sa; + } + } +} + +bool InkHUD::Renderer::shouldUpdate() +{ + bool should = false; + + // via forceUpdate + should |= forced; + + // via a system applet (which has locked update requests) + if (lockRequests) { + should |= lockRequests->wantsToRender(); + return should; // Early exit - no other requests considered + } + + // via system applet (not locked) + for (SystemApplet *sa : inkhud->systemApplets) { + if (sa->wantsToRender() // This applet requested + && sa->isForeground()) // This applet is currently shown + { + should = true; + break; + } + } + + // via user applet + for (Applet *ua : inkhud->userApplets) { + if (ua // Tile has valid applet + && ua->wantsToRender() // This applet requested display update + && ua->isForeground()) // This applet is currently shown + { + should = true; + break; + } + } + + return should; +} + +// Determine which type of E-Ink update the display will perform, to change the image. +// Considers the needs of the various applets, then weighs against display health. +// An update type specified by forceUpdate will be granted with no further questioning. +Drivers::EInk::UpdateTypes InkHUD::Renderer::decideUpdateType() +{ + // Ask applets which update type they would prefer + // Some update types take priority over others + + // No need to consider the "requests" if somebody already forced an update + if (!forced) { + // User applets + for (Applet *ua : inkhud->userApplets) { + if (ua && ua->isForeground()) + displayHealth.requestUpdateType(ua->wantsUpdateType()); + } + // System Applets + for (SystemApplet *sa : inkhud->systemApplets) { + if (sa && sa->isForeground()) + displayHealth.requestUpdateType(sa->wantsUpdateType()); + } + } + + return displayHealth.decideUpdateType(); +} + +// Run the drawing operations of any user applets which are currently displayed +// Pixel output is placed into the framebuffer, ready for handoff to the EInk driver +void InkHUD::Renderer::renderUserApplets() +{ + // Don't render user applets if a system applet has demanded the whole display to itself + if (lockRendering) + return; + + // Render any user applets which are currently visible + for (Applet *ua : inkhud->userApplets) { + if (ua && ua->isActive() && ua->isForeground()) { + uint32_t start = millis(); + ua->render(); // Draw! + uint32_t stop = millis(); + LOG_DEBUG("%s took %dms to render", ua->name, stop - start); + } + } +} + +// Run the drawing operations of any system applets which are currently displayed +// Pixel output is placed into the framebuffer, ready for handoff to the EInk driver +void InkHUD::Renderer::renderSystemApplets() +{ + SystemApplet *battery = inkhud->getSystemApplet("BatteryIcon"); + SystemApplet *menu = inkhud->getSystemApplet("Menu"); + SystemApplet *notifications = inkhud->getSystemApplet("Notification"); + + // Each system applet + for (SystemApplet *sa : inkhud->systemApplets) { + + // Skip if not shown + if (!sa->isForeground()) + continue; + + // Skip if locked by another applet + if (lockRendering && lockRendering != sa) + continue; + + // Don't draw the battery or notifications overtop the menu + // Todo: smarter way to handle this + if (menu->isForeground() && (sa == battery || sa == notifications)) + continue; + + assert(sa->getTile()); + + // uint32_t start = millis(); + sa->render(); // Draw! + // uint32_t stop = millis(); + // LOG_DEBUG("%s took %dms to render", sa->name, stop - start); + } +} + +// In some situations (e.g. layout or applet selection changes), +// a user tile can end up without an assigned applet. +// In this case, we will fill the empty space with diagonal lines. +void InkHUD::Renderer::renderPlaceholders() +{ + // Don't fill empty space with placeholders if a system applet wants exclusive use of the display + if (lockRendering) + return; + + // Ask the window manager which tiles are empty + std::vector emptyTiles = inkhud->getEmptyTiles(); + + // No empty tiles + if (emptyTiles.size() == 0) + return; + + SystemApplet *placeholder = inkhud->getSystemApplet("Placeholder"); + + // uint32_t start = millis(); + for (Tile *t : emptyTiles) { + t->assignApplet(placeholder); + placeholder->render(); + t->assignApplet(nullptr); + } + // uint32_t stop = millis(); + // LOG_DEBUG("Placeholders took %dms to render", stop - start); +} + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Renderer.h b/src/graphics/niche/InkHUD/Renderer.h new file mode 100644 index 000000000..b6cf9e215 --- /dev/null +++ b/src/graphics/niche/InkHUD/Renderer.h @@ -0,0 +1,96 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +Orchestrates updating of the display image + +- takes requests (or demands) for display update +- performs the various steps of the rendering operation +- interfaces with the E-Ink driver + +*/ + +#pragma once + +#include "configuration.h" + +#include "./DisplayHealth.h" +#include "./InkHUD.h" +#include "./Persistence.h" +#include "graphics/niche/Drivers/EInk/EInk.h" + +namespace NicheGraphics::InkHUD +{ + +class Renderer : protected concurrency::OSThread +{ + + public: + Renderer(); + + // Configuration, before begin + + void setDriver(Drivers::EInk *driver); + void setDisplayResilience(uint8_t fastPerFull, float stressMultiplier); + + void begin(); + + // Call these to make the image change + + void requestUpdate(); // Update display, if a foreground applet has info it wants to show + void forceUpdate(Drivers::EInk::UpdateTypes type = Drivers::EInk::UpdateTypes::UNSPECIFIED, + bool async = true); // Update display, regardless of whether any applets requested this + + // Wait for an update to complete + void awaitUpdate(); + + // Receives pixel output from an applet (via a tile, which translates the coordinates) + void handlePixel(int16_t x, int16_t y, Color c); + + // Size of display, in context of current rotation + + uint16_t width(); + uint16_t height(); + + private: + // Make attemps to render / update, once triggered by requestUpdate or forceUpdate + int32_t runOnce() override; + + // Apply the display rotation to handled pixels + void rotatePixelCoords(int16_t *x, int16_t *y); + + // Execute the render process now, then hand off to driver for display update + void render(bool async = true); + + // Steps of the rendering process + + void clearBuffer(); + void checkLocks(); + bool shouldUpdate(); + Drivers::EInk::UpdateTypes decideUpdateType(); + void renderUserApplets(); + void renderSystemApplets(); + void renderPlaceholders(); + + Drivers::EInk *driver = nullptr; // Interacts with your variants display hardware + DisplayHealth displayHealth; // Manages display health by controlling type of update + + uint8_t *imageBuffer = nullptr; // Fed into driver + uint16_t imageBufferHeight = 0; + uint16_t imageBufferWidth = 0; + uint32_t imageBufferSize = 0; // Bytes + + SystemApplet *lockRendering = nullptr; // Render this applet *only* + SystemApplet *lockRequests = nullptr; // Honor update requests from this applet *only* + + bool requested = false; + bool forced = false; + + // For convenience + InkHUD *inkhud = nullptr; + Persistence::Settings *settings = nullptr; +}; + +} // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/SystemApplet.h b/src/graphics/niche/InkHUD/SystemApplet.h new file mode 100644 index 000000000..0f8ceedc7 --- /dev/null +++ b/src/graphics/niche/InkHUD/SystemApplet.h @@ -0,0 +1,41 @@ +#ifdef MESHTASTIC_INCLUDE_INKHUD + +/* + +An applet with nonstandard behavior, which will require special handling + +For features like the menu, and the battery icon. + +*/ + +#pragma once + +#include "configuration.h" + +#include "./Applet.h" + +namespace NicheGraphics::InkHUD +{ + +class SystemApplet : public Applet +{ + public: + // System applets have the right to: + + bool handleInput = false; // - respond to input from the user button + bool lockRendering = false; // - prevent other applets from being rendered during an update + bool lockRequests = false; // - prevent other applets from triggering display updates + + // Other system applets may take precedence over our own system applet though + // The order an applet is passed to WindowManager::addSystemApplet determines this hierarchy (added earlier = higher rank) + + private: + // System applets are always running (active), but may not be visible (foreground) + + void onActivate() override {} + void onDeactivate() override {} +}; + +}; // namespace NicheGraphics::InkHUD + +#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Tile.cpp b/src/graphics/niche/InkHUD/Tile.cpp index e65835801..5e548de74 100644 --- a/src/graphics/niche/InkHUD/Tile.cpp +++ b/src/graphics/niche/InkHUD/Tile.cpp @@ -18,7 +18,7 @@ static int32_t runtaskHighlight() LOG_DEBUG("Dismissing Highlight"); InkHUD::Tile::highlightShown = false; InkHUD::Tile::highlightTarget = nullptr; - InkHUD::WindowManager::getInstance()->forceUpdate(Drivers::EInk::UpdateTypes::FAST); // Re-render, clearing the highlighting + InkHUD::InkHUD::getInstance()->forceUpdate(Drivers::EInk::UpdateTypes::FAST); // Re-render, clearing the highlighting return taskHighlight->disable(); } static void inittaskHighlight() @@ -33,21 +33,30 @@ static void inittaskHighlight() InkHUD::Tile::Tile() { - // For convenince - windowManager = InkHUD::WindowManager::getInstance(); + inkhud = InkHUD::getInstance(); inittaskHighlight(); Tile::highlightTarget = nullptr; Tile::highlightShown = false; } +InkHUD::Tile::Tile(int16_t left, int16_t top, uint16_t width, uint16_t height) +{ + assert(width > 0 && height > 0); + + this->left = left; + this->top = top; + this->width = width; + this->height = height; +} + // Set the region of the tile automatically, based on the user's chosen layout // This method places tiles which will host user applets // The WindowManager multiplexes the applets to these tiles automatically -void InkHUD::Tile::placeUserTile(uint8_t userTileCount, uint8_t tileIndex) +void InkHUD::Tile::setRegion(uint8_t userTileCount, uint8_t tileIndex) { - uint16_t displayWidth = windowManager->getWidth(); - uint16_t displayHeight = windowManager->getHeight(); + uint16_t displayWidth = inkhud->width(); + uint16_t displayHeight = inkhud->height(); bool landscape = displayWidth > displayHeight; @@ -62,10 +71,9 @@ void InkHUD::Tile::placeUserTile(uint8_t userTileCount, uint8_t tileIndex) return; } - // Todo: special handling for the notification area // Todo: special handling for 3 tile layout - // Gap between tiles + // Gutters between tiles const uint16_t spacing = 4; switch (userTileCount) { @@ -124,17 +132,12 @@ void InkHUD::Tile::placeUserTile(uint8_t userTileCount, uint8_t tileIndex) } assert(width > 0 && height > 0); - - this->left = left; - this->top = top; - this->width = width; - this->height = height; } // Manually set the region for a tile // This is only done for tiles which will host certain "System Applets", which have unique position / sizes: // Things like the NotificationApplet, BatteryIconApplet, etc -void InkHUD::Tile::placeSystemTile(int16_t left, int16_t top, uint16_t width, uint16_t height) +void InkHUD::Tile::setRegion(int16_t left, int16_t top, uint16_t width, uint16_t height) { assert(width > 0 && height > 0); @@ -182,31 +185,32 @@ void InkHUD::Tile::handleAppletPixel(int16_t x, int16_t y, Color c) // Crop to tile borders if (x >= left && x < (left + width) && y >= top && y < (top + height)) { - // Pass to the window manager - windowManager->handleTilePixel(x, y, c); + // Pass to the renderer + inkhud->drawPixel(x, y, c); } } -// Called by Applet base class, when learning of its dimensions +// Called by Applet base class, when setting applet dimensions, immediately before render uint16_t InkHUD::Tile::getWidth() { return width; } -// Called by Applet base class, when learning of its dimensions +// Called by Applet base class, when setting applet dimensions, immediately before render uint16_t InkHUD::Tile::getHeight() { return height; } // Longest edge of the display, in pixels +// A 296px x 250px display will return 296, for example // Maximum possible size of any tile's width / height -// Used by some components to allocate resources for the "worst possible situtation" +// Used by some components to allocate resources for the "worst possible situation" // "Sizing the cathedral for christmas eve" uint16_t InkHUD::Tile::maxDisplayDimension() { - WindowManager *wm = WindowManager::getInstance(); - return max(wm->getHeight(), wm->getWidth()); + InkHUD *inkhud = InkHUD::getInstance(); + return max(inkhud->height(), inkhud->width()); } // Ask for this tile to be highlighted @@ -216,7 +220,7 @@ void InkHUD::Tile::requestHighlight() { Tile::highlightTarget = this; Tile::highlightShown = false; - windowManager->forceUpdate(Drivers::EInk::UpdateTypes::FAST); + inkhud->forceUpdate(Drivers::EInk::UpdateTypes::FAST); } // Starts the timer which will automatically dismiss the highlighting, if the tile doesn't organically redraw first diff --git a/src/graphics/niche/InkHUD/Tile.h b/src/graphics/niche/InkHUD/Tile.h index e41536e53..0f5444f17 100644 --- a/src/graphics/niche/InkHUD/Tile.h +++ b/src/graphics/niche/InkHUD/Tile.h @@ -14,47 +14,44 @@ #include "configuration.h" #include "./Applet.h" -#include "./Types.h" -#include "./WindowManager.h" -#include +#include "./InkHUD.h" namespace NicheGraphics::InkHUD { -class Applet; -class WindowManager; - class Tile { public: Tile(); - void placeUserTile(uint8_t layoutSize, uint8_t tileIndex); // Assign region automatically, based on layout - void placeSystemTile(int16_t left, int16_t top, uint16_t width, uint16_t height); // Assign region manually - void handleAppletPixel(int16_t x, int16_t y, Color c); // Receive px output from assigned applet - uint16_t getWidth(); // Used to set the assigned applet's width before render - uint16_t getHeight(); // Used to set the assigned applet's height before render + Tile(int16_t left, int16_t top, uint16_t width, uint16_t height); + + void setRegion(uint8_t layoutSize, uint8_t tileIndex); // Assign region automatically, based on layout + void setRegion(int16_t left, int16_t top, uint16_t width, uint16_t height); // Assign region manually + void handleAppletPixel(int16_t x, int16_t y, Color c); // Receive px output from assigned applet + uint16_t getWidth(); + uint16_t getHeight(); static uint16_t maxDisplayDimension(); // Largest possible width / height any tile may ever encounter - void assignApplet(Applet *a); // Place an applet onto a tile - Applet *getAssignedApplet(); // Applet which is on a tile + void assignApplet(Applet *a); // Link an applet with this tile + Applet *getAssignedApplet(); // Applet which is currently linked with this tile void requestHighlight(); // Ask for this tile to be highlighted static void startHighlightTimeout(); // Start the auto-dismissal timer static void cancelHighlightTimeout(); // Cancel the auto-dismissal timer early; already dismissed static Tile *highlightTarget; // Which tile are we highlighting? (Intending to highlight?) - static bool highlightShown; // Is the tile highlighted yet? Controlls highlight vs dismiss + static bool highlightShown; // Is the tile highlighted yet? Controls highlight vs dismiss - protected: - int16_t left; - int16_t top; - uint16_t width; - uint16_t height; + private: + InkHUD *inkhud = nullptr; + + int16_t left = 0; + int16_t top = 0; + uint16_t width = 0; + uint16_t height = 0; Applet *assignedApplet = nullptr; // Pointer to the applet which is currently linked with the tile - - WindowManager *windowManager; // Convenient access to the WindowManager singleton }; } // namespace NicheGraphics::InkHUD diff --git a/src/graphics/niche/InkHUD/Types.h b/src/graphics/niche/InkHUD/Types.h deleted file mode 100644 index f4ab9ed4e..000000000 --- a/src/graphics/niche/InkHUD/Types.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifdef MESHTASTIC_INCLUDE_INKHUD - -/* - -Custom data types for InkHUD - -Only "general purpose" data-types should be defined here. -If your applet has its own structs or enums, which won't be useful to other applets, -please define them inside (or in the same folder as) your applet. - -*/ - -#pragma once - -#include "configuration.h" - -#include "graphics/niche/Drivers/EInk/EInk.h" - -namespace NicheGraphics::InkHUD -{ - -// Color, understood by display controller IC (as bit values) -// Also suitable for use as AdafruitGFX colors -enum Color : uint8_t { - BLACK = 0, - WHITE = 1, -}; - -// Info contained within AppletFont -struct FontDimensions { - uint8_t height; - uint8_t ascenderHeight; - uint8_t descenderHeight; -}; - -// Which edge Applet::printAt will place on the X parameter -enum HorizontalAlignment : uint8_t { - LEFT, - RIGHT, - CENTER, -}; - -// Which edge Applet::printAt will place on the Y parameter -enum VerticalAlignment : uint8_t { - TOP, - MIDDLE, - BOTTOM, -}; - -// An easy-to-understand intepretation of SNR and RSSI -// Calculate with Applet::getSignalStringth -enum SignalStrength : int8_t { - SIGNAL_UNKNOWN = -1, - SIGNAL_NONE, - SIGNAL_BAD, - SIGNAL_FAIR, - SIGNAL_GOOD, -}; - -} // namespace NicheGraphics::InkHUD - -#endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/WindowManager.cpp b/src/graphics/niche/InkHUD/WindowManager.cpp index f987a3646..c883e9a29 100644 --- a/src/graphics/niche/InkHUD/WindowManager.cpp +++ b/src/graphics/niche/InkHUD/WindowManager.cpp @@ -2,11 +2,6 @@ #include "./WindowManager.h" -#include "RTC.h" -#include "mesh/NodeDB.h" - -// System applets -// Must be defined in .cpp to prevent a circular dependency with Applet base class #include "./Applets/System/BatteryIcon/BatteryIconApplet.h" #include "./Applets/System/Logo/LogoApplet.h" #include "./Applets/System/Menu/MenuApplet.h" @@ -14,479 +9,108 @@ #include "./Applets/System/Pairing/PairingApplet.h" #include "./Applets/System/Placeholder/PlaceholderApplet.h" #include "./Applets/System/Tips/TipsApplet.h" +#include "./SystemApplet.h" using namespace NicheGraphics; -InkHUD::WindowManager::WindowManager() : concurrency::OSThread("InkHUD WM") +InkHUD::WindowManager::WindowManager() { - // Nothing for the timer to do just yet - OSThread::disable(); + // Convenient references + inkhud = InkHUD::getInstance(); + settings = &inkhud->persistence->settings; } -// Get or create the WindowManager singleton -InkHUD::WindowManager *InkHUD::WindowManager::getInstance() -{ - // Create the singleton instance of our class, if not yet done - static InkHUD::WindowManager *instance = new InkHUD::WindowManager(); - return instance; -} - -// Connect the driver, which is created independently is setupNicheGraphics() -void InkHUD::WindowManager::setDriver(Drivers::EInk *driver) -{ - // Make sure not already set - if (this->driver) { - LOG_ERROR("Driver already set"); - delay(2000); // Wait for native serial.. - assert(false); - } - - // Store the driver which was created in setupNicheGraphics() - this->driver = driver; - - // Determine the dimensions of the image buffer, in bytes. - // Along rows, pixels are stored 8 per byte. - // Not all display widths are divisible by 8. Need to make sure bytecount accommodates padding for these. - imageBufferWidth = ((driver->width - 1) / 8) + 1; - imageBufferHeight = driver->height; - - // Allocate the image buffer - imageBuffer = new uint8_t[imageBufferWidth * imageBufferHeight]; -} - -// Sets the ideal ratio of FAST updates to FULL updates -// We want as many FAST updates as possible, without causing gradual degradation of the display -// If explicitly requested, number of FAST updates may exceed fastPerFull value. -// In this case, the stressMultiplier is applied, causing the "FULL update debt" to increase by more than normal -// The stressMultplier helps the display recover from particularly taxing periods of use -// (Default arguments of 5,2 are very conservative values) -void InkHUD::WindowManager::setDisplayResilience(uint8_t fastPerFull = 5, float stressMultiplier = 2.0) -{ - mediator.fastPerFull = fastPerFull; - mediator.stressMultiplier = stressMultiplier; -} - -// Register a user applet with the WindowManager +// Register a user applet with InkHUD // This is called in setupNicheGraphics() // This should be the only time that specific user applets are mentioned in the code // If a user applet is not added with this method, its code should not be built +// Call before begin void InkHUD::WindowManager::addApplet(const char *name, Applet *a, bool defaultActive, bool defaultAutoshow, uint8_t onTile) { - userApplets.push_back(a); + inkhud->userApplets.push_back(a); // If requested, mark in settings that this applet should be active by default // This means that it will be available for the user to cycle to with short-press of the button - // This is the default state only: user can activate or deactive applets through the menu. + // This is the default state only: user can activate or deactivate applets through the menu. // User's choice of active applets is stored in settings, and will be honored instead of these defaults, if present if (defaultActive) - settings.userApplets.active[userApplets.size() - 1] = true; + settings->userApplets.active[inkhud->userApplets.size() - 1] = true; // If requested, mark in settings that this applet should "autoshow" by default // This means that the applet will be automatically brought to foreground when it has new data to show // This is the default state only: user can select which applets have this behavior through the menu // User's selection is stored in settings, and will be honored instead of these defaults, if present if (defaultAutoshow) - settings.userApplets.autoshow[userApplets.size() - 1] = true; + settings->userApplets.autoshow[inkhud->userApplets.size() - 1] = true; // If specified, mark this as the default applet for a given tile index // Used only to avoid placeholder applet "out of the box", when default settings have more than one tile if (onTile != (uint8_t)-1) - settings.userTiles.displayedUserApplet[onTile] = userApplets.size() - 1; + settings->userTiles.displayedUserApplet[onTile] = inkhud->userApplets.size() - 1; // The label that will be show in the applet selection menu, on the device a->name = name; } -// Perform initial setup, and begin responding to incoming events -// First task once init is to show the boot screen +// Initial configuration at startup void InkHUD::WindowManager::begin() { - // Make sure we have set a driver - if (!this->driver) { - LOG_ERROR("Driver not set"); - delay(2000); // Wait for native serial.. - assert(false); - } - - loadDataFromFlash(); + assert(inkhud); createSystemApplets(); - createSystemTiles(); placeSystemTiles(); - assignSystemAppletsToTiles(); createUserApplets(); createUserTiles(); placeUserTiles(); assignUserAppletsToTiles(); refocusTile(); - - logoApplet->showBootScreen(); - forceUpdate(Drivers::EInk::FULL, false); // Update now, and wait here until complete - - deepSleepObserver.observe(¬ifyDeepSleep); - rebootObserver.observe(¬ifyReboot); - textMessageObserver.observe(textMessageModule); -#ifdef ARCH_ESP32 - lightSleepObserver.observe(¬ifyLightSleep); -#endif } -// Set-up special "system applets" -// These handle things like bootscreen, pop-up notifications etc -// They are processed separately from the user applets, because they might need to do "weird things" -// They also won't be activated or deactivated -void InkHUD::WindowManager::createSystemApplets() +// Focus on a different tile +// The "focused tile" is the one which cycles applets on user button press, +// and the one where the menu will be displayed +void InkHUD::WindowManager::nextTile() { - logoApplet = new LogoApplet; - pairingApplet = new PairingApplet; - tipsApplet = new TipsApplet; - notificationApplet = new NotificationApplet; - batteryIconApplet = new BatteryIconApplet; - menuApplet = new MenuApplet; - placeholderApplet = new PlaceholderApplet; - - // System applets are always active - logoApplet->activate(); - pairingApplet->activate(); - tipsApplet->activate(); - notificationApplet->activate(); - batteryIconApplet->activate(); - menuApplet->activate(); - placeholderApplet->activate(); - - // Add to the systemApplets vector - // Although system applets often need special handling, sometimes we can process them en-masse with this vector - // e.g. rendering, raising events - // Order of these entries determines Z-Index when rendering - systemApplets.push_back(logoApplet); - systemApplets.push_back(pairingApplet); - systemApplets.push_back(tipsApplet); - systemApplets.push_back(batteryIconApplet); - systemApplets.push_back(menuApplet); - systemApplets.push_back(notificationApplet); - // Note: placeholder applet is technically a system applet, but it renders in WindowManager::renderPlaceholders -} - -void InkHUD::WindowManager::createSystemTiles() -{ - fullscreenTile = new Tile; - notificationTile = new Tile; - batteryIconTile = new Tile; -} - -void InkHUD::WindowManager::placeSystemTiles() -{ - fullscreenTile->placeSystemTile(0, 0, getWidth(), getHeight()); - notificationTile->placeSystemTile(0, 0, getWidth(), 20); // Testing only: constant value - - // Todo: appropriate sizing for the battery icon - const uint16_t batteryIconHeight = Applet::getHeaderHeight() - (2 * 2); - uint16_t batteryIconWidth = batteryIconHeight * 1.8; - - batteryIconTile->placeSystemTile(getWidth() - batteryIconWidth, 2, batteryIconWidth, batteryIconHeight); -} - -// Assign a system applet to the fullscreen tile -// Rendering of user tiles is suspended when the fullscreen tile is occupied -void InkHUD::WindowManager::claimFullscreen(InkHUD::Applet *a) -{ - // Make sure that only system applets use the fullscreen tile - bool isSystemApplet = false; - for (Applet *sa : systemApplets) { - if (sa == a) { - isSystemApplet = true; - break; - } - } - assert(isSystemApplet); - - fullscreenTile->assignApplet(a); -} - -// Clear the fullscreen tile, unlinking whichever system applet is assigned -// This allows the normal rendering of user tiles to resume -void InkHUD::WindowManager::releaseFullscreen() -{ - // Make sure the applet is ready to release the tile - assert(!fullscreenTile->getAssignedApplet()->isForeground()); - - // Break the link between the applet and the fullscreen tile - fullscreenTile->assignApplet(nullptr); -} - -// Some system applets can be assigned to a tile at boot -// These are applets which do have their own tile, and whose assignment never changes -// Applets which: -// - share the fullscreen tile (e.g. logoApplet, pairingApplet), -// - render on user tiles (e.g. menuApplet, placeholderApplet), -// are assigned to the tile only when needed -void InkHUD::WindowManager::assignSystemAppletsToTiles() -{ - notificationTile->assignApplet(notificationApplet); - batteryIconTile->assignApplet(batteryIconApplet); -} - -// Activate or deactivate user applets, to match settings -// Called at boot, or after run-time config changes via menu -// Note: this method does not instantiate the applets; -// this is done in setupNicheGraphics, with WindowManager::addApplet -void InkHUD::WindowManager::createUserApplets() -{ - // Deactivate and remove any no-longer-needed applets - for (uint8_t i = 0; i < userApplets.size(); i++) { - Applet *a = userApplets.at(i); - - // If the applet is active, but settings say it shouldn't be: - // - run applet's custom deactivation code - // - mark applet as inactive (internally) - if (a->isActive() && !settings.userApplets.active[i]) - a->deactivate(); + // Close the menu applet if open + // We don't *really* want to do this, but it simplifies handling *a lot* + MenuApplet *menu = (MenuApplet *)inkhud->getSystemApplet("Menu"); + bool menuWasOpen = false; + if (menu->isForeground()) { + menu->sendToBackground(); + menuWasOpen = true; } - // Activate and add any new applets - for (uint8_t i = 0; i < userApplets.size() && i < MAX_USERAPPLETS_GLOBAL; i++) { + // Swap to next tile + settings->userTiles.focused = (settings->userTiles.focused + 1) % settings->userTiles.count; - // If not activated, but it now should be: - // - run applet's custom activation code - // - mark applet as active (internally) - if (!userApplets.at(i)->isActive() && settings.userApplets.active[i]) - userApplets.at(i)->activate(); - } + // Make sure that we don't get stuck on the placeholder tile + refocusTile(); + + if (menuWasOpen) + menu->show(userTiles.at(settings->userTiles.focused)); + + // Ask the tile to draw an indicator showing which tile is now focused + // Requests a render + // We only draw this indicator if the device uses an aux button to switch tiles. + // Assume aux button is used to switch tiles if the "next tile" menu item is hidden + if (!settings->optionalMenuItems.nextTile) + userTiles.at(settings->userTiles.focused)->requestHighlight(); } -void InkHUD::WindowManager::createUserTiles() +// Show the menu (on the the focused tile) +// The applet previously displayed there will be restored once the menu closes +void InkHUD::WindowManager::openMenu() { - // Delete any tiles which currently exist - for (Tile *t : userTiles) - delete t; - userTiles.clear(); - - // Create new tiles - for (uint8_t i = 0; i < settings.userTiles.count; i++) { - Tile *t = new Tile; - userTiles.push_back(t); - } -} - -void InkHUD::WindowManager::placeUserTiles() -{ - // Calculate the display region occupied by each tile - // This determines how pixels are translated from applet-space to windowmanager-space - for (uint8_t i = 0; i < userTiles.size(); i++) - userTiles.at(i)->placeUserTile(settings.userTiles.count, i); -} - -void InkHUD::WindowManager::assignUserAppletsToTiles() -{ - // Set "assignedApplet" property - // Which applet should be initially shown on a tile? - // This is preserved between reboots, but the value needs validating at startup - for (uint8_t i = 0; i < userTiles.size(); i++) { - Tile *t = userTiles.at(i); - - // Check whether tile can display the previously shown applet again - uint8_t oldIndex = settings.userTiles.displayedUserApplet[i]; // Previous index in WindowManager::userApplets - bool canRestore = true; - if (oldIndex > userApplets.size() - 1) // Check if old index is now out of bounds - canRestore = false; - else if (!settings.userApplets.active[oldIndex]) // Check that old applet is still activated - canRestore = false; - else { // Check that the old applet isn't now shown already on a different tile - for (uint8_t i2 = 0; i2 < i; i2++) { - if (settings.userTiles.displayedUserApplet[i2] == oldIndex) { - canRestore = false; - break; - } - } - } - - // Restore previously shown applet if possible, - // otherwise assign nullptr, which will render specially using placeholderApplet - if (canRestore) { - Applet *a = userApplets.at(oldIndex); - t->assignApplet(a); - a->bringToForeground(); - } else { - t->assignApplet(nullptr); - settings.userTiles.displayedUserApplet[i] = -1; // Update settings: current tile has no valid applet - } - } -} - -void InkHUD::WindowManager::refocusTile() -{ - // Validate "focused tile" setting - // - info: focused tile responds to button presses: applet cycling, menu, etc - // - if number of tiles changed, might now be out of index - if (settings.userTiles.focused >= userTiles.size()) - settings.userTiles.focused = 0; - - // Give "focused tile" a valid applet - // - scan for another valid applet, which we can addSubstitution - // - reason: nextApplet() won't cycle if no applet is assigned - Tile *focusedTile = userTiles.at(settings.userTiles.focused); - if (!focusedTile->getAssignedApplet()) { - // Search for available applets - for (uint8_t i = 0; i < userApplets.size(); i++) { - Applet *a = userApplets.at(i); - if (a->isActive() && !a->isForeground()) { - // Found a suitable applet - // Assign it to the focused tile - focusedTile->assignApplet(a); - a->bringToForeground(); - settings.userTiles.displayedUserApplet[settings.userTiles.focused] = i; // Record change: persist after reboot - break; - } - } - } -} - -// Callback for deepSleepObserver -// Returns 0 to signal that we agree to sleep now -int InkHUD::WindowManager::beforeDeepSleep(void *unused) -{ - // Notify all applets that we're shutting down - for (Applet *ua : userApplets) { - ua->onDeactivate(); - ua->onShutdown(); - } - for (Applet *sa : userApplets) { - // Note: no onDeactivate. System applets are always active. - sa->onShutdown(); - } - - // User has successfull executed a safe shutdown - // We don't need to nag at boot anymore - settings.tips.safeShutdownSeen = true; - - saveDataToFlash(); - - // Display the shutdown screen, and wait here until the update is complete - logoApplet->showShutdownScreen(); - forceUpdate(Drivers::EInk::UpdateTypes::FULL, false); - - return 0; // We agree: deep sleep now -} - -// Callback for rebootObserver -// Same as shutdown, without drawing the logoApplet -// Makes sure we don't lose message history / InkHUD config -int InkHUD::WindowManager::beforeReboot(void *unused) -{ - - // Notify all applets that we're "shutting down" - // They don't need to know that it's really a reboot - for (Applet *a : userApplets) { - a->onDeactivate(); - a->onShutdown(); - } - for (Applet *sa : userApplets) { - // Note: no onDeactivate. System applets are always active. - sa->onShutdown(); - } - - saveDataToFlash(); - - return 0; // No special status to report. Ignored anyway by this Observable -} - -#ifdef ARCH_ESP32 -// Callback for lightSleepObserver -// Make sure the display is not partway through an update when we begin light sleep -// This is because some displays require active input from us to terminate the update process, and protect the panel hardware -int InkHUD::WindowManager::beforeLightSleep(void *unused) -{ - if (driver->busy()) { - LOG_INFO("Waiting for display"); - driver->await(); // Wait here for update to complete - } - - return 0; // No special status to report. Ignored anyway by this Observable -} -#endif - -// Callback when a new text message is received -// Caches the most recently received message, for use by applets -// Rx does not trigger a save to flash, however the data *will* be saved alongside other during shutdown, etc. -// Note: this is different from devicestate.rx_text_message, which may contain an *outgoing* message -int InkHUD::WindowManager::onReceiveTextMessage(const meshtastic_MeshPacket *packet) -{ - // Short circuit: don't store outgoing messages - if (getFrom(packet) == nodeDB->getNodeNum()) - return 0; - - // Short circuit: don't store "emoji reactions" - // Possibly some implemetation of this in future? - if (packet->decoded.emoji) - return 0; - - // Determine whether the message is broadcast or a DM - // Store this info to prevent confusion after a reboot - // Avoids need to compare timestamps, because of situation where "future" messages block newly received, if time not set - latestMessage.wasBroadcast = isBroadcast(packet->to); - - // Pick the appropriate variable to store the message in - MessageStore::Message *storedMessage = latestMessage.wasBroadcast ? &latestMessage.broadcast : &latestMessage.dm; - - // Store nodenum of the sender - // Applets can use this to fetch user data from nodedb, if they want - storedMessage->sender = packet->from; - - // Store the time (epoch seconds) when message received - storedMessage->timestamp = getValidTime(RTCQuality::RTCQualityDevice, true); // Current RTC time - - // Store the channel - // - (potentially) used to determine whether notification shows - // - (potentially) used to determine which applet to focus - storedMessage->channelIndex = packet->channel; - - // Store the text - // Need to specify manually how many bytes, because source not null-terminated - storedMessage->text = - std::string(&packet->decoded.payload.bytes[0], &packet->decoded.payload.bytes[packet->decoded.payload.size]); - - return 0; // Tell caller to continue notifying other observers. (No reason to abort this event) -} - -// Triggered by an input source when a short-press fires -// The input source is a separate component; not part of InkHUD -// It is connected in setupNicheGraphics() -void InkHUD::WindowManager::handleButtonShort() -{ - // If notification is open: close it - if (notificationApplet->isForeground()) { - notificationApplet->dismiss(); - forceUpdate(EInk::UpdateTypes::FULL); // Redraw everything, to clear the notification - } - - // If window manager is locked: lock owner handles button - else if (lockOwner) - lockOwner->onButtonShortPress(); - - // Normally: next applet - else - nextApplet(); -} - -// Triggered by an input source when a long-press fires -// The input source is a separate component; not part of InkHUD -// It is connected in setupNicheGraphics() -// Note: input source should raise this while button still held -void InkHUD::WindowManager::handleButtonLong() -{ - if (lockOwner) - lockOwner->onButtonLongPress(); - - else - menuApplet->show(userTiles.at(settings.userTiles.focused)); + MenuApplet *menu = (MenuApplet *)inkhud->getSystemApplet("Menu"); + menu->show(userTiles.at(settings->userTiles.focused)); } // On the currently focussed tile: cycle to the next available user applet // Applets available for this must be activated, and not already displayed on another tile void InkHUD::WindowManager::nextApplet() { - Tile *t = userTiles.at(settings.userTiles.focused); + Tile *t = userTiles.at(settings->userTiles.focused); // Abort if zero applets available // nullptr means WindowManager::refocusTile determined that there were no available applets @@ -495,8 +119,8 @@ void InkHUD::WindowManager::nextApplet() // Find the index of the applet currently shown on the tile uint8_t appletIndex = -1; - for (uint8_t i = 0; i < userApplets.size(); i++) { - if (userApplets.at(i) == t->getAssignedApplet()) { + for (uint8_t i = 0; i < inkhud->userApplets.size(); i++) { + if (inkhud->userApplets.at(i) == t->getAssignedApplet()) { appletIndex = i; break; } @@ -507,15 +131,14 @@ void InkHUD::WindowManager::nextApplet() // Iterate forward through the WindowManager::applets, looking for the next valid applet Applet *nextValidApplet = nullptr; - // for (uint8_t i = (appletIndex + 1) % applets.size(); i != appletIndex; i = (i + 1) % applets.size()) { - for (uint8_t i = 1; i < userApplets.size(); i++) { - uint8_t newAppletIndex = (appletIndex + i) % userApplets.size(); - Applet *a = userApplets.at(newAppletIndex); + for (uint8_t i = 1; i < inkhud->userApplets.size(); i++) { + uint8_t newAppletIndex = (appletIndex + i) % inkhud->userApplets.size(); + Applet *a = inkhud->userApplets.at(newAppletIndex); // Looking for an applet which is active (enabled by user), but currently in background if (a->isActive() && !a->isForeground()) { nextValidApplet = a; - settings.userTiles.displayedUserApplet[settings.userTiles.focused] = + settings->userTiles.displayedUserApplet[settings->userTiles.focused] = newAppletIndex; // Remember this setting between boots! break; } @@ -529,35 +152,33 @@ void InkHUD::WindowManager::nextApplet() t->getAssignedApplet()->sendToBackground(); t->assignApplet(nextValidApplet); nextValidApplet->bringToForeground(); - forceUpdate(EInk::UpdateTypes::FAST); // bringToForeground already requested, but we're manually forcing FAST + inkhud->forceUpdate(EInk::UpdateTypes::FAST); // bringToForeground already requested, but we're manually forcing FAST } -// Focus on a different tile -// The "focused tile" is the one which cycles applets on user button press, -// and the one where the menu will be displayed -// Note: this method is only used by an aux button -// The menuApplet manually performs a subset of these actions, to avoid disturbing the stale image on adjacent tiles -void InkHUD::WindowManager::nextTile() +// Rotate the display image by 90 degrees +void InkHUD::WindowManager::rotate() { - // Close the menu applet if open - // We done *really* want to do this, but it simplifies handling *a lot* - if (menuApplet->isForeground()) - menuApplet->sendToBackground(); - - // Seems like some system applet other than menu is open. Pairing? Booting? - if (!canRequestUpdate()) - return; - - // Swap to next tile - settings.userTiles.focused = (settings.userTiles.focused + 1) % settings.userTiles.count; - - // Make sure that we don't get stuck on the placeholder tile - // changeLayout reassigns applets to tiles + settings->rotation = (settings->rotation + 1) % 4; changeLayout(); +} - // Ask the tile to draw an indicator showing which tile is now focused - // Requests a render - userTiles.at(settings.userTiles.focused)->requestHighlight(); +// Change whether the battery icon is displayed (top right corner) +// Don't toggle the OptionalFeatures value before calling this, our method handles it internally +void InkHUD::WindowManager::toggleBatteryIcon() +{ + BatteryIconApplet *batteryIcon = (BatteryIconApplet *)inkhud->getSystemApplet("BatteryIcon"); + + settings->optionalFeatures.batteryIcon = !settings->optionalFeatures.batteryIcon; // Preserve the change between boots + + // Show or hide the applet + if (settings->optionalFeatures.batteryIcon) + batteryIcon->bringToForeground(); + else + batteryIcon->sendToBackground(); + + // Force-render + // - redraw all applets + inkhud->forceUpdate(EInk::UpdateTypes::FAST); } // Perform necessary reconfiguration when user changes number of tiles (or rotation) at run-time @@ -589,21 +210,24 @@ void InkHUD::WindowManager::changeLayout() // Restore menu // - its tile was just destroyed and recreated (createUserTiles) // - its assignment was cleared (assignUserAppletsToTiles) - if (menuApplet->isForeground()) { - Tile *ft = userTiles.at(settings.userTiles.focused); - menuApplet->show(ft); + MenuApplet *menu = (MenuApplet *)inkhud->getSystemApplet("Menu"); + if (menu->isForeground()) { + Tile *ft = userTiles.at(settings->userTiles.focused); + menu->show(ft); } // Force-render // - redraw all applets - forceUpdate(EInk::UpdateTypes::FAST); + inkhud->forceUpdate(EInk::UpdateTypes::FAST); } // Perform necessary reconfiguration when user activates or deactivates applets at run-time // Call after changing settings.userApplets.active void InkHUD::WindowManager::changeActivatedApplets() { - assert(menuApplet->isForeground()); + MenuApplet *menu = (MenuApplet *)inkhud->getSystemApplet("Menu"); + + assert(menu->isForeground()); // Activate or deactivate applets // - to match value of settings.userApplets.active @@ -621,223 +245,41 @@ void InkHUD::WindowManager::changeActivatedApplets() // Restore menu // - its assignment was cleared (assignUserAppletsToTiles) - if (menuApplet->isForeground()) { - Tile *ft = userTiles.at(settings.userTiles.focused); - menuApplet->show(ft); + if (menu->isForeground()) { + Tile *ft = userTiles.at(settings->userTiles.focused); + menu->show(ft); } // Force-render // - redraw all applets - forceUpdate(EInk::UpdateTypes::FAST); + inkhud->forceUpdate(EInk::UpdateTypes::FAST); } -// Change whether the battery icon is displayed (top left corner) -// Don't toggle the OptionalFeatures value before calling this, our method handles it internally -void InkHUD::WindowManager::toggleBatteryIcon() -{ - assert(batteryIconApplet->isActive()); - settings.optionalFeatures.batteryIcon = !settings.optionalFeatures.batteryIcon; // Preserve the change between boots - - // Show or hide the applet - if (settings.optionalFeatures.batteryIcon) - batteryIconApplet->bringToForeground(); - else - batteryIconApplet->sendToBackground(); - - // Force-render - // - redraw all applets - forceUpdate(EInk::UpdateTypes::FAST); -} - -// Allow applets to suppress notifications -// Applets will be asked whether they approve, before a notification is shown via the NotificationApplet -// An applet might want to suppress a notification if the applet itself already displays this info -// Example: AllMessageApplet should not approve notifications for messages, if it is in foreground -bool InkHUD::WindowManager::approveNotification(InkHUD::Notification &n) -{ - // Ask all currently displayed applets - for (Tile *ut : userTiles) { - Applet *ua = ut->getAssignedApplet(); - if (ua && !ua->approveNotification(n)) - return false; - } - - // Nobody objected - return true; -} - -// Set a flag, which will be picked up by runOnce, ASAP. -// Quite likely, multiple applets will all want to respond to one event (Observable, etc) -// Each affected applet can independently call requestUpdate(), and all share the one opportunity to render, at next runOnce -void InkHUD::WindowManager::requestUpdate() -{ - requestingUpdate = true; - - // We will run the thread as soon as we loop(), - // after all Applets have had a chance to observe whatever event set this off - OSThread::setIntervalFromNow(0); - OSThread::enabled = true; - runASAP = true; -} - -// requestUpdate will not actually update if no requests were made by applets which are actually visible -// This can occur, because applets requestUpdate even from the background, -// in case the user's autoshow settings permit them to be moved to foreground. -// Sometimes, however, we will want to trigger a display update manually, in the absense of any sort of applet event -// Display health, for example. -// In these situations, we use forceUpdate -void InkHUD::WindowManager::forceUpdate(EInk::UpdateTypes type, bool async) -{ - requestingUpdate = true; - forcingUpdate = true; - forcedUpdateType = type; - - // Normally, we need to start the timer, in case the display is busy and we briefly defer the update - if (async) { - // We will run the thread as soon as we loop(), - // after all Applets have had a chance to observe whatever event set this off - OSThread::setIntervalFromNow(0); - OSThread::enabled = true; - runASAP = true; - } - - // If the update is *not* asynchronous, we begin the render process directly here - // so that it can block code flow while running - else - render(false); -} - -// Receives rendered image data from an Applet, via a tile -// When applets render, they output pixel data relative to their own left / top edges -// They pass this pixel data to tile, which offsets the pixels, making them relative to the display left / top edges -// That data is then passed to this method, which applies any rotation, then places the pixels into the image buffer -// That image buffer is the fully-formatted data handed off to the driver -void InkHUD::WindowManager::handleTilePixel(int16_t x, int16_t y, Color c) -{ - rotatePixelCoords(&x, &y); - setBufferPixel(x, y, c); -} - -// Width of the display, relative to rotation -uint16_t InkHUD::WindowManager::getWidth() -{ - if (settings.rotation % 2) - return driver->height; - else - return driver->width; -} - -// Height of the display, relative to rotation -uint16_t InkHUD::WindowManager::getHeight() -{ - if (settings.rotation % 2) - return driver->width; - else - return driver->height; -} - -// How many user applets have been built? Includes applets which have been inactivated by user config -uint8_t InkHUD::WindowManager::getAppletCount() -{ - return userApplets.size(); -} - -// A tidy title for applets: used on-display in some situations -// Index is the order in the WindowManager::userApplets vector -// This is the same order that applets were added in setupNicheGraphics -const char *InkHUD::WindowManager::getAppletName(uint8_t index) -{ - return userApplets.at(index)->name; -} - -// Allows a system applet to prevent other applets from temporarily requesting updates -// All user applets will honor this. Some system applets might not, although they probably should -// WindowManager::forceUpdate will ignore this lock -void InkHUD::WindowManager::lock(Applet *owner) -{ - // Only one system applet may lock render at once - assert(!lockOwner); - - // Only system applets may lock rendering - for (Applet *a : userApplets) - assert(owner != a); - - lockOwner = owner; -} - -// Remove a lock placed by a system applet, which prevents other applets from rendering -void InkHUD::WindowManager::unlock(Applet *owner) -{ - assert(lockOwner = owner); - lockOwner = nullptr; - - // Raise this as an event (system applets only) - // - in case applet waiting for lock - // - in case applet relinquished its lock earlier, and wants it back - for (Applet *sa : systemApplets) { - // Don't raise event for the applet which is calling unlock - // - avoid loop of unlock->lock (some implementations of Applet::onLockAvailable) - if (sa != owner) - sa->onLockAvailable(); - } -} - -// Is an applet blocked from requesting update by a current lock? -// Applets are allowed to request updates if there is no lock, or if they are the owner of the lock -// If a == nullptr, checks permission "for everyone and anyone" -bool InkHUD::WindowManager::canRequestUpdate(Applet *a) -{ - if (!lockOwner) - return true; - else if (lockOwner == a) - return true; - else - return false; -} - -// Get the applet which is currently locking rendering -// We might be able to convince it release its lock, if we want it instead -InkHUD::Applet *InkHUD::WindowManager::whoLocked() -{ - return WindowManager::lockOwner; -} - -// Runs at regular intervals -// WindowManager's uses of this include: -// - postponing render: until next loop(), allowing all applets to be notified of some Mesh event before render -// - queuing another render: while one is already is progress -int32_t InkHUD::WindowManager::runOnce() -{ - // If an applet asked to render, and hardware is able, lets try now - if (requestingUpdate && !driver->busy()) { - render(); - } - - // If our render() call failed, try again shortly - // otherwise, stop our thread until next update due - if (requestingUpdate) - return 250UL; - else - return OSThread::disable(); -} - -// Some applets may be permitted to bring themselved to foreground, to show new data +// Some applets may be permitted to bring themselves to foreground, to show new data // User selects which applets have this permission via on-screen menu // Priority is determined by the order which applets were added to WindowManager in setupNicheGraphics // We will only autoshow one applet void InkHUD::WindowManager::autoshow() { - for (uint8_t i = 0; i < userApplets.size(); i++) { - Applet *a = userApplets.at(i); - if (a->wantsToAutoshow() // Applet wants to become foreground - && !a->isForeground() // Not yet foreground - && settings.userApplets.autoshow[i] // User permits this applet to autoshow - && canRequestUpdate()) // Updates not currently blocked by system applet + // Don't perform autoshow if a system applet has exclusive use of the display right now + // Note: lockRequests prevents autoshow attempting to hide menuApplet + for (SystemApplet *sa : inkhud->systemApplets) { + if (sa->lockRendering || sa->lockRequests) + return; + } + + NotificationApplet *notificationApplet = (NotificationApplet *)inkhud->getSystemApplet("Notification"); + + for (uint8_t i = 0; i < inkhud->userApplets.size(); i++) { + Applet *a = inkhud->userApplets.at(i); + if (a->wantsToAutoshow() // Applet wants to become foreground + && !a->isForeground() // Not yet foreground + && settings->userApplets.autoshow[i]) // User permits this applet to autoshow { - Tile *t = userTiles.at(settings.userTiles.focused); // Get focused tile - t->getAssignedApplet()->sendToBackground(); // Background whichever applet is already on the tile - t->assignApplet(a); // Assign our new applet to tile - a->bringToForeground(); // Foreground our new applet + Tile *t = userTiles.at(settings->userTiles.focused); // Get focused tile + t->getAssignedApplet()->sendToBackground(); // Background whichever applet is already on the tile + t->assignApplet(a); // Assign our new applet to tile + a->bringToForeground(); // Foreground our new applet // Check if autoshown applet shows the same information as notification intended to // In this case, we can dismiss the notification before it is shown @@ -850,257 +292,220 @@ void InkHUD::WindowManager::autoshow() } } -// Check whether an update is justified -// We usually require that a foreground applet requested the update, -// but forceUpdate call will bypass these checks. -// Abstraction for WindowManager::render only -bool InkHUD::WindowManager::shouldUpdate() +// A collection of any user tiles which do not have a valid user applet +// This can occur in various situations, such as when a user enables fewer applets than their layout has tiles +// The tiles (and which regions the occupy) are private information of the window manager +// The renderer needs to know which regions (if any) are empty, +// in order to fill them with a "placeholder" pattern. +// -- There may be a tidier way to accomplish this -- +std::vector InkHUD::WindowManager::getEmptyTiles() { - bool should = false; + std::vector empty; - // via forceUpdate - should |= forcingUpdate; - - // via user applet - for (Tile *ut : userTiles) { - Applet *ua = ut->getAssignedApplet(); - if (ua // Tile has valid applet - && ua->wantsToRender() // This applet requested display update - && ua->isForeground() // This applet is currently shown - && canRequestUpdate()) // Requests are not currently locked - { - should = true; - break; - } + for (Tile *t : userTiles) { + Applet *a = t->getAssignedApplet(); + if (!a || !a->isActive()) + empty.push_back(t); } - // via system applet - for (Applet *sa : systemApplets) { - if (sa->wantsToRender() // This applet requested - && sa->isForeground() // This applet is currently shown - && canRequestUpdate(sa)) // Requests are not currently locked, or this applet owns the lock - { - should = true; - break; - } - } - - return should; + return empty; } -// Determine which type of E-Ink update the display will perform, to change the image. -// Considers the needs of the various applets, then weighs against display health. -// An update type specified by forceUpdate will be granted with no further questioning. -// Abstraction for WindowManager::render only -Drivers::EInk::UpdateTypes InkHUD::WindowManager::selectUpdateType() +// Complete the configuration of one newly instantiated system applet +// - link it with its tile +// Unlike user applets, most system applets have their own unique tile; +// the only reference to this tile is held by the system applet itself. +// - give it a name +// A system applet's name is its unique identifier. +// The name is our only reference to specific system applets, via InkHUD->getSystemApplet +// - add it to the list of system applets + +void InkHUD::WindowManager::addSystemApplet(const char *name, SystemApplet *applet, Tile *tile) { - // Ask applets which update type they would prefer - // Some update types take priority over others - EInk::UpdateTypes type = EInk::UpdateTypes::UNSPECIFIED; - if (forcingUpdate) { - // Update type was manually specified via forceUpdate - type = forcedUpdateType; - } else { - // User applets - for (Tile *ut : userTiles) { - Applet *ua = ut->getAssignedApplet(); - if (ua && ua->isForeground() && canRequestUpdate()) - type = mediator.prioritize(type, ua->wantsUpdateType()); - } - // System Applets - for (Applet *sa : systemApplets) { - if (sa->isForeground() && canRequestUpdate(sa)) - type = mediator.prioritize(type, sa->wantsUpdateType()); - } - } + // Some system applets might not have their own tile (e.g. menu, placeholder) + if (tile) + tile->assignApplet(applet); - // Tell the mediator what update type the applets deciced on, - // find out what update type the mediator will actually allow us to have - type = mediator.evaluate(type); - - return type; + applet->name = name; + inkhud->systemApplets.push_back(applet); } -// Run the drawing operations of any user applets which are currently displayed -// Pixel output is placed into the framebuffer, ready for handoff to the EInk driver -// Abstraction for WindowManager::render only -void InkHUD::WindowManager::renderUserApplets() +// Create the "system applets" +// These handle things like bootscreen, pop-up notifications etc +// They are processed separately from the user applets, because they might need to do "weird things" +void InkHUD::WindowManager::createSystemApplets() { - // Don't render any user applets if the screen is covered by a system applet using the fullscreen tile - if (fullscreenTile->getAssignedApplet()) - return; + addSystemApplet("Logo", new LogoApplet, new Tile); + addSystemApplet("Pairing", new PairingApplet, new Tile); + addSystemApplet("Tips", new TipsApplet, new Tile); - // For each tile - for (Tile *ut : userTiles) { - Applet *ua = ut->getAssignedApplet(); // Get the applet on the tile + addSystemApplet("Menu", new MenuApplet, nullptr); - // Don't render if tile has no applet. Handled in renderPlaceholders - if (!ua) - continue; + // Battery and notifications *behind* the menu + addSystemApplet("Notification", new NotificationApplet, new Tile); + addSystemApplet("BatteryIcon", new BatteryIconApplet, new Tile); - // Don't render the menu applet, Handled by renderSystemApplets - if (ua == menuApplet) - continue; + // Special handling only, via Rendering::renderPlaceholders + addSystemApplet("Placeholder", new PlaceholderApplet, nullptr); - uint32_t start = millis(); - ua->render(); // Draw! - uint32_t stop = millis(); - LOG_DEBUG("%s took %dms to render", ua->name, stop - start); + // System applets are always active + for (SystemApplet *sa : inkhud->systemApplets) + sa->activate(); +} + +// Set the position and size of most system applets +// Most system applets have their own tile. We manually set the region this tile occupies +void InkHUD::WindowManager::placeSystemTiles() +{ + inkhud->getSystemApplet("Logo")->getTile()->setRegion(0, 0, inkhud->width(), inkhud->height()); + inkhud->getSystemApplet("Pairing")->getTile()->setRegion(0, 0, inkhud->width(), inkhud->height()); + inkhud->getSystemApplet("Tips")->getTile()->setRegion(0, 0, inkhud->width(), inkhud->height()); + + inkhud->getSystemApplet("Notification")->getTile()->setRegion(0, 0, inkhud->width(), 20); + + const uint16_t batteryIconHeight = Applet::getHeaderHeight() - 2 - 2; + const uint16_t batteryIconWidth = batteryIconHeight * 1.8; + inkhud->getSystemApplet("BatteryIcon") + ->getTile() + ->setRegion(inkhud->width() - batteryIconWidth, // x + 2, // y + batteryIconWidth, // width + batteryIconHeight); // height + + // Note: the tiles of placeholder and menu applets are manipulated specially + // - menuApplet borrows user tiles + // - placeholder applet is temporarily assigned to each user tile of WindowManager::getEmptyTiles +} + +// Activate or deactivate user applets, to match settings +// Called at boot, or after run-time config changes via menu +// Note: this method does not instantiate the applets; +// this is done in setupNicheGraphics, when passing to InkHUD::addApplet +void InkHUD::WindowManager::createUserApplets() +{ + // Deactivate and remove any no-longer-needed applets + for (uint8_t i = 0; i < inkhud->userApplets.size(); i++) { + Applet *a = inkhud->userApplets.at(i); + + // If the applet is active, but settings say it shouldn't be: + // - run applet's custom deactivation code + // - mark applet as inactive (internally) + if (a->isActive() && !settings->userApplets.active[i]) + a->deactivate(); + } + + // Activate and add any new applets + for (uint8_t i = 0; i < inkhud->userApplets.size(); i++) { + + // If not activated, but it now should be: + // - run applet's custom activation code + // - mark applet as active (internally) + if (!inkhud->userApplets.at(i)->isActive() && settings->userApplets.active[i]) + inkhud->userApplets.at(i)->activate(); } } -// Run the drawing operations of any system applets which are currently displayed -// Pixel output is placed into the framebuffer, ready for handoff to the EInk driver -// Abstraction for WindowManager::render only -void InkHUD::WindowManager::renderSystemApplets() +// Creates the tiles which will host user applets +// The amount of these is controlled by the user, via "layout" option in the InkHUD menu +void InkHUD::WindowManager::createUserTiles() { - // Each system applet - for (Applet *sa : systemApplets) { - // Skip if not shown - if (!sa->isForeground()) - continue; + // Delete any tiles which currently exist + for (Tile *t : userTiles) + delete t; + userTiles.clear(); - // Don't draw the battery overtop the menu - // Todo: smarter way to handle this - if (sa == batteryIconApplet && menuApplet->isForeground()) - continue; - - // Skip applet if fullscreen tile is in use, but not used by this applet - // Applet is "obscured" - if (fullscreenTile->getAssignedApplet() && fullscreenTile->getAssignedApplet() != sa) - continue; - - // uint32_t start = millis(); // Debugging only: runtime - sa->render(); // Draw! - // uint32_t stop = millis(); // Debugging only: runtime - // LOG_DEBUG("%s (system) took %dms to render", (sa->name == nullptr) ? "Unnamed" : sa->name, stop - start); + // Create new tiles + for (uint8_t i = 0; i < settings->userTiles.count; i++) { + Tile *t = new Tile; + userTiles.push_back(t); } } -// In some situations (e.g. layout or applet selection changes), -// a user tile can end up without an assigned applet. -// In this case, we will fill the empty space with diagonal lines. -void InkHUD::WindowManager::renderPlaceholders() +// Calculate the display region occupied by each tile +// This determines how pixels are translated from "relative" applet-space to "absolute" windowmanager-space +// The size and position depend on the amount of tiles the user prefers, set by the "layout" option +void InkHUD::WindowManager::placeUserTiles() { - // Don't draw if obscured by the fullscreen tile - if (fullscreenTile->getAssignedApplet()) - return; + for (uint8_t i = 0; i < userTiles.size(); i++) + userTiles.at(i)->setRegion(settings->userTiles.count, i); +} - for (Tile *ut : userTiles) { - // If no applet assigned - if (!ut->getAssignedApplet()) { - ut->assignApplet(placeholderApplet); - placeholderApplet->render(); - ut->assignApplet(nullptr); +// Link "foreground" user applets with tiles +// Which applet should be *initially* shown on a tile? +// This initial state changes once WindowManager::nextApplet is called. +// Performed at startup, or during certain run-time reconfigurations (e.g number of tiles) +// This state of "which applets are foreground" is preserved between reboots, but the value needs validating at startup. +void InkHUD::WindowManager::assignUserAppletsToTiles() +{ + // Each user tile + for (uint8_t i = 0; i < userTiles.size(); i++) { + Tile *t = userTiles.at(i); + + // Check whether tile can display the previously shown applet again + uint8_t oldIndex = settings->userTiles.displayedUserApplet[i]; // Previous index in WindowManager::userApplets + bool canRestore = true; + if (oldIndex > inkhud->userApplets.size() - 1) // Check if old index is now out of bounds + canRestore = false; + else if (!settings->userApplets.active[oldIndex]) // Check that old applet is still activated + canRestore = false; + else { // Check that the old applet isn't now shown already on a different tile + for (uint8_t i2 = 0; i2 < i; i2++) { + if (settings->userTiles.displayedUserApplet[i2] == oldIndex) { + canRestore = false; + break; + } + } + } + + // Restore previously shown applet if possible, + // otherwise assign nullptr, which will render specially using placeholderApplet + if (canRestore) { + Applet *a = inkhud->userApplets.at(oldIndex); + t->assignApplet(a); + a->bringToForeground(); + } else { + t->assignApplet(nullptr); + settings->userTiles.displayedUserApplet[i] = -1; // Update settings: current tile has no valid applet } } } -// Make an attempt to gather image data from some / all applets, and update the display -// Might not be possible right now, if update already is progress. -void InkHUD::WindowManager::render(bool async) +// During layout changes, our focused tile setting can become invalid +// This method identifies that situation and corrects for it +void InkHUD::WindowManager::refocusTile() { - // Make sure the display is ready for a new update - if (async) { - // Previous update still running, Will try again shortly, via runOnce() - if (driver->busy()) - return; - } else { - // Wait here for previous update to complete - driver->await(); + // Validate "focused tile" setting + // - info: focused tile responds to button presses: applet cycling, menu, etc + // - if number of tiles changed, might now be out of index + if (settings->userTiles.focused >= userTiles.size()) + settings->userTiles.focused = 0; + + // Give "focused tile" a valid applet + // - scan for another valid applet, which we can addSubstitution + // - reason: nextApplet() won't cycle if no applet is assigned + Tile *focusedTile = userTiles.at(settings->userTiles.focused); + if (!focusedTile->getAssignedApplet()) { + // Search for available applets + for (uint8_t i = 0; i < inkhud->userApplets.size(); i++) { + Applet *a = inkhud->userApplets.at(i); + if (a->isActive() && !a->isForeground()) { + // Found a suitable applet + // Assign it to the focused tile + focusedTile->assignApplet(a); + a->bringToForeground(); + settings->userTiles.displayedUserApplet[settings->userTiles.focused] = i; // Record change: persist after reboot + break; + } + } } - - // (Potentially) change applet to display new info, - // then check if this newly displayed applet makes a pending notification redundant - autoshow(); - - // If an update is justified. - // We don't know this until after autoshow has run, as new applets may now be in foreground - if (shouldUpdate()) { - - // Decide which technique the display will use to change image - EInk::UpdateTypes updateType = selectUpdateType(); - - // Render the new image - clearBuffer(); - renderUserApplets(); - renderSystemApplets(); - renderPlaceholders(); - - // Tell display to begin process of drawing new image - LOG_INFO("Updating display"); - driver->update(imageBuffer, updateType); - - // If not async, wait here until the update is complete - if (!async) - driver->await(); - } else - LOG_DEBUG("Not updating display"); - - // Our part is done now. - // If update is async, the display hardware is still performing the update process, - // but that's all handled by NicheGraphics::Drivers::EInk - - // Tidy up, ready for a new request - requestingUpdate = false; - forcingUpdate = false; - forcedUpdateType = EInk::UpdateTypes::UNSPECIFIED; -} - -// Set a ready-to-draw pixel into the image buffer -// All rotations / translations have already taken place: this buffer data is formatted ready for the driver -void InkHUD::WindowManager::setBufferPixel(int16_t x, int16_t y, Color c) -{ - uint32_t byteNum = (y * imageBufferWidth) + (x / 8); // X data is 8 pixels per byte - uint8_t bitNum = 7 - (x % 8); // Invert order: leftmost bit (most significant) is leftmost pixel of byte. - - bitWrite(imageBuffer[byteNum], bitNum, c); -} - -// Applies the system-wide rotation to pixel positions -// This step is applied to image data which has already been translated by a Tile object -// This is the final step before the pixel is placed into the image buffer -// No return: values of the *x and *y parameters are modified by the method -void InkHUD::WindowManager::rotatePixelCoords(int16_t *x, int16_t *y) -{ - // Apply a global rotation to pixel locations - int16_t x1 = 0; - int16_t y1 = 0; - switch (settings.rotation) { - case 0: - x1 = *x; - y1 = *y; - break; - case 1: - x1 = (driver->width - 1) - *y; - y1 = *x; - break; - case 2: - x1 = (driver->width - 1) - *x; - y1 = (driver->height - 1) - *y; - break; - case 3: - x1 = *y; - y1 = (driver->height - 1) - *x; - break; - } - *x = x1; - *y = y1; -} - -// Manually fill the image buffer with WHITE -// Clears any old drawing -void InkHUD::WindowManager::clearBuffer() -{ - memset(imageBuffer, 0xFF, imageBufferHeight * imageBufferWidth); } // Seach for any applets which believe they are foreground, but no longer have a valid tile // Tidies up after layout changes at runtime void InkHUD::WindowManager::findOrphanApplets() { - for (uint8_t ia = 0; ia < userApplets.size(); ia++) { - Applet *a = userApplets.at(ia); + for (uint8_t ia = 0; ia < inkhud->userApplets.size(); ia++) { + Applet *a = inkhud->userApplets.at(ia); // Applet doesn't believe it is displayed: not orphaned if (!a->isForeground()) diff --git a/src/graphics/niche/InkHUD/WindowManager.h b/src/graphics/niche/InkHUD/WindowManager.h index f701233e2..4d1aedf1b 100644 --- a/src/graphics/niche/InkHUD/WindowManager.h +++ b/src/graphics/niche/InkHUD/WindowManager.h @@ -2,13 +2,7 @@ /* - Singleton class, which manages the broadest InkHUD behaviors - - Tasks include: - - containing instances of Tiles and Applets - - co-ordinating display updates - - interacting with other NicheGraphics componets, such as the driver, and input sources - - handling system-wide events (e.g. shutdown) +Responsible for managing which applets are shown, and their sizes / positions */ @@ -16,48 +10,47 @@ #include "configuration.h" -#include - -#include "main.h" -#include "modules/TextMessageModule.h" -#include "power.h" -#include "sleep.h" - -#include "./Applet.h" -#include "./Applets/System/Notification/Notification.h" +#include "./Applets/System/Notification/Notification.h" // The notification object, not the applet +#include "./InkHUD.h" #include "./Persistence.h" #include "./Tile.h" -#include "./Types.h" -#include "./UpdateMediator.h" -#include "graphics/niche/Drivers/EInk/EInk.h" namespace NicheGraphics::InkHUD { -class Applet; -class Tile; - -class LogoApplet; -class MenuApplet; -class NotificationApplet; - -class WindowManager : protected concurrency::OSThread +class WindowManager { public: - static WindowManager *getInstance(); // Get or create singleton instance + WindowManager(); + void addApplet(const char *name, Applet *a, bool defaultActive, bool defaultAutoshow, uint8_t onTile); + void begin(); - void setDriver(NicheGraphics::Drivers::EInk *driver); // Assign a driver class - void setDisplayResilience(uint8_t fastPerFull, float stressMultiplier); // How many FAST updates before FULL - void addApplet(const char *name, Applet *a, bool defaultActive = false, bool defaultAutoshow = false, - uint8_t onTile = -1); // Select which applets are used with InkHUD - void begin(); // Start running the window manager (provisioning done) + // - call these to make stuff change - void createSystemApplets(); // Instantiate and activate system applets - void createSystemTiles(); // Instantiate tiles which host system applets - void assignSystemAppletsToTiles(); - void placeSystemTiles(); // Set position and size - void claimFullscreen(Applet *sa); // Assign a system applet to the fullscreen tile - void releaseFullscreen(); // Remove any system applet from the fullscreen tile + void nextTile(); + void openMenu(); + void nextApplet(); + void rotate(); + void toggleBatteryIcon(); + + // - call these to manifest changes already made to the relevant Persistence::Settings values + + void changeLayout(); // Change tile layout or count + void changeActivatedApplets(); // Change which applets are activated + + // - called during the rendering operation + + void autoshow(); // Show a different applet, to display new info + std::vector getEmptyTiles(); // Any user tiles without a valid applet + + private: + // Steps for configuring (or reconfiguring) the window manager + // - all steps required at startup + // - various combinations of steps required for on-the-fly reconfiguration (by user, via menu) + + void addSystemApplet(const char *name, SystemApplet *applet, Tile *tile); + void createSystemApplets(); // Instantiate the system applets + void placeSystemTiles(); // Assign manual positions to (most) system applets void createUserApplets(); // Activate user's selected applets void createUserTiles(); // Instantiate enough tiles for user's selected layout @@ -65,113 +58,15 @@ class WindowManager : protected concurrency::OSThread void placeUserTiles(); // Automatically place tiles, according to user's layout void refocusTile(); // Ensure focused tile has a valid applet - int beforeDeepSleep(void *unused); // Prepare for shutdown - int beforeReboot(void *unused); // Prepare for reboot - int onReceiveTextMessage(const meshtastic_MeshPacket *packet); // Store most recent text message -#ifdef ARCH_ESP32 - int beforeLightSleep(void *unused); // Prepare for light sleep -#endif - - void handleButtonShort(); // User button: short press - void handleButtonLong(); // User button: long press - - void nextApplet(); // Cycle through user applets - void nextTile(); // Focus the next tile (when showing multiple applets at once) - - void changeLayout(); // Change tile layout or count - void changeActivatedApplets(); // Change which applets are activated - void toggleBatteryIcon(); // Change whether the battery icon is shown - bool approveNotification(Notification &n); // Ask applets if a notification is worth showing - - void handleTilePixel(int16_t x, int16_t y, Color c); // Apply rotation, then store the pixel in framebuffer - void requestUpdate(); // Update display, if a foreground applet has info it wants to show - void forceUpdate(Drivers::EInk::UpdateTypes type = Drivers::EInk::UpdateTypes::UNSPECIFIED, - bool async = true); // Update display, regardless of whether any applets requested this - - uint16_t getWidth(); // Display width, relative to rotation - uint16_t getHeight(); // Display height, relative to rotation - uint8_t getAppletCount(); // How many user applets are available, including inactivated - const char *getAppletName(uint8_t index); // By order in userApplets - - void lock(Applet *owner); // Allows system applets to prevent other applets triggering a refresh - void unlock(Applet *owner); // Allows normal updating of user applets to continue - bool canRequestUpdate(Applet *a = nullptr); // Checks if allowed to request an update (not locked by other applet) - Applet *whoLocked(); // Find which applet is blocking update requests, if any - - protected: - WindowManager(); // Private constructor for singleton - - int32_t runOnce() override; - - void clearBuffer(); // Empty the framebuffer - void autoshow(); // Show a different applet, to display new info - bool shouldUpdate(); // Check if reason to change display image - Drivers::EInk::UpdateTypes selectUpdateType(); // Determine how the display hardware will perform the image update - void renderUserApplets(); // Draw all currently displayed user applets to the frame buffer - void renderSystemApplets(); // Draw all currently displayed system applets to the frame buffer - void renderPlaceholders(); // Draw diagonal lines on user tiles which have no assigned applet - void render(bool async = true); // Attempt to update the display - - void setBufferPixel(int16_t x, int16_t y, Color c); // Place pixels into the frame buffer. All translation / rotation done. - void rotatePixelCoords(int16_t *x, int16_t *y); // Apply the display rotation - void findOrphanApplets(); // Find any applets left-behind when layout changes - // Get notified when the system is shutting down - CallbackObserver deepSleepObserver = - CallbackObserver(this, &WindowManager::beforeDeepSleep); + std::vector userTiles; // Tiles which can host user applets - // Get notified when the system is rebooting - CallbackObserver rebootObserver = - CallbackObserver(this, &WindowManager::beforeReboot); - - // Cache *incoming* text messages, for use by applets - CallbackObserver textMessageObserver = - CallbackObserver(this, &WindowManager::onReceiveTextMessage); - -#ifdef ARCH_ESP32 - // Get notified when the system is entering light sleep - CallbackObserver lightSleepObserver = - CallbackObserver(this, &WindowManager::beforeLightSleep); -#endif - - NicheGraphics::Drivers::EInk *driver = nullptr; - uint8_t *imageBuffer; // Fed into driver - uint16_t imageBufferHeight; - uint16_t imageBufferWidth; - uint32_t imageBufferSize; // Bytes - - // Encapsulates decision making about E-Ink update types - // Responsible for display health - UpdateMediator mediator; - - // User Applets - std::vector userApplets; - std::vector userTiles; - - // System Applets - std::vector systemApplets; - Tile *fullscreenTile = nullptr; - Tile *notificationTile = nullptr; - Tile *batteryIconTile = nullptr; - LogoApplet *logoApplet; - Applet *pairingApplet; - Applet *tipsApplet; - NotificationApplet *notificationApplet; - Applet *batteryIconApplet; - MenuApplet *menuApplet; - Applet *placeholderApplet; - - // requestUpdate - bool requestingUpdate = false; // WindowManager::render run pending - - // forceUpdate - bool forcingUpdate = false; // WindowManager::render run pending, guaranteed no skip of update - Drivers::EInk::UpdateTypes forcedUpdateType = Drivers::EInk::UpdateTypes::UNSPECIFIED; // guaranteed update using this type - - Applet *lockOwner = nullptr; // Which system applet (if any) is preventing other applets from requesting update + // For convenience + InkHUD *inkhud = nullptr; + Persistence::Settings *settings = nullptr; }; -}; // namespace NicheGraphics::InkHUD +} // namespace NicheGraphics::InkHUD #endif \ No newline at end of file diff --git a/src/graphics/niche/Inputs/TwoButton.cpp b/src/graphics/niche/Inputs/TwoButton.cpp index e478364cc..10d89ef41 100644 --- a/src/graphics/niche/Inputs/TwoButton.cpp +++ b/src/graphics/niche/Inputs/TwoButton.cpp @@ -18,6 +18,10 @@ TwoButton::TwoButton() : concurrency::OSThread("TwoButton") lsObserver.observe(¬ifyLightSleep); lsEndObserver.observe(¬ifyLightSleepEnd); #endif + + // Explicitly initialize these, just to keep cppcheck quiet.. + buttons[0] = Button(); + buttons[1] = Button(); } // Get access to (or create) the singleton instance of this class @@ -185,7 +189,7 @@ int32_t TwoButton::runOnce() // New press detected by interrupt case IRQ: powerFSM.trigger(EVENT_PRESS); // Tell PowerFSM that press occurred (resets sleep timer) - buttons[i].onDown(); // Inform that press has begun (possible hold behavior) + buttons[i].onDown(); // Run callback: press has begun (possible hold behavior) buttons[i].state = State::POLLING_UNFIRED; // Mark that button-down has been handled awaitingRelease = true; // Mark that polling-for-release should continue break; @@ -197,17 +201,17 @@ int32_t TwoButton::runOnce() // If button released since last thread tick, if (digitalRead(buttons[i].pin) != buttons[i].activeLogic) { - buttons[i].onUp(); // Inform that press has ended (possible release of a hold) + buttons[i].onUp(); // Run callback: press has ended (possible release of a hold) buttons[i].state = State::REST; // Mark that the button has reset - if (length > buttons[i].debounceLength && length < buttons[i].longpressLength) - buttons[i].onShortPress(); + if (length > buttons[i].debounceLength && length < buttons[i].longpressLength) // If too short for longpress, + buttons[i].onShortPress(); // Run callback: short press } // If button not yet released else { awaitingRelease = true; // Mark that polling-for-release should continue if (length >= buttons[i].longpressLength) { - // Raise a long press event, once + // Run callback: long press (once) // Then continue waiting for release, to rearm buttons[i].state = State::POLLING_FIRED; buttons[i].onLongPress(); @@ -222,7 +226,7 @@ int32_t TwoButton::runOnce() // Release detected if (digitalRead(buttons[i].pin) != buttons[i].activeLogic) { buttons[i].state = State::REST; - buttons[i].onUp(); // Possible release of hold (in this case: *after* longpress has fired) + buttons[i].onUp(); // Callback: release of hold (in this case: *after* longpress has fired) } // Not yet released, keep polling else diff --git a/variants/heltec_vision_master_e213/nicheGraphics.h b/variants/heltec_vision_master_e213/nicheGraphics.h index f7a37fc61..b14c72896 100644 --- a/variants/heltec_vision_master_e213/nicheGraphics.h +++ b/variants/heltec_vision_master_e213/nicheGraphics.h @@ -6,7 +6,7 @@ // InkHUD-specific components // --------------------------- -#include "graphics/niche/InkHUD/WindowManager.h" +#include "graphics/niche/InkHUD/InkHUD.h" // Applets #include "graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.h" @@ -49,30 +49,29 @@ void setupNicheGraphics() // InkHUD // ---------------------------- - InkHUD::WindowManager *windowManager = InkHUD::WindowManager::getInstance(); + InkHUD::InkHUD *inkhud = InkHUD::InkHUD::getInstance(); // Set the driver - windowManager->setDriver(driver); + inkhud->setDriver(driver); // Set how many FAST updates per FULL update // Set how unhealthy additional FAST updates beyond this number are - windowManager->setDisplayResilience(10, 1.5); + inkhud->setDisplayResilience(10, 1.5); // Prepare fonts - InkHUD::AppletFont largeFont(FreeSans9pt7b); - InkHUD::AppletFont smallFont(FreeSans6pt7b); + InkHUD::Applet::fontLarge = InkHUD::AppletFont(FreeSans9pt7b); + InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt7b); /* // Font localization demo: Cyrillic - InkHUD::AppletFont smallFont(FreeSans6pt8bCyrillic); - smallFont.addSubstitutionsWin1251(); + InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt8bCyrillic); + InkHUD::Applet::fontSmall.addSubstitutionsWin1251(); */ - InkHUD::Applet::setDefaultFonts(largeFont, smallFont); // Init settings, and customize defaults - InkHUD::settings.userTiles.maxCount = 2; // How many tiles can the display handle? - InkHUD::settings.rotation = 3; // 270 degrees clockwise - InkHUD::settings.userTiles.count = 1; // One tile only by default, keep things simple for new users - InkHUD::settings.optionalMenuItems.nextTile = false; // Behavior handled by aux button instead + inkhud->persistence->settings.userTiles.maxCount = 2; // How many tiles can the display handle? + inkhud->persistence->settings.rotation = 3; // 270 degrees clockwise + inkhud->persistence->settings.userTiles.count = 1; // One tile only by default, keep things simple for new users + inkhud->persistence->settings.optionalMenuItems.nextTile = false; // Behavior handled by aux button instead // Pick applets // Note: order of applets determines priority of "auto-show" feature @@ -80,18 +79,18 @@ void setupNicheGraphics() // - is activated? // - is autoshown? // - is foreground on a specific tile (index)? - windowManager->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown - windowManager->addApplet("DMs", new InkHUD::DMApplet); - windowManager->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); - windowManager->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); - windowManager->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated - windowManager->addApplet("Recents List", new InkHUD::RecentsListApplet); - windowManager->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0 - // windowManager->addApplet("Basic", new InkHUD::BasicExampleApplet); - // windowManager->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet); + inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown + inkhud->addApplet("DMs", new InkHUD::DMApplet); + inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); + inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); + inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated + inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); + inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0 + // inkhud->addApplet("Basic", new InkHUD::BasicExampleApplet); + // inkhud->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet); - // Start running window manager - windowManager->begin(); + // Start running InkHUD + inkhud->begin(); // Buttons // -------------------------- @@ -102,13 +101,13 @@ void setupNicheGraphics() // Setup the main user button buttons->setWiring(MAIN_BUTTON, BUTTON_PIN); - buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::WindowManager::getInstance()->handleButtonShort(); }); - buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::WindowManager::getInstance()->handleButtonLong(); }); + buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->shortpress(); }); + buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->longpress(); }); // Setup the aux button // Bonus feature of VME213 buttons->setWiring(AUX_BUTTON, BUTTON_PIN_SECONDARY); - buttons->setHandlerShortPress(AUX_BUTTON, []() { InkHUD::WindowManager::getInstance()->nextTile(); }); + buttons->setHandlerShortPress(AUX_BUTTON, []() { InkHUD::InkHUD::getInstance()->nextTile(); }); buttons->start(); } diff --git a/variants/heltec_vision_master_e213/platformio.ini b/variants/heltec_vision_master_e213/platformio.ini index 00fffdfd9..6ba597200 100644 --- a/variants/heltec_vision_master_e213/platformio.ini +++ b/variants/heltec_vision_master_e213/platformio.ini @@ -30,8 +30,8 @@ build_flags = ${inkhud.build_flags} -I variants/heltec_vision_master_e213 -D HELTEC_VISION_MASTER_E213 - -D MAX_THREADS=40 + -D MAX_THREADS=40 ; Required if used with WiFi lib_deps = - ${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot intead of AdafruitGFX + ${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX ${esp32s3_base.lib_deps} -upload_speed = 115200 \ No newline at end of file +upload_speed = 921600 \ No newline at end of file diff --git a/variants/heltec_vision_master_e290/nicheGraphics.h b/variants/heltec_vision_master_e290/nicheGraphics.h index c55a84ec0..c14ee76ec 100644 --- a/variants/heltec_vision_master_e290/nicheGraphics.h +++ b/variants/heltec_vision_master_e290/nicheGraphics.h @@ -62,30 +62,29 @@ void setupNicheGraphics() // InkHUD // ---------------------------- - InkHUD::WindowManager *windowManager = InkHUD::WindowManager::getInstance(); + InkHUD::InkHUD *inkhud = InkHUD::InkHUD::getInstance(); // Set the driver - windowManager->setDriver(driver); + inkhud->setDriver(driver); // Set how many FAST updates per FULL update // Set how unhealthy additional FAST updates beyond this number are - windowManager->setDisplayResilience(7, 1.5); + inkhud->setDisplayResilience(7, 1.5); // Prepare fonts - InkHUD::AppletFont largeFont(FreeSans9pt7b); - InkHUD::AppletFont smallFont(FreeSans6pt7b); + InkHUD::Applet::fontLarge = InkHUD::AppletFont(FreeSans9pt7b); + InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt7b); /* // Font localization demo: Cyrillic - InkHUD::AppletFont smallFont(FreeSans6pt8bCyrillic); - smallFont.addSubstitutionsWin1251(); + InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt8bCyrillic); + InkHUD::Applet::fontSmall.addSubstitutionsWin1251(); */ - InkHUD::Applet::setDefaultFonts(largeFont, smallFont); // Init settings, and customize defaults - InkHUD::settings.userTiles.maxCount = 2; // How many tiles can the display handle? - InkHUD::settings.rotation = 1; // 90 degrees clockwise - InkHUD::settings.userTiles.count = 1; // One tile only by default, keep things simple for new users - InkHUD::settings.optionalMenuItems.nextTile = false; // Behavior handled by aux button instead + inkhud->persistence->settings.userTiles.maxCount = 2; // How many tiles can the display handle? + inkhud->persistence->settings.rotation = 1; // 90 degrees clockwise + inkhud->persistence->settings.userTiles.count = 1; // One tile only by default, keep things simple for new users + inkhud->persistence->settings.optionalMenuItems.nextTile = false; // Behavior handled by aux button instead // Pick applets // Note: order of applets determines priority of "auto-show" feature @@ -93,35 +92,33 @@ void setupNicheGraphics() // - is activated? // - is autoshown? // - is foreground on a specific tile (index)? - windowManager->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown - windowManager->addApplet("DMs", new InkHUD::DMApplet); - windowManager->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); - windowManager->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); - windowManager->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated - windowManager->addApplet("Recents List", new InkHUD::RecentsListApplet); - windowManager->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0 - // windowManager->addApplet("Basic", new InkHUD::BasicExampleApplet); - // windowManager->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet); + inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown + inkhud->addApplet("DMs", new InkHUD::DMApplet); + inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); + inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); + inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated + inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); + inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0 + // inkhud->addApplet("Basic", new InkHUD::BasicExampleApplet); + // inkhud->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet); - // Start running window manager - windowManager->begin(); + // Start running InkHUD + inkhud->begin(); // Buttons // -------------------------- - Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // Shared NicheGraphics component - constexpr uint8_t MAIN_BUTTON = 0; - constexpr uint8_t AUX_BUTTON = 1; + Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // A shared NicheGraphics component - // Setup the main user button - buttons->setWiring(MAIN_BUTTON, BUTTON_PIN); - buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::WindowManager::getInstance()->handleButtonShort(); }); - buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::WindowManager::getInstance()->handleButtonLong(); }); + // Setup the main user button (0) + buttons->setWiring(0, BUTTON_PIN); + buttons->setHandlerShortPress(0, []() { InkHUD::InkHUD::getInstance()->shortpress(); }); + buttons->setHandlerLongPress(0, []() { InkHUD::InkHUD::getInstance()->longpress(); }); - // Setup the aux button + // Setup the aux button (1) // Bonus feature of VME290 - buttons->setWiring(AUX_BUTTON, BUTTON_PIN_SECONDARY); - buttons->setHandlerShortPress(AUX_BUTTON, []() { InkHUD::WindowManager::getInstance()->nextTile(); }); + buttons->setWiring(1, BUTTON_PIN_SECONDARY); + buttons->setHandlerShortPress(1, []() { InkHUD::InkHUD::getInstance()->nextTile(); }); buttons->start(); } diff --git a/variants/heltec_vision_master_e290/platformio.ini b/variants/heltec_vision_master_e290/platformio.ini index 232b13559..cfea81a7e 100644 --- a/variants/heltec_vision_master_e290/platformio.ini +++ b/variants/heltec_vision_master_e290/platformio.ini @@ -34,8 +34,8 @@ build_flags = ${inkhud.build_flags} -I variants/heltec_vision_master_e290 -D HELTEC_VISION_MASTER_E290 - -D MAX_THREADS=40 + -D MAX_THREADS=40 ; Required if used with WiFi lib_deps = - ${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot intead of AdafruitGFX + ${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX ${esp32s3_base.lib_deps} -upload_speed = 115200 \ No newline at end of file +upload_speed = 921600 \ No newline at end of file diff --git a/variants/heltec_wireless_paper/nicheGraphics.h b/variants/heltec_wireless_paper/nicheGraphics.h index 0c26f453c..44405b8f6 100644 --- a/variants/heltec_wireless_paper/nicheGraphics.h +++ b/variants/heltec_wireless_paper/nicheGraphics.h @@ -6,7 +6,7 @@ // InkHUD-specific components // --------------------------- -#include "graphics/niche/InkHUD/WindowManager.h" +#include "graphics/niche/InkHUD/InkHUD.h" // Applets #include "graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.h" @@ -49,29 +49,28 @@ void setupNicheGraphics() // InkHUD // ---------------------------- - InkHUD::WindowManager *windowManager = InkHUD::WindowManager::getInstance(); + InkHUD::InkHUD *inkhud = InkHUD::InkHUD::getInstance(); // Set the driver - windowManager->setDriver(driver); + inkhud->setDriver(driver); // Set how many FAST updates per FULL update // Set how unhealthy additional FAST updates beyond this number are - windowManager->setDisplayResilience(10, 1.5); + inkhud->setDisplayResilience(10, 1.5); // Prepare fonts - InkHUD::AppletFont largeFont(FreeSans9pt7b); - InkHUD::AppletFont smallFont(FreeSans6pt7b); + InkHUD::Applet::fontLarge = InkHUD::AppletFont(FreeSans9pt7b); + InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt7b); /* // Font localization demo: Cyrillic - InkHUD::AppletFont smallFont(FreeSans6pt8bCyrillic); - smallFont.addSubstitutionsWin1251(); + InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt8bCyrillic); + InkHUD::Applet::fontSmall.addSubstitutionsWin1251(); */ - InkHUD::Applet::setDefaultFonts(largeFont, smallFont); // Init settings, and customize defaults - InkHUD::settings.userTiles.maxCount = 2; // How many tiles can the display handle? - InkHUD::settings.rotation = 3; // 270 degrees clockwise - InkHUD::settings.userTiles.count = 1; // One tile only by default, keep things simple for new users + inkhud->persistence->settings.userTiles.maxCount = 2; // How many tiles can the display handle? + inkhud->persistence->settings.rotation = 3; // 270 degrees clockwise + inkhud->persistence->settings.userTiles.count = 1; // One tile only by default, keep things simple for new users // Pick applets // Note: order of applets determines priority of "auto-show" feature @@ -79,18 +78,18 @@ void setupNicheGraphics() // - is activated? // - is autoshown? // - is foreground on a specific tile (index)? - windowManager->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown - windowManager->addApplet("DMs", new InkHUD::DMApplet); - windowManager->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); - windowManager->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); - windowManager->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated - windowManager->addApplet("Recents List", new InkHUD::RecentsListApplet); - windowManager->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0 - // windowManager->addApplet("Basic", new InkHUD::BasicExampleApplet); - // windowManager->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet); + inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown + inkhud->addApplet("DMs", new InkHUD::DMApplet); + inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); + inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); + inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated + inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); + inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0 + // inkhud->addApplet("Basic", new InkHUD::BasicExampleApplet); + // inkhud->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet); - // Start running window manager - windowManager->begin(); + // Start running InkHUD + inkhud->begin(); // Buttons // -------------------------- @@ -100,8 +99,8 @@ void setupNicheGraphics() // Setup the main user button buttons->setWiring(MAIN_BUTTON, BUTTON_PIN); - buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::WindowManager::getInstance()->handleButtonShort(); }); - buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::WindowManager::getInstance()->handleButtonLong(); }); + buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->shortpress(); }); + buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->longpress(); }); // No aux button on this board diff --git a/variants/heltec_wireless_paper/platformio.ini b/variants/heltec_wireless_paper/platformio.ini index b32b60dd5..9979e1c1d 100644 --- a/variants/heltec_wireless_paper/platformio.ini +++ b/variants/heltec_wireless_paper/platformio.ini @@ -31,8 +31,8 @@ build_flags = ${inkhud.build_flags} -I variants/heltec_wireless_paper -D HELTEC_WIRELESS_PAPER - -D MAX_THREADS=40 + -D MAX_THREADS=40 ; Required if used with WiFi lib_deps = - ${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot intead of AdafruitGFX + ${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX ${esp32s3_base.lib_deps} -upload_speed = 115200 \ No newline at end of file +upload_speed = 921600 \ No newline at end of file diff --git a/variants/t-echo/nicheGraphics.h b/variants/t-echo/nicheGraphics.h index 44d8ef4c3..f0ffe4108 100644 --- a/variants/t-echo/nicheGraphics.h +++ b/variants/t-echo/nicheGraphics.h @@ -6,7 +6,7 @@ // InkHUD-specific components // --------------------------- -#include "graphics/niche/InkHUD/WindowManager.h" +#include "graphics/niche/InkHUD/InkHUD.h" // Applets #include "graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.h" @@ -50,31 +50,30 @@ void setupNicheGraphics() // InkHUD // ---------------------------- - InkHUD::WindowManager *windowManager = InkHUD::WindowManager::getInstance(); + InkHUD::InkHUD *inkhud = InkHUD::InkHUD::getInstance(); // Set the driver - windowManager->setDriver(driver); + inkhud->setDriver(driver); // Set how many FAST updates per FULL update // Set how unhealthy additional FAST updates beyond this number are - windowManager->setDisplayResilience(20, 1.5); + inkhud->setDisplayResilience(20, 1.5); // Prepare fonts - InkHUD::AppletFont largeFont(FreeSans9pt7b); - InkHUD::AppletFont smallFont(FreeSans6pt7b); + InkHUD::Applet::fontLarge = InkHUD::AppletFont(FreeSans9pt7b); + InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt7b); /* // Font localization demo: Cyrillic - InkHUD::AppletFont smallFont(FreeSans6pt8bCyrillic); - smallFont.addSubstitutionsWin1251(); + InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt8bCyrillic); + InkHUD::Applet::fontSmall.addSubstitutionsWin1251(); */ - InkHUD::Applet::setDefaultFonts(largeFont, smallFont); // Init settings, and customize defaults // Values ignored individually if found saved to flash - InkHUD::settings.userTiles.maxCount = 2; // Two applets side-by-side - InkHUD::settings.rotation = 3; // 270 degrees clockwise - InkHUD::settings.optionalFeatures.batteryIcon = true; // Device definitely has a battery - InkHUD::settings.optionalMenuItems.backlight = true; // Until proven (by touch) that user still has the capacitive button + inkhud->persistence->settings.userTiles.maxCount = 2; // Two applets side-by-side + inkhud->persistence->settings.rotation = 3; // 270 degrees clockwise + inkhud->persistence->settings.optionalFeatures.batteryIcon = true; // Device definitely has a battery + inkhud->persistence->settings.optionalMenuItems.backlight = true; // Until proves capacitive button works by touching it // Setup backlight // Note: AUX button behavior configured further down @@ -83,30 +82,32 @@ void setupNicheGraphics() // Pick applets // Note: order of applets determines priority of "auto-show" feature - windowManager->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown - windowManager->addApplet("DMs", new InkHUD::DMApplet); - windowManager->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); - windowManager->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); - windowManager->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated - windowManager->addApplet("Recents List", new InkHUD::RecentsListApplet); - windowManager->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, no autoshow, default on tile 0 - // windowManager->addApplet("Basic", new InkHUD::BasicExampleApplet); - // windowManager->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet); + inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown + inkhud->addApplet("DMs", new InkHUD::DMApplet); + inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); + inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); + inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated + inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); + inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, no autoshow, default on tile 0 + // inkhud->addApplet("Basic", new InkHUD::BasicExampleApplet); + // inkhud->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet); - // Start running window manager - windowManager->begin(); + // Start running InkHUD + inkhud->begin(); // Buttons // -------------------------- Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // Shared NicheGraphics component + + // (To improve code readability only) constexpr uint8_t MAIN_BUTTON = 0; constexpr uint8_t TOUCH_BUTTON = 1; // Setup the main user button buttons->setWiring(MAIN_BUTTON, BUTTON_PIN, LOW); - buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::WindowManager::getInstance()->handleButtonShort(); }); - buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::WindowManager::getInstance()->handleButtonLong(); }); + buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->shortpress(); }); + buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->longpress(); }); // Setup the capacitive touch button // - short: momentary backlight @@ -115,7 +116,8 @@ void setupNicheGraphics() buttons->setTiming(TOUCH_BUTTON, 50, 5000); // 5 seconds before latch - limited by T-Echo's capacitive touch IC buttons->setHandlerDown(TOUCH_BUTTON, [backlight]() { backlight->peek(); - InkHUD::settings.optionalMenuItems.backlight = false; // We've proved user still has the button. No need for menu entry. + InkHUD::InkHUD::getInstance()->persistence->settings.optionalMenuItems.backlight = + false; // We've proved user still has the button. No need to make backlight togglable via the menu. }); buttons->setHandlerLongPress(TOUCH_BUTTON, [backlight]() { backlight->latch(); }); buttons->setHandlerShortPress(TOUCH_BUTTON, [backlight]() { backlight->off(); }); diff --git a/variants/t-echo/platformio.ini b/variants/t-echo/platformio.ini index bca760453..e01befb45 100644 --- a/variants/t-echo/platformio.ini +++ b/variants/t-echo/platformio.ini @@ -39,6 +39,6 @@ build_src_filter = ${inkhud.build_src_filter} +<../variants/t-echo> lib_deps = - ${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot intead of AdafruitGFX + ${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX ${nrf52840_base.lib_deps} lewisxhe/PCF8563_Library@^1.0.1 \ No newline at end of file From f6a9e7d741eb656457dac9ee88d4d0b6908e78f5 Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Thu, 6 Mar 2025 12:28:43 +0200 Subject: [PATCH 245/381] =?UTF-8?q?Add=20initial=20support=20for=20CrowPan?= =?UTF-8?q?el=20ESP32=205.79=E2=80=9D=20E-paper=20HMI=20(#6233)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graphics/EInkDisplay2.cpp | 5 +- src/graphics/EInkDisplay2.h | 4 +- src/graphics/ScreenFonts.h | 10 + src/graphics/fonts/EinkDisplayFonts.cpp | 1184 +++++++++++++++++ src/graphics/fonts/EinkDisplayFonts.h | 14 + .../crowpanel-esp32s3-5-epaper/pins_arduino.h | 26 + .../crowpanel-esp32s3-5-epaper/platformio.ini | 28 + variants/crowpanel-esp32s3-5-epaper/variant.h | 77 ++ 8 files changed, 1345 insertions(+), 3 deletions(-) create mode 100644 src/graphics/fonts/EinkDisplayFonts.cpp create mode 100644 src/graphics/fonts/EinkDisplayFonts.h create mode 100644 variants/crowpanel-esp32s3-5-epaper/pins_arduino.h create mode 100644 variants/crowpanel-esp32s3-5-epaper/platformio.ini create mode 100644 variants/crowpanel-esp32s3-5-epaper/variant.h diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index 9702b0086..a640e3560 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -166,7 +166,7 @@ bool EInkDisplay::connect() } #elif defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_VISION_MASTER_E213) || \ - defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) + defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) || defined(CROWPANEL_ESP32S3_5_EPAPER) { // Start HSPI hspi = new SPIClass(HSPI); @@ -182,6 +182,9 @@ bool EInkDisplay::connect() // Init GxEPD2 adafruitDisplay->init(); adafruitDisplay->setRotation(3); +#if defined(CROWPANEL_ESP32S3_5_EPAPER) + adafruitDisplay->setRotation(0); +#endif } #elif defined(PCA10059) || defined(ME25LS01) { diff --git a/src/graphics/EInkDisplay2.h b/src/graphics/EInkDisplay2.h index af631150e..efbf45f0f 100644 --- a/src/graphics/EInkDisplay2.h +++ b/src/graphics/EInkDisplay2.h @@ -68,7 +68,7 @@ class EInkDisplay : public OLEDDisplay // If display uses HSPI #if defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_VISION_MASTER_E213) || \ - defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) + defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) || defined(CROWPANEL_ESP32S3_5_EPAPER) SPIClass *hspi = NULL; #endif @@ -77,4 +77,4 @@ class EInkDisplay : public OLEDDisplay uint32_t lastDrawMsec = 0; }; -#endif \ No newline at end of file +#endif diff --git a/src/graphics/ScreenFonts.h b/src/graphics/ScreenFonts.h index f6abec0f5..910d1b0b9 100644 --- a/src/graphics/ScreenFonts.h +++ b/src/graphics/ScreenFonts.h @@ -73,6 +73,16 @@ #define FONT_LARGE FONT_LARGE_LOCAL // Height: 28 #endif +#if defined(CROWPANEL_ESP32S3_5_EPAPER) +#include "graphics/fonts/EinkDisplayFonts.h" +#undef FONT_SMALL +#undef FONT_MEDIUM +#undef FONT_LARGE +#define FONT_SMALL FONT_LARGE_LOCAL // Height: 30 +#define FONT_MEDIUM FONT_LARGE_LOCAL // Height: 30 +#define FONT_LARGE FONT_LARGE_LOCAL // Height: 30 +#endif + #define _fontHeight(font) ((font)[1] + 1) // height is position 1 #define FONT_HEIGHT_SMALL _fontHeight(FONT_SMALL) diff --git a/src/graphics/fonts/EinkDisplayFonts.cpp b/src/graphics/fonts/EinkDisplayFonts.cpp new file mode 100644 index 000000000..cfe2c931f --- /dev/null +++ b/src/graphics/fonts/EinkDisplayFonts.cpp @@ -0,0 +1,1184 @@ +#include "EinkDisplayFonts.h" + +// Created by https://oleddisplay.squix.ch/ Consider a donation +// In case of problems make sure that you are using the font file with the correct version! +const uint8_t Monospaced_plain_30[] PROGMEM = { + 0x12, // Width: 18 + 0x24, // Height: 36 + 0x20, // First Char: 32 + 0xE0, // Numbers of Chars: 224 + + // Jump Table: + 0xFF, 0xFF, 0x00, 0x12, // 32:65535 + 0x00, 0x00, 0x36, 0x12, // 33:0 + 0x00, 0x36, 0x3E, 0x12, // 34:54 + 0x00, 0x74, 0x57, 0x12, // 35:116 + 0x00, 0xCB, 0x54, 0x12, // 36:203 + 0x01, 0x1F, 0x54, 0x12, // 37:287 + 0x01, 0x73, 0x59, 0x12, // 38:371 + 0x01, 0xCC, 0x2F, 0x12, // 39:460 + 0x01, 0xFB, 0x40, 0x12, // 40:507 + 0x02, 0x3B, 0x3A, 0x12, // 41:571 + 0x02, 0x75, 0x4D, 0x12, // 42:629 + 0x02, 0xC2, 0x4E, 0x12, // 43:706 + 0x03, 0x10, 0x36, 0x12, // 44:784 + 0x03, 0x46, 0x3F, 0x12, // 45:838 + 0x03, 0x85, 0x36, 0x12, // 46:901 + 0x03, 0xBB, 0x51, 0x12, // 47:955 + 0x04, 0x0C, 0x4E, 0x12, // 48:1036 + 0x04, 0x5A, 0x54, 0x12, // 49:1114 + 0x04, 0xAE, 0x4F, 0x12, // 50:1198 + 0x04, 0xFD, 0x4E, 0x12, // 51:1277 + 0x05, 0x4B, 0x53, 0x12, // 52:1355 + 0x05, 0x9E, 0x4E, 0x12, // 53:1438 + 0x05, 0xEC, 0x4E, 0x12, // 54:1516 + 0x06, 0x3A, 0x4D, 0x12, // 55:1594 + 0x06, 0x87, 0x4F, 0x12, // 56:1671 + 0x06, 0xD6, 0x4E, 0x12, // 57:1750 + 0x07, 0x24, 0x36, 0x12, // 58:1828 + 0x07, 0x5A, 0x36, 0x12, // 59:1882 + 0x07, 0x90, 0x4F, 0x12, // 60:1936 + 0x07, 0xDF, 0x4E, 0x12, // 61:2015 + 0x08, 0x2D, 0x4E, 0x12, // 62:2093 + 0x08, 0x7B, 0x48, 0x12, // 63:2171 + 0x08, 0xC3, 0x59, 0x12, // 64:2243 + 0x09, 0x1C, 0x59, 0x12, // 65:2332 + 0x09, 0x75, 0x4F, 0x12, // 66:2421 + 0x09, 0xC4, 0x4F, 0x12, // 67:2500 + 0x0A, 0x13, 0x4E, 0x12, // 68:2579 + 0x0A, 0x61, 0x4F, 0x12, // 69:2657 + 0x0A, 0xB0, 0x4D, 0x12, // 70:2736 + 0x0A, 0xFD, 0x54, 0x12, // 71:2813 + 0x0B, 0x51, 0x4F, 0x12, // 72:2897 + 0x0B, 0xA0, 0x4F, 0x12, // 73:2976 + 0x0B, 0xEF, 0x44, 0x12, // 74:3055 + 0x0C, 0x33, 0x59, 0x12, // 75:3123 + 0x0C, 0x8C, 0x54, 0x12, // 76:3212 + 0x0C, 0xE0, 0x54, 0x12, // 77:3296 + 0x0D, 0x34, 0x4F, 0x12, // 78:3380 + 0x0D, 0x83, 0x53, 0x12, // 79:3459 + 0x0D, 0xD6, 0x52, 0x12, // 80:3542 + 0x0E, 0x28, 0x53, 0x12, // 81:3624 + 0x0E, 0x7B, 0x59, 0x12, // 82:3707 + 0x0E, 0xD4, 0x4F, 0x12, // 83:3796 + 0x0F, 0x23, 0x57, 0x12, // 84:3875 + 0x0F, 0x7A, 0x4E, 0x12, // 85:3962 + 0x0F, 0xC8, 0x51, 0x12, // 86:4040 + 0x10, 0x19, 0x57, 0x12, // 87:4121 + 0x10, 0x70, 0x59, 0x12, // 88:4208 + 0x10, 0xC9, 0x56, 0x12, // 89:4297 + 0x11, 0x1F, 0x54, 0x12, // 90:4383 + 0x11, 0x73, 0x45, 0x12, // 91:4467 + 0x11, 0xB8, 0x54, 0x12, // 92:4536 + 0x12, 0x0C, 0x3B, 0x12, // 93:4620 + 0x12, 0x47, 0x52, 0x12, // 94:4679 + 0x12, 0x99, 0x5A, 0x12, // 95:4761 + 0x12, 0xF3, 0x34, 0x12, // 96:4851 + 0x13, 0x27, 0x4F, 0x12, // 97:4903 + 0x13, 0x76, 0x53, 0x12, // 98:4982 + 0x13, 0xC9, 0x4F, 0x12, // 99:5065 + 0x14, 0x18, 0x4F, 0x12, // 100:5144 + 0x14, 0x67, 0x53, 0x12, // 101:5223 + 0x14, 0xBA, 0x4D, 0x12, // 102:5306 + 0x15, 0x07, 0x4F, 0x12, // 103:5383 + 0x15, 0x56, 0x4F, 0x12, // 104:5462 + 0x15, 0xA5, 0x4F, 0x12, // 105:5541 + 0x15, 0xF4, 0x3B, 0x12, // 106:5620 + 0x16, 0x2F, 0x54, 0x12, // 107:5679 + 0x16, 0x83, 0x4F, 0x12, // 108:5763 + 0x16, 0xD2, 0x54, 0x12, // 109:5842 + 0x17, 0x26, 0x4F, 0x12, // 110:5926 + 0x17, 0x75, 0x4E, 0x12, // 111:6005 + 0x17, 0xC3, 0x53, 0x12, // 112:6083 + 0x18, 0x16, 0x50, 0x12, // 113:6166 + 0x18, 0x66, 0x52, 0x12, // 114:6246 + 0x18, 0xB8, 0x4A, 0x12, // 115:6328 + 0x19, 0x02, 0x4A, 0x12, // 116:6402 + 0x19, 0x4C, 0x4F, 0x12, // 117:6476 + 0x19, 0x9B, 0x4D, 0x12, // 118:6555 + 0x19, 0xE8, 0x57, 0x12, // 119:6632 + 0x1A, 0x3F, 0x54, 0x12, // 120:6719 + 0x1A, 0x93, 0x52, 0x12, // 121:6803 + 0x1A, 0xE5, 0x4A, 0x12, // 122:6885 + 0x1B, 0x2F, 0x4B, 0x12, // 123:6959 + 0x1B, 0x7A, 0x32, 0x12, // 124:7034 + 0x1B, 0xAC, 0x4E, 0x12, // 125:7084 + 0x1B, 0xFA, 0x4E, 0x12, // 126:7162 + 0x1C, 0x48, 0x55, 0x12, // 127:7240 + 0x1C, 0x9D, 0x55, 0x12, // 128:7325 + 0x1C, 0xF2, 0x55, 0x12, // 129:7410 + 0x1D, 0x47, 0x55, 0x12, // 130:7495 + 0x1D, 0x9C, 0x55, 0x12, // 131:7580 + 0x1D, 0xF1, 0x55, 0x12, // 132:7665 + 0x1E, 0x46, 0x55, 0x12, // 133:7750 + 0x1E, 0x9B, 0x55, 0x12, // 134:7835 + 0x1E, 0xF0, 0x55, 0x12, // 135:7920 + 0x1F, 0x45, 0x55, 0x12, // 136:8005 + 0x1F, 0x9A, 0x55, 0x12, // 137:8090 + 0x1F, 0xEF, 0x55, 0x12, // 138:8175 + 0x20, 0x44, 0x55, 0x12, // 139:8260 + 0x20, 0x99, 0x55, 0x12, // 140:8345 + 0x20, 0xEE, 0x55, 0x12, // 141:8430 + 0x21, 0x43, 0x55, 0x12, // 142:8515 + 0x21, 0x98, 0x55, 0x12, // 143:8600 + 0x21, 0xED, 0x55, 0x12, // 144:8685 + 0x22, 0x42, 0x55, 0x12, // 145:8770 + 0x22, 0x97, 0x55, 0x12, // 146:8855 + 0x22, 0xEC, 0x55, 0x12, // 147:8940 + 0x23, 0x41, 0x55, 0x12, // 148:9025 + 0x23, 0x96, 0x55, 0x12, // 149:9110 + 0x23, 0xEB, 0x55, 0x12, // 150:9195 + 0x24, 0x40, 0x55, 0x12, // 151:9280 + 0x24, 0x95, 0x55, 0x12, // 152:9365 + 0x24, 0xEA, 0x55, 0x12, // 153:9450 + 0x25, 0x3F, 0x55, 0x12, // 154:9535 + 0x25, 0x94, 0x55, 0x12, // 155:9620 + 0x25, 0xE9, 0x55, 0x12, // 156:9705 + 0x26, 0x3E, 0x55, 0x12, // 157:9790 + 0x26, 0x93, 0x55, 0x12, // 158:9875 + 0x26, 0xE8, 0x55, 0x12, // 159:9960 + 0xFF, 0xFF, 0x00, 0x12, // 160:65535 + 0x27, 0x3D, 0x37, 0x12, // 161:10045 + 0x27, 0x74, 0x4A, 0x12, // 162:10100 + 0x27, 0xBE, 0x54, 0x12, // 163:10174 + 0x28, 0x12, 0x54, 0x12, // 164:10258 + 0x28, 0x66, 0x56, 0x12, // 165:10342 + 0x28, 0xBC, 0x32, 0x12, // 166:10428 + 0x28, 0xEE, 0x49, 0x12, // 167:10478 + 0x29, 0x37, 0x42, 0x12, // 168:10551 + 0x29, 0x79, 0x58, 0x12, // 169:10617 + 0x29, 0xD1, 0x49, 0x12, // 170:10705 + 0x2A, 0x1A, 0x4F, 0x12, // 171:10778 + 0x2A, 0x69, 0x4E, 0x12, // 172:10857 + 0x2A, 0xB7, 0x3F, 0x12, // 173:10935 + 0x2A, 0xF6, 0x58, 0x12, // 174:10998 + 0x2B, 0x4E, 0x43, 0x12, // 175:11086 + 0x2B, 0x91, 0x3E, 0x12, // 176:11153 + 0x2B, 0xCF, 0x4F, 0x12, // 177:11215 + 0x2C, 0x1E, 0x3F, 0x12, // 178:11294 + 0x2C, 0x5D, 0x43, 0x12, // 179:11357 + 0x2C, 0xA0, 0x42, 0x12, // 180:11424 + 0x2C, 0xE2, 0x59, 0x12, // 181:11490 + 0x2D, 0x3B, 0x4F, 0x12, // 182:11579 + 0x2D, 0x8A, 0x35, 0x12, // 183:11658 + 0x2D, 0xBF, 0x3C, 0x12, // 184:11711 + 0x2D, 0xFB, 0x3F, 0x12, // 185:11771 + 0x2E, 0x3A, 0x49, 0x12, // 186:11834 + 0x2E, 0x83, 0x53, 0x12, // 187:11907 + 0x2E, 0xD6, 0x54, 0x12, // 188:11990 + 0x2F, 0x2A, 0x4F, 0x12, // 189:12074 + 0x2F, 0x79, 0x54, 0x12, // 190:12153 + 0x2F, 0xCD, 0x4A, 0x12, // 191:12237 + 0x30, 0x17, 0x59, 0x12, // 192:12311 + 0x30, 0x70, 0x59, 0x12, // 193:12400 + 0x30, 0xC9, 0x59, 0x12, // 194:12489 + 0x31, 0x22, 0x59, 0x12, // 195:12578 + 0x31, 0x7B, 0x59, 0x12, // 196:12667 + 0x31, 0xD4, 0x59, 0x12, // 197:12756 + 0x32, 0x2D, 0x54, 0x12, // 198:12845 + 0x32, 0x81, 0x4F, 0x12, // 199:12929 + 0x32, 0xD0, 0x4F, 0x12, // 200:13008 + 0x33, 0x1F, 0x4F, 0x12, // 201:13087 + 0x33, 0x6E, 0x4F, 0x12, // 202:13166 + 0x33, 0xBD, 0x4F, 0x12, // 203:13245 + 0x34, 0x0C, 0x4F, 0x12, // 204:13324 + 0x34, 0x5B, 0x4F, 0x12, // 205:13403 + 0x34, 0xAA, 0x4F, 0x12, // 206:13482 + 0x34, 0xF9, 0x4F, 0x12, // 207:13561 + 0x35, 0x48, 0x4E, 0x12, // 208:13640 + 0x35, 0x96, 0x4F, 0x12, // 209:13718 + 0x35, 0xE5, 0x53, 0x12, // 210:13797 + 0x36, 0x38, 0x53, 0x12, // 211:13880 + 0x36, 0x8B, 0x53, 0x12, // 212:13963 + 0x36, 0xDE, 0x53, 0x12, // 213:14046 + 0x37, 0x31, 0x53, 0x12, // 214:14129 + 0x37, 0x84, 0x4F, 0x12, // 215:14212 + 0x37, 0xD3, 0x56, 0x12, // 216:14291 + 0x38, 0x29, 0x4E, 0x12, // 217:14377 + 0x38, 0x77, 0x4E, 0x12, // 218:14455 + 0x38, 0xC5, 0x4E, 0x12, // 219:14533 + 0x39, 0x13, 0x4E, 0x12, // 220:14611 + 0x39, 0x61, 0x56, 0x12, // 221:14689 + 0x39, 0xB7, 0x53, 0x12, // 222:14775 + 0x3A, 0x0A, 0x54, 0x12, // 223:14858 + 0x3A, 0x5E, 0x4F, 0x12, // 224:14942 + 0x3A, 0xAD, 0x4F, 0x12, // 225:15021 + 0x3A, 0xFC, 0x4F, 0x12, // 226:15100 + 0x3B, 0x4B, 0x4F, 0x12, // 227:15179 + 0x3B, 0x9A, 0x4F, 0x12, // 228:15258 + 0x3B, 0xE9, 0x4F, 0x12, // 229:15337 + 0x3C, 0x38, 0x59, 0x12, // 230:15416 + 0x3C, 0x91, 0x4F, 0x12, // 231:15505 + 0x3C, 0xE0, 0x53, 0x12, // 232:15584 + 0x3D, 0x33, 0x53, 0x12, // 233:15667 + 0x3D, 0x86, 0x53, 0x12, // 234:15750 + 0x3D, 0xD9, 0x53, 0x12, // 235:15833 + 0x3E, 0x2C, 0x4F, 0x12, // 236:15916 + 0x3E, 0x7B, 0x4F, 0x12, // 237:15995 + 0x3E, 0xCA, 0x4F, 0x12, // 238:16074 + 0x3F, 0x19, 0x4F, 0x12, // 239:16153 + 0x3F, 0x68, 0x4E, 0x12, // 240:16232 + 0x3F, 0xB6, 0x4F, 0x12, // 241:16310 + 0x40, 0x05, 0x4E, 0x12, // 242:16389 + 0x40, 0x53, 0x4E, 0x12, // 243:16467 + 0x40, 0xA1, 0x4E, 0x12, // 244:16545 + 0x40, 0xEF, 0x4E, 0x12, // 245:16623 + 0x41, 0x3D, 0x4E, 0x12, // 246:16701 + 0x41, 0x8B, 0x53, 0x12, // 247:16779 + 0x41, 0xDE, 0x52, 0x12, // 248:16862 + 0x42, 0x30, 0x4F, 0x12, // 249:16944 + 0x42, 0x7F, 0x4F, 0x12, // 250:17023 + 0x42, 0xCE, 0x4F, 0x12, // 251:17102 + 0x43, 0x1D, 0x4F, 0x12, // 252:17181 + 0x43, 0x6C, 0x52, 0x12, // 253:17260 + 0x43, 0xBE, 0x53, 0x12, // 254:17342 + 0x44, 0x11, 0x52, 0x12, // 255:17425 + + // Font Data: + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, + 0x1F, 0x0F, 0x00, 0xC0, 0xFF, 0x1F, 0x0F, 0x00, 0xC0, 0xFF, 0x1F, 0x0F, // 33 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0x00, 0xC0, 0x3F, // 34 + 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x70, 0x38, 0x08, 0x00, 0x00, 0x70, 0xB8, 0x0F, 0x00, 0x00, + 0x70, 0xF8, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x01, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0x80, 0xFF, 0x38, 0x00, 0x00, 0xC0, 0x7F, + 0x38, 0x08, 0x00, 0xC0, 0x70, 0xB8, 0x0F, 0x00, 0x00, 0x70, 0xFC, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x00, 0x00, 0x00, 0xFC, 0x3F, + 0x00, 0x00, 0xC0, 0xFF, 0x38, 0x00, 0x00, 0xC0, 0x7F, 0x38, 0x00, 0x00, 0xC0, 0x70, 0x38, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, + 0x00, 0x00, 0x70, // 35 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x01, 0x07, 0x00, 0x00, + 0xF8, 0x03, 0x07, 0x00, 0x00, 0xFC, 0x03, 0x0E, 0x00, 0x00, 0x1E, 0x07, 0x0E, 0x00, 0x00, 0x0E, 0x06, 0x0E, 0x00, 0x00, 0x0E, + 0x06, 0x0E, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x0E, 0x0C, 0x0E, 0x00, 0x00, 0x0E, 0x0C, + 0x0E, 0x00, 0x00, 0x0E, 0x1C, 0x0F, 0x00, 0x00, 0x1C, 0xF8, 0x07, 0x00, 0x00, 0x1C, 0xF8, 0x03, 0x00, 0x00, 0x00, 0xE0, + 0x01, // 36 + 0x00, 0x1F, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x10, 0x00, 0x00, 0xC0, 0x71, 0x18, 0x00, 0x00, 0xC0, 0x60, 0x08, 0x00, 0x00, 0xC0, + 0x60, 0x0C, 0x00, 0x00, 0xC0, 0x60, 0x04, 0x00, 0x00, 0xC0, 0x71, 0x06, 0x00, 0x00, 0x80, 0x3F, 0x02, 0x00, 0x00, 0x00, 0x1F, + 0xE3, 0x03, 0x00, 0x00, 0x00, 0xF1, 0x07, 0x00, 0x00, 0x80, 0x39, 0x0E, 0x00, 0x00, 0x80, 0x18, 0x0C, 0x00, 0x00, 0xC0, 0x18, + 0x0C, 0x00, 0x00, 0x40, 0x18, 0x0C, 0x00, 0x00, 0x60, 0x38, 0x0E, 0x00, 0x00, 0x20, 0xF0, 0x07, 0x00, 0x00, 0x00, 0xC0, + 0x03, // 37 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0x00, 0xFF, 0x03, 0x00, 0x00, + 0x1F, 0x87, 0x07, 0x00, 0x80, 0xFF, 0x03, 0x0F, 0x00, 0x80, 0xFF, 0x01, 0x0F, 0x00, 0xC0, 0xE3, 0x03, 0x0E, 0x00, 0xC0, 0x81, + 0x07, 0x0E, 0x00, 0xC0, 0x01, 0x1F, 0x0E, 0x00, 0xC0, 0x01, 0x3E, 0x0E, 0x00, 0xC0, 0x01, 0x7C, 0x07, 0x00, 0x80, 0x03, 0xF0, + 0x07, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x00, 0xC0, 0x07, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x7E, 0x0E, + 0x00, 0x00, 0x00, 0x1E, 0x08, // 38 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x3F, + 0x00, 0x00, 0x00, 0xC0, 0x3F, // 39 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0x03, 0x00, 0x00, 0xFE, + 0xFF, 0x0F, 0x00, 0x80, 0x3F, 0x80, 0x3F, 0x00, 0xE0, 0x03, 0x00, 0xF8, 0x00, 0xE0, 0x00, 0x00, 0xE0, 0x00, 0x20, 0x00, 0x00, + 0x80, // 40 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0xE0, 0x00, 0x00, 0xE0, 0x00, 0xE0, 0x03, 0x00, 0xF8, 0x00, 0x80, 0x3F, + 0x80, 0x3F, 0x00, 0x00, 0xFE, 0xFF, 0x0F, 0x00, 0x00, 0xF8, 0xFF, 0x03, 0x00, 0x00, 0xC0, 0x7F, // 41 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x86, 0x01, 0x00, 0x00, 0x00, + 0xCC, 0x00, 0x00, 0x00, 0x00, 0xCC, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xC0, 0xFF, + 0x0F, 0x00, 0x00, 0xC0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0xCC, 0x00, + 0x00, 0x00, 0x00, 0xCC, 0x00, 0x00, 0x00, 0x00, 0x86, 0x01, 0x00, 0x00, 0x00, 0x84, // 42 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, + 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0xF8, + 0xFF, 0x07, 0x00, 0x00, 0xF8, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, + 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, // 43 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xFF, 0x01, 0x00, 0x00, + 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x0F, // 44 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x18, // 45 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, + 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, // 46 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, + 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0xF8, 0x03, 0x00, 0x00, 0x00, + 0xFE, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0xF8, 0x03, 0x00, 0x00, 0x00, 0x7E, 0x00, + 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0x00, 0xC0, 0x07, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0x40, // 47 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0x00, + 0xFF, 0xFF, 0x03, 0x00, 0x80, 0x0F, 0xC0, 0x07, 0x00, 0xC0, 0x03, 0x00, 0x0F, 0x00, 0xC0, 0x01, 0x06, 0x0E, 0x00, 0xC0, 0x01, + 0x07, 0x0E, 0x00, 0xC0, 0x01, 0x07, 0x0E, 0x00, 0xC0, 0x01, 0x02, 0x0E, 0x00, 0xC0, 0x03, 0x00, 0x0F, 0x00, 0x80, 0x0F, 0xC0, + 0x07, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0x00, 0xF0, 0x3F, // 48 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x03, 0x00, 0x0E, 0x00, 0x80, 0x03, 0x00, 0x0E, 0x00, 0xC0, 0x03, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, + 0x00, 0x0E, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, + 0x0E, // 49 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x0E, 0x00, 0x80, 0x03, 0x00, 0x0F, 0x00, 0xC0, + 0x01, 0x80, 0x0F, 0x00, 0xC0, 0x01, 0xC0, 0x0F, 0x00, 0xC0, 0x01, 0xE0, 0x0E, 0x00, 0xC0, 0x01, 0xF0, 0x0E, 0x00, 0xC0, 0x01, + 0x78, 0x0E, 0x00, 0xC0, 0x01, 0x3C, 0x0E, 0x00, 0xC0, 0x01, 0x1E, 0x0E, 0x00, 0xC0, 0x03, 0x0F, 0x0E, 0x00, 0x80, 0x87, 0x0F, + 0x0E, 0x00, 0x80, 0xFF, 0x07, 0x0E, 0x00, 0x00, 0xFF, 0x01, 0x0E, 0x00, 0x00, 0xFC, 0x00, 0x0E, // 50 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x80, 0x03, 0x00, 0x07, 0x00, 0x80, + 0x03, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, + 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0xC1, 0x03, 0x0E, 0x00, 0x80, 0xC3, 0x06, 0x0F, 0x00, 0x80, 0xFF, 0x8E, + 0x07, 0x00, 0x00, 0x7F, 0xFE, 0x07, 0x00, 0x00, 0x3E, 0xFC, 0x03, 0x00, 0x00, 0x00, 0xF0, // 51 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, + 0x00, 0x7F, 0x00, 0x00, 0x00, 0xC0, 0x77, 0x00, 0x00, 0x00, 0xE0, 0x71, 0x00, 0x00, 0x00, 0x78, 0x70, 0x00, 0x00, 0x00, 0x1E, + 0x70, 0x00, 0x00, 0x00, 0x0F, 0x70, 0x00, 0x00, 0xC0, 0x03, 0x70, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, + 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x70, // 52 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0xC0, 0xFF, 0x03, 0x07, 0x00, 0xC0, + 0xFF, 0x01, 0x0E, 0x00, 0xC0, 0xFF, 0x01, 0x0E, 0x00, 0xC0, 0xC1, 0x01, 0x0E, 0x00, 0xC0, 0xC1, 0x01, 0x0E, 0x00, 0xC0, 0xC1, + 0x01, 0x0E, 0x00, 0xC0, 0xC1, 0x01, 0x0E, 0x00, 0xC0, 0xC1, 0x03, 0x0E, 0x00, 0xC0, 0xC1, 0x03, 0x07, 0x00, 0xC0, 0x81, 0x87, + 0x07, 0x00, 0xC0, 0x81, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xFF, 0x01, 0x00, 0x00, 0x00, 0xFC, // 53 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0x01, 0x00, 0x00, + 0xFF, 0xFF, 0x03, 0x00, 0x80, 0x1F, 0x87, 0x07, 0x00, 0x80, 0x87, 0x03, 0x0F, 0x00, 0xC0, 0x83, 0x01, 0x0E, 0x00, 0xC0, 0xC1, + 0x01, 0x0E, 0x00, 0xC0, 0xC1, 0x01, 0x0E, 0x00, 0xC0, 0xC1, 0x01, 0x0E, 0x00, 0xC0, 0xC1, 0x03, 0x0F, 0x00, 0xC0, 0x81, 0x87, + 0x07, 0x00, 0x80, 0x83, 0xFF, 0x07, 0x00, 0x00, 0x00, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xFC, // 54 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, + 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x08, 0x00, 0xC0, 0x01, 0x00, 0x0F, 0x00, 0xC0, 0x01, 0xE0, 0x0F, 0x00, 0xC0, 0x01, + 0xF8, 0x07, 0x00, 0xC0, 0x01, 0xFF, 0x01, 0x00, 0xC0, 0xE1, 0x3F, 0x00, 0x00, 0xC0, 0xF9, 0x07, 0x00, 0x00, 0xC0, 0xFF, 0x01, + 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0x00, 0xC0, 0x07, 0x00, 0x00, 0x00, 0xC0, 0x01, // 55 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x3E, 0xFC, 0x03, 0x00, 0x00, + 0x7F, 0xFE, 0x07, 0x00, 0x80, 0xFF, 0x8E, 0x07, 0x00, 0xC0, 0xC3, 0x06, 0x0F, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, + 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0xC3, 0x06, 0x0F, 0x00, 0x80, 0xFF, 0x8E, + 0x07, 0x00, 0x00, 0x7F, 0xFE, 0x07, 0x00, 0x00, 0x3E, 0xFC, 0x03, 0x00, 0x00, 0x00, 0xF8, 0x01, // 56 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x03, 0x00, 0x00, 0x80, + 0xFF, 0x07, 0x07, 0x00, 0x80, 0x87, 0x07, 0x0E, 0x00, 0xC0, 0x03, 0x0F, 0x0E, 0x00, 0xC0, 0x01, 0x0E, 0x0E, 0x00, 0xC0, 0x01, + 0x0E, 0x0E, 0x00, 0xC0, 0x01, 0x0E, 0x0E, 0x00, 0xC0, 0x01, 0x0E, 0x0F, 0x00, 0xC0, 0x03, 0x87, 0x07, 0x00, 0x80, 0x87, 0xE1, + 0x07, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0xFE, 0xFF, 0x00, 0x00, 0x00, 0xF0, 0x3F, // 57 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x0F, 0x00, 0x00, 0xF0, + 0x00, 0x0F, 0x00, 0x00, 0xF0, 0x00, 0x0F, 0x00, 0x00, 0xF0, 0x00, 0x0F, // 58 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0xF0, 0x00, 0xFF, 0x01, 0x00, 0xF0, + 0x00, 0xFF, 0x00, 0x00, 0xF0, 0x00, 0x3F, 0x00, 0x00, 0xF0, 0x00, 0x0F, // 59 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, + 0x00, 0x1B, 0x00, 0x00, 0x00, 0x80, 0x3B, 0x00, 0x00, 0x00, 0x80, 0x33, 0x00, 0x00, 0x00, 0x80, 0x31, 0x00, 0x00, 0x00, 0xC0, + 0x71, 0x00, 0x00, 0x00, 0xC0, 0x60, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x70, 0xC0, + 0x01, 0x00, 0x00, 0x70, 0xC0, 0x01, 0x00, 0x00, 0x30, 0x80, 0x01, 0x00, 0x00, 0x38, 0x80, 0x03, // 60 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x31, 0x00, 0x00, 0x00, 0x80, 0x31, 0x00, 0x00, 0x00, 0x80, 0x31, 0x00, 0x00, 0x00, + 0x80, 0x31, 0x00, 0x00, 0x00, 0x80, 0x31, 0x00, 0x00, 0x00, 0x80, 0x31, 0x00, 0x00, 0x00, 0x80, 0x31, 0x00, 0x00, 0x00, 0x80, + 0x31, 0x00, 0x00, 0x00, 0x80, 0x31, 0x00, 0x00, 0x00, 0x80, 0x31, 0x00, 0x00, 0x00, 0x80, 0x31, 0x00, 0x00, 0x00, 0x80, 0x31, + 0x00, 0x00, 0x00, 0x80, 0x31, 0x00, 0x00, 0x00, 0x80, 0x31, 0x00, 0x00, 0x00, 0x80, 0x31, // 61 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x80, 0x03, 0x00, 0x00, 0x30, 0x80, 0x01, 0x00, 0x00, 0x70, 0xC0, 0x01, 0x00, 0x00, + 0x70, 0xC0, 0x01, 0x00, 0x00, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0xC0, 0x60, 0x00, 0x00, 0x00, 0xC0, + 0x71, 0x00, 0x00, 0x00, 0x80, 0x31, 0x00, 0x00, 0x00, 0x80, 0x31, 0x00, 0x00, 0x00, 0x80, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x1B, + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, // 62 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x80, + 0x03, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x3E, 0x0F, 0x00, 0xC0, 0x01, + 0x3F, 0x0F, 0x00, 0xC0, 0xC1, 0x3F, 0x0F, 0x00, 0xC0, 0xC1, 0x03, 0x00, 0x00, 0xC0, 0xF3, 0x01, 0x00, 0x00, 0x80, 0xFF, 0x00, + 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x1E, // 63 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x01, 0x00, 0x00, 0xE0, 0xFF, 0x07, 0x00, 0x00, 0xF0, 0x00, 0x1F, 0x00, 0x00, + 0x38, 0x00, 0x38, 0x00, 0x00, 0x0C, 0x00, 0x70, 0x00, 0x00, 0x0E, 0x7C, 0xE0, 0x00, 0x00, 0x06, 0xFF, 0xC1, 0x00, 0x00, 0x83, + 0x83, 0xC3, 0x00, 0x00, 0x83, 0x01, 0x87, 0x01, 0x00, 0xC3, 0x00, 0x86, 0x01, 0x00, 0xC3, 0x00, 0x86, 0x01, 0x00, 0xC3, 0x00, + 0x86, 0x01, 0x00, 0xC7, 0x00, 0x86, 0x01, 0x00, 0x86, 0x01, 0xC3, 0x01, 0x00, 0x9E, 0x83, 0xC3, 0x01, 0x00, 0xFC, 0xFF, 0x07, + 0x00, 0x00, 0xF0, 0xFF, 0x07, // 64 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, + 0x00, 0xFF, 0x07, 0x00, 0x00, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0xFC, 0x7F, 0x00, 0x00, 0x80, 0xFF, 0x71, 0x00, 0x00, 0xC0, 0x3F, + 0x70, 0x00, 0x00, 0xC0, 0x03, 0x70, 0x00, 0x00, 0xC0, 0x3F, 0x70, 0x00, 0x00, 0x80, 0xFF, 0x71, 0x00, 0x00, 0x00, 0xFC, 0x7F, + 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x80, 0x0F, + 0x00, 0x00, 0x00, 0x00, 0x0C, // 65 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, + 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, + 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0xC3, 0x07, 0x0F, 0x00, 0x80, 0xFF, 0x0E, + 0x07, 0x00, 0x00, 0x7F, 0xFE, 0x07, 0x00, 0x00, 0x3E, 0xFC, 0x03, 0x00, 0x00, 0x00, 0xF0, 0x01, // 66 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0x00, 0x00, 0x00, + 0xFE, 0xFF, 0x01, 0x00, 0x00, 0x1F, 0xE0, 0x03, 0x00, 0x80, 0x07, 0x80, 0x07, 0x00, 0x80, 0x03, 0x00, 0x07, 0x00, 0xC0, 0x01, + 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, + 0x0E, 0x00, 0xC0, 0x03, 0x00, 0x0E, 0x00, 0x80, 0x03, 0x00, 0x07, 0x00, 0x00, 0x07, 0x80, 0x03, // 67 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, + 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, + 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0x80, 0x03, 0x00, 0x07, 0x00, 0x80, 0x07, 0x80, 0x07, 0x00, 0x00, 0x1F, 0xE0, + 0x03, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0xFC, 0xFF, 0x00, 0x00, 0x00, 0xF0, 0x3F, // 68 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, + 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, + 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, + 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, // 69 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, + 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0x81, 0x03, 0x00, 0x00, 0xC0, 0x81, 0x03, 0x00, 0x00, 0xC0, 0x81, + 0x03, 0x00, 0x00, 0xC0, 0x81, 0x03, 0x00, 0x00, 0xC0, 0x81, 0x03, 0x00, 0x00, 0xC0, 0x81, 0x03, 0x00, 0x00, 0xC0, 0x81, 0x03, + 0x00, 0x00, 0xC0, 0x81, 0x03, 0x00, 0x00, 0xC0, 0x81, 0x03, 0x00, 0x00, 0xC0, 0x01, // 70 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0x00, 0x00, 0x00, + 0xFE, 0xFF, 0x01, 0x00, 0x00, 0x1F, 0xE0, 0x03, 0x00, 0x80, 0x07, 0x80, 0x07, 0x00, 0x80, 0x03, 0x00, 0x07, 0x00, 0xC0, 0x01, + 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x07, 0x0E, 0x00, 0xC0, 0x01, 0x07, + 0x0E, 0x00, 0xC0, 0x01, 0x07, 0x0F, 0x00, 0x80, 0x03, 0xFF, 0x07, 0x00, 0x00, 0x07, 0xFF, 0x07, 0x00, 0x00, 0x00, 0xFF, + 0x03, // 71 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, + 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x80, + 0x03, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x80, 0x03, + 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, // 72 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, + 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0xFF, + 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, + 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, // 73 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, + 0x00, 0x00, 0x07, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, + 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x07, 0x00, 0xC0, 0xFF, 0xFF, + 0x03, 0x00, 0xC0, 0xFF, 0xFF, // 74 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, + 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x00, 0xF0, + 0x07, 0x00, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x00, 0x3C, 0x3E, 0x00, 0x00, 0x00, 0x1E, 0xFC, 0x00, 0x00, 0x00, 0x0F, 0xF0, + 0x01, 0x00, 0x80, 0x03, 0xE0, 0x07, 0x00, 0xC0, 0x01, 0x80, 0x0F, 0x00, 0xC0, 0x00, 0x00, 0x0F, 0x00, 0x40, 0x00, 0x00, 0x0C, + 0x00, 0x00, 0x00, 0x00, 0x08, // 75 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, + 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, + 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, + 0x0E, // 76 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, + 0x03, 0x00, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00, 0x00, + 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x80, 0x1F, 0x00, + 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, + 0x0F, // 77 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, + 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0xE0, + 0x07, 0x00, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x00, 0x80, + 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, // 78 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0x00, + 0xFF, 0xFF, 0x03, 0x00, 0x80, 0x0F, 0xC0, 0x07, 0x00, 0x80, 0x03, 0x00, 0x07, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, + 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0x80, 0x03, 0x00, + 0x07, 0x00, 0x80, 0x0F, 0xC0, 0x07, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0x00, 0xF0, 0x3F, // 79 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, + 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0x01, 0x07, 0x00, 0x00, 0xC0, 0x01, 0x07, 0x00, 0x00, 0xC0, 0x01, + 0x07, 0x00, 0x00, 0xC0, 0x01, 0x07, 0x00, 0x00, 0xC0, 0x01, 0x07, 0x00, 0x00, 0xC0, 0x01, 0x07, 0x00, 0x00, 0xC0, 0x83, 0x07, + 0x00, 0x00, 0x80, 0xC7, 0x03, 0x00, 0x00, 0x80, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x7C, // 80 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0x00, + 0xFF, 0xFF, 0x03, 0x00, 0x80, 0x0F, 0xC0, 0x07, 0x00, 0x80, 0x03, 0x00, 0x07, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, + 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x3E, 0x00, 0x80, 0x03, 0x00, + 0x7F, 0x00, 0x80, 0x0F, 0xC0, 0xF7, 0x00, 0x00, 0xFF, 0xFF, 0x63, 0x00, 0x00, 0xFE, 0xFF, 0x41, 0x00, 0x00, 0xF0, 0x3F, // 81 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, + 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0x01, 0x07, 0x00, 0x00, 0xC0, 0x01, 0x07, 0x00, 0x00, 0xC0, 0x01, 0x07, 0x00, 0x00, 0xC0, 0x01, + 0x07, 0x00, 0x00, 0xC0, 0x01, 0x07, 0x00, 0x00, 0xC0, 0x01, 0x0F, 0x00, 0x00, 0xC0, 0x83, 0x1F, 0x00, 0x00, 0x80, 0xC7, 0x7D, + 0x00, 0x00, 0x80, 0xFF, 0xF9, 0x01, 0x00, 0x00, 0xFF, 0xF0, 0x07, 0x00, 0x00, 0x7C, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0E, + 0x00, 0x00, 0x00, 0x00, 0x08, // 82 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x07, 0x00, 0x00, 0xFF, 0x00, 0x07, 0x00, 0x80, + 0xFF, 0x01, 0x0E, 0x00, 0x80, 0xC7, 0x01, 0x0E, 0x00, 0xC0, 0xC3, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, + 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x07, 0x0E, 0x00, 0xC0, 0x01, 0x07, 0x0E, 0x00, 0xC0, 0x01, 0x07, 0x0F, 0x00, 0xC0, 0x01, 0x8F, + 0x07, 0x00, 0x80, 0x03, 0xFE, 0x07, 0x00, 0x80, 0x03, 0xFC, 0x03, 0x00, 0x00, 0x00, 0xF8, 0x01, // 83 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, + 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0xFF, + 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, + 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, + 0x00, 0xC0, 0x01, // 84 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x03, 0x00, 0xC0, + 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, + 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x80, + 0x07, 0x00, 0xC0, 0xFF, 0xFF, 0x07, 0x00, 0xC0, 0xFF, 0xFF, 0x03, 0x00, 0xC0, 0xFF, 0xFF, // 85 + 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x07, 0x00, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x00, 0x00, 0x80, + 0xFF, 0x03, 0x00, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x01, 0x00, 0x00, 0x00, 0xFC, 0x0F, 0x00, 0x00, 0x00, + 0xE0, 0x0F, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0xFC, 0x0F, 0x00, 0x00, 0xC0, 0xFF, 0x01, 0x00, 0x00, 0xF8, 0x3F, + 0x00, 0x00, 0x80, 0xFF, 0x03, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x00, 0x00, 0xC0, 0x07, 0x00, 0x00, 0x00, 0xC0, // 86 + 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x0F, 0x00, 0x00, + 0x00, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0xF0, + 0x01, 0x00, 0x00, 0x00, 0xF0, 0x01, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0x00, 0xE0, + 0x0F, 0x00, 0x00, 0x00, 0xFF, 0x0F, 0x00, 0x00, 0xFE, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0x7F, 0x00, 0x00, 0xC0, 0xFF, 0x00, 0x00, + 0x00, 0xC0, 0x01, // 87 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x08, 0x00, 0xC0, 0x00, 0x00, 0x0E, 0x00, 0xC0, 0x03, 0x00, 0x0F, 0x00, 0xC0, + 0x07, 0xC0, 0x0F, 0x00, 0x80, 0x1F, 0xE0, 0x03, 0x00, 0x00, 0x3E, 0xF8, 0x01, 0x00, 0x00, 0x7C, 0x7E, 0x00, 0x00, 0x00, 0xF0, + 0x1F, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0x7C, 0x7C, + 0x00, 0x00, 0x00, 0x3E, 0xF8, 0x01, 0x00, 0x80, 0x0F, 0xE0, 0x03, 0x00, 0xC0, 0x07, 0xC0, 0x0F, 0x00, 0xC0, 0x03, 0x00, 0x0F, + 0x00, 0xC0, 0x00, 0x00, 0x0C, // 88 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0x00, 0xC0, + 0x0F, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x00, 0xE0, + 0xFF, 0x0F, 0x00, 0x00, 0x80, 0xFF, 0x0F, 0x00, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x00, 0xFC, 0x00, + 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, + 0x00, 0x40, // 89 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x80, 0x0F, 0x00, 0xC0, + 0x01, 0xC0, 0x0F, 0x00, 0xC0, 0x01, 0xF0, 0x0F, 0x00, 0xC0, 0x01, 0xF8, 0x0E, 0x00, 0xC0, 0x01, 0x7E, 0x0E, 0x00, 0xC0, 0x01, + 0x1F, 0x0E, 0x00, 0xC0, 0xC1, 0x0F, 0x0E, 0x00, 0xC0, 0xE1, 0x03, 0x0E, 0x00, 0xC0, 0xF9, 0x01, 0x0E, 0x00, 0xC0, 0x7D, 0x00, + 0x0E, 0x00, 0xC0, 0x3F, 0x00, 0x0E, 0x00, 0xC0, 0x0F, 0x00, 0x0E, 0x00, 0xC0, 0x07, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, + 0x0E, // 90 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0x00, 0xE0, 0xFF, + 0xFF, 0xFF, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0x00, 0xE0, 0x00, 0x00, 0xE0, 0x00, 0xE0, 0x00, 0x00, 0xE0, 0x00, 0xE0, 0x00, 0x00, + 0xE0, 0x00, 0xE0, 0x00, 0x00, 0xE0, // 91 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, + 0x07, 0x00, 0x00, 0x00, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x00, 0xE0, + 0x0F, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x00, 0xC0, + 0x0F, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, + 0x40, // 92 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0xE0, 0x00, 0xE0, 0x00, 0x00, 0xE0, 0x00, 0xE0, 0x00, 0x00, 0xE0, 0x00, 0xE0, 0x00, + 0x00, 0xE0, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, // 93 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, + 0x1C, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0x00, 0xC0, 0x01, + 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, + 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x20, // 94 + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, + 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, // 95 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x02, // 96 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0xC0, 0xF1, 0x07, 0x00, 0x00, + 0xE0, 0xF8, 0x07, 0x00, 0x00, 0xE0, 0x38, 0x0F, 0x00, 0x00, 0x70, 0x1C, 0x0E, 0x00, 0x00, 0x70, 0x1C, 0x0E, 0x00, 0x00, 0x70, + 0x1C, 0x0E, 0x00, 0x00, 0x70, 0x1C, 0x0E, 0x00, 0x00, 0x70, 0x1C, 0x06, 0x00, 0x00, 0x70, 0x1C, 0x07, 0x00, 0x00, 0xE0, 0x9C, + 0x01, 0x00, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0xC0, 0xFF, 0x0F, 0x00, 0x00, 0x80, 0xFF, 0x0F, // 97 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x0F, 0x00, 0xE0, + 0xFF, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0xC0, 0x81, 0x03, 0x00, 0x00, 0xE0, 0x00, 0x07, 0x00, 0x00, 0x70, + 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0xF0, 0x00, + 0x0F, 0x00, 0x00, 0xE0, 0x81, 0x07, 0x00, 0x00, 0xE0, 0xFF, 0x07, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xFF, // 98 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, + 0x80, 0xFF, 0x01, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, 0xE0, 0xC3, 0x07, 0x00, 0x00, 0xE0, 0x00, 0x07, 0x00, 0x00, 0xF0, + 0x00, 0x0F, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, + 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0xE0, 0x00, 0x07, 0x00, 0x00, 0xC0, 0x81, 0x03, // 99 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, + 0xE0, 0xFF, 0x07, 0x00, 0x00, 0xE0, 0x81, 0x07, 0x00, 0x00, 0xF0, 0x00, 0x0F, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, + 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0xE0, 0x00, 0x07, 0x00, 0x00, 0xC0, 0x81, + 0x03, 0x00, 0xE0, 0xFF, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0xFF, 0x0F, // 100 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x01, 0x00, 0x00, + 0xC0, 0xFF, 0x03, 0x00, 0x00, 0xE0, 0x9D, 0x07, 0x00, 0x00, 0xE0, 0x1C, 0x07, 0x00, 0x00, 0x70, 0x1C, 0x0E, 0x00, 0x00, 0x70, + 0x1C, 0x0E, 0x00, 0x00, 0x70, 0x1C, 0x0E, 0x00, 0x00, 0x70, 0x1C, 0x0E, 0x00, 0x00, 0x70, 0x1C, 0x0E, 0x00, 0x00, 0xF0, 0x1C, + 0x0E, 0x00, 0x00, 0xE0, 0x1C, 0x07, 0x00, 0x00, 0xE0, 0x1F, 0x07, 0x00, 0x00, 0xC0, 0x9F, 0x03, 0x00, 0x00, 0x00, 0x1F, // 101 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, + 0x70, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, + 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xE0, 0x71, 0x00, 0x00, 0x00, 0xE0, 0x70, 0x00, 0x00, 0x00, 0xE0, 0x70, 0x00, + 0x00, 0x00, 0xE0, 0x70, 0x00, 0x00, 0x00, 0xE0, 0x70, 0x00, 0x00, 0x00, 0xE0, 0x70, // 102 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, + 0xE0, 0xFF, 0xC7, 0x01, 0x00, 0xE0, 0x81, 0xC7, 0x01, 0x00, 0xF0, 0x00, 0x8F, 0x03, 0x00, 0x70, 0x00, 0x8E, 0x03, 0x00, 0x70, + 0x00, 0x8E, 0x03, 0x00, 0x70, 0x00, 0x8E, 0x03, 0x00, 0x70, 0x00, 0x8E, 0x03, 0x00, 0xE0, 0x00, 0xC7, 0x03, 0x00, 0xC0, 0x81, + 0xE3, 0x01, 0x00, 0xF0, 0xFF, 0xFF, 0x01, 0x00, 0xF0, 0xFF, 0xFF, 0x00, 0x00, 0xF0, 0xFF, 0x3F, // 103 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x0F, 0x00, 0xE0, + 0xFF, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x60, + 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, + 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x80, 0xFF, 0x0F, // 104 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, + 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0xE0, 0xF0, + 0xFF, 0x0F, 0x00, 0xE0, 0xF0, 0xFF, 0x0F, 0x00, 0xE0, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, // 105 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, + 0x70, 0x00, 0x80, 0x03, 0x00, 0x70, 0x00, 0x80, 0x03, 0x00, 0x70, 0x00, 0x80, 0x03, 0x00, 0x70, 0x00, 0x80, 0x03, 0x00, 0x70, + 0x00, 0xC0, 0x03, 0xE0, 0xF0, 0xFF, 0xFF, 0x01, 0xE0, 0xF0, 0xFF, 0xFF, 0x00, 0xE0, 0xF0, 0xFF, 0x7F, // 106 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x0F, 0x00, 0xE0, + 0xFF, 0xFF, 0x0F, 0x00, 0xE0, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, + 0x1F, 0x00, 0x00, 0x00, 0x80, 0x7F, 0x00, 0x00, 0x00, 0xC0, 0xFB, 0x00, 0x00, 0x00, 0xE0, 0xF3, 0x03, 0x00, 0x00, 0xF0, 0xC1, + 0x07, 0x00, 0x00, 0xF0, 0x80, 0x0F, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x00, 0x10, 0x00, + 0x08, // 107 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0xE0, + 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x01, 0x00, 0xE0, 0xFF, + 0xFF, 0x03, 0x00, 0xE0, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, // 108 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, + 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0xF0, + 0xFF, 0x0F, 0x00, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x80, 0xFF, 0x0F, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, + 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0xC0, 0xFF, + 0x0F, // 109 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, + 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x60, + 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, + 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x80, 0xFF, 0x0F, // 110 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, + 0xE0, 0xFF, 0x07, 0x00, 0x00, 0xE0, 0x81, 0x07, 0x00, 0x00, 0xF0, 0x00, 0x0F, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, + 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0xF0, 0x00, 0x0F, 0x00, 0x00, 0xE0, 0x81, + 0x07, 0x00, 0x00, 0xE0, 0xFF, 0x07, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xFF, // 111 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0x03, 0x00, + 0xF0, 0xFF, 0xFF, 0x03, 0x00, 0xF0, 0xFF, 0xFF, 0x03, 0x00, 0xC0, 0x81, 0x03, 0x00, 0x00, 0xE0, 0x00, 0x07, 0x00, 0x00, 0x70, + 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0xF0, 0x00, + 0x0F, 0x00, 0x00, 0xE0, 0x81, 0x07, 0x00, 0x00, 0xE0, 0xFF, 0x07, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xFF, // 112 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, + 0xE0, 0xFF, 0x07, 0x00, 0x00, 0xE0, 0x81, 0x07, 0x00, 0x00, 0xF0, 0x00, 0x0F, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, + 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0xE0, 0x00, 0x07, 0x00, 0x00, 0xC0, 0x81, + 0x03, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0x03, 0x00, 0xF0, 0xFF, 0xFF, 0x03, 0x00, 0xF0, 0xFF, 0xFF, 0x03, // 113 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0x80, + 0x03, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, + 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0xE0, // 114 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x83, 0x03, 0x00, 0x00, + 0xE0, 0x07, 0x07, 0x00, 0x00, 0xE0, 0x0F, 0x07, 0x00, 0x00, 0xF0, 0x0E, 0x0E, 0x00, 0x00, 0x70, 0x0E, 0x0E, 0x00, 0x00, 0x70, + 0x0E, 0x0E, 0x00, 0x00, 0x70, 0x1E, 0x0E, 0x00, 0x00, 0x70, 0x1C, 0x0E, 0x00, 0x00, 0x70, 0x1C, 0x0F, 0x00, 0x00, 0x70, 0xFC, + 0x07, 0x00, 0x00, 0xE0, 0xF8, 0x07, 0x00, 0x00, 0x00, 0xF0, 0x01, // 115 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, + 0x70, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0x03, 0x00, 0x80, 0xFF, 0xFF, 0x07, 0x00, 0x80, 0xFF, + 0xFF, 0x0F, 0x00, 0x00, 0x70, 0x00, 0x0F, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, + 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, // 116 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x01, 0x00, 0x00, + 0xF0, 0xFF, 0x07, 0x00, 0x00, 0xF0, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, + 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x80, + 0x01, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x0F, // 117 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0x00, + 0xE0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x07, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, + 0x00, 0x0F, 0x00, 0x00, 0x00, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0xFC, 0x07, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xE0, 0x3F, + 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x10, // 118 + 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x07, 0x00, 0x00, + 0x00, 0xFC, 0x0F, 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0x00, + 0x1E, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0xC0, + 0x0F, 0x00, 0x00, 0x00, 0xFC, 0x0F, 0x00, 0x00, 0xC0, 0xFF, 0x07, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0xF0, 0x03, 0x00, + 0x00, 0x00, 0x30, // 119 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x30, 0x00, 0x0E, 0x00, 0x00, + 0x70, 0x00, 0x0F, 0x00, 0x00, 0xF0, 0xC1, 0x07, 0x00, 0x00, 0xE0, 0xE3, 0x03, 0x00, 0x00, 0xC0, 0xFF, 0x01, 0x00, 0x00, 0x00, + 0x7F, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x01, 0x00, 0x00, 0xE0, 0xE3, 0x03, 0x00, 0x00, 0xF0, 0xC1, + 0x07, 0x00, 0x00, 0x70, 0x00, 0x0F, 0x00, 0x00, 0x30, 0x00, 0x0E, 0x00, 0x00, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, + 0x08, // 120 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x80, 0x03, 0x00, + 0xF0, 0x03, 0x80, 0x03, 0x00, 0xE0, 0x1F, 0x80, 0x03, 0x00, 0x80, 0x7F, 0xC0, 0x03, 0x00, 0x00, 0xFC, 0xF3, 0x01, 0x00, 0x00, + 0xF0, 0xFF, 0x01, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0xFE, 0x03, 0x00, 0x00, 0x80, 0x7F, + 0x00, 0x00, 0x00, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x10, // 121 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, + 0x70, 0x00, 0x0F, 0x00, 0x00, 0x70, 0xC0, 0x0F, 0x00, 0x00, 0x70, 0xE0, 0x0F, 0x00, 0x00, 0x70, 0xF8, 0x0F, 0x00, 0x00, 0x70, + 0x7C, 0x0E, 0x00, 0x00, 0x70, 0x3F, 0x0E, 0x00, 0x00, 0xF0, 0x0F, 0x0E, 0x00, 0x00, 0xF0, 0x07, 0x0E, 0x00, 0x00, 0xF0, 0x03, + 0x0E, 0x00, 0x00, 0xF0, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, // 122 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, + 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x80, 0xFF, + 0xFB, 0x7F, 0x00, 0xC0, 0xFF, 0xFB, 0xFF, 0x00, 0xE0, 0xFF, 0xF1, 0xFF, 0x01, 0xE0, 0x01, 0x00, 0xE0, 0x01, 0xE0, 0x00, 0x00, + 0xC0, 0x01, 0xE0, 0x00, 0x00, 0xC0, 0x01, 0xE0, 0x00, 0x00, 0xC0, 0x01, // 123 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, + 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0xFF, 0x07, // 124 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, + 0x00, 0x00, 0xC0, 0x01, 0xE0, 0x00, 0x00, 0xC0, 0x01, 0xE0, 0x00, 0x00, 0xC0, 0x01, 0xE0, 0x01, 0x00, 0xE0, 0x01, 0xE0, 0xFF, + 0xF1, 0xFF, 0x00, 0xC0, 0xFF, 0xFB, 0xFF, 0x00, 0x80, 0xFF, 0xFB, 0x7F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x0E, + 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, // 125 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, + 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0E, // 126 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 127 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 128 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 129 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 130 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 131 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 132 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 133 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 134 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 135 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 136 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 137 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 138 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 139 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 140 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 141 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 142 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 143 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 144 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 145 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 146 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 147 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 148 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 149 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 150 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 151 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 152 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 153 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 154 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 155 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 156 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 157 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 158 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, + 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, + 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, + 0x01, // 159 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, + 0xF8, 0xFF, 0x03, 0x00, 0xF0, 0xF8, 0xFF, 0x03, 0x00, 0xF0, 0xF8, 0xFF, 0x03, // 161 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, + 0x80, 0xFF, 0x01, 0x00, 0x00, 0xE0, 0xFF, 0x07, 0x00, 0x00, 0xE0, 0x81, 0x07, 0x00, 0x00, 0xF0, 0x00, 0x0F, 0x00, 0x00, 0x70, + 0x00, 0x0E, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, + 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0xE0, 0x00, 0x07, // 162 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0E, 0x00, 0x00, + 0x00, 0x07, 0x0E, 0x00, 0x00, 0x00, 0x07, 0x0E, 0x00, 0x00, 0xFC, 0xFF, 0x0F, 0x00, 0x00, 0xFF, 0xFF, 0x0F, 0x00, 0x80, 0xFF, + 0xFF, 0x0F, 0x00, 0x80, 0x07, 0x07, 0x0E, 0x00, 0xC0, 0x03, 0x07, 0x0E, 0x00, 0xC0, 0x01, 0x07, 0x0E, 0x00, 0xC0, 0x01, 0x07, + 0x0E, 0x00, 0xC0, 0x01, 0x07, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0x80, 0x03, 0x00, + 0x0E, // 163 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x01, 0x00, 0x00, + 0x70, 0x80, 0x03, 0x00, 0x00, 0xE0, 0xDE, 0x01, 0x00, 0x00, 0xC0, 0xFF, 0x00, 0x00, 0x00, 0x80, 0x61, 0x00, 0x00, 0x00, 0xC0, + 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x80, 0x61, + 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x00, 0x00, 0x00, 0xE0, 0xDE, 0x01, 0x00, 0x00, 0x70, 0x80, 0x03, 0x00, 0x00, 0x20, 0x00, + 0x01, // 164 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC1, 0x18, 0x00, 0x00, 0xC0, 0xC3, 0x18, 0x00, 0x00, 0xC0, + 0xCF, 0x18, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x00, 0x00, 0x00, 0xFC, 0x18, 0x00, 0x00, 0x00, 0xF8, 0x1B, 0x00, 0x00, 0x00, 0xE0, + 0xFF, 0x0F, 0x00, 0x00, 0x80, 0xFF, 0x0F, 0x00, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0xF8, 0x1B, 0x00, 0x00, 0x00, 0xFC, 0x18, + 0x00, 0x00, 0x00, 0xFF, 0x18, 0x00, 0x00, 0xC0, 0xCF, 0x18, 0x00, 0x00, 0xC0, 0xC3, 0x18, 0x00, 0x00, 0xC0, 0xC1, 0x18, 0x00, + 0x00, 0x40, // 165 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, + 0xC3, 0xFF, 0x01, 0x80, 0xFF, 0xC3, 0xFF, 0x01, // 166 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x8F, 0x1F, 0x38, 0x00, 0x80, 0xDF, 0x1F, 0x70, 0x00, 0x80, 0xFF, 0x38, 0x60, 0x00, 0xC0, 0x71, 0x30, 0x60, 0x00, 0xC0, 0xE0, + 0x60, 0x60, 0x00, 0xC0, 0xC0, 0xE0, 0x60, 0x00, 0xC0, 0xC0, 0xC1, 0x71, 0x00, 0xC0, 0x80, 0xE3, 0x3F, 0x00, 0xC0, 0x81, 0xBF, + 0x3F, 0x00, 0x80, 0x03, 0x3F, 0x0E, 0x00, 0x00, 0x00, 0x1E, // 167 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, + 0x00, 0x00, 0xE0, // 168 + 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0x38, 0x70, 0x00, 0x00, 0x00, 0x1C, 0xE0, 0x00, 0x00, 0x00, + 0x8E, 0xCF, 0x01, 0x00, 0x00, 0xE6, 0x9F, 0x01, 0x00, 0x00, 0x63, 0x38, 0x03, 0x00, 0x00, 0x33, 0x30, 0x03, 0x00, 0x00, 0x33, + 0x30, 0x03, 0x00, 0x00, 0x33, 0x30, 0x03, 0x00, 0x00, 0x33, 0x30, 0x03, 0x00, 0x00, 0x63, 0x18, 0x03, 0x00, 0x00, 0x06, 0x80, + 0x01, 0x00, 0x00, 0x0E, 0xC0, 0x01, 0x00, 0x00, 0x1C, 0xE0, 0x00, 0x00, 0x00, 0x38, 0x70, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, + 0x00, 0x00, 0xC0, 0x0F, // 169 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xF0, 0x30, 0x00, 0x00, 0x80, 0xF9, 0x31, 0x00, 0x00, 0xC0, 0x98, 0x33, 0x00, 0x00, 0xC0, 0x0C, 0x33, 0x00, 0x00, 0xC0, 0x0C, + 0x33, 0x00, 0x00, 0xC0, 0x0C, 0x33, 0x00, 0x00, 0xC0, 0x0C, 0x33, 0x00, 0x00, 0xC0, 0x8C, 0x31, 0x00, 0x00, 0x80, 0xCD, 0x30, + 0x00, 0x00, 0x80, 0xFF, 0x33, 0x00, 0x00, 0x00, 0xFF, 0x33, // 170 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, + 0x00, 0x1F, 0x00, 0x00, 0x00, 0x80, 0x3B, 0x00, 0x00, 0x00, 0xC0, 0x71, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x70, + 0xC0, 0x01, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x80, 0x3B, + 0x00, 0x00, 0x00, 0xC0, 0x71, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x70, 0xC0, 0x01, // 171 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, + 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, + 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x01, + 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x80, 0x3F, // 172 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x18, // 173 + 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0x38, 0x70, 0x00, 0x00, 0x00, 0x1C, 0xE0, 0x00, 0x00, 0x00, + 0x0E, 0xC0, 0x01, 0x00, 0x00, 0x06, 0x80, 0x01, 0x00, 0x00, 0xF3, 0x3F, 0x03, 0x00, 0x00, 0xF3, 0x3F, 0x03, 0x00, 0x00, 0x33, + 0x07, 0x03, 0x00, 0x00, 0x33, 0x1F, 0x03, 0x00, 0x00, 0xF3, 0x3D, 0x03, 0x00, 0x00, 0xE3, 0x30, 0x03, 0x00, 0x00, 0x06, 0xA0, + 0x01, 0x00, 0x00, 0x0E, 0xC0, 0x01, 0x00, 0x00, 0x1C, 0xE0, 0x00, 0x00, 0x00, 0x38, 0x70, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, + 0x00, 0x00, 0xC0, 0x0F, // 174 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, + 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, + 0x00, 0x00, 0xC0, 0x01, // 175 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1F, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0x00, 0xC0, 0x71, 0x00, 0x00, 0x00, 0xC0, 0x60, 0x00, 0x00, 0x00, 0xC0, 0x60, + 0x00, 0x00, 0x00, 0xC0, 0x60, 0x00, 0x00, 0x00, 0xC0, 0x71, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x1F, // 176 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0C, 0x00, 0x00, 0x00, 0x03, 0x0C, 0x00, 0x00, + 0x00, 0x03, 0x0C, 0x00, 0x00, 0x00, 0x03, 0x0C, 0x00, 0x00, 0x00, 0x03, 0x0C, 0x00, 0x00, 0x00, 0x03, 0x0C, 0x00, 0x00, 0xF8, + 0x7F, 0x0C, 0x00, 0x00, 0xF8, 0x7F, 0x0C, 0x00, 0x00, 0x00, 0x03, 0x0C, 0x00, 0x00, 0x00, 0x03, 0x0C, 0x00, 0x00, 0x00, 0x03, + 0x0C, 0x00, 0x00, 0x00, 0x03, 0x0C, 0x00, 0x00, 0x00, 0x03, 0x0C, 0x00, 0x00, 0x00, 0x03, 0x0C, // 177 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x03, 0x00, 0x00, 0xC0, 0x80, 0x03, 0x00, 0x00, 0xC0, 0xC0, 0x03, 0x00, 0x00, 0xC0, 0xE0, + 0x03, 0x00, 0x00, 0xC0, 0x70, 0x03, 0x00, 0x00, 0xC0, 0x39, 0x03, 0x00, 0x00, 0x80, 0x1F, 0x03, 0x00, 0x00, 0x00, 0x07, + 0x03, // 178 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x81, 0x01, 0x00, 0x00, 0xC0, 0x00, 0x03, 0x00, 0x00, 0xC0, 0x0C, 0x03, 0x00, 0x00, 0xC0, 0x0C, + 0x03, 0x00, 0x00, 0xC0, 0x0C, 0x03, 0x00, 0x00, 0xC0, 0x0C, 0x03, 0x00, 0x00, 0xC0, 0x9C, 0x03, 0x00, 0x00, 0x80, 0xFF, 0x01, + 0x00, 0x00, 0x80, 0xF3, // 179 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x10, // 180 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0x03, 0x00, + 0xF0, 0xFF, 0xFF, 0x03, 0x00, 0xF0, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x80, + 0x07, 0x00, 0x00, 0xF0, 0xFF, 0x01, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0E, + 0x00, 0x00, 0x00, 0x00, 0x0E, // 181 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x80, + 0xFF, 0x01, 0x00, 0x00, 0x80, 0xFF, 0x01, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, 0xC0, 0xFF, + 0x03, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x7F, 0x00, 0xC0, 0xFF, 0xFF, 0x7F, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, + 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x7F, 0x00, 0xC0, 0xFF, 0xFF, 0x7F, // 182 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x80, + 0x0F, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0x80, 0x0F, // 183 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x00, 0xC0, 0x01, // 184 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x03, 0x00, 0x00, 0x80, 0x01, 0x03, 0x00, 0x00, 0xC0, 0x00, 0x03, 0x00, 0x00, 0xC0, 0xFF, + 0x03, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + 0x03, // 185 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7E, 0x30, 0x00, 0x00, 0x00, 0xFF, 0x30, 0x00, 0x00, 0x80, 0xC3, 0x31, 0x00, 0x00, 0xC0, 0x81, 0x33, 0x00, 0x00, 0xC0, 0x00, + 0x33, 0x00, 0x00, 0xC0, 0x00, 0x33, 0x00, 0x00, 0xC0, 0x00, 0x33, 0x00, 0x00, 0xC0, 0x81, 0x33, 0x00, 0x00, 0x80, 0xC3, 0x31, + 0x00, 0x00, 0x00, 0xFF, 0x30, 0x00, 0x00, 0x00, 0x7E, 0x30, // 186 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xC0, 0x01, 0x00, 0x00, + 0xE0, 0xE0, 0x00, 0x00, 0x00, 0xC0, 0x71, 0x00, 0x00, 0x00, 0x80, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x70, 0xC0, 0x01, 0x00, 0x00, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0xC0, 0x71, + 0x00, 0x00, 0x00, 0x80, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, // 187 + 0x00, 0x00, 0x18, 0x00, 0x00, 0x60, 0xC0, 0x18, 0x00, 0x00, 0x60, 0xC0, 0x0C, 0x00, 0x00, 0x30, 0xC0, 0x0C, 0x00, 0x00, 0xF0, + 0xFF, 0x0C, 0x00, 0x00, 0xF0, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0xC0, 0x06, 0x00, 0x00, 0x00, 0xC0, 0x06, 0x18, 0x00, 0x00, 0xC0, + 0x06, 0x1E, 0x00, 0x00, 0x00, 0x06, 0x1B, 0x00, 0x00, 0x00, 0x83, 0x19, 0x00, 0x00, 0x00, 0xE3, 0x18, 0x00, 0x00, 0x00, 0x33, + 0x18, 0x00, 0x00, 0x00, 0xF3, 0xFF, 0x00, 0x00, 0x80, 0xF1, 0xFF, 0x00, 0x00, 0x80, 0x01, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x18, // 188 + 0x00, 0x00, 0x18, 0x00, 0x00, 0x60, 0xC0, 0x18, 0x00, 0x00, 0x60, 0xC0, 0x0C, 0x00, 0x00, 0x30, 0xC0, 0x0C, 0x00, 0x00, 0xF0, + 0xFF, 0x0C, 0x00, 0x00, 0xF0, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0xC0, 0x06, 0x00, 0x00, 0x00, 0xC0, 0x06, 0x00, 0x00, 0x00, 0xC0, + 0x66, 0xC0, 0x00, 0x00, 0x00, 0x36, 0xE0, 0x00, 0x00, 0x00, 0x33, 0xF0, 0x00, 0x00, 0x00, 0x33, 0xF8, 0x00, 0x00, 0x00, 0x33, + 0xDC, 0x00, 0x00, 0x00, 0x73, 0xCE, 0x00, 0x00, 0x80, 0xE1, 0xC7, 0x00, 0x00, 0x80, 0xC1, 0xC1, // 189 + 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x60, 0x60, 0x0C, 0x00, 0x00, 0x30, 0xC0, 0x0C, 0x00, 0x00, 0x30, + 0xC3, 0x0C, 0x00, 0x00, 0x30, 0xC3, 0x0C, 0x00, 0x00, 0x30, 0xC3, 0x06, 0x00, 0x00, 0x30, 0xC3, 0x06, 0x18, 0x00, 0x30, 0xE7, + 0x06, 0x1E, 0x00, 0xE0, 0x7F, 0x06, 0x1B, 0x00, 0xE0, 0x3C, 0x83, 0x19, 0x00, 0x00, 0x00, 0xE3, 0x18, 0x00, 0x00, 0x00, 0x33, + 0x18, 0x00, 0x00, 0x00, 0xF3, 0xFF, 0x00, 0x00, 0x80, 0xF1, 0xFF, 0x00, 0x00, 0x80, 0x01, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x18, // 190 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, + 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x01, 0x00, 0x00, 0x80, 0xCF, 0x03, 0x00, 0x00, 0xC0, 0x83, 0x03, 0x00, 0xF0, + 0xFC, 0x81, 0x03, 0x00, 0xF0, 0xFC, 0x80, 0x03, 0x00, 0xF0, 0x7C, 0x80, 0x03, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, + 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xE0, // 191 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, + 0x00, 0xFF, 0x07, 0x00, 0x00, 0xE0, 0xFF, 0x00, 0x00, 0x02, 0xFC, 0x7F, 0x00, 0x00, 0x86, 0xFF, 0x71, 0x00, 0x00, 0xCE, 0x3F, + 0x70, 0x00, 0x00, 0xDC, 0x03, 0x70, 0x00, 0x00, 0xD8, 0x3F, 0x70, 0x00, 0x00, 0x90, 0xFF, 0x71, 0x00, 0x00, 0x00, 0xFC, 0x7F, + 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x80, 0x0F, + 0x00, 0x00, 0x00, 0x00, 0x0C, // 192 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, + 0x00, 0xFF, 0x07, 0x00, 0x00, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0xFC, 0x7F, 0x00, 0x00, 0x90, 0xFF, 0x71, 0x00, 0x00, 0xD8, 0x3F, + 0x70, 0x00, 0x00, 0xDC, 0x03, 0x70, 0x00, 0x00, 0xCE, 0x3F, 0x70, 0x00, 0x00, 0x86, 0xFF, 0x71, 0x00, 0x00, 0x02, 0xFC, 0x7F, + 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x80, 0x0F, + 0x00, 0x00, 0x00, 0x00, 0x0C, // 193 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, + 0x00, 0xFF, 0x07, 0x00, 0x10, 0xE0, 0xFF, 0x00, 0x00, 0x18, 0xFC, 0x7F, 0x00, 0x00, 0x9C, 0xFF, 0x71, 0x00, 0x00, 0xC6, 0x3F, + 0x70, 0x00, 0x00, 0xC2, 0x03, 0x70, 0x00, 0x00, 0xC6, 0x3F, 0x70, 0x00, 0x00, 0x9C, 0xFF, 0x71, 0x00, 0x00, 0x18, 0xFC, 0x7F, + 0x00, 0x00, 0x10, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x80, 0x0F, + 0x00, 0x00, 0x00, 0x00, 0x0C, // 194 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, + 0x00, 0xFF, 0x07, 0x00, 0x0C, 0xE0, 0xFF, 0x00, 0x00, 0x0E, 0xFC, 0x7F, 0x00, 0x00, 0x86, 0xFF, 0x71, 0x00, 0x00, 0xC6, 0x3F, + 0x70, 0x00, 0x00, 0xCE, 0x03, 0x70, 0x00, 0x00, 0xCC, 0x3F, 0x70, 0x00, 0x00, 0x8C, 0xFF, 0x71, 0x00, 0x00, 0x0E, 0xFC, 0x7F, + 0x00, 0x00, 0x06, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x80, 0x0F, + 0x00, 0x00, 0x00, 0x00, 0x0C, // 195 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, + 0x00, 0xFF, 0x07, 0x00, 0x0E, 0xE0, 0xFF, 0x00, 0x00, 0x0E, 0xFC, 0x7F, 0x00, 0x00, 0x8E, 0xFF, 0x71, 0x00, 0x00, 0xC0, 0x3F, + 0x70, 0x00, 0x00, 0xC0, 0x03, 0x70, 0x00, 0x00, 0xC0, 0x3F, 0x70, 0x00, 0x00, 0x8E, 0xFF, 0x71, 0x00, 0x00, 0x0E, 0xFC, 0x7F, + 0x00, 0x00, 0x0E, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x80, 0x0F, + 0x00, 0x00, 0x00, 0x00, 0x0C, // 196 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, + 0x00, 0xFF, 0x07, 0x00, 0x3C, 0xF0, 0x7F, 0x00, 0x00, 0x7E, 0xFE, 0x7F, 0x00, 0x00, 0xE7, 0xFF, 0x70, 0x00, 0x00, 0xC3, 0x1F, + 0x70, 0x00, 0x00, 0xC3, 0x01, 0x70, 0x00, 0x00, 0xC3, 0x1F, 0x70, 0x00, 0x00, 0xE7, 0xFF, 0x70, 0x00, 0x00, 0x7E, 0xFE, 0x7F, + 0x00, 0x00, 0x3C, 0xF0, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x00, 0x80, 0x0F, + 0x00, 0x00, 0x00, 0x00, 0x0C, // 197 + 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0xFC, 0x0F, 0x00, 0x00, 0x80, 0xFF, 0x03, 0x00, 0x00, + 0xF8, 0x7F, 0x00, 0x00, 0x80, 0xFF, 0x77, 0x00, 0x00, 0xC0, 0x7F, 0x70, 0x00, 0x00, 0xC0, 0x07, 0x70, 0x00, 0x00, 0xC0, 0x01, + 0x70, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0x81, 0x03, + 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x01, 0x00, + 0x0E, // 198 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0x00, 0x00, 0x00, + 0xFE, 0xFF, 0x01, 0x00, 0x00, 0x1F, 0xE0, 0x03, 0x00, 0x80, 0x07, 0x80, 0x07, 0x00, 0x80, 0x03, 0x00, 0x07, 0x03, 0xC0, 0x01, + 0x00, 0x0E, 0x03, 0xC0, 0x01, 0x00, 0x0E, 0x03, 0xC0, 0x01, 0x00, 0x3E, 0x03, 0xC0, 0x01, 0x00, 0xFE, 0x03, 0xC0, 0x01, 0x00, + 0xCE, 0x01, 0xC0, 0x03, 0x00, 0x0E, 0x00, 0x80, 0x03, 0x00, 0x07, 0x00, 0x00, 0x07, 0x80, 0x03, // 199 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, + 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC2, 0x81, 0x03, 0x0E, 0x00, 0xC6, 0x81, 0x03, 0x0E, 0x00, 0xCE, 0x81, + 0x03, 0x0E, 0x00, 0xDC, 0x81, 0x03, 0x0E, 0x00, 0xD8, 0x81, 0x03, 0x0E, 0x00, 0xD0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, + 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, // 200 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, + 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xD0, 0x81, 0x03, 0x0E, 0x00, 0xD8, 0x81, + 0x03, 0x0E, 0x00, 0xDC, 0x81, 0x03, 0x0E, 0x00, 0xCE, 0x81, 0x03, 0x0E, 0x00, 0xC6, 0x81, 0x03, 0x0E, 0x00, 0xC2, 0x81, 0x03, + 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, // 201 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, + 0xFF, 0xFF, 0x0F, 0x00, 0xD0, 0xFF, 0xFF, 0x0F, 0x00, 0xD8, 0x81, 0x03, 0x0E, 0x00, 0xDC, 0x81, 0x03, 0x0E, 0x00, 0xC6, 0x81, + 0x03, 0x0E, 0x00, 0xC2, 0x81, 0x03, 0x0E, 0x00, 0xC6, 0x81, 0x03, 0x0E, 0x00, 0xDC, 0x81, 0x03, 0x0E, 0x00, 0xD8, 0x81, 0x03, + 0x0E, 0x00, 0xD0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, // 202 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, + 0xFF, 0xFF, 0x0F, 0x00, 0xCE, 0xFF, 0xFF, 0x0F, 0x00, 0xCE, 0x81, 0x03, 0x0E, 0x00, 0xCE, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, + 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xCE, 0x81, 0x03, 0x0E, 0x00, 0xCE, 0x81, 0x03, + 0x0E, 0x00, 0xCE, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, // 203 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, + 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC2, 0x01, 0x00, 0x0E, 0x00, 0xC6, 0x01, 0x00, 0x0E, 0x00, 0xCE, 0xFF, + 0xFF, 0x0F, 0x00, 0xDC, 0xFF, 0xFF, 0x0F, 0x00, 0xD8, 0xFF, 0xFF, 0x0F, 0x00, 0xD0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, + 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, // 204 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, + 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xD0, 0x01, 0x00, 0x0E, 0x00, 0xD8, 0xFF, + 0xFF, 0x0F, 0x00, 0xDC, 0xFF, 0xFF, 0x0F, 0x00, 0xCE, 0xFF, 0xFF, 0x0F, 0x00, 0xC6, 0x01, 0x00, 0x0E, 0x00, 0xC2, 0x01, 0x00, + 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, // 205 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, + 0x01, 0x00, 0x0E, 0x00, 0xD0, 0x01, 0x00, 0x0E, 0x00, 0xD8, 0x01, 0x00, 0x0E, 0x00, 0xDC, 0x01, 0x00, 0x0E, 0x00, 0xC6, 0xFF, + 0xFF, 0x0F, 0x00, 0xC2, 0xFF, 0xFF, 0x0F, 0x00, 0xC6, 0xFF, 0xFF, 0x0F, 0x00, 0xDC, 0x01, 0x00, 0x0E, 0x00, 0xD8, 0x01, 0x00, + 0x0E, 0x00, 0xD0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, // 206 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, + 0x01, 0x00, 0x0E, 0x00, 0xCE, 0x01, 0x00, 0x0E, 0x00, 0xCE, 0x01, 0x00, 0x0E, 0x00, 0xCE, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0xFF, + 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xCE, 0x01, 0x00, 0x0E, 0x00, 0xCE, 0x01, 0x00, + 0x0E, 0x00, 0xCE, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, // 207 + 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, + 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0x81, + 0x03, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0x80, 0x03, 0x00, 0x07, 0x00, 0x80, 0x07, 0x80, 0x07, 0x00, 0x00, 0x1F, 0xE0, + 0x03, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0xFC, 0xFF, 0x00, 0x00, 0x00, 0xF0, 0x3F, // 208 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC6, + 0xFF, 0xFF, 0x0F, 0x00, 0xC7, 0x07, 0x00, 0x00, 0x00, 0x03, 0x3F, 0x00, 0x00, 0x00, 0x03, 0xFC, 0x00, 0x00, 0x00, 0x03, 0xE0, + 0x07, 0x00, 0x00, 0x06, 0x80, 0x1F, 0x00, 0x00, 0x06, 0x00, 0xFC, 0x00, 0x00, 0x06, 0x00, 0xF0, 0x03, 0x00, 0x07, 0x00, 0x80, + 0x0F, 0x00, 0xC3, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, // 209 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0x00, + 0xFF, 0xFF, 0x03, 0x00, 0x80, 0x0F, 0xC0, 0x07, 0x00, 0x82, 0x03, 0x00, 0x07, 0x00, 0xC6, 0x01, 0x00, 0x0E, 0x00, 0xCE, 0x01, + 0x00, 0x0E, 0x00, 0xDC, 0x01, 0x00, 0x0E, 0x00, 0xD8, 0x01, 0x00, 0x0E, 0x00, 0xD0, 0x01, 0x00, 0x0E, 0x00, 0x80, 0x03, 0x00, + 0x07, 0x00, 0x80, 0x0F, 0xC0, 0x07, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0x00, 0xF0, 0x3F, // 210 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0x00, + 0xFF, 0xFF, 0x03, 0x00, 0x80, 0x0F, 0xC0, 0x07, 0x00, 0x80, 0x03, 0x00, 0x07, 0x00, 0xD0, 0x01, 0x00, 0x0E, 0x00, 0xD8, 0x01, + 0x00, 0x0E, 0x00, 0xDC, 0x01, 0x00, 0x0E, 0x00, 0xCE, 0x01, 0x00, 0x0E, 0x00, 0xC6, 0x01, 0x00, 0x0E, 0x00, 0x82, 0x03, 0x00, + 0x07, 0x00, 0x80, 0x0F, 0xC0, 0x07, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0x00, 0xF0, 0x3F, // 211 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0x00, + 0xFF, 0xFF, 0x03, 0x00, 0x90, 0x0F, 0xC0, 0x07, 0x00, 0x98, 0x03, 0x00, 0x07, 0x00, 0xDC, 0x01, 0x00, 0x0E, 0x00, 0xC6, 0x01, + 0x00, 0x0E, 0x00, 0xC2, 0x01, 0x00, 0x0E, 0x00, 0xC6, 0x01, 0x00, 0x0E, 0x00, 0xDC, 0x01, 0x00, 0x0E, 0x00, 0x98, 0x03, 0x00, + 0x07, 0x00, 0x90, 0x0F, 0xC0, 0x07, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0x00, 0xF0, 0x3F, // 212 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0x00, + 0xFF, 0xFF, 0x03, 0x00, 0x8C, 0x0F, 0xC0, 0x07, 0x00, 0x8E, 0x03, 0x00, 0x07, 0x00, 0xC6, 0x01, 0x00, 0x0E, 0x00, 0xC6, 0x01, + 0x00, 0x0E, 0x00, 0xCE, 0x01, 0x00, 0x0E, 0x00, 0xCC, 0x01, 0x00, 0x0E, 0x00, 0xCC, 0x01, 0x00, 0x0E, 0x00, 0x8E, 0x03, 0x00, + 0x07, 0x00, 0x86, 0x0F, 0xC0, 0x07, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0x00, 0xF0, 0x3F, // 213 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0x00, + 0xFF, 0xFF, 0x03, 0x00, 0x8E, 0x0F, 0xC0, 0x07, 0x00, 0x8E, 0x03, 0x00, 0x07, 0x00, 0xCE, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, + 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xCE, 0x01, 0x00, 0x0E, 0x00, 0x8E, 0x03, 0x00, + 0x07, 0x00, 0x8E, 0x0F, 0xC0, 0x07, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0xFE, 0xFF, 0x01, 0x00, 0x00, 0xF0, 0x3F, // 214 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x01, 0x00, 0x00, 0x70, 0x80, 0x03, 0x00, 0x00, + 0xE0, 0xC0, 0x01, 0x00, 0x00, 0xC0, 0xE1, 0x00, 0x00, 0x00, 0x80, 0x73, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, + 0x1E, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x80, 0x73, 0x00, 0x00, 0x00, 0xC0, 0xE1, + 0x00, 0x00, 0x00, 0xE0, 0xC0, 0x01, 0x00, 0x00, 0x70, 0x80, 0x03, 0x00, 0x00, 0x20, 0x00, 0x01, // 215 + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0xF0, 0x3F, 0x0F, 0x00, 0x00, 0xFE, 0xFF, 0x03, 0x00, 0x00, + 0xFF, 0xFF, 0x03, 0x00, 0x80, 0x0F, 0xF0, 0x07, 0x00, 0x80, 0x03, 0x38, 0x07, 0x00, 0xC0, 0x01, 0x1C, 0x0E, 0x00, 0xC0, 0x01, + 0x06, 0x0E, 0x00, 0xC0, 0x81, 0x03, 0x0E, 0x00, 0xC0, 0xC1, 0x01, 0x0E, 0x00, 0xC0, 0xE1, 0x00, 0x0E, 0x00, 0x80, 0x73, 0x00, + 0x07, 0x00, 0x80, 0x1F, 0xC0, 0x07, 0x00, 0x00, 0xFE, 0xFF, 0x03, 0x00, 0x00, 0xFF, 0xFF, 0x01, 0x00, 0xC0, 0xF1, 0x3F, 0x00, + 0x00, 0xC0, // 216 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x03, 0x00, 0xC0, + 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x02, 0x00, 0x00, 0x0F, 0x00, 0x06, 0x00, 0x00, 0x0E, 0x00, 0x0E, 0x00, + 0x00, 0x0E, 0x00, 0x1C, 0x00, 0x00, 0x0E, 0x00, 0x18, 0x00, 0x00, 0x0E, 0x00, 0x10, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x80, + 0x07, 0x00, 0xC0, 0xFF, 0xFF, 0x07, 0x00, 0xC0, 0xFF, 0xFF, 0x03, 0x00, 0xC0, 0xFF, 0xFF, // 217 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x03, 0x00, 0xC0, + 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x10, 0x00, 0x00, 0x0E, 0x00, 0x18, 0x00, + 0x00, 0x0E, 0x00, 0x1C, 0x00, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x00, 0x0E, 0x00, 0x06, 0x00, 0x00, 0x0F, 0x00, 0x02, 0x00, 0x80, + 0x07, 0x00, 0xC0, 0xFF, 0xFF, 0x07, 0x00, 0xC0, 0xFF, 0xFF, 0x03, 0x00, 0xC0, 0xFF, 0xFF, // 218 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x03, 0x00, 0xC0, + 0xFF, 0xFF, 0x07, 0x00, 0x10, 0x00, 0x80, 0x07, 0x00, 0x18, 0x00, 0x00, 0x0F, 0x00, 0x0E, 0x00, 0x00, 0x0E, 0x00, 0x06, 0x00, + 0x00, 0x0E, 0x00, 0x06, 0x00, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x00, 0x0E, 0x00, 0x18, 0x00, 0x00, 0x0F, 0x00, 0x10, 0x00, 0x80, + 0x07, 0x00, 0xC0, 0xFF, 0xFF, 0x07, 0x00, 0xC0, 0xFF, 0xFF, 0x03, 0x00, 0xC0, 0xFF, 0xFF, // 219 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x03, 0x00, 0xC0, + 0xFF, 0xFF, 0x07, 0x00, 0x0E, 0x00, 0x80, 0x07, 0x00, 0x0E, 0x00, 0x00, 0x0F, 0x00, 0x0E, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, + 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x00, 0x0F, 0x00, 0x0E, 0x00, 0x80, + 0x07, 0x00, 0xC0, 0xFF, 0xFF, 0x07, 0x00, 0xC0, 0xFF, 0xFF, 0x03, 0x00, 0xC0, 0xFF, 0xFF, // 220 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0x00, 0xC0, + 0x0F, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x10, 0xF8, 0x01, 0x00, 0x00, 0x18, 0xE0, + 0xFF, 0x0F, 0x00, 0x1C, 0x80, 0xFF, 0x0F, 0x00, 0x0E, 0xE0, 0xFF, 0x0F, 0x00, 0x06, 0xF8, 0x01, 0x00, 0x00, 0x02, 0xFC, 0x00, + 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, + 0x00, 0x40, // 221 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xC0, + 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x1C, 0x70, 0x00, 0x00, 0x00, 0x1C, 0x70, 0x00, 0x00, 0x00, 0x1C, + 0x70, 0x00, 0x00, 0x00, 0x1C, 0x70, 0x00, 0x00, 0x00, 0x1C, 0x70, 0x00, 0x00, 0x00, 0x1C, 0x70, 0x00, 0x00, 0x00, 0x3C, 0x78, + 0x00, 0x00, 0x00, 0x78, 0x3C, 0x00, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x00, 0x00, 0xF0, 0x1F, 0x00, 0x00, 0x00, 0xE0, 0x0F, // 222 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x0F, 0x00, 0x80, + 0xFF, 0xFF, 0x0F, 0x00, 0xC0, 0xFF, 0xFF, 0x0F, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x07, 0x00, 0xE0, 0xE0, + 0x01, 0x0E, 0x00, 0xE0, 0xF0, 0x03, 0x0E, 0x00, 0xE0, 0xF8, 0x07, 0x0E, 0x00, 0xE0, 0x19, 0x06, 0x0E, 0x00, 0xC0, 0x0F, 0x0E, + 0x0E, 0x00, 0x80, 0x0F, 0x1C, 0x0F, 0x00, 0x00, 0x0E, 0xF8, 0x07, 0x00, 0x00, 0x00, 0xF0, 0x07, 0x00, 0x00, 0x00, 0xE0, + 0x01, // 223 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0xC0, 0xF1, 0x07, 0x00, 0x10, + 0xE0, 0xF8, 0x07, 0x00, 0x30, 0xE0, 0x38, 0x0F, 0x00, 0x70, 0x70, 0x1C, 0x0E, 0x00, 0xE0, 0x70, 0x1C, 0x0E, 0x00, 0xC0, 0x73, + 0x1C, 0x0E, 0x00, 0x00, 0x73, 0x1C, 0x0E, 0x00, 0x00, 0x72, 0x1C, 0x06, 0x00, 0x00, 0x70, 0x1C, 0x07, 0x00, 0x00, 0xE0, 0x9C, + 0x01, 0x00, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0xC0, 0xFF, 0x0F, 0x00, 0x00, 0x80, 0xFF, 0x0F, // 224 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0xC0, 0xF1, 0x07, 0x00, 0x00, + 0xE0, 0xF8, 0x07, 0x00, 0x00, 0xE0, 0x38, 0x0F, 0x00, 0x00, 0x70, 0x1C, 0x0E, 0x00, 0x00, 0x72, 0x1C, 0x0E, 0x00, 0x00, 0x73, + 0x1C, 0x0E, 0x00, 0xC0, 0x73, 0x1C, 0x0E, 0x00, 0xE0, 0x70, 0x1C, 0x06, 0x00, 0x70, 0x70, 0x1C, 0x07, 0x00, 0x30, 0xE0, 0x9C, + 0x01, 0x00, 0x10, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0xC0, 0xFF, 0x0F, 0x00, 0x00, 0x80, 0xFF, 0x0F, // 225 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0xC0, 0xF1, 0x07, 0x00, 0x00, + 0xE2, 0xF8, 0x07, 0x00, 0x80, 0xE3, 0x38, 0x0F, 0x00, 0xC0, 0x71, 0x1C, 0x0E, 0x00, 0xF0, 0x70, 0x1C, 0x0E, 0x00, 0x30, 0x70, + 0x1C, 0x0E, 0x00, 0xF0, 0x70, 0x1C, 0x0E, 0x00, 0xC0, 0x71, 0x1C, 0x06, 0x00, 0x80, 0x73, 0x1C, 0x07, 0x00, 0x00, 0xE2, 0x9C, + 0x01, 0x00, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0xC0, 0xFF, 0x0F, 0x00, 0x00, 0x80, 0xFF, 0x0F, // 226 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0xC0, 0xF1, 0x07, 0x00, 0xC0, + 0xE1, 0xF8, 0x07, 0x00, 0xE0, 0xE1, 0x38, 0x0F, 0x00, 0x60, 0x70, 0x1C, 0x0E, 0x00, 0x60, 0x70, 0x1C, 0x0E, 0x00, 0xE0, 0x70, + 0x1C, 0x0E, 0x00, 0xC0, 0x71, 0x1C, 0x0E, 0x00, 0x80, 0x71, 0x1C, 0x06, 0x00, 0x80, 0x71, 0x1C, 0x07, 0x00, 0xE0, 0xE1, 0x9C, + 0x01, 0x00, 0x60, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0xC0, 0xFF, 0x0F, 0x00, 0x00, 0x80, 0xFF, 0x0F, // 227 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0xC0, 0xF1, 0x07, 0x00, 0x00, + 0xE0, 0xF8, 0x07, 0x00, 0xE0, 0xE0, 0x38, 0x0F, 0x00, 0xE0, 0x70, 0x1C, 0x0E, 0x00, 0xE0, 0x70, 0x1C, 0x0E, 0x00, 0x00, 0x70, + 0x1C, 0x0E, 0x00, 0x00, 0x70, 0x1C, 0x0E, 0x00, 0x00, 0x70, 0x1C, 0x06, 0x00, 0xE0, 0x70, 0x1C, 0x07, 0x00, 0xE0, 0xE0, 0x9C, + 0x01, 0x00, 0xE0, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0xC0, 0xFF, 0x0F, 0x00, 0x00, 0x80, 0xFF, 0x0F, // 228 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0xC0, 0xF1, 0x07, 0x00, 0x00, + 0xE0, 0xF8, 0x07, 0x00, 0xF0, 0xE0, 0x38, 0x0F, 0x00, 0xF8, 0x71, 0x1C, 0x0E, 0x00, 0x9C, 0x73, 0x1C, 0x0E, 0x00, 0x0C, 0x73, + 0x1C, 0x0E, 0x00, 0x0C, 0x73, 0x1C, 0x0E, 0x00, 0x9C, 0x73, 0x1C, 0x06, 0x00, 0xF8, 0x71, 0x1C, 0x07, 0x00, 0xF0, 0xE0, 0x9C, + 0x01, 0x00, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0xC0, 0xFF, 0x0F, 0x00, 0x00, 0x80, 0xFF, 0x0F, // 229 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0xE0, 0xF8, 0x07, 0x00, 0x00, 0x70, 0xF8, 0x0F, 0x00, 0x00, + 0x70, 0x3C, 0x0F, 0x00, 0x00, 0x70, 0x1C, 0x0E, 0x00, 0x00, 0x70, 0x1C, 0x0E, 0x00, 0x00, 0xF0, 0x1C, 0x0F, 0x00, 0x00, 0xE0, + 0xFF, 0x07, 0x00, 0x00, 0xC0, 0xFF, 0x01, 0x00, 0x00, 0xE0, 0xFF, 0x07, 0x00, 0x00, 0xF0, 0x1C, 0x07, 0x00, 0x00, 0x70, 0x1C, + 0x0E, 0x00, 0x00, 0x70, 0x1C, 0x0E, 0x00, 0x00, 0xF0, 0x1C, 0x0E, 0x00, 0x00, 0xF0, 0x1F, 0x0E, 0x00, 0x00, 0xE0, 0x1F, 0x07, + 0x00, 0x00, 0x80, 0x1F, 0x07, // 230 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, + 0x80, 0xFF, 0x01, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, 0xE0, 0xC3, 0x07, 0x00, 0x00, 0xE0, 0x00, 0x07, 0x00, 0x00, 0xF0, + 0x00, 0x0F, 0x03, 0x00, 0x70, 0x00, 0x0E, 0x03, 0x00, 0x70, 0x00, 0x0E, 0x03, 0x00, 0x70, 0x00, 0x3E, 0x03, 0x00, 0x70, 0x00, + 0xFE, 0x03, 0x00, 0x70, 0x00, 0xCE, 0x01, 0x00, 0xE0, 0x00, 0x07, 0x00, 0x00, 0xC0, 0x81, 0x03, // 231 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x01, 0x00, 0x10, + 0xC0, 0xFF, 0x03, 0x00, 0x30, 0xE0, 0x9D, 0x07, 0x00, 0x70, 0xE0, 0x1C, 0x07, 0x00, 0xE0, 0x70, 0x1C, 0x0E, 0x00, 0xC0, 0x73, + 0x1C, 0x0E, 0x00, 0x00, 0x73, 0x1C, 0x0E, 0x00, 0x00, 0x72, 0x1C, 0x0E, 0x00, 0x00, 0x70, 0x1C, 0x0E, 0x00, 0x00, 0xF0, 0x1C, + 0x0E, 0x00, 0x00, 0xE0, 0x1C, 0x07, 0x00, 0x00, 0xE0, 0x1F, 0x07, 0x00, 0x00, 0xC0, 0x9F, 0x03, 0x00, 0x00, 0x00, 0x1F, // 232 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x01, 0x00, 0x00, + 0xC0, 0xFF, 0x03, 0x00, 0x00, 0xE0, 0x9D, 0x07, 0x00, 0x00, 0xE0, 0x1C, 0x07, 0x00, 0x00, 0x72, 0x1C, 0x0E, 0x00, 0x00, 0x73, + 0x1C, 0x0E, 0x00, 0xC0, 0x73, 0x1C, 0x0E, 0x00, 0xE0, 0x70, 0x1C, 0x0E, 0x00, 0x70, 0x70, 0x1C, 0x0E, 0x00, 0x30, 0xF0, 0x1C, + 0x0E, 0x00, 0x10, 0xE0, 0x1C, 0x07, 0x00, 0x00, 0xE0, 0x1F, 0x07, 0x00, 0x00, 0xC0, 0x9F, 0x03, 0x00, 0x00, 0x00, 0x1F, // 233 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x01, 0x00, 0x00, + 0xC2, 0xFF, 0x03, 0x00, 0x80, 0xE3, 0x9D, 0x07, 0x00, 0xC0, 0xE1, 0x1C, 0x07, 0x00, 0xF0, 0x70, 0x1C, 0x0E, 0x00, 0x30, 0x70, + 0x1C, 0x0E, 0x00, 0xF0, 0x70, 0x1C, 0x0E, 0x00, 0xC0, 0x71, 0x1C, 0x0E, 0x00, 0x80, 0x73, 0x1C, 0x0E, 0x00, 0x00, 0xF2, 0x1C, + 0x0E, 0x00, 0x00, 0xE0, 0x1C, 0x07, 0x00, 0x00, 0xE0, 0x1F, 0x07, 0x00, 0x00, 0xC0, 0x9F, 0x03, 0x00, 0x00, 0x00, 0x1F, // 234 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x01, 0x00, 0x00, + 0xC0, 0xFF, 0x03, 0x00, 0xE0, 0xE0, 0x9D, 0x07, 0x00, 0xE0, 0xE0, 0x1C, 0x07, 0x00, 0xE0, 0x70, 0x1C, 0x0E, 0x00, 0x00, 0x70, + 0x1C, 0x0E, 0x00, 0x00, 0x70, 0x1C, 0x0E, 0x00, 0x00, 0x70, 0x1C, 0x0E, 0x00, 0xE0, 0x70, 0x1C, 0x0E, 0x00, 0xE0, 0xF0, 0x1C, + 0x0E, 0x00, 0xE0, 0xE0, 0x1C, 0x07, 0x00, 0x00, 0xE0, 0x1F, 0x07, 0x00, 0x00, 0xC0, 0x9F, 0x03, 0x00, 0x00, 0x00, 0x1F, // 235 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x10, + 0x70, 0x00, 0x0E, 0x00, 0x30, 0x70, 0x00, 0x0E, 0x00, 0x70, 0x70, 0x00, 0x0E, 0x00, 0xE0, 0x70, 0x00, 0x0E, 0x00, 0xC0, 0xF3, + 0xFF, 0x0F, 0x00, 0x00, 0xF3, 0xFF, 0x0F, 0x00, 0x00, 0xF2, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, // 236 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, + 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x72, 0x00, 0x0E, 0x00, 0x00, 0xF3, + 0xFF, 0x0F, 0x00, 0xC0, 0xF3, 0xFF, 0x0F, 0x00, 0xE0, 0xF0, 0xFF, 0x0F, 0x00, 0x70, 0x00, 0x00, 0x0E, 0x00, 0x30, 0x00, 0x00, + 0x0E, 0x00, 0x10, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, // 237 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, + 0x72, 0x00, 0x0E, 0x00, 0x80, 0x73, 0x00, 0x0E, 0x00, 0xC0, 0x71, 0x00, 0x0E, 0x00, 0xF0, 0x70, 0x00, 0x0E, 0x00, 0x30, 0xF0, + 0xFF, 0x0F, 0x00, 0xF0, 0xF0, 0xFF, 0x0F, 0x00, 0xC0, 0xF1, 0xFF, 0x0F, 0x00, 0x80, 0x03, 0x00, 0x0E, 0x00, 0x00, 0x02, 0x00, + 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, // 238 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, + 0x70, 0x00, 0x0E, 0x00, 0xE0, 0x70, 0x00, 0x0E, 0x00, 0xE0, 0x70, 0x00, 0x0E, 0x00, 0xE0, 0x70, 0x00, 0x0E, 0x00, 0x00, 0xF0, + 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0xE0, 0x00, 0x00, 0x0E, 0x00, 0xE0, 0x00, 0x00, + 0x0E, 0x00, 0xE0, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, // 239 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x20, + 0xE6, 0xFF, 0x07, 0x00, 0x60, 0xE2, 0x81, 0x07, 0x00, 0xE0, 0xF3, 0x00, 0x0F, 0x00, 0xE0, 0x73, 0x00, 0x0E, 0x00, 0xC0, 0x77, + 0x00, 0x0E, 0x00, 0x80, 0x7F, 0x00, 0x0E, 0x00, 0x80, 0x7E, 0x00, 0x0E, 0x00, 0xC0, 0x7C, 0x00, 0x0F, 0x00, 0xC0, 0xF8, 0x81, + 0x07, 0x00, 0x40, 0xF0, 0xFF, 0x07, 0x00, 0x00, 0xC0, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x7F, // 240 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0xC0, + 0xF1, 0xFF, 0x0F, 0x00, 0xE0, 0xF1, 0xFF, 0x0F, 0x00, 0x60, 0xC0, 0x01, 0x00, 0x00, 0x60, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x60, + 0x00, 0x00, 0x00, 0xC0, 0x71, 0x00, 0x00, 0x00, 0x80, 0x71, 0x00, 0x00, 0x00, 0x80, 0x71, 0x00, 0x00, 0x00, 0xE0, 0xF1, 0x00, + 0x00, 0x00, 0x60, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0xE0, 0xFF, 0x0F, 0x00, 0x00, 0x80, 0xFF, 0x0F, // 241 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x10, + 0xE0, 0xFF, 0x07, 0x00, 0x30, 0xE0, 0x81, 0x07, 0x00, 0x70, 0xF0, 0x00, 0x0F, 0x00, 0xE0, 0x70, 0x00, 0x0E, 0x00, 0xC0, 0x73, + 0x00, 0x0E, 0x00, 0x00, 0x73, 0x00, 0x0E, 0x00, 0x00, 0x72, 0x00, 0x0E, 0x00, 0x00, 0xF0, 0x00, 0x0F, 0x00, 0x00, 0xE0, 0x81, + 0x07, 0x00, 0x00, 0xE0, 0xFF, 0x07, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xFF, // 242 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, + 0xE0, 0xFF, 0x07, 0x00, 0x00, 0xE0, 0x81, 0x07, 0x00, 0x00, 0xF0, 0x00, 0x0F, 0x00, 0x00, 0x72, 0x00, 0x0E, 0x00, 0x00, 0x73, + 0x00, 0x0E, 0x00, 0xC0, 0x73, 0x00, 0x0E, 0x00, 0xE0, 0x70, 0x00, 0x0E, 0x00, 0x70, 0xF0, 0x00, 0x0F, 0x00, 0x30, 0xE0, 0x81, + 0x07, 0x00, 0x10, 0xE0, 0xFF, 0x07, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xFF, // 243 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, + 0xE0, 0xFF, 0x07, 0x00, 0x00, 0xE2, 0x81, 0x07, 0x00, 0x80, 0xF3, 0x00, 0x0F, 0x00, 0xE0, 0x71, 0x00, 0x0E, 0x00, 0x70, 0x70, + 0x00, 0x0E, 0x00, 0x70, 0x70, 0x00, 0x0E, 0x00, 0xE0, 0x71, 0x00, 0x0E, 0x00, 0x80, 0xF3, 0x00, 0x0F, 0x00, 0x00, 0xE2, 0x81, + 0x07, 0x00, 0x00, 0xE0, 0xFF, 0x07, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xFF, // 244 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0xC0, + 0xE1, 0xFF, 0x07, 0x00, 0xE0, 0xE1, 0x81, 0x07, 0x00, 0x60, 0xF0, 0x00, 0x0F, 0x00, 0x60, 0x70, 0x00, 0x0E, 0x00, 0xE0, 0x70, + 0x00, 0x0E, 0x00, 0xC0, 0x71, 0x00, 0x0E, 0x00, 0x80, 0x71, 0x00, 0x0E, 0x00, 0x80, 0xF1, 0x00, 0x0F, 0x00, 0xE0, 0xE1, 0x81, + 0x07, 0x00, 0x60, 0xE0, 0xFF, 0x07, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xFF, // 245 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0xE0, + 0xE0, 0xFF, 0x07, 0x00, 0xE0, 0xE0, 0x81, 0x07, 0x00, 0xE0, 0xF0, 0x00, 0x0F, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, + 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0xE0, 0xF0, 0x00, 0x0F, 0x00, 0xE0, 0xE0, 0x81, + 0x07, 0x00, 0xE0, 0xE0, 0xFF, 0x07, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xFF, // 246 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, + 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0xF0, 0xCC, 0x03, 0x00, 0x00, 0xF0, + 0xCC, 0x03, 0x00, 0x00, 0xF0, 0xCC, 0x03, 0x00, 0x00, 0xF0, 0xCC, 0x03, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, + 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x0C, // 247 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x7F, 0x0E, 0x00, 0x00, 0xC0, 0xFF, 0x07, 0x00, 0x00, + 0xE0, 0xFF, 0x03, 0x00, 0x00, 0xE0, 0xC1, 0x07, 0x00, 0x00, 0xF0, 0xE0, 0x07, 0x00, 0x00, 0x70, 0x70, 0x0E, 0x00, 0x00, 0x70, + 0x38, 0x0E, 0x00, 0x00, 0x70, 0x1C, 0x0E, 0x00, 0x00, 0x70, 0x0E, 0x0E, 0x00, 0x00, 0xE0, 0x07, 0x0F, 0x00, 0x00, 0xE0, 0x83, + 0x07, 0x00, 0x00, 0xC0, 0xFF, 0x07, 0x00, 0x00, 0xE0, 0xFF, 0x03, 0x00, 0x00, 0x38, 0xFE, 0x00, 0x00, 0x00, 0x10, // 248 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x01, 0x00, 0x10, + 0xF0, 0xFF, 0x07, 0x00, 0x30, 0xF0, 0xFF, 0x07, 0x00, 0x70, 0x00, 0x00, 0x0F, 0x00, 0xE0, 0x00, 0x00, 0x0E, 0x00, 0xC0, 0x03, + 0x00, 0x0E, 0x00, 0x00, 0x03, 0x00, 0x0E, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x80, + 0x01, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x0F, // 249 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x01, 0x00, 0x00, + 0xF0, 0xFF, 0x07, 0x00, 0x00, 0xF0, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x02, 0x00, 0x0E, 0x00, 0x00, 0x03, + 0x00, 0x0E, 0x00, 0xC0, 0x03, 0x00, 0x0E, 0x00, 0xE0, 0x00, 0x00, 0x06, 0x00, 0x70, 0x00, 0x00, 0x07, 0x00, 0x30, 0x00, 0x80, + 0x01, 0x00, 0x10, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x0F, // 250 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x01, 0x00, 0x00, + 0xF0, 0xFF, 0x07, 0x00, 0x00, 0xF2, 0xFF, 0x07, 0x00, 0x80, 0x03, 0x00, 0x0F, 0x00, 0xC0, 0x01, 0x00, 0x0E, 0x00, 0xF0, 0x00, + 0x00, 0x0E, 0x00, 0x30, 0x00, 0x00, 0x0E, 0x00, 0xF0, 0x00, 0x00, 0x06, 0x00, 0xC0, 0x01, 0x00, 0x07, 0x00, 0x80, 0x03, 0x80, + 0x01, 0x00, 0x00, 0xF2, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x0F, // 251 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x01, 0x00, 0x00, + 0xF0, 0xFF, 0x07, 0x00, 0xE0, 0xF0, 0xFF, 0x07, 0x00, 0xE0, 0x00, 0x00, 0x0F, 0x00, 0xE0, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, + 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0xE0, 0x00, 0x00, 0x07, 0x00, 0xE0, 0x00, 0x80, + 0x01, 0x00, 0xE0, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0x0F, // 252 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x80, 0x03, 0x00, + 0xF0, 0x03, 0x80, 0x03, 0x00, 0xE0, 0x1F, 0x80, 0x03, 0x00, 0x80, 0x7F, 0xC0, 0x03, 0x00, 0x02, 0xFC, 0xF3, 0x01, 0x00, 0x03, + 0xF0, 0xFF, 0x01, 0xC0, 0x03, 0xC0, 0x7F, 0x00, 0xE0, 0x00, 0xF0, 0x0F, 0x00, 0x70, 0x00, 0xFE, 0x03, 0x00, 0x30, 0x80, 0x7F, + 0x00, 0x00, 0x10, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x10, // 253 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0x03, 0xE0, + 0xFF, 0xFF, 0xFF, 0x03, 0xE0, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0xC0, 0x81, 0x03, 0x00, 0x00, 0xE0, 0x00, 0x07, 0x00, 0x00, 0x70, + 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0x70, 0x00, 0x0E, 0x00, 0x00, 0xF0, 0x00, + 0x0F, 0x00, 0x00, 0xE0, 0x81, 0x07, 0x00, 0x00, 0xE0, 0xFF, 0x07, 0x00, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xFF, // 254 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x80, 0x03, 0x00, + 0xF0, 0x03, 0x80, 0x03, 0xE0, 0xE0, 0x1F, 0x80, 0x03, 0xE0, 0x80, 0x7F, 0xC0, 0x03, 0xE0, 0x00, 0xFC, 0xF3, 0x01, 0x00, 0x00, + 0xF0, 0xFF, 0x01, 0x00, 0x00, 0xC0, 0x7F, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0xE0, 0x00, 0xFE, 0x03, 0x00, 0xE0, 0x80, 0x7F, + 0x00, 0x00, 0xE0, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x10 // 255 +}; diff --git a/src/graphics/fonts/EinkDisplayFonts.h b/src/graphics/fonts/EinkDisplayFonts.h new file mode 100644 index 000000000..342525a19 --- /dev/null +++ b/src/graphics/fonts/EinkDisplayFonts.h @@ -0,0 +1,14 @@ +#ifndef EINKDISPLAYFONTS_h +#define EINKDISPLAYFONTS_h + +#ifdef ARDUINO +#include +#elif __MBED__ +#define PROGMEM +#endif + +/** + * Monospaced Plain 30 + */ +extern const uint8_t Monospaced_plain_30[] PROGMEM; +#endif diff --git a/variants/crowpanel-esp32s3-5-epaper/pins_arduino.h b/variants/crowpanel-esp32s3-5-epaper/pins_arduino.h new file mode 100644 index 000000000..55a85939b --- /dev/null +++ b/variants/crowpanel-esp32s3-5-epaper/pins_arduino.h @@ -0,0 +1,26 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define USB_VID 0x303a +#define USB_PID 0x1001 + +// The default Wire will be mapped to PMU and RTC +static const uint8_t SDA = 21; +static const uint8_t SCL = 15; + +// Default SPI will be mapped to Radio +static const uint8_t SS = 14; +static const uint8_t MOSI = 8; +static const uint8_t MISO = 9; +static const uint8_t SCK = 3; + +#define SPI_MOSI (40) +#define SPI_SCK (39) +#define SPI_MISO (13) +#define SPI_CS (10) +// IO42 TF_3V3_CTL +#define SDCARD_CS SPI_CS + +#endif /* Pins_Arduino_h */ diff --git a/variants/crowpanel-esp32s3-5-epaper/platformio.ini b/variants/crowpanel-esp32s3-5-epaper/platformio.ini new file mode 100644 index 000000000..83d57a0ef --- /dev/null +++ b/variants/crowpanel-esp32s3-5-epaper/platformio.ini @@ -0,0 +1,28 @@ +[env:crowpanel-esp32s3-5-epaper] +extends = esp32s3_base +board_build.arduino.memory_type = qio_opi +board_build.flash_mode = qio +board_build.psram_type = opi +board_upload.flash_size = 8MB +board_upload.maximum_size = 8388608 +board = esp32-s3-devkitc-1 +upload_port = /dev/ttyUSB0 +board_level = extra +upload_protocol = esptool +build_flags = + ${esp32_base.build_flags} -D CROWPANEL_ESP32S3_5_EPAPER -I variants/crowpanel-esp32s3-5-epaper + -D PRIVATE_HW + -DBOARD_HAS_PSRAM + -DGPS_POWER_TOGGLE + -DEINK_DISPLAY_MODEL=GxEPD2_579_GDEY0579T93 ;https://www.good-display.com/product/439.html + ;-DEINK_DISPLAY_MODEL=GxEPD2_290_GDEY029T94 ;https://www.good-display.com/product/389.html + ;-DEINK_DISPLAY_MODEL=GxEPD2_420_GYE042A87 ; similar Panel: GDEY042T81 : https://www.good-display.com/product/386.html + -DEINK_WIDTH=792 + -DEINK_HEIGHT=272 + -DUSE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk + -DEINK_LIMIT_FASTREFRESH=100 ; How many consecutive fast-refreshes are permitted + ;-DEINK_LIMIT_RATE_BACKGROUND_SEC=30 ; Minimum interval between BACKGROUND updates + ;-DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 +lib_deps = + ${esp32s3_base.lib_deps} + https://github.com/markbirss/GxEPD2#markbirss-patch-1 diff --git a/variants/crowpanel-esp32s3-5-epaper/variant.h b/variants/crowpanel-esp32s3-5-epaper/variant.h new file mode 100644 index 000000000..360e33481 --- /dev/null +++ b/variants/crowpanel-esp32s3-5-epaper/variant.h @@ -0,0 +1,77 @@ +#define HAS_SDCARD +#define SDCARD_USE_SPI1 + +// Display (E-Ink) +#define USE_EINK +#define PIN_EINK_CS 45 +#define PIN_EINK_BUSY 48 +#define PIN_EINK_DC 46 +#define PIN_EINK_RES 47 +#define PIN_EINK_SCLK 12 +#define PIN_EINK_MOSI 11 +#define VEXT_ENABLE 7 // e-ink power enable pin +#define VEXT_ON_VALUE HIGH + +#define PIN_POWER_EN 42 // TF/SD Card Power Enable Pin + +// #define BATTERY_PIN 1 // A battery voltage measurement pin, voltage divider connected here to +// measure battery voltage ratio of voltage divider = 2.0 (assumption) +// #define ADC_MULTIPLIER 2.11 // 2.0 + 10% for correction of display undervoltage. +// #define ADC_CHANNEL ADC1_GPIO1_CHANNEL + +#define I2C_SDA SDA // 21 +#define I2C_SCL SCL // 15 + +#define GPS_DEFAULT_NOT_PRESENT 1 +// #define GPS_RX_PIN 44 +// #define GPS_TX_PIN 43 + +#define LED_PIN 41 +#define BUTTON_PIN 2 +#define BUTTON_NEED_PULLUP + +// Buzzer - noisy ? +#define PIN_BUZZER (0 + 18) + +// Wheel +// Up 6 +// Push 5 +// Down 4 +// MENU Top 2 +// EXIT Bottom 1 + +// TTGO uses a common pinout for their SX1262 vs RF95 modules - both can be enabled and +// we will probe at runtime for RF95 and if not found then probe for SX1262 +// #define USE_RF95 // RFM95/SX127x +#define USE_SX1262 +// #define USE_SX1280 + +#define LORA_SCK 3 +#define LORA_MISO 9 +#define LORA_MOSI 8 +#define LORA_CS 14 +#define LORA_RESET 38 + +#define LORA_DIO1 16 +#define LORA_DIO2 17 + +// per SX1262_Receive_Interrupt/utilities.h +#ifdef USE_SX1262 +#define SX126X_CS LORA_CS +#define SX126X_DIO1 LORA_DIO1 +#define SX126X_BUSY LORA_DIO2 +#define SX126X_RESET LORA_RESET +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 +#endif + +// per SX128x_Receive_Interrupt/utilities.h +#ifdef USE_SX1280 +#define SX128X_CS LORA_CS +#define SX128X_DIO1 LORA_DIO1 +#define SX128X_BUSY LORA_DIO2 +#define SX128X_RESET LORA_RESET +#define SX128X_RXEN 21 +#define SX128X_TXEN 15 +#define SX128X_MAX_POWER 3 +#endif From c8bd6c32cc6112a4dba98bbbca534de5ed25149f Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 6 Mar 2025 08:43:03 -0600 Subject: [PATCH 246/381] Correct HW_MODEL --- src/platform/nrf52/architecture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/nrf52/architecture.h b/src/platform/nrf52/architecture.h index 2c51dc1cc..bf7fce29a 100644 --- a/src/platform/nrf52/architecture.h +++ b/src/platform/nrf52/architecture.h @@ -76,7 +76,7 @@ #elif defined(HELTEC_T114) #define HW_VENDOR meshtastic_HardwareModel_HELTEC_MESH_NODE_T114 #elif defined(SEEED_XIAO_NRF52840_KIT) -#define HW_VENDOR meshtastic_HardwareModel_SEEED_XIAO_NRF52840_KIT +#define HW_VENDOR meshtastic_HardwareModel_XIAO_NRF52_KIT #else #define HW_VENDOR meshtastic_HardwareModel_NRF52_UNKNOWN #endif From f7afa9a81e998bb117fe5506471eaf26dc78af5b Mon Sep 17 00:00:00 2001 From: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com> Date: Thu, 6 Mar 2025 23:58:08 +0100 Subject: [PATCH 247/381] [Task]: 2.6 device-install scripts (#6248) * update device-install.bat * add device-install unittest * update device-update.bat * update uf2-convert.bat * update regen-protos.bat * update rem * bump version * update device-install.sh * add esptool * move esptool to setup.sh * trunk check+fmt * update uf2-convert.bat --- .devcontainer/setup.sh | 3 + bin/device-install.bat | 433 ++++++++++++++++++++++++------------ bin/device-install.sh | 226 +++++++++---------- bin/device-install_test.ps1 | 111 +++++++++ bin/device-update.bat | 205 +++++++++++++---- bin/regen-protos.bat | 11 +- bin/uf2-convert.bat | 126 ++++++++++- 7 files changed, 812 insertions(+), 303 deletions(-) create mode 100644 bin/device-install_test.ps1 diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index 0b2665f84..7c7487cc8 100755 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -1,3 +1,6 @@ #!/usr/bin/env sh git submodule update --init + +pip install --no-cache-dir setuptools +pipx install esptool diff --git a/bin/device-install.bat b/bin/device-install.bat index 4d13d9f3b..3e2ea49aa 100755 --- a/bin/device-install.bat +++ b/bin/device-install.bat @@ -1,149 +1,292 @@ @ECHO OFF SETLOCAL EnableDelayedExpansion -set "SCRIPTNAME=%~nx0" -set "PYTHON=python" -set "WEB_APP=0" -set "TFT8=0" -set "TFT16=0" -SET "TFT_BUILD=0" -SET "DO_SPECIAL_OTA=0" +TITLE Meshtastic device-install -:: Determine the correct esptool command to use -where esptool >nul 2>&1 -if %ERRORLEVEL% EQU 0 ( - set "ESPTOOL_CMD=esptool" -) else ( - set "ESPTOOL_CMD=%PYTHON% -m esptool" -) - -goto GETOPTS -:HELP -echo Usage: %SCRIPTNAME% [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME] [--web] [--tft] [--tft-16mb] -echo Flash image file to device, but first erasing and writing system information -echo. -echo -h Display this help and exit -echo -p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerrous). -echo -P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: %PYTHON%) -echo -f FILENAME The .bin file to flash. Custom to your device type and region. -echo --web Flash WEB APP. -echo --tft Flash MUI 8mb -echo --tft-16mb Flash MUI 16mb -goto EOF - -:GETOPTS -if /I "%~1"=="-h" goto HELP & exit /b -if /I "%~1"=="--help" goto HELP & exit /b -if "%~1"=="-p" set "ESPTOOL_PORT=%~2" & SHIFT & SHIFT & goto GETOPTS -if "%~1"=="-P" set "PYTHON=%~2" & SHIFT & SHIFT & goto GETOPTS -if /I "%~1"=="-f" set "FILENAME=%~2" & SHIFT & SHIFT & goto GETOPTS -if /I "%~1"=="--web" set "WEB_APP=1" & SHIFT & goto GETOPTS -if /I "%~1"=="--tft" set "TFT8=1" & SHIFT & goto GETOPTS -if /I "%~1"=="--tft-16mb" set "TFT16=1" & SHIFT & goto GETOPTS -SHIFT -IF NOT "%~1"=="" goto GETOPTS - -IF "__%FILENAME%__" == "____" ( - echo "Missing FILENAME" - goto HELP -) - -:: Check if FILENAME contains "-tft-" and either TFT8 or TFT16 is 1 (--tft, -tft-16mb) -IF NOT "%FILENAME:-tft-=%"=="%FILENAME%" ( - SET "TFT_BUILD=1" - IF NOT "%TFT8%"=="1" IF NOT "%TFT16%"=="1" ( - echo Error: Either --tft or --tft-16mb must be set to use a TFT build. - goto EOF - ) - IF "%TFT8%"=="1" IF "%TFT16%"=="1" ( - echo Error: Both --tft and --tft-16mb must NOT be set at the same time. - goto EOF - ) -) - -:: Extract BASENAME from %FILENAME% for later use. -SET BASENAME=%FILENAME:firmware-=% - -IF EXIST %FILENAME% IF x%FILENAME:update=%==x%FILENAME% ( - @REM Default littlefs* offset (--web). - SET "OFFSET=0x300000" - - @REM Default OTA Offset - SET "OTA_OFFSET=0x260000" - - @REM littlefs* offset for MUI 8mb (--tft) and OTA OFFSET. - IF "%TFT8%"=="1" IF "%TFT_BUILD%"=="1" ( - SET "OFFSET=0x670000" - SET "OTA_OFFSET=0x340000" - ) else ( - echo Ignoring --tft, not a TFT Build. - ) - - @REM littlefs* offset for MUI 16mb (--tft-16mb) and OTA OFFSET. - IF "%TFT16%"=="1" IF "%TFT_BUILD%"=="1" ( - SET "OFFSET=0xc90000" - SET "OTA_OFFSET=0x650000" - ) else ( - echo Ignoring --tft-16mb, not a TFT Build. - ) - - echo Trying to flash update %FILENAME%, but first erasing and writing system information" - %ESPTOOL_CMD% --baud 115200 erase_flash - %ESPTOOL_CMD% --baud 115200 write_flash 0x00 "%FILENAME%" - - @REM Account for S3 and C3 board's different OTA partition - IF NOT "%FILENAME%"=="%FILENAME:s3=%" SET "DO_SPECIAL_OTA=1" - IF NOT "%FILENAME%"=="%FILENAME:v3=%" SET "DO_SPECIAL_OTA=1" - IF NOT "%FILENAME%"=="%FILENAME:t-deck=%" SET "DO_SPECIAL_OTA=1" - IF NOT "%FILENAME%"=="%FILENAME:wireless-paper=%" SET "DO_SPECIAL_OTA=1" - IF NOT "%FILENAME%"=="%FILENAME:wireless-tracker=%" SET "DO_SPECIAL_OTA=1" - IF NOT "%FILENAME%"=="%FILENAME:station-g2=%" SET "DO_SPECIAL_OTA=1" - IF NOT "%FILENAME%"=="%FILENAME:unphone=%" SET "DO_SPECIAL_OTA=1" - IF NOT "%FILENAME%"=="%FILENAME:esp32c3=%" SET "DO_SPECIAL_OTA=1" - - IF "!DO_SPECIAL_OTA!"=="1" ( - IF NOT "%FILENAME%"=="%FILENAME:esp32c3=%" ( - %ESPTOOL_CMD% --baud 115200 write_flash !OTA_OFFSET! bleota-c3.bin - ) ELSE ( - %ESPTOOL_CMD% --baud 115200 write_flash !OTA_OFFSET! bleota-s3.bin - ) - ) ELSE ( - %ESPTOOL_CMD% --baud 115200 write_flash !OTA_OFFSET! bleota.bin - ) - - @REM Check if WEB_APP (--web) is enabled and add "littlefswebui-" to BASENAME else "littlefs-". - IF "%WEB_APP%"=="1" ( - @REM Check it the file exist before trying to write it. - IF EXIST "littlefswebui-%BASENAME%" ( - %ESPTOOL_CMD% --baud 115200 write_flash !OFFSET! "littlefswebui-%BASENAME%" - ) else ( - echo Error: file "littlefswebui-%BASENAME%" wasn't found, littlefswebui not written. - goto EOF - ) - ) else ( - @REM Check it the file exist before trying to write it. - IF EXIST "littlefs-%BASENAME%" ( - %ESPTOOL_CMD% --baud 115200 write_flash !OFFSET! "littlefs-%BASENAME%" - ) else ( - echo Error: file "littlefs-%BASENAME%" wasn't found, littlefs not written. - goto EOF - ) - ) -) else ( - echo "Invalid file: %FILENAME%" - goto HELP -) - -:EOF -@REM Cleanup vars. -SET "SCRIPTNAME=" +SET "SCRIPT_NAME=%~nx0" +SET "DEBUG=0" SET "PYTHON=" -SET "WEB_APP=" -SET "TFT8=" -Set "TFT16=" -SET "OFFSET=" -SET "OTA_OFFSET=" -SET "DO_SPECIAL_OTA=" -SET "FILENAME=" -SET "BASENAME=" -endlocal -exit /b 0 \ No newline at end of file +SET "WEB_APP=0" +SET "TFT_BUILD=0" +SET "TFT8=0" +SET "TFT16=0" +SET "ESPTOOL_BAUD=115200" +SET "ESPTOOL_CMD=" +SET "LOGCOUNTER=0" + +GOTO getopts +:help +ECHO Flash image file to device, but first erasing and writing system information. +ECHO. +ECHO Usage: %SCRIPT_NAME% -f filename [-p PORT] [-P python] (--web) +ECHO. +ECHO Options: +ECHO -f filename The .bin file to flash. Custom to your device type and region. (required) +ECHO The file must be located in this current directory. +ECHO -p PORT Set the environment variable for ESPTOOL_PORT. +ECHO If not set, ESPTOOL iterates all ports (Dangerous). +ECHO -P python Specify alternate python interpreter to use to invoke esptool. (default: python) +ECHO If supplied the script will use python. +ECHO If not supplied the script will try to find esptool in Path. +ECHO --web Enable WebUI. (default: false) +ECHO. +ECHO Example: %SCRIPT_NAME% -f firmware-t-deck-tft-2.6.0.0b106d4.bin -p COM11 +ECHO Example: %SCRIPT_NAME% -f littlefs-unphone-2.6.0.0b106d4.bin -p COM11 --web +GOTO eof + +:version +ECHO %SCRIPT_NAME% [Version 2.6.0] +ECHO Meshtastic +GOTO eof + +:getopts +IF "%~1"=="" GOTO endopts +IF /I "%~1"=="-?" GOTO help +IF /I "%~1"=="-h" GOTO help +IF /I "%~1"=="--help" GOTO help +IF /I "%~1"=="-v" GOTO version +IF /I "%~1"=="--version" GOTO version +IF /I "%~1"=="--debug" SET "DEBUG=1" & CALL :LOG_MESSAGE DEBUG "DEBUG mode: enabled." +IF /I "%~1"=="-f" SET "FILENAME=%~2" & SHIFT +IF "%~1"=="-p" SET "ESPTOOL_PORT=%~2" & SHIFT +IF /I "%~1"=="--port" SET "ESPTOOL_PORT=%~2" & SHIFT +IF "%~1"=="-P" SET "PYTHON=%~2" & SHIFT +IF /I "%~1"=="--web" SET "WEB_APP=1" +SHIFT +GOTO getopts +:endopts + +CALL :LOG_MESSAGE DEBUG "Checking FILENAME parameter..." +IF "__!FILENAME!__"=="____" ( + CALL :LOG_MESSAGE DEBUG "Missing -f filename input." + GOTO help +) ELSE ( + IF NOT "__!FILENAME: =!__"=="__!FILENAME!__" ( + CALL :LOG_MESSAGE ERROR "Filename containing spaces are not supported." + GOTO help + ) + @REM Remove ".\" or "./" file prefix if present. + SET "FILENAME=!FILENAME:.\=!" + SET "FILENAME=!FILENAME:./=!" +) + +CALL :LOG_MESSAGE DEBUG "Filename: !FILENAME!" +CALL :LOG_MESSAGE DEBUG "Checking if !FILENAME! exists..." +IF NOT EXIST !FILENAME! ( + CALL :LOG_MESSAGE ERROR "File does not exist: !FILENAME!. Terminating." + GOTO eof +) + +IF NOT "!FILENAME:update=!"=="!FILENAME!" ( + CALL :LOG_MESSAGE DEBUG "We are working with a *update* file. !FILENAME!" + CALL :LOG_MESSAGE INFO "Use script device-update.bat to flash update !FILENAME!." + GOTO eof +) ELSE ( + CALL :LOG_MESSAGE DEBUG "We are NOT working with a *update* file. !FILENAME!" +) + +CALL :LOG_MESSAGE DEBUG "Determine the correct esptool command to use..." +IF NOT "__%PYTHON%__"=="____" ( + SET "ESPTOOL_CMD=!PYTHON! -m esptool" + CALL :LOG_MESSAGE DEBUG "Python interpreter supplied." +) ELSE ( + CALL :LOG_MESSAGE DEBUG "Python interpreter NOT supplied. Looking for esptool... + WHERE esptool >nul 2>&1 + IF %ERRORLEVEL% EQU 0 ( + @REM WHERE exits with code 0 if esptool is found. + SET "ESPTOOL_CMD=esptool" + ) ELSE ( + SET "ESPTOOL_CMD=python -m esptool" + CALL :RESET_ERROR + ) +) + +CALL :LOG_MESSAGE DEBUG "Checking esptool command !ESPTOOL_CMD!..." +!ESPTOOL_CMD! >nul 2>&1 +IF %ERRORLEVEL% GTR 2 ( + @REM esptool exits with code 1 if help is displayed. + CALL :LOG_MESSAGE ERROR "esptool not found: !ESPTOOL_CMD!" + EXIT /B 1 + GOTO eof +) +IF %DEBUG% EQU 1 ( + CALL :LOG_MESSAGE DEBUG "Skipping ESPTOOL_CMD steps." + SET "ESPTOOL_CMD=REM !ESPTOOL_CMD!" +) + +CALL :LOG_MESSAGE DEBUG "Using esptool command: !ESPTOOL_CMD!" +IF "__!ESPTOOL_PORT!__" == "____" ( + CALL :LOG_MESSAGE WARN "Using esptool port: UNSET." +) ELSE ( + CALL :LOG_MESSAGE INFO "Using esptool port: !ESPTOOL_PORT!." +) +CALL :LOG_MESSAGE INFO "Using esptool baud: !ESPTOOL_BAUD!." + +@REM Check if FILENAME contains "-tft-" and set target partitionScheme accordingly. +@REM https://github.com/meshtastic/web-flasher/blob/main/types/resources.ts#L3 +IF NOT "!FILENAME:-tft-=!"=="!FILENAME!" ( + CALL :LOG_MESSAGE DEBUG "We are working with a *-tft-* file. !FILENAME!" + IF %WEB_APP% EQU 1 ( + CALL :LOG_MESSAGE ERROR "Cannot enable WebUI (--web) and MUI." & GOTO eof + ) + SET "TFT_BUILD=1" + GOTO tft +) ELSE ( + CALL :LOG_MESSAGE DEBUG "We are NOT working with a *-tft-* file. !FILENAME!" + GOTO no_tft +) + +:tft +SET "TFT8MB=picomputer-s3 unphone seeed-sensecap-indicator" +FOR %%a IN (%TFT8MB%) DO ( + IF NOT "!FILENAME:%%a=!"=="!FILENAME!" ( + @REM We are working with any of %TFT8MB%. + SET "TFT8=1" + GOTO end_loop_tft8mb + ) +) +:end_loop_tft8mb + +SET "TFT16MB=t-deck" +FOR %%a IN (%TFT16MB%) DO ( + IF NOT "!FILENAME:%%a=!"=="!FILENAME!" ( + @REM We are working with any of %TFT16MB%. + SET "TFT16=1" + GOTO end_loop_tft16mb + ) +) +:end_loop_tft16mb + +IF %TFT8% EQU 1 CALL :LOG_MESSAGE INFO "tft and MUI 8mb selected." +IF %TFT16% EQU 1 CALL :LOG_MESSAGE INFO "tft and MUI 16mb selected." + +:no_tft + +@REM Extract BASENAME from %FILENAME% for later use. +SET "BASENAME=!FILENAME:firmware-=!" +CALL :LOG_MESSAGE DEBUG "Computed firmware basename: !BASENAME!" + +@REM Account for S3 and C3 board's different OTA partition. +SET "S3=s3 v3 t-deck wireless-paper wireless-tracker station-g2 unphone" +FOR %%a IN (%S3%) DO ( + IF NOT "!FILENAME:%%a=!"=="!FILENAME!" ( + @REM We are working with any of %S3%. + SET "OTA_FILENAME=bleota-s3.bin" + GOTO :end_loop_s3 + ) +) + +SET "C3=esp32c3" +FOR %%a IN (%C3%) DO ( + IF NOT "!FILENAME:%%a=!"=="!FILENAME!" ( + @REM We are working with any of %C3%. + SET "OTA_FILENAME=bleota-c3.bin" + GOTO :end_loop_c3 + ) +) + +@REM Everything else +SET "OTA_FILENAME=bleota.bin" +:end_loop_s3 +:end_loop_c3 +CALL :LOG_MESSAGE DEBUG "Set OTA_FILENAME to: !OTA_FILENAME!" + +@REM Check if (--web) is enabled and prefix BASENAME with "littlefswebui-" else "littlefs-". +IF %WEB_APP% EQU 1 ( + CALL :LOG_MESSAGE INFO "WebUI selected." + SET "SPIFFS_FILENAME=littlefswebui-%BASENAME%" +) ELSE ( + SET "SPIFFS_FILENAME=littlefs-%BASENAME%" +) +CALL :LOG_MESSAGE DEBUG "Set SPIFFS_FILENAME to: !SPIFFS_FILENAME!" + +@REM Default offsets. +@REM https://github.com/meshtastic/web-flasher/blob/main/stores/firmwareStore.ts#L202 +SET "OTA_OFFSET=0x260000" +SET "SPIFFS_OFFSET=0x300000" + +@REM Offsets for MUI 8mb. +IF %TFT8% EQU 1 IF %TFT_BUILD% EQU 1 ( + SET "OTA_OFFSET=0x340000" + SET "SPIFFS_OFFSET=0x670000" +) + +@REM Offsets for MUI 16mb. +IF %TFT16% EQU 1 IF %TFT_BUILD% EQU 1 ( + SET "OTA_OFFSET=0x650000" + SET "SPIFFS_OFFSET=0xc90000" +) + +CALL :LOG_MESSAGE DEBUG "Set OTA_OFFSET to: !OTA_OFFSET!" +CALL :LOG_MESSAGE DEBUG "Set SPIFFS_OFFSET to: !SPIFFS_OFFSET!" + +@REM Ensure target files exist before flashing operations. +IF NOT EXIST !FILENAME! CALL :LOG_MESSAGE ERROR "File does not exist: "!FILENAME!". Terminating." & EXIT /B 2 & GOTO eof +IF NOT EXIST !OTA_FILENAME! CALL :LOG_MESSAGE ERROR "File does not exist: "!OTA_FILENAME!". Terminating." & EXIT /B 2 & GOTO eof +IF NOT EXIST !SPIFFS_FILENAME! CALL :LOG_MESSAGE ERROR "File does not exist: "!SPIFFS_FILENAME!". Terminating." & EXIT /B 2 & GOTO eof + +@REM Flashing operations. +CALL :LOG_MESSAGE INFO "Trying to flash "!FILENAME!", but first erasing and writing system information..." +CALL :RUN_ESPTOOL !ESPTOOL_BAUD! erase_flash || GOTO eof +CALL :RUN_ESPTOOL !ESPTOOL_BAUD! write_flash 0x00 "!FILENAME!" || GOTO eof + +CALL :LOG_MESSAGE INFO "Trying to flash BLEOTA "!OTA_FILENAME!" at OTA_OFFSET !OTA_OFFSET!..." +CALL :RUN_ESPTOOL !ESPTOOL_BAUD! write_flash !OTA_OFFSET! "!OTA_FILENAME!" || GOTO eof + +CALL :LOG_MESSAGE INFO "Trying to flash SPIFFS "!SPIFFS_FILENAME!" at SPIFFS_OFFSET !SPIFFS_OFFSET!..." +CALL :RUN_ESPTOOL !ESPTOOL_BAUD! write_flash !SPIFFS_OFFSET! "!SPIFFS_FILENAME!" || GOTO eof + +CALL :LOG_MESSAGE INFO "Script complete!." + +:eof +ENDLOCAL +EXIT /B %ERRORLEVEL% + + +:RUN_ESPTOOL +@REM Subroutine used to run ESPTOOL_CMD with arguments. +@REM Also handles %ERRORLEVEL%. +@REM CALL :RUN_ESPTOOL [Baud] [erase_flash|write_flash] [OFFSET] [Filename] +@REM. +@REM Example:: CALL :RUN_ESPTOOL 115200 write_flash 0x10000 "firmwarefile.bin" +IF %DEBUG% EQU 1 CALL :LOG_MESSAGE DEBUG "About to run command: !ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4" +CALL :RESET_ERROR +!ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4 +IF %ERRORLEVEL% NEQ 0 ( + CALL :LOG_MESSAGE ERROR "Error running command: !ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4" + EXIT /B %ERRORLEVEL% +) +GOTO :eof + +:LOG_MESSAGE +@REM Subroutine used to print log messages in four different levels. +@REM DEBUG messages only get printed if [-d] flag is passed to script. +@REM CALL :LOG_MESSAGE [ERROR|INFO|WARN|DEBUG] "Message" +@REM. +@REM Example:: CALL :LOG_MESSAGE INFO "Message." +SET /A LOGCOUNTER=LOGCOUNTER+1 +IF "%1" == "ERROR" CALL :GET_TIMESTAMP & ECHO %1 ^| !TIMESTAMP! !LOGCOUNTER! %~2 +IF "%1" == "INFO" CALL :GET_TIMESTAMP & ECHO %1 ^| !TIMESTAMP! !LOGCOUNTER! %~2 +IF "%1" == "WARN" CALL :GET_TIMESTAMP & ECHO %1 ^| !TIMESTAMP! !LOGCOUNTER! %~2 +IF "%1" == "DEBUG" IF %DEBUG% EQU 1 CALL :GET_TIMESTAMP & ECHO %1 ^| !TIMESTAMP! !LOGCOUNTER! %~2 +GOTO :eof + +:GET_TIMESTAMP +@REM Subroutine used to set !TIMESTAMP! to HH:MM:ss. +@REM CALL :GET_TIMESTAMP +@REM. +@REM Updates: !TIMESTAMP! +FOR /F "tokens=1,2,3 delims=:,." %%a IN ("%TIME%") DO ( + SET "HH=%%a" + SET "MM=%%b" + SET "ss=%%c" +) +SET "TIMESTAMP=!HH!:!MM!:!ss!" +GOTO :eof + +:RESET_ERROR +@REM Subroutine to reset %ERRORLEVEL% to 0. +@REM CALL :RESET_ERROR +@REM. +@REM Updates: %ERRORLEVEL% +EXIT /B 0 +GOTO :eof diff --git a/bin/device-install.sh b/bin/device-install.sh index 96a204a5a..c1ba33c4a 100755 --- a/bin/device-install.sh +++ b/bin/device-install.sh @@ -8,158 +8,152 @@ TFT_BUILD=false # Determine the correct esptool command to use if "$PYTHON" -m esptool version >/dev/null 2>&1; then - ESPTOOL_CMD="$PYTHON -m esptool" + ESPTOOL_CMD="$PYTHON -m esptool" elif command -v esptool >/dev/null 2>&1; then - ESPTOOL_CMD="esptool" + ESPTOOL_CMD="esptool" elif command -v esptool.py >/dev/null 2>&1; then - ESPTOOL_CMD="esptool.py" + ESPTOOL_CMD="esptool.py" else - echo "Error: esptool not found" - exit 1 + echo "Error: esptool not found" + exit 1 fi set -e # Usage info show_help() { - cat <&2 - exit 1 - ;; - esac - shift # Move to the next argument + case "$1" in + -h | --help) + show_help + exit 0 + ;; + -p) + ESPTOOL_PORT="$2" + shift # Shift past the option argument + ;; + -P) + PYTHON="$2" + shift + ;; + -f) + FILENAME="$2" + shift + ;; + --web) + WEB_APP=true + ;; + --) # Stop parsing options + shift + break + ;; + *) + echo "Unknown argument: $1" >&2 + exit 1 + ;; + esac + shift # Move to the next argument done [ -z "$FILENAME" -a -n "$1" ] && { - FILENAME=$1 - shift + FILENAME=$1 + shift } -# Check if FILENAME contains "-tft-" and either TFT8 or TFT16 is 1 (--tft, -tft-16mb) -if [[ "${FILENAME//-tft-/}" != "$FILENAME" ]]; then - TFT_BUILD=true - if [[ "$TFT8" != true && "$TFT16" != true ]]; then - echo "Error: Either --tft or --tft-16mb must be set to use a TFT build." - exit 1 - fi - if [[ "$TFT8" == true && "$TFT16" == true ]]; then - echo "Error: Both --tft and --tft-16mb must NOT be set at the same time." - exit 1 - fi +# Check if FILENAME contains "-tft-" and set target partitionScheme accordingly. +if [[ ${FILENAME//-tft-/} != "$FILENAME" ]]; then + TFT_BUILD=true + if [[ $WEB_APP == true ]] && [[ $TFT_BUILD == true ]]; then + echo "Cannot enable WebUI (--web) and MUI." + exit 1 + fi + + if [[ $FILENAME == *"picomputer-s3"* || $FILENAME == *"unphone"* || $FILENAME == *"seeed-sensecap-indicator"* ]]; then + TFT8=true + fi + + if [[ $FILENAME == *"t-deck"* ]]; then + TFT16=true + fi fi # Extract BASENAME from %FILENAME% for later use. BASENAME="${FILENAME/firmware-/}" if [ -f "${FILENAME}" ] && [ -n "${FILENAME##*"update"*}" ]; then - # Default littlefs* offset (--web). - OFFSET=0x300000 + # Default littlefs* offset (--web). + OFFSET=0x300000 - # Default OTA Offset - OTA_OFFSET=0x260000 + # Default OTA Offset + OTA_OFFSET=0x260000 - # littlefs* offset for MUI 8mb (--tft) and OTA OFFSET. - if [ "$TFT8" = true ]; then - if [ "$TFT_BUILD" = true ]; then - OFFSET=0x670000 - OTA_OFFSET=0x340000 - else - echo "Ignoring --tft, not a TFT Build." - fi - fi + # littlefs* offset for MUI 8mb and OTA OFFSET. + if [ "$TFT8" = true ] && [ "$TFT_BUILD" = true ]; then + OFFSET=0x670000 + OTA_OFFSET=0x340000 + fi - # littlefs* offset for MUI 16mb (--tft-16mb) and OTA OFFSET. - if [ "$TFT16" = true ]; then - if [ "$TFT_BUILD" = true ]; then - OFFSET=0xc90000 - OTA_OFFSET=0x650000 - else - echo "Ignoring --tft-16mb, not a TFT Build." - fi - fi + # littlefs* offset for MUI 16mb and OTA OFFSET. + if [ "$TFT16" = true ] && [ "$TFT_BUILD" = true ]; then + OFFSET=0xc90000 + OTA_OFFSET=0x650000 + fi - echo "Trying to flash ${FILENAME}, but first erasing and writing system information" - $ESPTOOL_CMD erase_flash - $ESPTOOL_CMD write_flash 0x00 "${FILENAME}" - # Account for S3 board's different OTA partition - if [ -n "${FILENAME##*"s3"*}" ] && [ -n "${FILENAME##*"-v3"*}" ] && [ -n "${FILENAME##*"t-deck"*}" ] && [ -n "${FILENAME##*"wireless-paper"*}" ] && [ -n "${FILENAME##*"wireless-tracker"*}" ] && [ -n "${FILENAME##*"station-g2"*}" ] && [ -n "${FILENAME##*"unphone"*}" ]; then - if [ -n "${FILENAME##*"esp32c3"*}" ]; then - $ESPTOOL_CMD write_flash $OTA_OFFSET bleota.bin - else - $ESPTOOL_CMD write_flash $OTA_OFFSET bleota-c3.bin - fi - else - $ESPTOOL_CMD write_flash $OTA_OFFSET bleota-s3.bin - fi + # Account for S3 board's different OTA partition + if [ -n "${FILENAME##*"s3"*}" ] && [ -n "${FILENAME##*"-v3"*}" ] && [ -n "${FILENAME##*"t-deck"*}" ] && [ -n "${FILENAME##*"wireless-paper"*}" ] && [ -n "${FILENAME##*"wireless-tracker"*}" ] && [ -n "${FILENAME##*"station-g2"*}" ] && [ -n "${FILENAME##*"unphone"*}" ]; then + if [ -n "${FILENAME##*"esp32c3"*}" ]; then + OTAFILE=bleota.bin + else + OTAFILE=bleota-c3.bin + fi + else + OTAFILE=bleota-s3.bin + fi - # Check if WEB_APP (--web) is enabled and add "littlefswebui-" to BASENAME else "littlefs-". - if [ "$WEB_APP" = true ]; then - # Check it the file exist before trying to write it. - if [ -f "littlefswebui-${BASENAME}" ]; then - $ESPTOOL_CMD write_flash $OFFSET "littlefswebui-${BASENAME}" - else - echo "Error: file "littlefswebui-${BASENAME}" wasn't found, littlefs not written." - exit 1 - fi - else - # Check it the file exist before trying to write it. - if [ -f "littlefs-${BASENAME}" ]; then - $ESPTOOL_CMD write_flash $OFFSET "littlefs-${BASENAME}" - else - echo "Error: file "littlefs-${BASENAME}" wasn't found, littlefs not written." - exit 1 - fi - fi + # Check if WEB_APP (--web) is enabled and add "littlefswebui-" to BASENAME else "littlefs-". + if [ "$WEB_APP" = true ]; then + SPIFFSFILE=littlefswebui-${BASENAME} + else + SPIFFSFILE=littlefs-${BASENAME} + fi + + if [[ ! -f $FILENAME ]]; then + echo "Error: file ${FILENAME} wasn't found. Terminating." + exit 1 + fi + if [[ ! -f $OTAFILE ]]; then + echo "Error: file ${OTAFILE} wasn't found. Terminating." + exit 1 + fi + if [[ ! -f $SPIFFSFILE ]]; then + echo "Error: file ${SPIFFSFILE} wasn't found. Terminating." + exit 1 + fi + + echo "Trying to flash ${FILENAME}, but first erasing and writing system information" + $ESPTOOL_CMD erase_flash + $ESPTOOL_CMD write_flash 0x00 "${FILENAME}" + echo "Trying to flash ${OTAFILE} at offset ${OTA_OFFSET}" + $ESPTOOL_CMD write_flash $OTA_OFFSET "${OTAFILE}" + echo "Trying to flash ${SPIFFSFILE}, at offset ${OFFSET}" + $ESPTOOL_CMD write_flash $OFFSET "${SPIFFSFILE}" else - show_help - echo "Invalid file: ${FILENAME}" + show_help + echo "Invalid file: ${FILENAME}" fi exit 0 diff --git a/bin/device-install_test.ps1 b/bin/device-install_test.ps1 new file mode 100644 index 000000000..d7d3e6178 --- /dev/null +++ b/bin/device-install_test.ps1 @@ -0,0 +1,111 @@ +<# + .SYNOPSIS + Unit-test for .\device-install.bat. + + .DESCRIPTION + This script performs a positive unit-test on .\device-install.bat by creating the expected .bin + files for a device followed by running the .bat script without flashing the firmware (--debug). + If any errors are hit they are presented in the standard output. Investigate accordingly. + + This script needs to be placed in the same directory as .\device-install.bat. + + .EXAMPLE + .\device-install_test.ps1 + + .EXAMPLE + .\device-install_test.ps1 -Verbose + + .LINK + .\device-install.bat --help +#> + +[CmdletBinding()] +param() + +function New-EmptyFile() { + [CmdletBinding()] + param ( + [Parameter(Position=0,Mandatory=$true)] + # Specifies the file name. + [string]$FileName, + [Parameter(Position=1)] + # Specifies the target path. (Get-Location).Path is the default. + [string]$Directory = (Get-Location).Path + ) + + $filePath = Join-Path -Path $Directory -ChildPath $FileName + + Write-Verbose -Message "Create empty test file if it doesn't exist: $($FileName)" + New-Item -Path "$filePath" -ItemType File -ErrorAction SilentlyContinue | Out-Null +} + +function Remove-EmptyFile() { + [CmdletBinding()] + param ( + [Parameter(Position=0,Mandatory=$true)] + # Specifies the file name. + [string]$FileName, + [Parameter(Position=1)] + # Specifies the target path. (Get-Location).Path is the default. + [string]$Directory = (Get-Location).Path + ) + + $filePath = Join-Path -Path $Directory -ChildPath $FileName + + Write-Verbose -Message "Deleted empty test file: $($FileName)" + Remove-Item -Path "$filePath" | Out-Null +} + + +$TestCases = New-Object -TypeName PSObject -Property @{ + # Use this PSObject to define testcases according to this syntax: + # "testname" = @("firmware-testname","bleota","littlefs-testname","args") + "t-deck" = @("firmware-t-deck-2.6.0.0b106d4.bin", "bleota-s3.bin", "littlefs-t-deck-2.6.0.0b106d4.bin","") + "t-deck_web" = @("firmware-t-deck-2.6.0.0b106d4.bin", "bleota-s3.bin", "littlefswebui-t-deck-2.6.0.0b106d4.bin","--web") + "t-deck-tft" = @("firmware-t-deck-tft-2.6.0.0b106d4.bin", "bleota-s3.bin", "littlefs-t-deck-tft-2.6.0.0b106d4.bin","") + "heltec-ht62-esp32c3" = @("firmware-heltec-ht62-esp32c3-sx1262-2.6.0.0b106d4.bin", "bleota-c3.bin", "littlefs-heltec-ht62-esp32c3-sx1262-2.6.0.0b106d4.bin","") + "tlora-c6" = @("firmware-tlora-c6-2.6.0.0b106d4.bin", "bleota.bin", "littlefs-tlora-c6-2.6.0.0b106d4.bin","") + "heltec-v3_web" = @("firmware-heltec-v3-2.6.0.0b106d4.bin", "bleota-s3.bin", "littlefswebui-heltec-v3-2.6.0.0b106d4.bin","--web") + "seeed-sensecap-indicator-tft" = @("firmware-seeed-sensecap-indicator-tft-2.6.0.0b106d4.bin", "bleota.bin", "littlefs-seeed-sensecap-indicator-tft-2.6.0.0b106d4.bin","") + "picomputer-s3-tft" = @("firmware-picomputer-s3-tft-2.6.0.0b106d4.bin", "bleota-s3.bin", "littlefs-picomputer-s3-tft-2.6.0.0b106d4.bin","") +} + +foreach ($TestCase in $TestCases.PSObject.Properties) { + $Name = $TestCase.Name + $Files = $TestCase.Value + $Errors = $null + $Counter = 0 + + Write-Host -Object "Testcase: $Name`:" -ForegroundColor Green + foreach ($File in $Files) { + if ($File.EndsWith(".bin")) { + New-EmptyFile -FileName $File + } + } + + Write-Host -Object "Performing test on $Name..." -ForegroundColor Blue + $Test = Invoke-Expression -Command "cmd /c .\device-install.bat --debug -f $($TestCases."$Name"[0]) $($TestCases."$Name"[3])" + + foreach ($Line in $Test) { + if ($Line -match "Set OTA_OFFSET to" -or ` + $Line -match "Set SPIFFS_OFFSET to") { + Write-Host -Object "$($Line -replace "^.*?Set","Set")" -ForegroundColor Blue + } elseif ($VerbosePreference -eq "Continue") { + Write-Host -Object $Line + } + if ($Line -match "ERROR") { + $Errors += $Line + $Counter++ + } + } + if ($null -ne $Errors) { + Write-Host -Object "$Counter ERROR(s) detected!" -ForegroundColor Red + if (-not ($VerbosePreference -eq "Continue")) {Write-Host -Object $Errors} + } + + foreach ($File in $Files) { + if ($File.EndsWith(".bin")) { + Remove-EmptyFile -FileName $File + } + } +} diff --git a/bin/device-update.bat b/bin/device-update.bat index a52f3d33f..ecfeec187 100755 --- a/bin/device-update.bat +++ b/bin/device-update.bat @@ -1,48 +1,175 @@ @ECHO OFF +SETLOCAL EnableDelayedExpansion +TITLE Meshtastic device-update -set PYTHON=python +SET "SCRIPT_NAME=%~nx0" +SET "DEBUG=0" +SET "PYTHON=" +SET "ESPTOOL_BAUD=115200" +SET "ESPTOOL_CMD=" +SET "LOGCOUNTER=0" -:: Determine the correct esptool command to use -where esptool >nul 2>&1 -if %ERRORLEVEL% EQU 0 ( - set "ESPTOOL_CMD=esptool" -) else ( - set "ESPTOOL_CMD=%PYTHON% -m esptool" -) +GOTO getopts +:help +ECHO Flash image file to device, but leave existing system intact. +ECHO. +ECHO Usage: %SCRIPT_NAME% -f filename [-p PORT] [-P python] +ECHO. +ECHO Options: +ECHO -f filename The .bin file to flash. Custom to your device type and region. (required) +ECHO The file must be located in this current directory. +ECHO -p PORT Set the environment variable for ESPTOOL_PORT. +ECHO If not set, ESPTOOL iterates all ports (Dangerous). +ECHO -P python Specify alternate python interpreter to use to invoke esptool. (default: python) +ECHO If supplied the script will use python. +ECHO If not supplied the script will try to find esptool in Path. +ECHO. +ECHO Example: %SCRIPT_NAME% -f firmware-t-deck-tft-2.6.0.0b106d4-update.bin -p COM11 +GOTO eof -goto GETOPTS -:HELP -echo Usage: %~nx0 [-h] [-p ESPTOOL_PORT] [-P PYTHON] [-f FILENAME^|FILENAME] -echo Flash image file to device, leave existing system intact. -echo. -echo -h Display this help and exit -echo -p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerrous). -echo -P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: %PYTHON%) -echo -f FILENAME The *update.bin file to flash. Custom to your device type. -goto EOF +:version +ECHO %SCRIPT_NAME% [Version 2.6.0] +ECHO Meshtastic +GOTO eof -:GETOPTS -if /I "%1"=="-h" goto HELP -if /I "%1"=="--help" goto HELP -if /I "%1"=="-F" set "FILENAME=%2" & SHIFT -if /I "%1"=="-p" set ESPTOOL_PORT=%2 & SHIFT -if /I "%1"=="-P" set PYTHON=%2 & SHIFT +:getopts +IF "%~1"=="" GOTO endopts +IF /I "%~1"=="-?" GOTO help +IF /I "%~1"=="-h" GOTO help +IF /I "%~1"=="--help" GOTO help +IF /I "%~1"=="-v" GOTO version +IF /I "%~1"=="--version" GOTO version +IF /I "%~1"=="--debug" SET "DEBUG=1" & CALL :LOG_MESSAGE DEBUG "DEBUG mode: enabled." +IF /I "%~1"=="-f" SET "FILENAME=%~2" & SHIFT +IF "%~1"=="-p" SET "ESPTOOL_PORT=%~2" & SHIFT +IF /I "%~1"=="--port" SET "ESPTOOL_PORT=%~2" & SHIFT +IF "%~1"=="-P" SET "PYTHON=%~2" & SHIFT SHIFT -IF NOT "__%1__"=="____" goto GETOPTS +GOTO getopts +:endopts -IF "__%FILENAME%__" == "____" ( - echo "Missing FILENAME" - goto HELP -) -IF EXIST %FILENAME% IF NOT x%FILENAME:update=%==x%FILENAME% ( - echo Trying to flash update %FILENAME% - %ESPTOOL_CMD% --baud 115200 write_flash 0x10000 %FILENAME% -) else ( - echo "Invalid file: %FILENAME%" - goto HELP -) else ( - echo "Invalid file: %FILENAME%" - goto HELP +CALL :LOG_MESSAGE DEBUG "Checking FILENAME parameter..." +IF "__!FILENAME!__"=="____" ( + CALL :LOG_MESSAGE DEBUG "Missing -f filename input." + GOTO help +) ELSE ( + IF NOT "__!FILENAME: =!__"=="__!FILENAME!__" ( + CALL :LOG_MESSAGE ERROR "Filename containing spaces are not supported." + GOTO help + ) + @REM Remove ".\" or "./" file prefix if present. + SET "FILENAME=!FILENAME:.\=!" + SET "FILENAME=!FILENAME:./=!" ) -:EOF +CALL :LOG_MESSAGE DEBUG "Filename: !FILENAME!" +CALL :LOG_MESSAGE DEBUG "Checking if !FILENAME! exists..." +IF NOT EXIST !FILENAME! ( + CALL :LOG_MESSAGE ERROR "File does not exist: !FILENAME!. Terminating." + GOTO eof +) + +IF "!FILENAME:update=!"=="!FILENAME!" ( + CALL :LOG_MESSAGE DEBUG "We are NOT working with a *update* file. !FILENAME!" + CALL :LOG_MESSAGE INFO "Use script device-install.bat to flash update !FILENAME!." + GOTO eof +) ELSE ( + CALL :LOG_MESSAGE DEBUG "We are working with a *update* file. !FILENAME!" +) + +CALL :LOG_MESSAGE DEBUG "Determine the correct esptool command to use..." +IF NOT "__%PYTHON%__"=="____" ( + SET "ESPTOOL_CMD=!PYTHON! -m esptool" + CALL :LOG_MESSAGE DEBUG "Python interpreter supplied." +) ELSE ( + CALL :LOG_MESSAGE DEBUG "Python interpreter NOT supplied. Looking for esptool... + WHERE esptool >nul 2>&1 + IF %ERRORLEVEL% EQU 0 ( + @REM WHERE exits with code 0 if esptool is found. + SET "ESPTOOL_CMD=esptool" + ) ELSE ( + SET "ESPTOOL_CMD=python -m esptool" + CALL :RESET_ERROR + ) +) + +CALL :LOG_MESSAGE DEBUG "Checking esptool command !ESPTOOL_CMD!..." +!ESPTOOL_CMD! >nul 2>&1 +IF %ERRORLEVEL% GTR 2 ( + @REM esptool exits with code 1 if help is displayed. + CALL :LOG_MESSAGE ERROR "esptool not found: !ESPTOOL_CMD!" + EXIT /B 1 + GOTO eof +) +IF %DEBUG% EQU 1 ( + CALL :LOG_MESSAGE DEBUG "Skipping ESPTOOL_CMD steps." + SET "ESPTOOL_CMD=REM !ESPTOOL_CMD!" +) + +CALL :LOG_MESSAGE DEBUG "Using esptool command: !ESPTOOL_CMD!" +IF "__!ESPTOOL_PORT!__" == "____" ( + CALL :LOG_MESSAGE WARN "Using esptool port: UNSET." +) ELSE ( + CALL :LOG_MESSAGE INFO "Using esptool port: !ESPTOOL_PORT!." +) +CALL :LOG_MESSAGE INFO "Using esptool baud: !ESPTOOL_BAUD!." + +@REM Flashing operations. +CALL :LOG_MESSAGE INFO "Trying to flash update "!FILENAME!" at OFFSET 0x10000..." +CALL :RUN_ESPTOOL !ESPTOOL_BAUD! write_flash 0x10000 "!FILENAME!" || GOTO eof + +CALL :LOG_MESSAGE INFO "Script complete!." + +:eof +ENDLOCAL +EXIT /B %ERRORLEVEL% + + +:RUN_ESPTOOL +@REM Subroutine used to run ESPTOOL_CMD with arguments. +@REM Also handles %ERRORLEVEL%. +@REM CALL :RUN_ESPTOOL [Baud] [erase_flash|write_flash] [OFFSET] [Filename] +@REM. +@REM Example:: CALL :RUN_ESPTOOL 115200 write_flash 0x10000 "firmwarefile.bin" +IF %DEBUG% EQU 1 CALL :LOG_MESSAGE DEBUG "About to run command: !ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4" +CALL :RESET_ERROR +!ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4 +IF %ERRORLEVEL% NEQ 0 ( + CALL :LOG_MESSAGE ERROR "Error running command: !ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4" + EXIT /B %ERRORLEVEL% +) +GOTO :eof + +:LOG_MESSAGE +@REM Subroutine used to print log messages in four different levels. +@REM DEBUG messages only get printed if [-d] flag is passed to script. +@REM CALL :LOG_MESSAGE [ERROR|INFO|WARN|DEBUG] "Message" +@REM. +@REM Example:: CALL :LOG_MESSAGE INFO "Message." +SET /A LOGCOUNTER=LOGCOUNTER+1 +IF "%1" == "ERROR" CALL :GET_TIMESTAMP & ECHO %1 ^| !TIMESTAMP! !LOGCOUNTER! %~2 +IF "%1" == "INFO" CALL :GET_TIMESTAMP & ECHO %1 ^| !TIMESTAMP! !LOGCOUNTER! %~2 +IF "%1" == "WARN" CALL :GET_TIMESTAMP & ECHO %1 ^| !TIMESTAMP! !LOGCOUNTER! %~2 +IF "%1" == "DEBUG" IF %DEBUG% EQU 1 CALL :GET_TIMESTAMP & ECHO %1 ^| !TIMESTAMP! !LOGCOUNTER! %~2 +GOTO :eof + +:GET_TIMESTAMP +@REM Subroutine used to set !TIMESTAMP! to HH:MM:ss. +@REM CALL :GET_TIMESTAMP +@REM. +@REM Updates: !TIMESTAMP! +FOR /F "tokens=1,2,3 delims=:,." %%a IN ("%TIME%") DO ( + SET "HH=%%a" + SET "MM=%%b" + SET "ss=%%c" +) +SET "TIMESTAMP=!HH!:!MM!:!ss!" +GOTO :eof + +:RESET_ERROR +@REM Subroutine to reset %ERRORLEVEL% to 0. +@REM CALL :RESET_ERROR +@REM. +@REM Updates: %ERRORLEVEL% +EXIT /B 0 +GOTO :eof diff --git a/bin/regen-protos.bat b/bin/regen-protos.bat index 7fa8f333d..0bbfbe38a 100644 --- a/bin/regen-protos.bat +++ b/bin/regen-protos.bat @@ -1 +1,10 @@ -cd protobufs && ..\nanopb-0.4.9\generator-bin\protoc.exe --experimental_allow_proto3_optional "--nanopb_out=-S.cpp -v:..\src\mesh\generated" -I=..\protobufs\ ..\protobufs\meshtastic\*.proto +@ECHO OFF +SETLOCAL + +cd protobufs +..\nanopb-0.4.9\generator-bin\protoc.exe --experimental_allow_proto3_optional "--nanopb_out=-S.cpp -v:..\src\mesh\generated" -I=..\protobufs\ ..\protobufs\meshtastic\*.proto +GOTO eof + +:eof +ENDLOCAL +EXIT /B %ERRORLEVEL% diff --git a/bin/uf2-convert.bat b/bin/uf2-convert.bat index 242bec3ab..5e36617e3 100644 --- a/bin/uf2-convert.bat +++ b/bin/uf2-convert.bat @@ -1,2 +1,124 @@ -@echo off -if [%1]==[] (echo "Please specify a platformio NRF target (i.e. rak4631) as the first argument.") else (python3 .\bin\uf2conv.py .\.pio\build\%1\firmware.hex -c -o .\.pio\build\%1\firmware.uf2 -f 0xADA52840) \ No newline at end of file +@ECHO OFF +SETLOCAL EnableDelayedExpansion +TITLE Meshtastic uf2-convert + +SET "SCRIPT_NAME=%~nx0" +SET "DEBUG=0" +SET "NRF=0" +SET "UF2CONV_CMD=python3 .\bin\uf2conv.py" + +GOTO getopts +:help +ECHO. +ECHO Usage: %SCRIPT_NAME% -t [t-echo^|rak4631^|nano-g2-ultra^|wio-tracker-wm1110^|canaryone^| +ECHO heltec-mesh-node-t114^|tracker-t1000-e^|rak_wismeshtap^|rak2560^| +ECHO nrf52_promicro_diy_tcxo] +ECHO. +ECHO Options: +ECHO -t target Specify a platformio NRF target to build for. (required) +ECHO. +ECHO Example: %SCRIPT_NAME% -t rak4631 +GOTO eof + +:version +ECHO %SCRIPT_NAME% [Version 2.6.0] +ECHO Meshtastic +GOTO eof + +:getopts +IF "%~1"=="" GOTO endopts +IF /I "%~1"=="-?" GOTO help +IF /I "%~1"=="-h" GOTO help +IF /I "%~1"=="--help" GOTO help +IF /I "%~1"=="-v" GOTO version +IF /I "%~1"=="--version" GOTO version +IF /I "%~1"=="--debug" SET "DEBUG=1" & CALL :LOG_MESSAGE DEBUG "DEBUG mode: enabled." +IF /I "%~1"=="-t" SET "TARGETNAME=%~2" & SHIFT +IF /I "%~1"=="--target" SET "TARGETNAME=%~2" & SHIFT +SHIFT +GOTO getopts +:endopts + +CALL :LOG_MESSAGE DEBUG "Checking TARGETNAME parameter..." +IF "__!TARGETNAME!__"=="____" ( + CALL :LOG_MESSAGE DEBUG "Missing -t target input." + GOTO help +) + +IF %DEBUG% EQU 1 SET "UF2CONV_CMD=REM python3 .\bin\uf2conv.py" + +SET "NRFTARGETS=t-echo rak4631 nano-g2-ultra wio-tracker-wm1110 canaryone heltec-mesh-node-t114 tracker-t1000-e rak_wismeshtap rak2560 nrf52_promicro_diy_tcxo" +FOR %%a IN (%NRFTARGETS%) DO ( + IF /I "%%a"=="!TARGETNAME!" ( + @REM We are working with any of %NRFTARGETS%. + SET "NRF=1" + GOTO end_loop_nrf + ) +) +:end_loop_nrf + +@REM Building operations. +IF !NRF! EQU 1 ( + CALL :LOG_MESSAGE INFO "Trying to build for !TARGETNAME!..." + CALL :RUN_UF2CONV !TARGETNAME! || GOTO eof +) ELSE ( + CALL :LOG_MESSAGE WARN "!TARGETNAME! is not supported..." + GOTO eof +) + +CALL :LOG_MESSAGE INFO "Script complete!." + + +:eof +ENDLOCAL +EXIT /B %ERRORLEVEL% + + +:RUN_UF2CONV +@REM Subroutine used to run .\bin\uf2conv.py with arguments. +@REM Also handles %ERRORLEVEL%. +@REM CALL :RUN_UF2CONV [target] +@REM. +@REM Example:: CALL :RUN_UF2CONV rak4631 +IF %DEBUG% EQU 1 CALL :LOG_MESSAGE DEBUG "About to run command: !UF2CONV_CMD! .\.pio\build\%~1\firmware.hex -c -o .\.pio\build\%~1\firmware.uf2 -f 0xADA52840" +CALL :RESET_ERROR +!UF2CONV_CMD! .\.pio\build\%~1\firmware.hex -c -o .\.pio\build\%~1\firmware.uf2 -f 0xADA52840 +IF %ERRORLEVEL% NEQ 0 ( + CALL :LOG_MESSAGE ERROR "Error running command: !UF2CONV_CMD! .\.pio\build\%~1\firmware.hex -c -o .\.pio\build\%~1\firmware.uf2 -f 0xADA52840" + EXIT /B %ERRORLEVEL% +) +GOTO :eof + +:LOG_MESSAGE +@REM Subroutine used to print log messages in four different levels. +@REM DEBUG messages only get printed if [-d] flag is passed to script. +@REM CALL :LOG_MESSAGE [ERROR|INFO|WARN|DEBUG] "Message" +@REM. +@REM Example:: CALL :LOG_MESSAGE INFO "Message." +SET /A LOGCOUNTER=LOGCOUNTER+1 +IF "%1" == "ERROR" CALL :GET_TIMESTAMP & ECHO %1 ^| !TIMESTAMP! !LOGCOUNTER! %~2 +IF "%1" == "INFO" CALL :GET_TIMESTAMP & ECHO %1 ^| !TIMESTAMP! !LOGCOUNTER! %~2 +IF "%1" == "WARN" CALL :GET_TIMESTAMP & ECHO %1 ^| !TIMESTAMP! !LOGCOUNTER! %~2 +IF "%1" == "DEBUG" IF %DEBUG% EQU 1 CALL :GET_TIMESTAMP & ECHO %1 ^| !TIMESTAMP! !LOGCOUNTER! %~2 +GOTO :eof + +:GET_TIMESTAMP +@REM Subroutine used to set !TIMESTAMP! to HH:MM:ss. +@REM CALL :GET_TIMESTAMP +@REM. +@REM Updates: !TIMESTAMP! +FOR /F "tokens=1,2,3 delims=:,." %%a IN ("%TIME%") DO ( + SET "HH=%%a" + SET "MM=%%b" + SET "ss=%%c" +) +SET "TIMESTAMP=!HH!:!MM!:!ss!" +GOTO :eof + +:RESET_ERROR +@REM Subroutine to reset %ERRORLEVEL% to 0. +@REM CALL :RESET_ERROR +@REM. +@REM Updates: %ERRORLEVEL% +EXIT /B 0 +GOTO :eof From f0a2ae9ff3065fc8f5b6892436a7a5ce564eeb66 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Fri, 7 Mar 2025 08:52:54 +0800 Subject: [PATCH 248/381] Give Semgrep permission to write its report (#6253) Previously semgrep had read-all permission. This patch limits read slightly and adds write permissions to security-events. --- .github/workflows/sec_sast_semgrep_cron.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sec_sast_semgrep_cron.yml b/.github/workflows/sec_sast_semgrep_cron.yml index 944103562..a7cd7fa24 100644 --- a/.github/workflows/sec_sast_semgrep_cron.yml +++ b/.github/workflows/sec_sast_semgrep_cron.yml @@ -6,7 +6,10 @@ on: schedule: - cron: 0 1 * * 6 -permissions: read-all +permissions: + actions: read + contents: read + security-events: write jobs: semgrep-full: From 5c77d423450df8f459e75095acc5149b750aaf8d Mon Sep 17 00:00:00 2001 From: Chris Danis Date: Thu, 6 Mar 2025 20:49:55 -0500 Subject: [PATCH 249/381] i2c: 0x45 can also be an SHT35 (#6249) --- src/configuration.h | 1 + src/detect/ScanI2CTwoWire.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/configuration.h b/src/configuration.h index 6f5255ec9..a9717a637 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -135,6 +135,7 @@ along with this program. If not, see . #define LPS22HB_ADDR 0x5C #define LPS22HB_ADDR_ALT 0x5D #define SHT31_4x_ADDR 0x44 +#define SHT31_4x_ADDR_ALT 0x45 #define PMSA0031_ADDR 0x12 #define QMA6100P_ADDR 0x12 #define AHT10_ADDR 0x38 diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index 0eca5cad3..ab8b05411 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -349,7 +349,8 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) } break; } - case SHT31_4x_ADDR: + case SHT31_4x_ADDR: // same as OPT3001_ADDR_ALT + case SHT31_4x_ADDR_ALT: // same as OPT3001_ADDR registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x89), 2); if (registerValue == 0x11a2 || registerValue == 0x11da || registerValue == 0xe9c) { type = SHT4X; @@ -422,7 +423,6 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) SCAN_SIMPLE_CASE(TCA9555_ADDR, TCA9555, "TCA9555", (uint8_t)addr.address); SCAN_SIMPLE_CASE(VEML7700_ADDR, VEML7700, "VEML7700", (uint8_t)addr.address); SCAN_SIMPLE_CASE(TSL25911_ADDR, TSL2591, "TSL2591", (uint8_t)addr.address); - SCAN_SIMPLE_CASE(OPT3001_ADDR, OPT3001, "OPT3001", (uint8_t)addr.address); SCAN_SIMPLE_CASE(MLX90632_ADDR, MLX90632, "MLX90632", (uint8_t)addr.address); SCAN_SIMPLE_CASE(NAU7802_ADDR, NAU7802, "NAU7802", (uint8_t)addr.address); SCAN_SIMPLE_CASE(MAX1704X_ADDR, MAX17048, "MAX17048", (uint8_t)addr.address); From 563747c5cd32c051a7f548178b9f05bcc32f01fe Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Fri, 7 Mar 2025 11:54:32 +0800 Subject: [PATCH 250/381] Flag semgrep to not run on self-hosted (#6256) The semgrep action runs inside a docker container, and docker in podman just doesn't work. --- .github/workflows/sec_sast_semgrep_cron.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sec_sast_semgrep_cron.yml b/.github/workflows/sec_sast_semgrep_cron.yml index a7cd7fa24..db308c9f5 100644 --- a/.github/workflows/sec_sast_semgrep_cron.yml +++ b/.github/workflows/sec_sast_semgrep_cron.yml @@ -13,7 +13,7 @@ permissions: jobs: semgrep-full: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 container: image: semgrep/semgrep From 60e46cd7650ccb04e70bc34645a718b358a64689 Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Fri, 7 Mar 2025 08:21:06 +0200 Subject: [PATCH 251/381] Update platformio.ini (#6245) --- .../crowpanel-esp32s3-5-epaper/platformio.ini | 58 ++++++++++++++++++- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/variants/crowpanel-esp32s3-5-epaper/platformio.ini b/variants/crowpanel-esp32s3-5-epaper/platformio.ini index 83d57a0ef..2393e168d 100644 --- a/variants/crowpanel-esp32s3-5-epaper/platformio.ini +++ b/variants/crowpanel-esp32s3-5-epaper/platformio.ini @@ -15,8 +15,6 @@ build_flags = -DBOARD_HAS_PSRAM -DGPS_POWER_TOGGLE -DEINK_DISPLAY_MODEL=GxEPD2_579_GDEY0579T93 ;https://www.good-display.com/product/439.html - ;-DEINK_DISPLAY_MODEL=GxEPD2_290_GDEY029T94 ;https://www.good-display.com/product/389.html - ;-DEINK_DISPLAY_MODEL=GxEPD2_420_GYE042A87 ; similar Panel: GDEY042T81 : https://www.good-display.com/product/386.html -DEINK_WIDTH=792 -DEINK_HEIGHT=272 -DUSE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk @@ -25,4 +23,58 @@ build_flags = ;-DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 lib_deps = ${esp32s3_base.lib_deps} - https://github.com/markbirss/GxEPD2#markbirss-patch-1 + https://github.com/meshtastic/GxEPD2 + +[env:crowpanel-esp32s3-4-epaper] +extends = esp32s3_base +board_build.arduino.memory_type = qio_opi +board_build.flash_mode = qio +board_build.psram_type = opi +board_upload.flash_size = 8MB +board_upload.maximum_size = 8388608 +board = esp32-s3-devkitc-1 +upload_port = /dev/ttyUSB0 +board_level = extra +upload_protocol = esptool +build_flags = + ${esp32_base.build_flags} -D CROWPANEL_ESP32S3_5_EPAPER -I variants/crowpanel-esp32s3-5-epaper + -D PRIVATE_HW + -DBOARD_HAS_PSRAM + -DGPS_POWER_TOGGLE + -DEINK_DISPLAY_MODEL=GxEPD2_420_GYE042A87 ; similar Panel: GDEY042T81 : https://www.good-display.com/product/386.html + -DEINK_WIDTH=400 + -DEINK_HEIGHT=300 + -DUSE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk + -DEINK_LIMIT_FASTREFRESH=100 ; How many consecutive fast-refreshes are permitted + ;-DEINK_LIMIT_RATE_BACKGROUND_SEC=30 ; Minimum interval between BACKGROUND updates + ;-DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 +lib_deps = + ${esp32s3_base.lib_deps} + https://github.com/meshtastic/GxEPD2 + +[env:crowpanel-esp32s3-2-epaper] +extends = esp32s3_base +board_build.arduino.memory_type = qio_opi +board_build.flash_mode = qio +board_build.psram_type = opi +board_upload.flash_size = 8MB +board_upload.maximum_size = 8388608 +board = esp32-s3-devkitc-1 +upload_port = /dev/ttyUSB0 +board_level = extra +upload_protocol = esptool +build_flags = + ${esp32_base.build_flags} -D CROWPANEL_ESP32S3_5_EPAPER -I variants/crowpanel-esp32s3-5-epaper + -D PRIVATE_HW + -DBOARD_HAS_PSRAM + -DGPS_POWER_TOGGLE + -DEINK_DISPLAY_MODEL=GxEPD2_290_GDEY029T94 ;https://www.good-display.com/product/389.html + -DEINK_WIDTH=296 + -DEINK_HEIGHT=128 + -DUSE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk + -DEINK_LIMIT_FASTREFRESH=100 ; How many consecutive fast-refreshes are permitted + ;-DEINK_LIMIT_RATE_BACKGROUND_SEC=30 ; Minimum interval between BACKGROUND updates + ;-DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 +lib_deps = + ${esp32s3_base.lib_deps} + https://github.com/meshtastic/GxEPD2 From 2a3e1f904d1cddcdbc89c86e58de019bbfed74dc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 7 Mar 2025 09:12:08 +0100 Subject: [PATCH 252/381] Upgrade trunk (#6257) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index b1df7e417..85211b0f2 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -9,12 +9,12 @@ plugins: lint: enabled: - prettier@3.5.3 - - trufflehog@3.88.14 + - trufflehog@3.88.15 - yamllint@1.35.1 - bandit@1.8.3 - - checkov@3.2.379 + - checkov@3.2.382 - terrascan@1.19.9 - - trivy@0.59.1 + - trivy@0.60.0 - taplo@0.9.3 - ruff@0.9.9 - isort@6.0.1 From 284598ed5643cf139d8cfa092219dfb498371d55 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Fri, 7 Mar 2025 18:51:38 +0800 Subject: [PATCH 253/381] Add detection support for LTR390UV Sensor (#6009) * Add detection support for LTR390UV Sensor The LTR390 is a UV sensor. This patch adds detection support, for a future patch that will add the full sensor support. * Update ScanI2C.h --- src/configuration.h | 1 + src/detect/ScanI2C.h | 1 + src/detect/ScanI2CTwoWire.cpp | 1 + src/main.cpp | 1 + 4 files changed, 4 insertions(+) diff --git a/src/configuration.h b/src/configuration.h index a9717a637..fd4a5b196 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -151,6 +151,7 @@ along with this program. If not, see . #define MAX30102_ADDR 0x57 #define MLX90614_ADDR_DEF 0x5A #define CGRADSENS_ADDR 0x66 +#define LTR390UV_ADDR 0x53 // ----------------------------------------------------------------------------- // ACCELEROMETER diff --git a/src/detect/ScanI2C.h b/src/detect/ScanI2C.h index 6828169a8..5b6bbe629 100644 --- a/src/detect/ScanI2C.h +++ b/src/detect/ScanI2C.h @@ -68,6 +68,7 @@ class ScanI2C NXP_SE050, DFROBOT_RAIN, DPS310, + LTR390UV, } DeviceType; // typedef uint8_t DeviceAddress; diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index ab8b05411..8b779277d 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -427,6 +427,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) SCAN_SIMPLE_CASE(NAU7802_ADDR, NAU7802, "NAU7802", (uint8_t)addr.address); SCAN_SIMPLE_CASE(MAX1704X_ADDR, MAX17048, "MAX17048", (uint8_t)addr.address); SCAN_SIMPLE_CASE(DFROBOT_RAIN_ADDR, DFROBOT_RAIN, "DFRobot Rain Gauge", (uint8_t)addr.address); + SCAN_SIMPLE_CASE(LTR390UV_ADDR, LTR390UV, "LTR390UV", (uint8_t)addr.address); #ifdef HAS_TPS65233 SCAN_SIMPLE_CASE(TPS65233_ADDR, TPS65233, "TPS65233", (uint8_t)addr.address); #endif diff --git a/src/main.cpp b/src/main.cpp index e5e1a2537..6b8089eaa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -641,6 +641,7 @@ void setup() scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::MAX30102, meshtastic_TelemetrySensorType_MAX30102); scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::CGRADSENS, meshtastic_TelemetrySensorType_RADSENS); scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::DFROBOT_RAIN, meshtastic_TelemetrySensorType_DFROBOT_RAIN); + scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::LTR390UV, meshtastic_TelemetrySensorType_LTR390UV); scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::DPS310, meshtastic_TelemetrySensorType_DPS310); i2cScanner.reset(); From 3fd47d9713e7d1b6866c48cf218e2435741651a2 Mon Sep 17 00:00:00 2001 From: Austin Date: Fri, 7 Mar 2025 07:38:15 -0500 Subject: [PATCH 254/381] Actions: Move version bump into release_channels (#6258) --- .github/workflows/build_debian_src.yml | 2 +- .github/workflows/main_matrix.yml | 29 +++------------- .github/workflows/release_channels.yml | 46 ++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build_debian_src.yml b/.github/workflows/build_debian_src.yml index 714542047..5c441f085 100644 --- a/.github/workflows/build_debian_src.yml +++ b/.github/workflows/build_debian_src.yml @@ -4,7 +4,7 @@ on: workflow_call: secrets: PPA_GPG_PRIVATE_KEY: - required: true + required: false inputs: series: description: Ubuntu/Debian series to target diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index da4b4e6f3..5b11926f2 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -136,6 +136,7 @@ jobs: secrets: inherit package-pio-deps-native-tft: + if: ${{ github.event_name == 'workflow_dispatch' }} uses: ./.github/workflows/package_pio_deps.yml with: pio_env: native-tft @@ -329,13 +330,13 @@ jobs: with: pattern: platformio-deps-native-tft-${{ steps.version.outputs.long }} merge-multiple: true - path: ./output/pio-deps-native + path: ./output/pio-deps-native-tft - name: Zip linux sources working-directory: output run: | zip -j -9 -r ./meshtasticd-${{ steps.version.outputs.deb }}-src.zip ./debian-src - zip -9 -r ./platformio-deps-native-${{ steps.version.outputs.long }}.zip ./pio-deps-native + zip -9 -r ./platformio-deps-native-tft-${{ steps.version.outputs.long }}.zip ./pio-deps-native-tft # For diagnostics - name: Display structure of downloaded files @@ -344,32 +345,10 @@ jobs: - name: Add linux sources to release run: | gh release upload v${{ steps.version.outputs.long }} ./output/meshtasticd-${{ steps.version.outputs.deb }}-src.zip - gh release upload v${{ steps.version.outputs.long }} ./output/platformio-deps-native-${{ steps.version.outputs.long }}.zip + gh release upload v${{ steps.version.outputs.long }} ./output/platformio-deps-native-tft-${{ steps.version.outputs.long }}.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Bump version.properties - run: >- - bin/bump_version.py - - - name: Ensure debian deps are installed - shell: bash - run: | - sudo apt-get update -y --fix-missing - sudo apt-get install -y devscripts - - - name: Update debian changelog - run: >- - debian/ci_changelog.sh - - - name: Create version.properties pull request - uses: peter-evans/create-pull-request@v7 - with: - title: Bump version.properties - add-paths: | - version.properties - debian/changelog - release-firmware: strategy: fail-fast: false diff --git a/.github/workflows/release_channels.yml b/.github/workflows/release_channels.yml index 9cdabde9e..710e8e51d 100644 --- a/.github/workflows/release_channels.yml +++ b/.github/workflows/release_channels.yml @@ -43,3 +43,49 @@ jobs: copr_project: |- ${{ contains(github.event.release.name, 'Beta') && 'beta' || contains(github.event.release.name, 'Alpha') && 'alpha' }} secrets: inherit + + # Create a PR to bump version when a release is Published + bump-version: + if: ${{ github.event.release.published }} + runs-on: ubuntu-latest + permissions: + pull-requests: write + contents: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: 3.x + + - name: Get release version string + run: | + echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + echo "deb=$(./bin/buildinfo.py deb)" >> $GITHUB_OUTPUT + id: version + env: + BUILD_LOCATION: local + + - name: Bump version.properties + run: >- + bin/bump_version.py + + - name: Ensure debian deps are installed + shell: bash + run: | + sudo apt-get update -y --fix-missing + sudo apt-get install -y devscripts + + - name: Update debian changelog + run: >- + debian/ci_changelog.sh + + - name: Create version.properties pull request + uses: peter-evans/create-pull-request@v7 + with: + title: Bump version.properties + add-paths: | + version.properties + debian/changelog From 16a0dce83c6defc8e6fb64a07e289f4978373b93 Mon Sep 17 00:00:00 2001 From: Austin Date: Fri, 7 Mar 2025 18:37:54 -0500 Subject: [PATCH 255/381] Ebyte E77 (STM32) DevKit support (#6255) --- variants/CDEBYTE_E77-MBL/platformio.ini | 41 +++++++++++++++++++++++++ variants/CDEBYTE_E77-MBL/variant.h | 23 ++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 variants/CDEBYTE_E77-MBL/platformio.ini create mode 100644 variants/CDEBYTE_E77-MBL/variant.h diff --git a/variants/CDEBYTE_E77-MBL/platformio.ini b/variants/CDEBYTE_E77-MBL/platformio.ini new file mode 100644 index 000000000..a8d90f676 --- /dev/null +++ b/variants/CDEBYTE_E77-MBL/platformio.ini @@ -0,0 +1,41 @@ +[env:CDEBYTE_E77-MBL] +extends = stm32_base +; `ebyte_e77_dev` was added in this commit. Remove when a new release is used in the base. +platform = https://github.com/platformio/platform-ststm32.git#3208828db447f4373cd303b7f7393c8fc0dae623 +board = ebyte_e77_dev +board_level = extra +build_flags = + ${stm32_base.build_flags} + -Ivariants/CDEBYTE_E77-MBL + -DSERIAL_UART_INSTANCE=1 + -DPIN_SERIAL_RX=PA3 + -DPIN_SERIAL_TX=PA2 + -DHAL_DAC_MODULE_ONLY + -DHAL_ADC_MODULE_DISABLED + -DHAL_COMP_MODULE_DISABLED + -DHAL_CRC_MODULE_DISABLED + -DHAL_CRYP_MODULE_DISABLED + -DHAL_GTZC_MODULE_DISABLED + -DHAL_HSEM_MODULE_DISABLED + -DHAL_I2C_MODULE_DISABLED + -DHAL_I2S_MODULE_DISABLED + -DHAL_IPCC_MODULE_DISABLED + -DHAL_IRDA_MODULE_DISABLED + -DHAL_IWDG_MODULE_DISABLED + -DHAL_LPTIM_MODULE_DISABLED + -DHAL_PKA_MODULE_DISABLED + -DHAL_RNG_MODULE_DISABLED + -DHAL_RTC_MODULE_DISABLED + -DHAL_SMARTCARD_MODULE_DISABLED + -DHAL_SMBUS_MODULE_DISABLED + -DHAL_TIM_MODULE_DISABLED + -DHAL_WWDG_MODULE_DISABLED + -DHAL_EXTI_MODULE_DISABLED + -DHAL_SAI_MODULE_DISABLED + -DHAL_ICACHE_MODULE_DISABLED + -DRADIOLIB_EXCLUDE_SX128X=1 + -DRADIOLIB_EXCLUDE_SX127X=1 + -DRADIOLIB_EXCLUDE_LR11X0=1 +; -D PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF + +upload_port = stlink \ No newline at end of file diff --git a/variants/CDEBYTE_E77-MBL/variant.h b/variants/CDEBYTE_E77-MBL/variant.h new file mode 100644 index 000000000..7331dcedc --- /dev/null +++ b/variants/CDEBYTE_E77-MBL/variant.h @@ -0,0 +1,23 @@ +/* +EByte E77-MBL series +https://www.cdebyte.com/products/E77-900MBL-01 +https://www.cdebyte.com/products/E77-400MBL-01 +https://github.com/olliw42/mLRS-docu/blob/master/docs/EBYTE_E77_MBL.md +*/ + +/* +This variant is a work in progress. +Do not expect a working Meshtastic device with this target. +*/ + +#ifndef _VARIANT_EBYTE_E77_ +#define _VARIANT_EBYTE_E77_ + +#define USE_STM32WLx +#define MAX_NUM_NODES 10 + +#define LED_PIN PB4 // LED1 +// #define LED_PIN PB3 // LED2 +#define LED_STATE_ON 1 + +#endif From 7f17747d8c3f60760ee905a725d47217e40661c6 Mon Sep 17 00:00:00 2001 From: Chris Danis Date: Fri, 7 Mar 2025 20:33:23 -0500 Subject: [PATCH 256/381] NodeInfo exchange: don't bother if too far away (#6260) When we receive a NodeInfo from a new node, if it is more than 2 hops beyond our configured hop limit away from us, don't bother to send a NodeInfo back to it. In my dense urban environment, I see many nodes that are >= 5 hops away, but sending their NodeInfo with a hopStart of 6 or 7. In most cases I can imagine, this seems like a waste of airtime. --- src/mesh/MeshService.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mesh/MeshService.cpp b/src/mesh/MeshService.cpp index 0ef21d4ca..3bb1f2776 100644 --- a/src/mesh/MeshService.cpp +++ b/src/mesh/MeshService.cpp @@ -88,8 +88,16 @@ int MeshService::handleFromRadio(const meshtastic_MeshPacket *mp) } else if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag && !nodeDB->getMeshNode(mp->from)->has_user && nodeInfoModule && !isPreferredRebroadcaster && !nodeDB->isFull()) { if (airTime->isTxAllowedChannelUtil(true)) { - LOG_INFO("Heard new node on ch. %d, send NodeInfo and ask for response", mp->channel); - nodeInfoModule->sendOurNodeInfo(mp->from, true, mp->channel); + // Hops used by the request. If somebody in between running modified firmware modified it, ignore it + auto hopStart = mp->hop_start; + auto hopLimit = mp->hop_limit; + uint8_t hopsUsed = hopStart < hopLimit ? config.lora.hop_limit : hopStart - hopLimit; + if (hopsUsed > config.lora.hop_limit + 2) { + LOG_DEBUG("Skip send NodeInfo: %d hops away is too far away", hopsUsed); + } else { + LOG_INFO("Heard new node on ch. %d, send NodeInfo and ask for response", mp->channel); + nodeInfoModule->sendOurNodeInfo(mp->from, true, mp->channel); + } } else { LOG_DEBUG("Skip sending NodeInfo > 25%% ch. util"); } From 94de2315c1f485dcdd3b4a48966f402af19af20a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 8 Mar 2025 06:22:11 -0600 Subject: [PATCH 257/381] [create-pull-request] automated change (#6266) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/portnums.pb.h | 3 +++ src/mesh/generated/meshtastic/telemetry.pb.h | 28 ++++++++++++++------ 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/protobufs b/protobufs index c261bd71a..035a8017b 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit c261bd71aaf416f3bcef5dbc774d06b797fc58c6 +Subproject commit 035a8017b87379f17624f7bba9b6a5b127bc026c diff --git a/src/mesh/generated/meshtastic/portnums.pb.h b/src/mesh/generated/meshtastic/portnums.pb.h index d7dc47785..4e7c43e58 100644 --- a/src/mesh/generated/meshtastic/portnums.pb.h +++ b/src/mesh/generated/meshtastic/portnums.pb.h @@ -128,6 +128,9 @@ typedef enum _meshtastic_PortNum { meshtastic_PortNum_MAP_REPORT_APP = 73, /* PowerStress based monitoring support (for automated power consumption testing) */ meshtastic_PortNum_POWERSTRESS_APP = 74, + /* Reticulum Network Stack Tunnel App + ENCODING: Fragmented RNS Packet. Handled by Meshtastic RNS interface */ + meshtastic_PortNum_RETICULUM_TUNNEL_APP = 76, /* Private applications should use portnums >= 256. To simplify initial development and testing you can use "PRIVATE_APP" in your code without needing to rebuild protobuf files (via [regen-protos.sh](https://github.com/meshtastic/firmware/blob/master/bin/regen-protos.sh)) */ diff --git a/src/mesh/generated/meshtastic/telemetry.pb.h b/src/mesh/generated/meshtastic/telemetry.pb.h index aa39a1ce4..69cdd33fe 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.h +++ b/src/mesh/generated/meshtastic/telemetry.pb.h @@ -85,7 +85,9 @@ typedef enum _meshtastic_TelemetrySensorType { /* DFRobot Gravity tipping bucket rain gauge */ meshtastic_TelemetrySensorType_DFROBOT_RAIN = 35, /* Infineon DPS310 High accuracy pressure and temperature */ - meshtastic_TelemetrySensorType_DPS310 = 36 + meshtastic_TelemetrySensorType_DPS310 = 36, + /* RAKWireless RAK12035 Soil Moisture Sensor Module */ + meshtastic_TelemetrySensorType_RAK12035 = 37 } meshtastic_TelemetrySensorType; /* Struct definitions */ @@ -172,6 +174,12 @@ typedef struct _meshtastic_EnvironmentMetrics { /* Rainfall in the last 24 hours in mm */ bool has_rainfall_24h; float rainfall_24h; + /* Soil moisture measured (% 1-100) */ + bool has_soil_moisture; + uint8_t soil_moisture; + /* Soil temperature measured (*C) */ + bool has_soil_temperature; + float soil_temperature; } meshtastic_EnvironmentMetrics; /* Power Metrics (voltage / current / etc) */ @@ -316,8 +324,8 @@ extern "C" { /* Helper constants for enums */ #define _meshtastic_TelemetrySensorType_MIN meshtastic_TelemetrySensorType_SENSOR_UNSET -#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_DPS310 -#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_DPS310+1)) +#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_RAK12035 +#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_RAK12035+1)) @@ -330,7 +338,7 @@ extern "C" { /* Initializer values for message structs */ #define meshtastic_DeviceMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0} -#define meshtastic_EnvironmentMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} +#define meshtastic_EnvironmentMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_PowerMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_AirQualityMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_LocalStats_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} @@ -338,7 +346,7 @@ extern "C" { #define meshtastic_Telemetry_init_default {0, 0, {meshtastic_DeviceMetrics_init_default}} #define meshtastic_Nau7802Config_init_default {0, 0} #define meshtastic_DeviceMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0} -#define meshtastic_EnvironmentMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} +#define meshtastic_EnvironmentMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_PowerMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_AirQualityMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define meshtastic_LocalStats_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} @@ -372,6 +380,8 @@ extern "C" { #define meshtastic_EnvironmentMetrics_radiation_tag 18 #define meshtastic_EnvironmentMetrics_rainfall_1h_tag 19 #define meshtastic_EnvironmentMetrics_rainfall_24h_tag 20 +#define meshtastic_EnvironmentMetrics_soil_moisture_tag 21 +#define meshtastic_EnvironmentMetrics_soil_temperature_tag 22 #define meshtastic_PowerMetrics_ch1_voltage_tag 1 #define meshtastic_PowerMetrics_ch1_current_tag 2 #define meshtastic_PowerMetrics_ch2_voltage_tag 3 @@ -445,7 +455,9 @@ X(a, STATIC, OPTIONAL, FLOAT, wind_gust, 16) \ X(a, STATIC, OPTIONAL, FLOAT, wind_lull, 17) \ X(a, STATIC, OPTIONAL, FLOAT, radiation, 18) \ X(a, STATIC, OPTIONAL, FLOAT, rainfall_1h, 19) \ -X(a, STATIC, OPTIONAL, FLOAT, rainfall_24h, 20) +X(a, STATIC, OPTIONAL, FLOAT, rainfall_24h, 20) \ +X(a, STATIC, OPTIONAL, UINT32, soil_moisture, 21) \ +X(a, STATIC, OPTIONAL, FLOAT, soil_temperature, 22) #define meshtastic_EnvironmentMetrics_CALLBACK NULL #define meshtastic_EnvironmentMetrics_DEFAULT NULL @@ -544,12 +556,12 @@ extern const pb_msgdesc_t meshtastic_Nau7802Config_msg; #define MESHTASTIC_MESHTASTIC_TELEMETRY_PB_H_MAX_SIZE meshtastic_Telemetry_size #define meshtastic_AirQualityMetrics_size 78 #define meshtastic_DeviceMetrics_size 27 -#define meshtastic_EnvironmentMetrics_size 103 +#define meshtastic_EnvironmentMetrics_size 113 #define meshtastic_HealthMetrics_size 11 #define meshtastic_LocalStats_size 60 #define meshtastic_Nau7802Config_size 16 #define meshtastic_PowerMetrics_size 30 -#define meshtastic_Telemetry_size 110 +#define meshtastic_Telemetry_size 120 #ifdef __cplusplus } /* extern "C" */ From c54fc5b7c5e0b8719abd1ed3e9777a0b4425907d Mon Sep 17 00:00:00 2001 From: Austin Date: Sat, 8 Mar 2025 17:36:55 -0500 Subject: [PATCH 258/381] Thread in harmony (#6271) --- platformio.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio.ini b/platformio.ini index f41726503..310134c30 100644 --- a/platformio.ini +++ b/platformio.ini @@ -60,7 +60,7 @@ lib_deps = mathertel/OneButton@2.6.1 https://github.com/meshtastic/arduino-fsm.git#7db3702bf0cfe97b783d6c72595e3f38e0b19159 https://github.com/meshtastic/TinyGPSPlus.git#71a82db35f3b973440044c476d4bcdc673b104f4 - https://github.com/meshtastic/ArduinoThread.git#1ae8778c85d0a2a729f989e0b1e7d7c4dc84eef0 + https://github.com/meshtastic/ArduinoThread.git#7c3ee9e1951551b949763b1f5280f8db1fa4068d nanopb/Nanopb@0.4.91 erriez/ErriezCRC32@1.0.1 @@ -94,7 +94,7 @@ lib_deps = [device-ui_base] lib_deps = - https://github.com/meshtastic/device-ui.git#8c3183e177a1d6452ce12b4f328bd3357bf7e21b + https://github.com/meshtastic/device-ui.git#d7b18e98704f988fcda9e5fa7404e677b3d11f8c ; Common libs for environmental measurements in telemetry module ; (not included in native / portduino) From 5de6bc1851a1c985b43705ebfd8786ad39eea872 Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Sun, 9 Mar 2025 14:06:32 +1300 Subject: [PATCH 259/381] Fix excluded_modules metadata with InkHUD (#6272) --- src/main.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 6b8089eaa..4634c7c14 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1225,8 +1225,12 @@ extern meshtastic_DeviceMetadata getDeviceMetadata() #if MESHTASTIC_EXCLUDE_AUDIO deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_AUDIO_CONFIG; #endif -#if !HAS_SCREEN || NO_EXT_GPIO - deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_CANNEDMSG_CONFIG | meshtastic_ExcludedModules_EXTNOTIF_CONFIG; +// Option to explicitly include canned messages for edge cases, e.g. niche graphics +#if (!HAS_SCREEN && NO_EXT_GPIO) && !MESHTASTIC_INCLUDE_CANNEDMSG + deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_CANNEDMSG_CONFIG; +#endif +#if NO_EXT_GPIO + deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_EXTNOTIF_CONFIG; #endif // Only edge case here is if we apply this a device with built in Accelerometer and want to detect interrupts // We'll have to macro guard against those targets potentially From 3c1f92ce84eb90a629ed3f0faa9444b70e468c82 Mon Sep 17 00:00:00 2001 From: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com> Date: Sun, 9 Mar 2025 12:43:16 +0100 Subject: [PATCH 260/381] Update device-install scripts (#6267) * fix example * check for firmware- filename * add powershell formatter setting * add crlf for ps1 * formatting * check for firmware- filename --------- Co-authored-by: Ben Meadors --- .gitattributes | 1 + .vscode/settings.json | 3 +++ bin/device-install.bat | 10 +++++++--- bin/device-install.sh | 7 ++++++- bin/device-install_test.ps1 | 31 ++++++++++++++++--------------- 5 files changed, 33 insertions(+), 19 deletions(-) diff --git a/.gitattributes b/.gitattributes index 584097061..79d1800fc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,5 @@ * text=auto eol=lf *.{cmd,[cC][mM][dD]} text eol=crlf *.{bat,[bB][aA][tT]} text eol=crlf +*.{ps1,[pP][sS]} text eol=crlf *.{sh,[sS][hH]} text eol=lf diff --git a/.vscode/settings.json b/.vscode/settings.json index bf9b82111..81deca8f9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,8 @@ "cmake.configureOnOpen": false, "[cpp]": { "editor.defaultFormatter": "trunk.io" + }, + "[powershell]": { + "editor.defaultFormatter": "ms-vscode.powershell" } } diff --git a/bin/device-install.bat b/bin/device-install.bat index 3e2ea49aa..926338464 100755 --- a/bin/device-install.bat +++ b/bin/device-install.bat @@ -20,7 +20,7 @@ ECHO. ECHO Usage: %SCRIPT_NAME% -f filename [-p PORT] [-P python] (--web) ECHO. ECHO Options: -ECHO -f filename The .bin file to flash. Custom to your device type and region. (required) +ECHO -f filename The firmware .bin file to flash. Custom to your device type and region. (required) ECHO The file must be located in this current directory. ECHO -p PORT Set the environment variable for ESPTOOL_PORT. ECHO If not set, ESPTOOL iterates all ports (Dangerous). @@ -30,7 +30,7 @@ ECHO If not supplied the script will try to find esptool in ECHO --web Enable WebUI. (default: false) ECHO. ECHO Example: %SCRIPT_NAME% -f firmware-t-deck-tft-2.6.0.0b106d4.bin -p COM11 -ECHO Example: %SCRIPT_NAME% -f littlefs-unphone-2.6.0.0b106d4.bin -p COM11 --web +ECHO Example: %SCRIPT_NAME% -f firmware-unphone-2.6.0.0b106d4.bin -p COM11 --web GOTO eof :version @@ -60,16 +60,20 @@ IF "__!FILENAME!__"=="____" ( CALL :LOG_MESSAGE DEBUG "Missing -f filename input." GOTO help ) ELSE ( + CALL :LOG_MESSAGE DEBUG "Filename: !FILENAME!" IF NOT "__!FILENAME: =!__"=="__!FILENAME!__" ( CALL :LOG_MESSAGE ERROR "Filename containing spaces are not supported." GOTO help ) + IF "__!FILENAME:firmware-=!__"=="__!FILENAME!__" ( + CALL :LOG_MESSAGE ERROR "Filename must be a firmware-* file." + GOTO help + ) @REM Remove ".\" or "./" file prefix if present. SET "FILENAME=!FILENAME:.\=!" SET "FILENAME=!FILENAME:./=!" ) -CALL :LOG_MESSAGE DEBUG "Filename: !FILENAME!" CALL :LOG_MESSAGE DEBUG "Checking if !FILENAME! exists..." IF NOT EXIST !FILENAME! ( CALL :LOG_MESSAGE ERROR "File does not exist: !FILENAME!. Terminating." diff --git a/bin/device-install.sh b/bin/device-install.sh index c1ba33c4a..61c72bc2e 100755 --- a/bin/device-install.sh +++ b/bin/device-install.sh @@ -29,7 +29,7 @@ Flash image file to device, but first erasing and writing system information. -h Display this help and exit. -p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerous). -P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: "$PYTHON") - -f FILENAME The .bin file to flash. Custom to your device type and region. + -f FILENAME The firmware .bin file to flash. Custom to your device type and region. --web Enable WebUI. (Default: false) EOF @@ -73,6 +73,11 @@ done shift } +if [[ $FILENAME != firmware-* ]]; then + echo "Filename must be a firmware-* file." + exit 1 +fi + # Check if FILENAME contains "-tft-" and set target partitionScheme accordingly. if [[ ${FILENAME//-tft-/} != "$FILENAME" ]]; then TFT_BUILD=true diff --git a/bin/device-install_test.ps1 b/bin/device-install_test.ps1 index d7d3e6178..ae4a61cb7 100644 --- a/bin/device-install_test.ps1 +++ b/bin/device-install_test.ps1 @@ -25,10 +25,10 @@ param() function New-EmptyFile() { [CmdletBinding()] param ( - [Parameter(Position=0,Mandatory=$true)] + [Parameter(Position = 0, Mandatory = $true)] # Specifies the file name. [string]$FileName, - [Parameter(Position=1)] + [Parameter(Position = 1)] # Specifies the target path. (Get-Location).Path is the default. [string]$Directory = (Get-Location).Path ) @@ -42,10 +42,10 @@ function New-EmptyFile() { function Remove-EmptyFile() { [CmdletBinding()] param ( - [Parameter(Position=0,Mandatory=$true)] + [Parameter(Position = 0, Mandatory = $true)] # Specifies the file name. [string]$FileName, - [Parameter(Position=1)] + [Parameter(Position = 1)] # Specifies the target path. (Get-Location).Path is the default. [string]$Directory = (Get-Location).Path ) @@ -60,14 +60,14 @@ function Remove-EmptyFile() { $TestCases = New-Object -TypeName PSObject -Property @{ # Use this PSObject to define testcases according to this syntax: # "testname" = @("firmware-testname","bleota","littlefs-testname","args") - "t-deck" = @("firmware-t-deck-2.6.0.0b106d4.bin", "bleota-s3.bin", "littlefs-t-deck-2.6.0.0b106d4.bin","") - "t-deck_web" = @("firmware-t-deck-2.6.0.0b106d4.bin", "bleota-s3.bin", "littlefswebui-t-deck-2.6.0.0b106d4.bin","--web") - "t-deck-tft" = @("firmware-t-deck-tft-2.6.0.0b106d4.bin", "bleota-s3.bin", "littlefs-t-deck-tft-2.6.0.0b106d4.bin","") - "heltec-ht62-esp32c3" = @("firmware-heltec-ht62-esp32c3-sx1262-2.6.0.0b106d4.bin", "bleota-c3.bin", "littlefs-heltec-ht62-esp32c3-sx1262-2.6.0.0b106d4.bin","") - "tlora-c6" = @("firmware-tlora-c6-2.6.0.0b106d4.bin", "bleota.bin", "littlefs-tlora-c6-2.6.0.0b106d4.bin","") - "heltec-v3_web" = @("firmware-heltec-v3-2.6.0.0b106d4.bin", "bleota-s3.bin", "littlefswebui-heltec-v3-2.6.0.0b106d4.bin","--web") - "seeed-sensecap-indicator-tft" = @("firmware-seeed-sensecap-indicator-tft-2.6.0.0b106d4.bin", "bleota.bin", "littlefs-seeed-sensecap-indicator-tft-2.6.0.0b106d4.bin","") - "picomputer-s3-tft" = @("firmware-picomputer-s3-tft-2.6.0.0b106d4.bin", "bleota-s3.bin", "littlefs-picomputer-s3-tft-2.6.0.0b106d4.bin","") + "t-deck" = @("firmware-t-deck-2.6.0.0b106d4.bin", "bleota-s3.bin", "littlefs-t-deck-2.6.0.0b106d4.bin", "") + "t-deck_web" = @("firmware-t-deck-2.6.0.0b106d4.bin", "bleota-s3.bin", "littlefswebui-t-deck-2.6.0.0b106d4.bin", "--web") + "t-deck-tft" = @("firmware-t-deck-tft-2.6.0.0b106d4.bin", "bleota-s3.bin", "littlefs-t-deck-tft-2.6.0.0b106d4.bin", "") + "heltec-ht62-esp32c3" = @("firmware-heltec-ht62-esp32c3-sx1262-2.6.0.0b106d4.bin", "bleota-c3.bin", "littlefs-heltec-ht62-esp32c3-sx1262-2.6.0.0b106d4.bin", "") + "tlora-c6" = @("firmware-tlora-c6-2.6.0.0b106d4.bin", "bleota.bin", "littlefs-tlora-c6-2.6.0.0b106d4.bin", "") + "heltec-v3_web" = @("firmware-heltec-v3-2.6.0.0b106d4.bin", "bleota-s3.bin", "littlefswebui-heltec-v3-2.6.0.0b106d4.bin", "--web") + "seeed-sensecap-indicator-tft" = @("firmware-seeed-sensecap-indicator-tft-2.6.0.0b106d4.bin", "bleota.bin", "littlefs-seeed-sensecap-indicator-tft-2.6.0.0b106d4.bin", "") + "picomputer-s3-tft" = @("firmware-picomputer-s3-tft-2.6.0.0b106d4.bin", "bleota-s3.bin", "littlefs-picomputer-s3-tft-2.6.0.0b106d4.bin", "") } foreach ($TestCase in $TestCases.PSObject.Properties) { @@ -88,9 +88,10 @@ foreach ($TestCase in $TestCases.PSObject.Properties) { foreach ($Line in $Test) { if ($Line -match "Set OTA_OFFSET to" -or ` - $Line -match "Set SPIFFS_OFFSET to") { + $Line -match "Set SPIFFS_OFFSET to") { Write-Host -Object "$($Line -replace "^.*?Set","Set")" -ForegroundColor Blue - } elseif ($VerbosePreference -eq "Continue") { + } + elseif ($VerbosePreference -eq "Continue") { Write-Host -Object $Line } if ($Line -match "ERROR") { @@ -100,7 +101,7 @@ foreach ($TestCase in $TestCases.PSObject.Properties) { } if ($null -ne $Errors) { Write-Host -Object "$Counter ERROR(s) detected!" -ForegroundColor Red - if (-not ($VerbosePreference -eq "Continue")) {Write-Host -Object $Errors} + if (-not ($VerbosePreference -eq "Continue")) { Write-Host -Object $Errors } } foreach ($File in $Files) { From 78b4eff568dd82d660a035a2c03dedea7e187de7 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 10 Mar 2025 11:57:39 -0500 Subject: [PATCH 261/381] Bump --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 4cb750c2c..79fae04ed 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 6 -build = 0 \ No newline at end of file +build = 1 From 7c3eddebc251aebcf2bd3ecbee493ea31f65566f Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Mon, 10 Mar 2025 22:42:29 +0100 Subject: [PATCH 262/381] device-ui: exFat support (#6279) --- platformio.ini | 2 +- variants/t-deck/platformio.ini | 1 + variants/t-deck/variant.h | 2 +- variants/unphone/platformio.ini | 1 + variants/unphone/variant.h | 1 - 5 files changed, 4 insertions(+), 3 deletions(-) diff --git a/platformio.ini b/platformio.ini index 310134c30..7f71d2f58 100644 --- a/platformio.ini +++ b/platformio.ini @@ -94,7 +94,7 @@ lib_deps = [device-ui_base] lib_deps = - https://github.com/meshtastic/device-ui.git#d7b18e98704f988fcda9e5fa7404e677b3d11f8c + https://github.com/meshtastic/device-ui.git#74e739ed4532ca10393df9fc89ae5a22f0bab2b1 ; Common libs for environmental measurements in telemetry module ; (not included in native / portduino) diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 0761e3251..a0005c9c6 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -39,6 +39,7 @@ build_flags = -D INPUTDRIVER_ENCODER_BTN=0 -D INPUTDRIVER_BUTTON_TYPE=0 -D MAX_NUM_NODES=250 + -D HAS_SDCARD -D HAS_SCREEN=0 -D HAS_TFT=1 -D USE_I2S_BUZZER diff --git a/variants/t-deck/variant.h b/variants/t-deck/variant.h index 8ffc4ea44..5b2c13a91 100644 --- a/variants/t-deck/variant.h +++ b/variants/t-deck/variant.h @@ -42,7 +42,7 @@ #define GPS_TX_PIN 43 // Have SPI interface SD card slot -#define HAS_SDCARD 1 +// #define HAS_SDCARD // --> needs to be in platform.ini for device-ui #define SPI_MOSI (41) #define SPI_SCK (40) #define SPI_MISO (38) diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini index d436314c3..88f6e7469 100644 --- a/variants/unphone/platformio.ini +++ b/variants/unphone/platformio.ini @@ -46,6 +46,7 @@ build_flags = -D MAX_THREADS=40 -D HAS_SCREEN=0 -D HAS_TFT=1 + -D HAS_SDCARD -D DISPLAY_SET_RESOLUTION -D RAM_SIZE=3072 -D LV_LVGL_H_INCLUDE_SIMPLE diff --git a/variants/unphone/variant.h b/variants/unphone/variant.h index e846b064a..7b39a5aa5 100644 --- a/variants/unphone/variant.h +++ b/variants/unphone/variant.h @@ -48,7 +48,6 @@ #undef GPS_RX_PIN #undef GPS_TX_PIN -#define HAS_SDCARD 1 #define SD_SPI_FREQUENCY 25000000 #define SDCARD_CS 43 From 186e5096075b110fdcdb9ad13706df2d86ef0ad5 Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Tue, 11 Mar 2025 13:11:11 +0200 Subject: [PATCH 263/381] Update esp32-s3-pico.json (#6284) * Update esp32-s3-pico.json * Update esp32-s3-pico.json --- boards/esp32-s3-pico.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/boards/esp32-s3-pico.json b/boards/esp32-s3-pico.json index 8f8c6fdb7..c092bfb74 100644 --- a/boards/esp32-s3-pico.json +++ b/boards/esp32-s3-pico.json @@ -7,13 +7,15 @@ "core": "esp32", "extra_flags": [ "-DARDUINO_ESP32S3_DEV", - "-DARDUINO_USB_MODE=1", "-DARDUINO_RUNNING_CORE=1", - "-DARDUINO_EVENT_RUNNING_CORE=1" + "-DARDUINO_EVENT_RUNNING_CORE=1", + "-DARDUINO_USB_CDC_ON_BOOT=1", + "-DBOARD_HAS_PSRAM" ], "f_cpu": "240000000L", "f_flash": "80000000L", "flash_mode": "qio", + "psram_type": "qio", "hwids": [["0x303A", "0x1001"]], "mcu": "esp32s3", "variant": "esp32s3" From 8795a63427f992324a0d856674c768719265400f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 06:26:45 -0500 Subject: [PATCH 264/381] Upgrade trunk (#6283) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 85211b0f2..0b7121128 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -16,7 +16,7 @@ lint: - terrascan@1.19.9 - trivy@0.60.0 - taplo@0.9.3 - - ruff@0.9.9 + - ruff@0.9.10 - isort@6.0.1 - markdownlint@0.44.0 - oxipng@9.1.4 From cb6dfb66d2f8aac0bd642f1dbafc2e403221c62d Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Tue, 11 Mar 2025 14:56:12 +0200 Subject: [PATCH 265/381] Update ME25LS01/MS24SF1 comment out upload port (#6285) * Update platformio.ini * Update platformio.ini * Update platformio.ini --- variants/ME25LS01-4Y10TD/platformio.ini | 2 +- variants/ME25LS01-4Y10TD_e-ink/platformio.ini | 2 +- variants/MS24SF1/platformio.ini | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/variants/ME25LS01-4Y10TD/platformio.ini b/variants/ME25LS01-4Y10TD/platformio.ini index 479a4e79c..bd764e107 100644 --- a/variants/ME25LS01-4Y10TD/platformio.ini +++ b/variants/ME25LS01-4Y10TD/platformio.ini @@ -12,4 +12,4 @@ lib_deps = ${nrf52840_base.lib_deps} ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) upload_protocol = nrfutil -upload_port = /dev/ttyACM1 \ No newline at end of file +;upload_port = /dev/ttyACM1 diff --git a/variants/ME25LS01-4Y10TD_e-ink/platformio.ini b/variants/ME25LS01-4Y10TD_e-ink/platformio.ini index 62314040a..fb9bd27d5 100644 --- a/variants/ME25LS01-4Y10TD_e-ink/platformio.ini +++ b/variants/ME25LS01-4Y10TD_e-ink/platformio.ini @@ -16,4 +16,4 @@ lib_deps = zinggjm/GxEPD2@^1.6.2 ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) upload_protocol = nrfutil -upload_port = /dev/ttyACM1 +;upload_port = /dev/ttyACM1 diff --git a/variants/MS24SF1/platformio.ini b/variants/MS24SF1/platformio.ini index 5cbd078d0..e109a3270 100644 --- a/variants/MS24SF1/platformio.ini +++ b/variants/MS24SF1/platformio.ini @@ -12,4 +12,4 @@ lib_deps = ${nrf52840_base.lib_deps} ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) upload_protocol = nrfutil -upload_port = /dev/ttyACM1 +;upload_port = /dev/ttyACM1 From e9effb9fff1f6ef0e8aa8c4e7f160bcf594da50c Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Tue, 11 Mar 2025 15:45:20 +0200 Subject: [PATCH 266/381] Update platformio.ini (#6286) --- variants/crowpanel-esp32s3-5-epaper/platformio.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/variants/crowpanel-esp32s3-5-epaper/platformio.ini b/variants/crowpanel-esp32s3-5-epaper/platformio.ini index 2393e168d..7e95a5fcf 100644 --- a/variants/crowpanel-esp32s3-5-epaper/platformio.ini +++ b/variants/crowpanel-esp32s3-5-epaper/platformio.ini @@ -6,7 +6,7 @@ board_build.psram_type = opi board_upload.flash_size = 8MB board_upload.maximum_size = 8388608 board = esp32-s3-devkitc-1 -upload_port = /dev/ttyUSB0 +;upload_port = /dev/ttyUSB0 board_level = extra upload_protocol = esptool build_flags = @@ -33,7 +33,7 @@ board_build.psram_type = opi board_upload.flash_size = 8MB board_upload.maximum_size = 8388608 board = esp32-s3-devkitc-1 -upload_port = /dev/ttyUSB0 +;upload_port = /dev/ttyUSB0 board_level = extra upload_protocol = esptool build_flags = @@ -60,7 +60,7 @@ board_build.psram_type = opi board_upload.flash_size = 8MB board_upload.maximum_size = 8388608 board = esp32-s3-devkitc-1 -upload_port = /dev/ttyUSB0 +;upload_port = /dev/ttyUSB0 board_level = extra upload_protocol = esptool build_flags = From f4c79530ecd9330de101762f9588f4a78c9fe7bc Mon Sep 17 00:00:00 2001 From: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com> Date: Tue, 11 Mar 2025 19:05:51 +0100 Subject: [PATCH 267/381] update gitattributes for windows (#6289) --- .gitattributes | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitattributes b/.gitattributes index 79d1800fc..1c945f060 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,5 @@ * text=auto eol=lf -*.{cmd,[cC][mM][dD]} text eol=crlf -*.{bat,[bB][aA][tT]} text eol=crlf -*.{ps1,[pP][sS]} text eol=crlf +*.cmd text eol=crlf +*.bat text eol=crlf +*.ps1 text eol=crlf *.{sh,[sS][hH]} text eol=lf From ec59f7d7dd3a937144e7c656a8bba5f2a174e92f Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Wed, 12 Mar 2025 00:59:44 +0100 Subject: [PATCH 268/381] fix packet queue full (#6292) --- src/mesh/api/PacketAPI.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/mesh/api/PacketAPI.cpp b/src/mesh/api/PacketAPI.cpp index 45bbe19d3..4f0fbaf97 100644 --- a/src/mesh/api/PacketAPI.cpp +++ b/src/mesh/api/PacketAPI.cpp @@ -89,18 +89,20 @@ bool PacketAPI::receivePacket(void) bool PacketAPI::sendPacket(void) { - // fill dummy buffer; we don't use it, we directly send the fromRadio structure - uint32_t len = getFromRadio(txBuf); - if (len != 0) { - static uint32_t id = 0; - fromRadioScratch.id = ++id; - bool result = server->sendPacket(DataPacket(id, fromRadioScratch)); - if (!result) { - LOG_ERROR("send queue full"); + if (server->available()) { + // fill dummy buffer; we don't use it, we directly send the fromRadio structure + uint32_t len = getFromRadio(txBuf); + if (len != 0) { + static uint32_t id = 0; + fromRadioScratch.id = ++id; + bool result = server->sendPacket(DataPacket(id, fromRadioScratch)); + if (!result) { + LOG_ERROR("send queue full"); + } + return result; } - return result; - } else - return false; + } + return false; } bool PacketAPI::notifyProgrammingMode(void) From 508ab171d69ce6a4b967c278bb4a1ad072e8ab88 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 12 Mar 2025 06:22:24 -0500 Subject: [PATCH 269/381] Upgrade trunk (#6295) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 0b7121128..ffb924a4d 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -9,8 +9,8 @@ plugins: lint: enabled: - prettier@3.5.3 - - trufflehog@3.88.15 - - yamllint@1.35.1 + - trufflehog@3.88.16 + - yamllint@1.36.0 - bandit@1.8.3 - checkov@3.2.382 - terrascan@1.19.9 From 2473af6995cb0a434b3dc40f59a94b03880a4d9c Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 12 Mar 2025 12:43:55 -0500 Subject: [PATCH 270/381] 45 days stale --- .github/workflows/stale_bot.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/stale_bot.yml b/.github/workflows/stale_bot.yml index 19b7cf7fd..5ae6bdfc9 100644 --- a/.github/workflows/stale_bot.yml +++ b/.github/workflows/stale_bot.yml @@ -18,5 +18,6 @@ jobs: - name: Stale PR+Issues uses: actions/stale@v9.1.0 with: + days-before-stale: 45 exempt-issue-labels: pinned,3.0 exempt-pr-labels: pinned,3.0 From 499ea56e3b825d45808d5f613c84196789ea1cd5 Mon Sep 17 00:00:00 2001 From: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com> Date: Wed, 12 Mar 2025 21:32:34 +0100 Subject: [PATCH 271/381] update devcontainer (#6299) --- .devcontainer/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index d599f447f..4b9f069ab 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -30,6 +30,9 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ gnupg2 \ libusb-1.0-0-dev \ libi2c-dev \ + libxcb-xkb-dev \ + libxkbcommon-dev \ + libinput-dev \ && apt-get clean && rm -rf /var/lib/apt/lists/* RUN pipx install platformio From 8efe8a2ea3407ab5d77a772b8b5d5bd08b0fb6be Mon Sep 17 00:00:00 2001 From: paragonnov Date: Thu, 13 Mar 2025 19:14:41 +0900 Subject: [PATCH 272/381] Fix KR920's Tx power limitation (#6307) --- src/mesh/RadioInterface.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index 695c5be77..36f4a5342 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -73,9 +73,10 @@ const RegionInfo regions[] = { RDEF(RU, 868.7f, 869.2f, 100, 0, 20, true, false, false), /* - ??? + https://www.law.go.kr/LSW/admRulLsInfoP.do?admRulId=53943&efYd=0 + https://resources.lora-alliance.org/technical-specifications/rp002-1-0-4-regional-parameters */ - RDEF(KR, 920.0f, 923.0f, 100, 0, 0, true, false, false), + RDEF(KR, 920.0f, 923.0f, 100, 0, 23, true, false, false), /* Taiwan, 920-925Mhz, limited to 0.5W indoor or coastal, 1.0W outdoor. From 4d34b3d73c7fbe257ab7974f7e7cb80e4539c977 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Mar 2025 08:32:49 -0500 Subject: [PATCH 273/381] Bump dorny/test-reporter from 1.9.1 to 2.0.0 in /.github/workflows (#6309) Bumps [dorny/test-reporter](https://github.com/dorny/test-reporter) from 1.9.1 to 2.0.0. - [Release notes](https://github.com/dorny/test-reporter/releases) - [Changelog](https://github.com/dorny/test-reporter/blob/main/CHANGELOG.md) - [Commits](https://github.com/dorny/test-reporter/compare/v1.9.1...v2.0.0) --- updated-dependencies: - dependency-name: dorny/test-reporter dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/test_native.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_native.yml b/.github/workflows/test_native.yml index c7b0ef34c..c3643dcbd 100644 --- a/.github/workflows/test_native.yml +++ b/.github/workflows/test_native.yml @@ -143,7 +143,7 @@ jobs: merge-multiple: true - name: Test Report - uses: dorny/test-reporter@v1.9.1 + uses: dorny/test-reporter@v2.0.0 with: name: PlatformIO Tests path: testreport.xml From f198d5d49fd0057bf47b8b1d1c4a6d50e08757ff Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 14 Mar 2025 06:58:08 -0500 Subject: [PATCH 274/381] Upgrade trunk to 1.22.11 (#6316) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index ffb924a4d..b42e2be31 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -1,6 +1,6 @@ version: 0.1 cli: - version: 1.22.10 + version: 1.22.11 plugins: sources: - id: trunk @@ -12,7 +12,7 @@ lint: - trufflehog@3.88.16 - yamllint@1.36.0 - bandit@1.8.3 - - checkov@3.2.382 + - checkov@3.2.384 - terrascan@1.19.9 - trivy@0.60.0 - taplo@0.9.3 From f66784ed2a1a86bd0043137968844e7ecfe45b32 Mon Sep 17 00:00:00 2001 From: Chris Danis Date: Fri, 14 Mar 2025 11:10:38 -0400 Subject: [PATCH 275/381] Don't allow is_managed without any valid admin_keys (#6310) --- src/modules/AdminModule.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index ac25f57a5..ac0a8c0de 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -637,6 +637,14 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c) #if !MESHTASTIC_EXCLUDE_PKI crypto->setDHPrivateKey(config.security.private_key.bytes); #endif + if (config.security.is_managed && !(config.security.admin_key[0].size == 32 || config.security.admin_key[1].size == 32 || + config.security.admin_key[2].size == 32)) { + config.security.is_managed = false; + const char *warning = "You must provide at least one admin public key to enable managed mode"; + LOG_WARN(warning); + sendWarning(warning); + } + if (config.security.debug_log_api_enabled == c.payload_variant.security.debug_log_api_enabled && config.security.serial_enabled == c.payload_variant.security.serial_enabled) requiresReboot = false; From 79233fe99debeeb0b2d9cd765ff6e814b09c4af4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 15 Mar 2025 11:30:58 +0100 Subject: [PATCH 276/381] mainline tlora v3 (#6322) --- variants/tlora_v3_3_0_tcxo/platformio.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/variants/tlora_v3_3_0_tcxo/platformio.ini b/variants/tlora_v3_3_0_tcxo/platformio.ini index 4066d64b0..8d060a087 100644 --- a/variants/tlora_v3_3_0_tcxo/platformio.ini +++ b/variants/tlora_v3_3_0_tcxo/platformio.ini @@ -1,7 +1,6 @@ [env:tlora-v3-3-0-tcxo] extends = esp32_base board = ttgo-lora32-v21 -board_level = extra build_flags = ${esp32_base.build_flags} -D TLORA_V2_1_16 From 99e42b4d2285a6fcb6dc915118fb2ccf1da2c032 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 15 Mar 2025 07:03:53 -0500 Subject: [PATCH 277/381] [create-pull-request] automated change (#6323) Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/admin.pb.h | 2 +- src/mesh/generated/meshtastic/config.pb.h | 4 ++-- src/mesh/generated/meshtastic/device_ui.pb.h | 2 ++ src/mesh/generated/meshtastic/mesh.pb.h | 11 +++++++++-- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/protobufs b/protobufs index 035a8017b..14ec20586 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 035a8017b87379f17624f7bba9b6a5b127bc026c +Subproject commit 14ec205865592fcfa798065bb001a549fc77b438 diff --git a/src/mesh/generated/meshtastic/admin.pb.h b/src/mesh/generated/meshtastic/admin.pb.h index 02d50127e..efe60f493 100644 --- a/src/mesh/generated/meshtastic/admin.pb.h +++ b/src/mesh/generated/meshtastic/admin.pb.h @@ -34,7 +34,7 @@ typedef enum _meshtastic_AdminMessage_ConfigType { meshtastic_AdminMessage_ConfigType_BLUETOOTH_CONFIG = 6, /* TODO: REPLACE */ meshtastic_AdminMessage_ConfigType_SECURITY_CONFIG = 7, - /* */ + /* Session key config */ meshtastic_AdminMessage_ConfigType_SESSIONKEY_CONFIG = 8, /* device-ui config */ meshtastic_AdminMessage_ConfigType_DEVICEUI_CONFIG = 9 diff --git a/src/mesh/generated/meshtastic/config.pb.h b/src/mesh/generated/meshtastic/config.pb.h index 4747ddb5a..848f8df86 100644 --- a/src/mesh/generated/meshtastic/config.pb.h +++ b/src/mesh/generated/meshtastic/config.pb.h @@ -374,7 +374,7 @@ typedef struct _meshtastic_Config_PositionConfig { /* Power Config\ See [Power Config](/docs/settings/config/power) for additional power config details. */ typedef struct _meshtastic_Config_PowerConfig { - /* Description: Will sleep everything as much as possible, for the tracker and sensor role this will also include the lora radio. + /* Description: Will sleep everything as much as possible, for the tracker and sensor role this will also include the lora radio. Don't use this setting if you want to use your device with the phone apps or are using a device without a user button. Technical Details: Works for ESP32 devices and NRF52 devices in the Sensor or Tracker roles */ bool is_power_saving; @@ -426,7 +426,7 @@ typedef struct _meshtastic_Config_NetworkConfig { char wifi_ssid[33]; /* If set, will be use to authenticate to the named wifi */ char wifi_psk[65]; - /* NTP server to use if WiFi is conneced, defaults to `0.pool.ntp.org` */ + /* NTP server to use if WiFi is conneced, defaults to `meshtastic.pool.ntp.org` */ char ntp_server[33]; /* Enable Ethernet */ bool eth_enabled; diff --git a/src/mesh/generated/meshtastic/device_ui.pb.h b/src/mesh/generated/meshtastic/device_ui.pb.h index 8cfc0b8cd..5692a2749 100644 --- a/src/mesh/generated/meshtastic/device_ui.pb.h +++ b/src/mesh/generated/meshtastic/device_ui.pb.h @@ -53,6 +53,8 @@ typedef enum _meshtastic_Language { meshtastic_Language_NORWEGIAN = 14, /* Slovenian */ meshtastic_Language_SLOVENIAN = 15, + /* Ukrainian */ + meshtastic_Language_UKRAINIAN = 16, /* Simplified Chinese (experimental) */ meshtastic_Language_SIMPLIFIED_CHINESE = 30, /* Traditional Chinese (experimental) */ diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 193a61901..991aeb8d2 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -159,7 +159,7 @@ typedef enum _meshtastic_HardwareModel { meshtastic_HardwareModel_TD_LORAC = 60, /* CDEBYTE EoRa-S3 board using their own MM modules, clone of LILYGO T3S3 */ meshtastic_HardwareModel_CDEBYTE_EORA_S3 = 61, - /* TWC_MESH_V4 + /* TWC_MESH_V4 Adafruit NRF52840 feather express with SX1262, SSD1306 OLED and NEO6M GPS */ meshtastic_HardwareModel_TWC_MESH_V4 = 62, /* NRF52_PROMICRO_DIY @@ -228,6 +228,13 @@ typedef enum _meshtastic_HardwareModel { meshtastic_HardwareModel_MESHLINK = 87, /* Seeed XIAO nRF52840 + Wio SX1262 kit */ meshtastic_HardwareModel_XIAO_NRF52_KIT = 88, + /* Elecrow ThinkNode M1 & M2 + https://www.elecrow.com/wiki/ThinkNode-M1_Transceiver_Device(Meshtastic)_Power_By_nRF52840.html + https://www.elecrow.com/wiki/ThinkNode-M2_Transceiver_Device(Meshtastic)_Power_By_NRF52840.html (this actually uses ESP32-S3) */ + meshtastic_HardwareModel_THINKNODE_M1 = 89, + meshtastic_HardwareModel_THINKNODE_M2 = 90, + /* Lilygo T-ETH-Elite */ + meshtastic_HardwareModel_T_ETH_ELITE = 91, /* ------------------------------------------------------------------------------------------------------------------------------------------ Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. ------------------------------------------------------------------------------------------------------------------------------------------ */ @@ -769,7 +776,7 @@ typedef struct _meshtastic_MeshPacket { meshtastic_MeshPacket_public_key_t public_key; /* Indicates whether the packet was en/decrypted using PKI */ bool pki_encrypted; - /* Last byte of the node number of the node that should be used as the next hop in routing. + /* Last byte of the node number of the node that should be used as the next hop in routing. Set by the firmware internally, clients are not supposed to set this. */ uint8_t next_hop; /* Last byte of the node number of the node that will relay/relayed this packet. From 1640fb105dad55a1d227d3978da1342fb8059ec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 15 Mar 2025 14:15:35 +0100 Subject: [PATCH 278/381] new device: Lilygo T-Eth-Elite (#6321) --- src/DebugConfiguration.h | 9 +++- src/Power.cpp | 5 ++ src/gps/GPS.cpp | 6 ++- src/main.cpp | 4 +- src/mesh/InterfacesTemplates.cpp | 2 +- src/mesh/api/WiFiServerAPI.h | 5 ++ src/mesh/api/ethServerAPI.cpp | 2 +- src/mesh/api/ethServerAPI.h | 2 + src/mesh/http/WebServer.cpp | 9 +++- src/mesh/udp/UdpMulticastThread.h | 5 ++ src/mesh/wifi/WiFiAPClient.cpp | 48 +++++++++++++++-- src/mesh/wifi/WiFiAPClient.h | 12 ++++- src/modules/AdminModule.cpp | 2 +- src/mqtt/MQTT.cpp | 9 ++++ src/mqtt/MQTT.h | 2 +- src/platform/esp32/architecture.h | 2 + src/platform/esp32/main-esp32.cpp | 4 +- variants/t-eth-elite/pins_arduino.h | 26 +++++++++ variants/t-eth-elite/platformio.ini | 16 ++++++ variants/t-eth-elite/rfswitch.h | 11 ++++ variants/t-eth-elite/variant.h | 83 +++++++++++++++++++++++++++++ 21 files changed, 247 insertions(+), 17 deletions(-) create mode 100644 variants/t-eth-elite/pins_arduino.h create mode 100644 variants/t-eth-elite/platformio.ini create mode 100644 variants/t-eth-elite/rfswitch.h create mode 100644 variants/t-eth-elite/variant.h diff --git a/src/DebugConfiguration.h b/src/DebugConfiguration.h index 7987e7fa1..a34710eb0 100644 --- a/src/DebugConfiguration.h +++ b/src/DebugConfiguration.h @@ -121,10 +121,15 @@ extern "C" void logLegacy(const char *level, const char *fmt, ...); // Default Bluetooth PIN #define defaultBLEPin 123456 -#if HAS_ETHERNET +#if HAS_ETHERNET && !defined(USE_WS5500) #include #endif // HAS_ETHERNET +#if HAS_ETHERNET && defined(USE_WS5500) +#include +#define ETH ETH2 +#endif // HAS_ETHERNET + #if HAS_WIFI #include #endif // HAS_WIFI @@ -164,4 +169,4 @@ class Syslog bool vlogf(uint16_t pri, const char *appName, const char *fmt, va_list args) __attribute__((format(printf, 3, 0))); }; -#endif // HAS_ETHERNET || HAS_WIFI \ No newline at end of file +#endif // HAS_NETWORKING \ No newline at end of file diff --git a/src/Power.cpp b/src/Power.cpp index 8d5fe1c32..5768e9908 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -32,6 +32,11 @@ #include #endif +#if HAS_ETHERNET && defined(USE_WS5500) +#include +#define ETH ETH2 +#endif // HAS_ETHERNET + #endif #ifndef DELAY_FOREVER diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 7dcb77fcc..7f490ea3c 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -1104,12 +1104,16 @@ int32_t GPS::runOnce() return (powerState == GPS_ACTIVE) ? GPS_THREAD_INTERVAL : 5000; } -// clear the GPS rx buffer as quickly as possible +// clear the GPS rx/tx buffer as quickly as possible void GPS::clearBuffer() { +#ifdef ARCH_ESP32 + _serial_gps->flush(false); +#else int x = _serial_gps->available(); while (x--) _serial_gps->read(); +#endif } /// Prepare the GPS for the cpu entering deep or light sleep, expect to be gone for at least 100s of msecs diff --git a/src/main.cpp b/src/main.cpp index 4634c7c14..797d911d1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -55,12 +55,12 @@ NimbleBluetooth *nimbleBluetooth = nullptr; NRF52Bluetooth *nrf52Bluetooth = nullptr; #endif -#if HAS_WIFI +#if HAS_WIFI || defined(USE_WS5500) #include "mesh/api/WiFiServerAPI.h" #include "mesh/wifi/WiFiAPClient.h" #endif -#if HAS_ETHERNET +#if HAS_ETHERNET && !defined(USE_WS5500) #include "mesh/api/ethServerAPI.h" #include "mesh/eth/ethClient.h" #endif diff --git a/src/mesh/InterfacesTemplates.cpp b/src/mesh/InterfacesTemplates.cpp index 2720e8525..57abbf0ee 100644 --- a/src/mesh/InterfacesTemplates.cpp +++ b/src/mesh/InterfacesTemplates.cpp @@ -25,7 +25,7 @@ template class LR11x0Interface; template class SX126xInterface; #endif -#if HAS_ETHERNET +#if HAS_ETHERNET && !defined(USE_WS5500) #include "api/ethServerAPI.h" template class ServerAPI; template class APIServerPort; diff --git a/src/mesh/api/WiFiServerAPI.h b/src/mesh/api/WiFiServerAPI.h index 6e60bb678..5f2019983 100644 --- a/src/mesh/api/WiFiServerAPI.h +++ b/src/mesh/api/WiFiServerAPI.h @@ -3,6 +3,11 @@ #include "ServerAPI.h" #include +#if HAS_ETHERNET && defined(USE_WS5500) +#include +#define ETH ETH2 +#endif // HAS_ETHERNET + /** * Provides both debug printing and, if the client starts sending protobufs to us, switches to send/receive protobufs * (and starts dropping debug printing - FIXME, eventually those prints should be encapsulated in protobufs). diff --git a/src/mesh/api/ethServerAPI.cpp b/src/mesh/api/ethServerAPI.cpp index a8701848a..0ccf92df7 100644 --- a/src/mesh/api/ethServerAPI.cpp +++ b/src/mesh/api/ethServerAPI.cpp @@ -1,7 +1,7 @@ #include "configuration.h" #include -#if HAS_ETHERNET +#if HAS_ETHERNET && !defined(USE_WS5500) #include "ethServerAPI.h" diff --git a/src/mesh/api/ethServerAPI.h b/src/mesh/api/ethServerAPI.h index 9d25a2fc1..c616c87be 100644 --- a/src/mesh/api/ethServerAPI.h +++ b/src/mesh/api/ethServerAPI.h @@ -1,6 +1,7 @@ #pragma once #include "ServerAPI.h" +#ifndef USE_WS5500 #include /** @@ -23,3 +24,4 @@ class ethServerPort : public APIServerPort }; void initApiServer(int port = SERVER_API_DEFAULT_PORT); +#endif diff --git a/src/mesh/http/WebServer.cpp b/src/mesh/http/WebServer.cpp index d9856e157..5f6ad9eb3 100644 --- a/src/mesh/http/WebServer.cpp +++ b/src/mesh/http/WebServer.cpp @@ -12,6 +12,11 @@ #include #include +#if HAS_ETHERNET && defined(USE_WS5500) +#include +#define ETH ETH2 +#endif // HAS_ETHERNET + #ifdef ARCH_ESP32 #include "esp_task_wdt.h" #endif @@ -166,14 +171,14 @@ WebServerThread *webServerThread; WebServerThread::WebServerThread() : concurrency::OSThread("WebServer") { - if (!config.network.wifi_enabled) { + if (!config.network.wifi_enabled && !config.network.eth_enabled) { disable(); } } int32_t WebServerThread::runOnce() { - if (!config.network.wifi_enabled) { + if (!config.network.wifi_enabled && !config.network.eth_enabled) { disable(); } diff --git a/src/mesh/udp/UdpMulticastThread.h b/src/mesh/udp/UdpMulticastThread.h index 9128d3b5c..69b1d2282 100644 --- a/src/mesh/udp/UdpMulticastThread.h +++ b/src/mesh/udp/UdpMulticastThread.h @@ -7,6 +7,11 @@ #include #include +#if HAS_ETHERNET && defined(USE_WS5500) +#include +#define ETH ETH2 +#endif // HAS_ETHERNET + #define UDP_MULTICAST_DEFAUL_PORT 4403 // Default port for UDP multicast is same as TCP api server #define UDP_MULTICAST_THREAD_INTERVAL_MS 15000 diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index ee50ee56f..92388d52a 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -9,6 +9,12 @@ #include "mesh/api/WiFiServerAPI.h" #include "target_specific.h" #include + +#if HAS_ETHERNET && defined(USE_WS5500) +#include +#define ETH ETH2 +#endif // HAS_ETHERNET + #include #ifdef ARCH_ESP32 #if !MESHTASTIC_EXCLUDE_WEBSERVER @@ -52,11 +58,28 @@ Syslog syslog(syslogClient); Periodic *wifiReconnect; +#ifdef USE_WS5500 +// Startup Ethernet +bool initEthernet() +{ + if ((config.network.eth_enabled) && (ETH.begin(ETH_PHY_W5500, 1, ETH_CS_PIN, ETH_INT_PIN, ETH_RST_PIN, SPI3_HOST, + ETH_SCLK_PIN, ETH_MISO_PIN, ETH_MOSI_PIN))) { + WiFi.onEvent(WiFiEvent); +#if !MESHTASTIC_EXCLUDE_WEBSERVER + createSSLCert(); // For WebServer +#endif + return true; + } + + return false; +} +#endif + static void onNetworkConnected() { if (!APStartupComplete) { // Start web server - LOG_INFO("Start WiFi network services"); + LOG_INFO("Start network services"); // start mdns if (!MDNS.begin("Meshtastic")) { @@ -188,6 +211,10 @@ bool isWifiAvailable() if (config.network.wifi_enabled && (config.network.wifi_ssid[0])) { return true; +#ifdef USE_WS5500 + } else if (config.network.eth_enabled) { + return true; +#endif } else { return false; } @@ -282,7 +309,7 @@ bool initWifi() // Called by the Espressif SDK to static void WiFiEvent(WiFiEvent_t event) { - LOG_DEBUG("WiFi-Event %d: ", event); + LOG_DEBUG("Network-Event %d: ", event); switch (event) { case ARDUINO_EVENT_WIFI_READY: @@ -377,19 +404,32 @@ static void WiFiEvent(WiFiEvent_t event) LOG_INFO("Ethernet started"); break; case ARDUINO_EVENT_ETH_STOP: + syslog.disable(); LOG_INFO("Ethernet stopped"); break; case ARDUINO_EVENT_ETH_CONNECTED: LOG_INFO("Ethernet connected"); break; case ARDUINO_EVENT_ETH_DISCONNECTED: + syslog.disable(); LOG_INFO("Ethernet disconnected"); break; case ARDUINO_EVENT_ETH_GOT_IP: - LOG_INFO("Obtained IP address (ARDUINO_EVENT_ETH_GOT_IP)"); +#ifdef USE_WS5500 + LOG_INFO("Obtained IP address: %s, %u Mbps, %s", ETH.localIP().toString().c_str(), ETH.linkSpeed(), + ETH.fullDuplex() ? "FULL_DUPLEX" : "HALF_DUPLEX"); + onNetworkConnected(); +#endif break; case ARDUINO_EVENT_ETH_GOT_IP6: - LOG_INFO("Obtained IP6 address (ARDUINO_EVENT_ETH_GOT_IP6)"); +#ifdef USE_WS5500 +#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0) + LOG_INFO("Obtained Local IP6 address: %s", ETH.linkLocalIPv6().toString().c_str()); + LOG_INFO("Obtained GlobalIP6 address: %s", ETH.globalIPv6().toString().c_str()); +#else + LOG_INFO("Obtained IP6 address: %s", ETH.localIPv6().toString().c_str()); +#endif +#endif break; case ARDUINO_EVENT_SC_SCAN_DONE: LOG_INFO("SmartConfig: Scan done"); diff --git a/src/mesh/wifi/WiFiAPClient.h b/src/mesh/wifi/WiFiAPClient.h index 5f4e2f5c9..078c40193 100644 --- a/src/mesh/wifi/WiFiAPClient.h +++ b/src/mesh/wifi/WiFiAPClient.h @@ -9,6 +9,11 @@ #include #endif +#if HAS_ETHERNET && defined(USE_WS5500) +#include +#define ETH ETH2 +#endif // HAS_ETHERNET + extern bool needReconnect; extern concurrency::Periodic *wifiReconnect; @@ -19,4 +24,9 @@ void deinitWifi(); bool isWifiAvailable(); -uint8_t getWifiDisconnectReason(); \ No newline at end of file +uint8_t getWifiDisconnectReason(); + +#ifdef USE_WS5500 +// Startup Ethernet +bool initEthernet(); +#endif \ No newline at end of file diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index ac0a8c0de..a765fb0b1 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -988,7 +988,7 @@ void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &r } #endif -#if HAS_ETHERNET +#if HAS_ETHERNET && !defined(USE_WS5500) conn.has_ethernet = true; conn.ethernet.has_status = true; if (Ethernet.linkStatus() == LinkON) { diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 5f16f909f..226bee44d 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -19,6 +19,10 @@ #include "mesh/wifi/WiFiAPClient.h" #include #endif +#if HAS_ETHERNET && defined(USE_WS5500) +#include +#define ETH ETH2 +#endif // HAS_ETHERNET #include "Default.h" #if !defined(ARCH_NRF52) || NRF52_USE_JSON #include "serialization/JSON.h" @@ -295,6 +299,11 @@ bool connectPubSub(const PubSubConfig &config, PubSubClient &pubSub, Client &cli inline bool isConnectedToNetwork() { +#ifdef USE_WS5500 + if (ETH.connected()) + return true; +#endif + #if HAS_WIFI return WiFi.isConnected(); #elif HAS_ETHERNET diff --git a/src/mqtt/MQTT.h b/src/mqtt/MQTT.h index 5cda90218..0c260dc9c 100644 --- a/src/mqtt/MQTT.h +++ b/src/mqtt/MQTT.h @@ -14,7 +14,7 @@ #include #endif #endif -#if HAS_ETHERNET +#if HAS_ETHERNET && !defined(USE_WS5500) #include #endif diff --git a/src/platform/esp32/architecture.h b/src/platform/esp32/architecture.h index 742b295b5..e4f8b49a0 100644 --- a/src/platform/esp32/architecture.h +++ b/src/platform/esp32/architecture.h @@ -176,6 +176,8 @@ #define HW_VENDOR meshtastic_HardwareModel_SEEED_XIAO_S3 #elif defined(MESH_TAB) #define HW_VENDOR meshtastic_HardwareModel_MESH_TAB +#elif defined(T_ETH_ELITE) +#define HW_VENDOR meshtastic_HardwareModel_T_ETH_ELITE #endif // ----------------------------------------------------------------------------- diff --git a/src/platform/esp32/main-esp32.cpp b/src/platform/esp32/main-esp32.cpp index 679222af5..3b3557e95 100644 --- a/src/platform/esp32/main-esp32.cpp +++ b/src/platform/esp32/main-esp32.cpp @@ -26,7 +26,9 @@ #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !MESHTASTIC_EXCLUDE_BLUETOOTH void setBluetoothEnable(bool enable) { -#if HAS_WIFI +#ifdef USE_WS5500 + if ((config.bluetooth.enabled == true) && (config.network.wifi_enabled == false)) +#elif HAS_WIFI if (!isWifiAvailable() && config.bluetooth.enabled == true) #else if (config.bluetooth.enabled == true) diff --git a/variants/t-eth-elite/pins_arduino.h b/variants/t-eth-elite/pins_arduino.h new file mode 100644 index 000000000..cddd8d0b9 --- /dev/null +++ b/variants/t-eth-elite/pins_arduino.h @@ -0,0 +1,26 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define USB_VID 0x303a +#define USB_PID 0x1001 + +// The default Wire will be mapped to PMU and RTC +static const uint8_t SDA = 17; +static const uint8_t SCL = 18; + +// Default SPI will be mapped to Radio +static const uint8_t SS = 40; +static const uint8_t MOSI = 11; +static const uint8_t MISO = 9; +static const uint8_t SCK = 10; + +#define SPI_MOSI (11) +#define SPI_SCK (10) +#define SPI_MISO (9) +#define SPI_CS (12) + +#define SDCARD_CS SPI_CS + +#endif /* Pins_Arduino_h */ \ No newline at end of file diff --git a/variants/t-eth-elite/platformio.ini b/variants/t-eth-elite/platformio.ini new file mode 100644 index 000000000..8c2f3bc37 --- /dev/null +++ b/variants/t-eth-elite/platformio.ini @@ -0,0 +1,16 @@ +[env:t-eth-elite] +extends = esp32s3_base +board = esp32s3box +board_check = true +build_flags = + ${esp32s3_base.build_flags} + -D T_ETH_ELITE + -I variants/t-eth-elite + -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. + +lib_ignore = + Ethernet + +lib_deps = + ${esp32s3_base.lib_deps} + https://github.com/meshtastic/ETHClass2#v1.0.0 diff --git a/variants/t-eth-elite/rfswitch.h b/variants/t-eth-elite/rfswitch.h new file mode 100644 index 000000000..589f24767 --- /dev/null +++ b/variants/t-eth-elite/rfswitch.h @@ -0,0 +1,11 @@ +#include "RadioLib.h" + +static const uint32_t rfswitch_dio_pins[] = {RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC}; + +static const Module::RfSwitchMode_t rfswitch_table[] = { + // mode DIO5 DIO6 + {LR11x0::MODE_STBY, {LOW, LOW}}, {LR11x0::MODE_RX, {HIGH, LOW}}, + {LR11x0::MODE_TX, {LOW, HIGH}}, {LR11x0::MODE_TX_HP, {LOW, HIGH}}, + {LR11x0::MODE_TX_HF, {LOW, LOW}}, {LR11x0::MODE_GNSS, {LOW, LOW}}, + {LR11x0::MODE_WIFI, {LOW, LOW}}, END_OF_MODE_TABLE, +}; diff --git a/variants/t-eth-elite/variant.h b/variants/t-eth-elite/variant.h new file mode 100644 index 000000000..b7ac05872 --- /dev/null +++ b/variants/t-eth-elite/variant.h @@ -0,0 +1,83 @@ +#define HAS_SDCARD +#define SDCARD_USE_SPI1 + +#define HAS_GPS 1 +#define GPS_RX_PIN 39 +#define GPS_TX_PIN 42 +#define GPS_BAUDRATE_FIXED 1 +#define GPS_BAUDRATE 9600 + +#define I2C_SDA 17 // I2C pins for this board +#define I2C_SCL 18 + +#define HAS_SCREEN 1 // Allow for OLED Screens on I2C Header of shield + +#define LED_PIN 38 // If defined we will blink this LED +#define BUTTON_PIN 0 // If defined, this will be used for user button presses, + +#define BUTTON_NEED_PULLUP + +// TTGO uses a common pinout for their SX1262 vs RF95 modules - both can be enabled and we will probe at runtime for RF95 and if +// not found then probe for SX1262 +#define USE_RF95 // RFM95/SX127x +#define USE_SX1262 +#define USE_SX1280 +#define USE_LR1121 + +#define LORA_SCK 10 +#define LORA_MISO 9 +#define LORA_MOSI 11 +#define LORA_CS 40 +#define LORA_RESET 46 + +// per SX1276_Receive_Interrupt/utilities.h +#define LORA_DIO0 8 +#define LORA_DIO1 16 +#define LORA_DIO2 RADIOLIB_NC + +// per SX1262_Receive_Interrupt/utilities.h +#ifdef USE_SX1262 +#define SX126X_CS LORA_CS +#define SX126X_DIO1 8 +#define SX126X_BUSY 16 +#define SX126X_RESET LORA_RESET +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 +#endif + +// per SX128x_Receive_Interrupt/utilities.h +#ifdef USE_SX1280 +#define SX128X_CS LORA_CS +#define SX128X_DIO1 8 +#define SX128X_DIO2 33 +#define SX128X_DIO3 34 +#define SX128X_BUSY 16 +#define SX128X_RESET LORA_RESET +#define SX128X_RXEN 13 +#define SX128X_TXEN 38 +#define SX128X_MAX_POWER 3 +#endif + +// LR1121 +#ifdef USE_LR1121 +#define LR1121_IRQ_PIN 8 +#define LR1121_NRESET_PIN LORA_RESET +#define LR1121_BUSY_PIN 16 +#define LR1121_SPI_NSS_PIN LORA_CS +#define LR1121_SPI_SCK_PIN LORA_SCK +#define LR1121_SPI_MOSI_PIN LORA_MOSI +#define LR1121_SPI_MISO_PIN LORA_MISO +#define LR11X0_DIO3_TCXO_VOLTAGE 3.0 +#define LR11X0_DIO_AS_RF_SWITCH +#endif + +#define HAS_ETHERNET 1 +#define USE_WS5500 1 // this driver uses the same stack as the ESP32 Wifi driver + +#define ETH_MISO_PIN 47 +#define ETH_MOSI_PIN 21 +#define ETH_SCLK_PIN 48 +#define ETH_CS_PIN 45 +#define ETH_INT_PIN 14 +#define ETH_RST_PIN -1 +#define ETH_ADDR 1 \ No newline at end of file From dc100e4d3e3dfbf58d3ead8141a49cddb0cbdc19 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 16 Mar 2025 08:19:17 -0500 Subject: [PATCH 279/381] Cleanup --- src/SafeFile.cpp | 8 ++++- src/mesh/MeshService.cpp | 6 ++-- src/mesh/MeshService.h | 2 +- src/mesh/NodeDB.cpp | 18 ++--------- src/mesh/NodeDB.h | 2 +- src/mesh/RadioInterface.cpp | 2 +- src/mesh/Router.cpp | 61 +++++++++++++++++++++++------------ src/mesh/Router.h | 5 ++- src/modules/RoutingModule.cpp | 5 --- src/mqtt/MQTT.cpp | 3 +- 10 files changed, 61 insertions(+), 51 deletions(-) diff --git a/src/SafeFile.cpp b/src/SafeFile.cpp index c942aa0ee..45b96ad07 100644 --- a/src/SafeFile.cpp +++ b/src/SafeFile.cpp @@ -11,12 +11,18 @@ static File openFile(const char *filename, bool fullAtomic) FSCom.remove(filename); return FSCom.open(filename, FILE_O_WRITE); #endif - if (!fullAtomic) + if (!fullAtomic) { FSCom.remove(filename); // Nuke the old file to make space (ignore if it !exists) + } String filenameTmp = filename; filenameTmp += ".tmp"; + // FIXME: If we are doing a full atomic write, we may need to remove the old tmp file now + // if (fullAtomic) { + // FSCom.remove(filename); + // } + // clear any previous LFS errors return FSCom.open(filenameTmp.c_str(), FILE_O_WRITE); } diff --git a/src/mesh/MeshService.cpp b/src/mesh/MeshService.cpp index 3bb1f2776..f293559ad 100644 --- a/src/mesh/MeshService.cpp +++ b/src/mesh/MeshService.cpp @@ -125,17 +125,15 @@ void MeshService::loop() } /// The radioConfig object just changed, call this to force the hw to change to the new settings -bool MeshService::reloadConfig(int saveWhat) +void MeshService::reloadConfig(int saveWhat) { // If we can successfully set this radio to these settings, save them to disk // This will also update the region as needed - bool didReset = nodeDB->resetRadioConfig(); // Don't let the phone send us fatally bad settings + nodeDB->resetRadioConfig(); // Don't let the phone send us fatally bad settings configChanged.notifyObservers(NULL); // This will cause radio hardware to change freqs etc nodeDB->saveToDisk(saveWhat); - - return didReset; } /// The owner User record just got updated, update our node DB and broadcast the info into the mesh diff --git a/src/mesh/MeshService.h b/src/mesh/MeshService.h index 42f701d5c..e2e430c03 100644 --- a/src/mesh/MeshService.h +++ b/src/mesh/MeshService.h @@ -118,7 +118,7 @@ class MeshService /** The radioConfig object just changed, call this to force the hw to change to the new settings * @return true if client devices should be sent a new set of radio configs */ - bool reloadConfig(int saveWhat = SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS); + void reloadConfig(int saveWhat = SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS); /// The owner User record just got updated, update our node DB and broadcast the info into the mesh void reloadOwner(bool shouldSave = true); diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 62ab675bc..b40c7153a 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -400,18 +400,12 @@ bool isBroadcast(uint32_t dest) return dest == NODENUM_BROADCAST || dest == NODENUM_BROADCAST_NO_LORA; } -bool NodeDB::resetRadioConfig(bool factory_reset, bool is_fresh_install) +void NodeDB::resetRadioConfig(bool is_fresh_install) { - bool didFactoryReset = false; - if (is_fresh_install) { radioGeneration++; } - if (factory_reset) { - didFactoryReset = factoryReset(); - } - if (channelFile.channels_count != MAX_NUM_CHANNELS) { LOG_INFO("Set default channel and radio preferences!"); @@ -422,14 +416,6 @@ bool NodeDB::resetRadioConfig(bool factory_reset, bool is_fresh_install) // Update the global myRegion initRegion(); - - if (didFactoryReset) { - LOG_INFO("Reboot due to factory reset"); - screen->startAlert("Rebooting..."); - rebootAtMsec = millis() + (5 * 1000); - } - - return didFactoryReset; } bool NodeDB::factoryReset(bool eraseBleBonds) @@ -591,7 +577,7 @@ void NodeDB::installDefaultConfig(bool preserveKey = false) config.device.node_info_broadcast_secs = default_node_info_broadcast_secs; config.security.serial_enabled = true; config.security.admin_channel_enabled = false; - resetRadioConfig(false, true); // This also triggers NodeInfo/Position requests since we're fresh + resetRadioConfig(true); // This also triggers NodeInfo/Position requests since we're fresh strncpy(config.network.ntp_server, "meshtastic.pool.ntp.org", 32); #if (defined(T_DECK) || defined(T_WATCH_S3) || defined(UNPHONE) || defined(PICOMPUTER_S3) || defined(SENSECAP_INDICATOR)) && \ diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index 25f1e9083..a31f33250 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -103,7 +103,7 @@ class NodeDB * @param is_fresh_install set to true after a fresh install, to trigger NodeInfo/Position requests * @return true if the config was completely reset, in that case, we should send it back to the client */ - bool resetRadioConfig(bool factory_reset = false, bool is_fresh_install = false); + void resetRadioConfig(bool is_fresh_install = false); /// given a subpacket sniffed from the network, update our DB state /// we updateGUI and updateGUIforNode if we think our this change is big enough for a redraw diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index 36f4a5342..2e50c0168 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -656,7 +656,7 @@ size_t RadioInterface::beginSending(meshtastic_MeshPacket *p) // if the sender nodenum is zero, that means uninitialized assert(radioBuffer.header.from); - + assert(p->encrypted.size <= sizeof(radioBuffer.payload)); memcpy(radioBuffer.payload, p->encrypted.bytes, p->encrypted.size); sendingPacket = p; diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index 9e1e41d53..9503109db 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -198,6 +198,14 @@ ErrorCode Router::sendLocal(meshtastic_MeshPacket *p, RxSource src) return send(p); } } +/** + * Send a packet on a suitable interface. + */ +ErrorCode Router::rawSend(meshtastic_MeshPacket *p) +{ + assert(iface); // This should have been detected already in sendLocal (or we just received a packet from outside) + return iface->send(p); +} /** * Send a packet on a suitable interface. This routine will @@ -319,27 +327,27 @@ void Router::sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Rout // FIXME, update nodedb here for any packet that passes through us } -bool perhapsDecode(meshtastic_MeshPacket *p) +DecodeState perhapsDecode(meshtastic_MeshPacket *p) { concurrency::LockGuard g(cryptLock); if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER && config.device.rebroadcast_mode == meshtastic_Config_DeviceConfig_RebroadcastMode_ALL_SKIP_DECODING) - return false; + return DecodeState::DECODE_FAILURE; if (config.device.rebroadcast_mode == meshtastic_Config_DeviceConfig_RebroadcastMode_KNOWN_ONLY && (nodeDB->getMeshNode(p->from) == NULL || !nodeDB->getMeshNode(p->from)->has_user)) { LOG_DEBUG("Node 0x%x not in nodeDB-> Rebroadcast mode KNOWN_ONLY will ignore packet", p->from); - return false; + return DecodeState::DECODE_FAILURE; } if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) - return true; // If packet was already decoded just return + return DecodeState::DECODE_SUCCESS; // If packet was already decoded just return size_t rawSize = p->encrypted.size; if (rawSize > sizeof(bytes)) { LOG_ERROR("Packet too large to attempt decryption! (rawSize=%d > 256)", rawSize); - return false; + return DecodeState::DECODE_FATAL; } bool decrypted = false; ChannelIndex chIndex = 0; @@ -353,18 +361,22 @@ bool perhapsDecode(meshtastic_MeshPacket *p) if (crypto->decryptCurve25519(p->from, nodeDB->getMeshNode(p->from)->user.public_key, p->id, rawSize, p->encrypted.bytes, bytes)) { LOG_INFO("PKI Decryption worked!"); - memset(&p->decoded, 0, sizeof(p->decoded)); + + meshtastic_Data decodedtmp; + memset(&decodedtmp, 0, sizeof(decodedtmp)); rawSize -= MESHTASTIC_PKC_OVERHEAD; - if (pb_decode_from_bytes(bytes, rawSize, &meshtastic_Data_msg, &p->decoded) && - p->decoded.portnum != meshtastic_PortNum_UNKNOWN_APP) { + if (pb_decode_from_bytes(bytes, rawSize, &meshtastic_Data_msg, &decodedtmp) && + decodedtmp.portnum != meshtastic_PortNum_UNKNOWN_APP) { decrypted = true; LOG_INFO("Packet decrypted using PKI!"); p->pki_encrypted = true; memcpy(&p->public_key.bytes, nodeDB->getMeshNode(p->from)->user.public_key.bytes, 32); p->public_key.size = 32; + memcpy(&p->decoded, &decodedtmp, sizeof(meshtastic_Data_msg)); + p->which_payload_variant = meshtastic_MeshPacket_decoded_tag; // change type to decoded } else { LOG_ERROR("PKC Decrypted, but pb_decode failed!"); - return false; + return DecodeState::DECODE_FAILURE; } } else { LOG_WARN("PKC decrypt attempted but failed!"); @@ -387,12 +399,15 @@ bool perhapsDecode(meshtastic_MeshPacket *p) // printBytes("plaintext", bytes, p->encrypted.size); // Take those raw bytes and convert them back into a well structured protobuf we can understand - memset(&p->decoded, 0, sizeof(p->decoded)); - if (!pb_decode_from_bytes(bytes, rawSize, &meshtastic_Data_msg, &p->decoded)) { + meshtastic_Data decodedtmp; + memset(&decodedtmp, 0, sizeof(decodedtmp)); + if (!pb_decode_from_bytes(bytes, rawSize, &meshtastic_Data_msg, &decodedtmp)) { LOG_ERROR("Invalid protobufs in received mesh packet id=0x%08x (bad psk?)!", p->id); - } else if (p->decoded.portnum == meshtastic_PortNum_UNKNOWN_APP) { + } else if (decodedtmp.portnum == meshtastic_PortNum_UNKNOWN_APP) { LOG_ERROR("Invalid portnum (bad psk?)!"); } else { + p->decoded = decodedtmp; + p->which_payload_variant = meshtastic_MeshPacket_decoded_tag; // change type to decoded decrypted = true; break; } @@ -401,8 +416,7 @@ bool perhapsDecode(meshtastic_MeshPacket *p) } if (decrypted) { // parsing was successful - p->which_payload_variant = meshtastic_MeshPacket_decoded_tag; // change type to decoded - p->channel = chIndex; // change to store the index instead of the hash + p->channel = chIndex; // change to store the index instead of the hash if (p->decoded.has_bitfield) p->decoded.want_response |= p->decoded.bitfield & BITFIELD_WANT_RESPONSE_MASK; @@ -434,10 +448,10 @@ bool perhapsDecode(meshtastic_MeshPacket *p) LOG_TRACE("%s", MeshPacketSerializer::JsonSerialize(p, false).c_str()); } #endif - return true; + return DecodeState::DECODE_SUCCESS; } else { LOG_WARN("No suitable channel found for decoding, hash was 0x%x!", p->channel); - return false; + return DecodeState::DECODE_FAILURE; } } @@ -592,8 +606,13 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src) meshtastic_MeshPacket *p_encrypted = packetPool.allocCopy(*p); // Take those raw bytes and convert them back into a well structured protobuf we can understand - bool decoded = perhapsDecode(p); - if (decoded) { + auto decodedState = perhapsDecode(p); + if (decodedState == DecodeState::DECODE_FATAL) { + // Fatal decoding error, we can't do anything with this packet + LOG_WARN("Fatal decode error, dropping packet"); + cancelSending(p->from, p->id); + skipHandle = true; + } else if (decodedState == DecodeState::DECODE_SUCCESS) { // parsing was successful, queue for our recipient if (src == RX_SRC_LOCAL) printPacket("handleReceived(LOCAL)", p); @@ -636,10 +655,12 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src) #if !MESHTASTIC_EXCLUDE_MQTT // Mark as pki_encrypted if it is not yet decoded and MQTT encryption is also enabled, hash matches and it's a DM not to // us (because we would be able to decrypt it) - if (!decoded && moduleConfig.mqtt.encryption_enabled && p->channel == 0x00 && !isBroadcast(p->to) && !isToUs(p)) + if (decodedState == DecodeState::DECODE_FAILURE && moduleConfig.mqtt.encryption_enabled && p->channel == 0x00 && + !isBroadcast(p->to) && !isToUs(p)) p_encrypted->pki_encrypted = true; // After potentially altering it, publish received message to MQTT if we're not the original transmitter of the packet - if ((decoded || p_encrypted->pki_encrypted) && moduleConfig.mqtt.enabled && !isFromUs(p) && mqtt) + if ((decodedState == DecodeState::DECODE_SUCCESS || p_encrypted->pki_encrypted) && moduleConfig.mqtt.enabled && + !isFromUs(p) && mqtt) mqtt->onSend(*p_encrypted, *p, p->channel); #endif } diff --git a/src/mesh/Router.h b/src/mesh/Router.h index bf6b77226..58ca50f3d 100644 --- a/src/mesh/Router.h +++ b/src/mesh/Router.h @@ -85,6 +85,7 @@ class Router : protected concurrency::OSThread, protected PacketHistory * NOTE: This method will free the provided packet (even if we return an error code) */ virtual ErrorCode send(meshtastic_MeshPacket *p); + virtual ErrorCode rawSend(meshtastic_MeshPacket *p); /* Statistics for the amount of duplicate received packets and the amount of times we cancel a relay because someone did it before us */ @@ -139,12 +140,14 @@ class Router : protected concurrency::OSThread, protected PacketHistory void abortSendAndNak(meshtastic_Routing_Error err, meshtastic_MeshPacket *p); }; +enum DecodeState { DECODE_SUCCESS, DECODE_FAILURE, DECODE_FATAL }; + /** FIXME - move this into a mesh packet class * Remove any encryption and decode the protobufs inside this packet (if necessary). * * @return true for success, false for corrupt packet. */ -bool perhapsDecode(meshtastic_MeshPacket *p); +DecodeState perhapsDecode(meshtastic_MeshPacket *p); /** Return 0 for success or a Routing_Error code for failure */ diff --git a/src/modules/RoutingModule.cpp b/src/modules/RoutingModule.cpp index 34ef2ddd1..e7e92c79a 100644 --- a/src/modules/RoutingModule.cpp +++ b/src/modules/RoutingModule.cpp @@ -46,11 +46,6 @@ meshtastic_MeshPacket *RoutingModule::allocReply() return NULL; assert(currentRequest); - // We only consider making replies if the request was a legit routing packet (not just something we were sniffing) - if (currentRequest->decoded.portnum == meshtastic_PortNum_ROUTING_APP) { - assert(0); // 1.2 refactoring fixme, Not sure if anything needs this yet? - // return allocDataProtobuf(u); - } return NULL; } diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 226bee44d..799f953b4 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -117,7 +117,8 @@ inline void onReceiveProto(char *topic, byte *payload, size_t length) // likely they discovered each other via a channel we have downlink enabled for if (isToUs(p.get()) || (tx && tx->has_user && rx && rx->has_user)) router->enqueueReceivedMessage(p.release()); - } else if (router && perhapsDecode(p.get())) // ignore messages if we don't have the channel key + } else if (router && + perhapsDecode(p.get()) == DecodeState::DECODE_SUCCESS) // ignore messages if we don't have the channel key router->enqueueReceivedMessage(p.release()); } From 64b9cfe1994a6fb17743e3d17c558c6f7b214d3b Mon Sep 17 00:00:00 2001 From: dylanli Date: Sun, 16 Mar 2025 23:04:24 +0800 Subject: [PATCH 280/381] update seeed-xiao-nrf52840-kit board defination (#6318) - Due to the lack of pins, we have temporarily removed the button. There are some technical solutions that can solve this problem, and we are currently exploring and researching them --- variants/seeed_xiao_nrf52840_kit/variant.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/variants/seeed_xiao_nrf52840_kit/variant.h b/variants/seeed_xiao_nrf52840_kit/variant.h index eae5e04fd..9d6345f0a 100644 --- a/variants/seeed_xiao_nrf52840_kit/variant.h +++ b/variants/seeed_xiao_nrf52840_kit/variant.h @@ -57,11 +57,15 @@ extern "C" { #define D9 (9ul) #define D10 (10ul) +/*Due to the lack of pins,and have to make sure gps standby work well we have temporarily removed the button. +There are some technical solutions that can solve this problem, +and we are currently exploring and researching them*/ + +// #define BUTTON_PIN D0 // This is the Program Button +// // #define BUTTON_NEED_PULLUP 1 +// #define BUTTON_ACTIVE_LOW true +// #define BUTTON_ACTIVE_PULLUP false -#define BUTTON_PIN D0 // This is the Program Button -// #define BUTTON_NEED_PULLUP 1 -#define BUTTON_ACTIVE_LOW true -#define BUTTON_ACTIVE_PULLUP false /* * Analog pins */ @@ -135,14 +139,14 @@ static const uint8_t SCL = PIN_WIRE_SCL; // GPS L76KB #define GPS_L76K #ifdef GPS_L76K -#define PIN_GPS_RX 32+12 // 44 -#define PIN_GPS_TX 32+11 // 43 +#define PIN_GPS_RX D6 +#define PIN_GPS_TX D7 #define HAS_GPS 1 #define GPS_BAUDRATE 9600 #define GPS_THREAD_INTERVAL 50 #define PIN_SERIAL1_RX PIN_GPS_TX #define PIN_SERIAL1_TX PIN_GPS_RX -#define PIN_GPS_STANDBY 2 +#define PIN_GPS_STANDBY D0 #endif From 2525111c39cd5081d794f3ebabaae2310395fc66 Mon Sep 17 00:00:00 2001 From: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com> Date: Sun, 16 Mar 2025 11:15:33 -0400 Subject: [PATCH 281/381] E-ink partial refresh limitation removed for free text screen (#6201) --- src/graphics/EInkDynamicDisplay.cpp | 8 ++++++++ src/graphics/EInkDynamicDisplay.h | 5 +++++ src/modules/CannedMessageModule.cpp | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/src/graphics/EInkDynamicDisplay.cpp b/src/graphics/EInkDynamicDisplay.cpp index 47012ca47..4a062cf7e 100644 --- a/src/graphics/EInkDynamicDisplay.cpp +++ b/src/graphics/EInkDynamicDisplay.cpp @@ -324,6 +324,14 @@ void EInkDynamicDisplay::checkConsecutiveFastRefreshes() if (refresh != UNSPECIFIED) return; + // Bypass limit if UNLIMITED_FAST mode is active + if (frameFlags & UNLIMITED_FAST) { + refresh = FAST; + reason = NO_OBJECTIONS; + LOG_DEBUG("refresh=FAST, reason=UNLIMITED_FAST_MODE_ACTIVE, frameFlags=0x%x", frameFlags); + return; + } + // If too many FAST refreshes consecutively - force a FULL refresh if (fastRefreshCount >= EINK_LIMIT_FASTREFRESH) { refresh = FULL; diff --git a/src/graphics/EInkDynamicDisplay.h b/src/graphics/EInkDynamicDisplay.h index 9e131dca7..d5e29e3f0 100644 --- a/src/graphics/EInkDynamicDisplay.h +++ b/src/graphics/EInkDynamicDisplay.h @@ -23,6 +23,10 @@ class EInkDynamicDisplay : public EInkDisplay, protected concurrency::NotifiedWo EInkDynamicDisplay(uint8_t address, int sda, int scl, OLEDDISPLAY_GEOMETRY geometry, HW_I2C i2cBus); ~EInkDynamicDisplay(); + // Methods to enable or disable unlimited fast refresh mode + void enableUnlimitedFastMode() { addFrameFlag(UNLIMITED_FAST); } + void disableUnlimitedFastMode() { frameFlags = (frameFlagTypes)(frameFlags & ~UNLIMITED_FAST); } + // What kind of frame is this enum frameFlagTypes : uint8_t { BACKGROUND = (1 << 0), // For frames via display() @@ -30,6 +34,7 @@ class EInkDynamicDisplay : public EInkDisplay, protected concurrency::NotifiedWo COSMETIC = (1 << 2), // For splashes DEMAND_FAST = (1 << 3), // Special case only BLOCKING = (1 << 4), // Modifier - block while refresh runs + UNLIMITED_FAST = (1 << 5) }; void addFrameFlag(frameFlagTypes flag); diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index 5fb32fff5..5f623720a 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -1057,6 +1057,11 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st display->drawString(10 + x, 0 + y + FONT_HEIGHT_SMALL, "Canned Message\nModule disabled."); } else if (cannedMessageModule->runState == CANNED_MESSAGE_RUN_STATE_FREETEXT) { requestFocus(); // Tell Screen::setFrames to move to our module's frame +#if defined(USE_EINK) && defined(USE_EINK_DYNAMICDISPLAY) + EInkDynamicDisplay* einkDisplay = static_cast(display); + einkDisplay->enableUnlimitedFastMode(); // Enable unlimited fast refresh while typing +#endif + #if defined(USE_VIRTUAL_KEYBOARD) drawKeyboard(display, state, 0, 0); #else From 2d565c292106a87ebb4b7d022a52f297b0bda41b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sun, 16 Mar 2025 16:18:12 +0100 Subject: [PATCH 282/381] trunk'd --- .trunk/trunk.yaml | 6 +++--- src/graphics/EInkDynamicDisplay.cpp | 2 +- src/modules/CannedMessageModule.cpp | 4 ++-- variants/seeed_xiao_nrf52840_kit/variant.cpp | 5 +---- variants/seeed_xiao_nrf52840_kit/variant.h | 21 +++++++------------- 5 files changed, 14 insertions(+), 24 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index b42e2be31..b0561679a 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -9,14 +9,14 @@ plugins: lint: enabled: - prettier@3.5.3 - - trufflehog@3.88.16 + - trufflehog@3.88.17 - yamllint@1.36.0 - bandit@1.8.3 - - checkov@3.2.384 + - checkov@3.2.386 - terrascan@1.19.9 - trivy@0.60.0 - taplo@0.9.3 - - ruff@0.9.10 + - ruff@0.10.0 - isort@6.0.1 - markdownlint@0.44.0 - oxipng@9.1.4 diff --git a/src/graphics/EInkDynamicDisplay.cpp b/src/graphics/EInkDynamicDisplay.cpp index 4a062cf7e..8e4adf87e 100644 --- a/src/graphics/EInkDynamicDisplay.cpp +++ b/src/graphics/EInkDynamicDisplay.cpp @@ -331,7 +331,7 @@ void EInkDynamicDisplay::checkConsecutiveFastRefreshes() LOG_DEBUG("refresh=FAST, reason=UNLIMITED_FAST_MODE_ACTIVE, frameFlags=0x%x", frameFlags); return; } - + // If too many FAST refreshes consecutively - force a FULL refresh if (fastRefreshCount >= EINK_LIMIT_FASTREFRESH) { refresh = FULL; diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index 5f623720a..2a5ec00ab 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -1058,8 +1058,8 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st } else if (cannedMessageModule->runState == CANNED_MESSAGE_RUN_STATE_FREETEXT) { requestFocus(); // Tell Screen::setFrames to move to our module's frame #if defined(USE_EINK) && defined(USE_EINK_DYNAMICDISPLAY) - EInkDynamicDisplay* einkDisplay = static_cast(display); - einkDisplay->enableUnlimitedFastMode(); // Enable unlimited fast refresh while typing + EInkDynamicDisplay *einkDisplay = static_cast(display); + einkDisplay->enableUnlimitedFastMode(); // Enable unlimited fast refresh while typing #endif #if defined(USE_VIRTUAL_KEYBOARD) diff --git a/variants/seeed_xiao_nrf52840_kit/variant.cpp b/variants/seeed_xiao_nrf52840_kit/variant.cpp index f7e175f2d..22072312a 100644 --- a/variants/seeed_xiao_nrf52840_kit/variant.cpp +++ b/variants/seeed_xiao_nrf52840_kit/variant.cpp @@ -1,8 +1,8 @@ #include "variant.h" +#include "configuration.h" #include "nrf.h" #include "wiring_constants.h" #include "wiring_digital.h" -#include "configuration.h" #include #include #include @@ -58,8 +58,6 @@ const uint32_t g_ADigitalPinMap[] = { 31, // D32 is P0.10 (VBAT) }; - - /* Copyright (c) 2014-2015 Arduino LLC. All right reserved. Copyright (c) 2016 Sandeep Mistry All right reserved. @@ -80,7 +78,6 @@ const uint32_t g_ADigitalPinMap[] = { Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - void initVariant() { // LED1 & LED2 diff --git a/variants/seeed_xiao_nrf52840_kit/variant.h b/variants/seeed_xiao_nrf52840_kit/variant.h index 9d6345f0a..20362cb52 100644 --- a/variants/seeed_xiao_nrf52840_kit/variant.h +++ b/variants/seeed_xiao_nrf52840_kit/variant.h @@ -43,7 +43,6 @@ extern "C" { * Buttons */ - // Digital PINs #define D0 (0ul) #define D1 (1ul) @@ -57,8 +56,8 @@ extern "C" { #define D9 (9ul) #define D10 (10ul) -/*Due to the lack of pins,and have to make sure gps standby work well we have temporarily removed the button. -There are some technical solutions that can solve this problem, +/*Due to the lack of pins,and have to make sure gps standby work well we have temporarily removed the button. +There are some technical solutions that can solve this problem, and we are currently exploring and researching them*/ // #define BUTTON_PIN D0 // This is the Program Button @@ -86,7 +85,6 @@ static const uint8_t A4 = PIN_A4; static const uint8_t A5 = PIN_A5; #define ADC_RESOLUTION 12 - #define PIN_SERIAL2_RX (-1) #define PIN_SERIAL2_TX (-1) @@ -99,7 +97,6 @@ static const uint8_t A5 = PIN_A5; #define PIN_SPI_MOSI (10) #define PIN_SPI_SCK (8) - static const uint8_t SS = D4; static const uint8_t MOSI = PIN_SPI_MOSI; static const uint8_t MISO = PIN_SPI_MISO; @@ -117,29 +114,27 @@ static const uint8_t SCK = PIN_SPI_SCK; #define SX126X_TXEN RADIOLIB_NC - #define SX126X_RXEN D4 -#define SX126X_DIO2_AS_RF_SWITCH // DIO2 is used to control the RF switch really necessary!!! +#define SX126X_DIO2_AS_RF_SWITCH // DIO2 is used to control the RF switch really necessary!!! #define SX126X_DIO3_TCXO_VOLTAGE 1.8 /* * Wire Interfaces */ -#define I2C_NO_RESCAN // I2C is a bit finicky, don't scan too much +#define I2C_NO_RESCAN // I2C is a bit finicky, don't scan too much #define WIRE_INTERFACES_COUNT 1 // 2 -#define PIN_WIRE_SDA (24) //change to use the correct pins if needed -#define PIN_WIRE_SCL (25) //change to use the correct pins if needed +#define PIN_WIRE_SDA (24) // change to use the correct pins if needed +#define PIN_WIRE_SCL (25) // change to use the correct pins if needed static const uint8_t SDA = PIN_WIRE_SDA; static const uint8_t SCL = PIN_WIRE_SCL; - // GPS L76KB #define GPS_L76K #ifdef GPS_L76K -#define PIN_GPS_RX D6 +#define PIN_GPS_RX D6 #define PIN_GPS_TX D7 #define HAS_GPS 1 #define GPS_BAUDRATE 9600 @@ -149,8 +144,6 @@ static const uint8_t SCL = PIN_WIRE_SCL; #define PIN_GPS_STANDBY D0 #endif - - // Battery #define BAT_READ \ From 96ba94843b25f787148e3353a7476ed175518b3b Mon Sep 17 00:00:00 2001 From: Jorropo Date: Mon, 17 Mar 2025 01:36:02 +0100 Subject: [PATCH 283/381] Send UDP packets to multicast address rather than broadcast address (#6331) A smart router or switch is able to snoop the multicast address to only send the packets to nodes listening on the multicast address. Before all machines reachable on the L2 layer would receive the packet. --- src/mesh/udp/UdpMulticastThread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/udp/UdpMulticastThread.h b/src/mesh/udp/UdpMulticastThread.h index 69b1d2282..675d4ce15 100644 --- a/src/mesh/udp/UdpMulticastThread.h +++ b/src/mesh/udp/UdpMulticastThread.h @@ -56,7 +56,7 @@ class UdpMulticastThread : public concurrency::OSThread LOG_DEBUG("Broadcasting packet over UDP (id=%u)", mp->id); uint8_t buffer[meshtastic_MeshPacket_size]; size_t encodedLength = pb_encode_to_bytes(buffer, sizeof(buffer), &meshtastic_MeshPacket_msg, mp); - udp.broadcastTo(buffer, encodedLength, UDP_MULTICAST_DEFAUL_PORT); + udp.writeTo(buffer, encodedLength, udpIpAddress, UDP_MULTICAST_DEFAUL_PORT); return true; } From af8b64e84ee60175d7a0e43c6c3458e3a3558708 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Mon, 17 Mar 2025 01:36:33 +0100 Subject: [PATCH 284/381] pass pointer to UDP multicast packet to protobuf decoder (#6333) The packet.readBytes API is not available on all targets: - RP2040 & RP2340 - yet to be written portduino API Instead pass the data buffer as-is. It also removes a memcpy which do not need to exists. I've tested it successfully on a tbeam. Co-authored-by: Ben Meadors --- src/mesh/udp/UdpMulticastThread.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mesh/udp/UdpMulticastThread.h b/src/mesh/udp/UdpMulticastThread.h index 675d4ce15..e5eb28d00 100644 --- a/src/mesh/udp/UdpMulticastThread.h +++ b/src/mesh/udp/UdpMulticastThread.h @@ -35,10 +35,8 @@ class UdpMulticastThread : public concurrency::OSThread size_t packetLength = packet.length(); LOG_DEBUG("UDP broadcast from: %s, len=%u", packet.remoteIP().toString().c_str(), packetLength); meshtastic_MeshPacket mp; - uint8_t bytes[meshtastic_MeshPacket_size]; // Allocate buffer for the data - size_t packetSize = packet.readBytes(bytes, packet.length()); - LOG_DEBUG("Decoding MeshPacket from UDP len=%u", packetSize); - bool isPacketDecoded = pb_decode_from_bytes(bytes, packetLength, &meshtastic_MeshPacket_msg, &mp); + LOG_DEBUG("Decoding MeshPacket from UDP len=%u", packetLength); + bool isPacketDecoded = pb_decode_from_bytes(packet.data(), packetLength, &meshtastic_MeshPacket_msg, &mp); if (isPacketDecoded && router) { UniquePacketPoolPacket p = packetPool.allocUniqueCopy(mp); // Unset received SNR/RSSI From 9cc13e628a4960e71d700d03629c2752945fbccb Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 17 Mar 2025 19:24:47 -0500 Subject: [PATCH 285/381] Stubbed out backup / restore methods for now and fixed bug --- src/mesh/NodeDB.cpp | 88 +++++++++++++++++++++++++++++++++++++ src/mesh/NodeDB.h | 8 +++- src/mesh/Router.cpp | 2 +- src/modules/AdminModule.cpp | 36 +++++++++++++++ 4 files changed, 132 insertions(+), 2 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index b40c7153a..e8efa7566 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -1598,6 +1598,94 @@ UserLicenseStatus NodeDB::getLicenseStatus(uint32_t nodeNum) return info->user.is_licensed ? UserLicenseStatus::Licensed : UserLicenseStatus::NotLicensed; } +bool NodeDB::backupPreferences(meshtastic_AdminMessage_BackupLocation location) +{ + bool success = false; + lastBackupAttempt = millis(); +#ifdef FSCom + if (location == meshtastic_AdminMessage_BackupLocation_FLASH) { + meshtastic_BackupPreferences backup = meshtastic_BackupPreferences_init_zero; + backup.version = DEVICESTATE_CUR_VER; + backup.timestamp = getValidTime(RTCQuality::RTCQualityDevice, false); + backup.has_config = true; + backup.config = config; + backup.has_module_config = true; + backup.module_config = moduleConfig; + backup.has_channels = true; + backup.channels = channelFile; + backup.has_owner = true; + backup.owner = owner; + + size_t backupSize; + pb_get_encoded_size(&backupSize, meshtastic_BackupPreferences_fields, &backup); + + spiLock->lock(); + FSCom.mkdir("/backups"); + spiLock->unlock(); + success = saveProto(backupFileName, backupSize, &meshtastic_BackupPreferences_msg, &backup); + + if (success) { + LOG_INFO("Saved backup preferences"); + } else { + LOG_ERROR("Failed to save backup preferences to file"); + } + } else if (location == meshtastic_AdminMessage_BackupLocation_SD) { + // TODO: After more mainline SD card support + } +#endif + return success; +} + +bool NodeDB::restorePreferences(meshtastic_AdminMessage_BackupLocation location, int restoreWhat) +{ + bool success = false; +#ifdef FSCom + if (location == meshtastic_AdminMessage_BackupLocation_FLASH) { + spiLock->lock(); + if (!FSCom.exists(backupFileName)) { + spiLock->unlock(); + LOG_WARN("Could not restore. No backup file found"); + return false; + } else { + spiLock->unlock(); + } + meshtastic_BackupPreferences backup = meshtastic_BackupPreferences_init_zero; + success = loadProto(backupFileName, meshtastic_BackupPreferences_size, sizeof(meshtastic_BackupPreferences), + &meshtastic_BackupPreferences_msg, &backup); + if (success) { + if (restoreWhat & SEGMENT_CONFIG) { + config = backup.config; + LOG_DEBUG("Restored config"); + } + if (restoreWhat & SEGMENT_MODULECONFIG) { + moduleConfig = backup.module_config; + LOG_DEBUG("Restored module config"); + } + if (restoreWhat & SEGMENT_DEVICESTATE) { + devicestate.owner = backup.owner; + LOG_DEBUG("Restored device state"); + } + if (restoreWhat & SEGMENT_CHANNELS) { + channelFile = backup.channels; + LOG_DEBUG("Restored channels"); + } + + success = saveToDisk(restoreWhat); + if (success) { + LOG_INFO("Restored preferences from backup"); + } else { + LOG_ERROR("Failed to save restored preferences to flash"); + } + } else { + LOG_ERROR("Failed to restore preferences from backup file"); + } + } else if (location == meshtastic_AdminMessage_BackupLocation_SD) { + // TODO: After more mainline SD card support + } + return success; +#endif +} + /// Record an error that should be reported via analytics void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, const char *filename) { diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index a31f33250..291c3804b 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -48,6 +48,7 @@ static constexpr const char *configFileName = "/prefs/config.proto"; static constexpr const char *uiconfigFileName = "/prefs/uiconfig.proto"; static constexpr const char *moduleConfigFileName = "/prefs/module.proto"; static constexpr const char *channelFileName = "/prefs/channels.proto"; +static constexpr const char *backupFileName = "/backups/backup.proto"; /// Given a node, return how many seconds in the past (vs now) that we last heard from it uint32_t sinceLastSeen(const meshtastic_NodeInfoLite *n); @@ -202,8 +203,13 @@ class NodeDB bool hasValidPosition(const meshtastic_NodeInfoLite *n); + bool backupPreferences(meshtastic_AdminMessage_BackupLocation location); + bool restorePreferences(meshtastic_AdminMessage_BackupLocation location, + int restoreWhat = SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS); + private: - uint32_t lastNodeDbSave = 0; // when we last saved our db to flash + uint32_t lastNodeDbSave = 0; // when we last saved our db to flash + uint32_t lastBackupAttempt = 0; // when we last tried a backup automatically or manually /// Find a node in our DB, create an empty NodeInfoLite if missing meshtastic_NodeInfoLite *getOrCreateMeshNode(NodeNum n); diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index 9503109db..992f38ff4 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -372,7 +372,7 @@ DecodeState perhapsDecode(meshtastic_MeshPacket *p) p->pki_encrypted = true; memcpy(&p->public_key.bytes, nodeDB->getMeshNode(p->from)->user.public_key.bytes, 32); p->public_key.size = 32; - memcpy(&p->decoded, &decodedtmp, sizeof(meshtastic_Data_msg)); + p->decoded = decodedtmp; p->which_payload_variant = meshtastic_MeshPacket_decoded_tag; // change type to decoded } else { LOG_ERROR("PKC Decrypted, but pb_decode failed!"); diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index a765fb0b1..ae25ea3fc 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -370,6 +370,42 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta LOG_DEBUG("Failed to delete file"); } spiLock->unlock(); +#endif + break; + } + case meshtastic_AdminMessage_backup_preferences_tag: { + LOG_INFO("Client requesting to backup preferences"); + if (nodeDB->backupPreferences(r->backup_preferences)) { + myReply = allocErrorResponse(meshtastic_Routing_Error_NONE, &mp); + } else { + myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp); + } + break; + } + case meshtastic_AdminMessage_restore_preferences_tag: { + LOG_INFO("Client requesting to restore preferences"); + if (nodeDB->restorePreferences(r->backup_preferences, + SEGMENT_DEVICESTATE | SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_CHANNELS)) { + myReply = allocErrorResponse(meshtastic_Routing_Error_NONE, &mp); + LOG_DEBUG("Rebooting after successful restore of preferences"); + reboot(1000); + disableBluetooth(); + } else { + myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp); + } + break; + } + case meshtastic_AdminMessage_remove_backup_preferences_tag: { + LOG_INFO("Client requesting to remove backup preferences"); +#ifdef FSCom + if (r->remove_backup_preferences == meshtastic_AdminMessage_BackupLocation_FLASH) { + spiLock->lock(); + FSCom.remove(backupFileName); + spiLock->unlock(); + } else if (r->remove_backup_preferences == meshtastic_AdminMessage_BackupLocation_SD) { + // TODO: After more mainline SD card support + LOG_ERROR("SD backup removal not implemented yet"); + } #endif break; } From 2876eec7ed9004271115495063151a028c0777e8 Mon Sep 17 00:00:00 2001 From: Austin Date: Mon, 17 Mar 2025 21:14:01 -0400 Subject: [PATCH 286/381] MeshToad - USB 1W 'MeshStick' (#6339) --- bin/config.d/lora-usb-meshtoad-e22.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 bin/config.d/lora-usb-meshtoad-e22.yaml diff --git a/bin/config.d/lora-usb-meshtoad-e22.yaml b/bin/config.d/lora-usb-meshtoad-e22.yaml new file mode 100644 index 000000000..b6cb61c6b --- /dev/null +++ b/bin/config.d/lora-usb-meshtoad-e22.yaml @@ -0,0 +1,17 @@ +Lora: + Module: sx1262 + CS: 0 + IRQ: 6 + Reset: 2 + Busy: 4 + RXen: 1 + DIO2_AS_RF_SWITCH: true + DIO3_TCXO_VOLTAGE: true + spidev: ch341 + USB_PID: 0x5512 + USB_VID: 0x1A86 + # Optional: Reduce power to 10 dBm to + # avoid over-drawing the USB port + # SX126X_MAX_POWER: 10 + # Optional: Set the serial number for multi-radio support + # USB_Serialnum: 13374201 From 8efc9702d34fb579f22ae8e782949ef47340e348 Mon Sep 17 00:00:00 2001 From: Kalle Lilja <15094562+ThatKalle@users.noreply.github.com> Date: Tue, 18 Mar 2025 02:16:16 +0100 Subject: [PATCH 287/381] device-install/update: fix esptool --port (#6341) * fix errorlevel check * add esptool --port if supplied * match device-install * add --port if supplied * update logmessage * bump version --------- Co-authored-by: Ben Meadors --- bin/device-install.bat | 5 +++-- bin/device-install.sh | 4 ++-- bin/device-update.bat | 11 ++++++----- bin/device-update.sh | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/bin/device-install.bat b/bin/device-install.bat index 926338464..7eb5c1b30 100755 --- a/bin/device-install.bat +++ b/bin/device-install.bat @@ -34,7 +34,7 @@ ECHO Example: %SCRIPT_NAME% -f firmware-unphone-2.6.0.0b106d4.bin -p COM11 --web GOTO eof :version -ECHO %SCRIPT_NAME% [Version 2.6.0] +ECHO %SCRIPT_NAME% [Version 2.6.1] ECHO Meshtastic GOTO eof @@ -106,7 +106,7 @@ IF NOT "__%PYTHON%__"=="____" ( CALL :LOG_MESSAGE DEBUG "Checking esptool command !ESPTOOL_CMD!..." !ESPTOOL_CMD! >nul 2>&1 -IF %ERRORLEVEL% GTR 2 ( +IF %ERRORLEVEL% GEQ 2 ( @REM esptool exits with code 1 if help is displayed. CALL :LOG_MESSAGE ERROR "esptool not found: !ESPTOOL_CMD!" EXIT /B 1 @@ -121,6 +121,7 @@ CALL :LOG_MESSAGE DEBUG "Using esptool command: !ESPTOOL_CMD!" IF "__!ESPTOOL_PORT!__" == "____" ( CALL :LOG_MESSAGE WARN "Using esptool port: UNSET." ) ELSE ( + SET "ESPTOOL_CMD=!ESPTOOL_CMD! --port !ESPTOOL_PORT!" CALL :LOG_MESSAGE INFO "Using esptool port: !ESPTOOL_PORT!." ) CALL :LOG_MESSAGE INFO "Using esptool baud: !ESPTOOL_BAUD!." diff --git a/bin/device-install.sh b/bin/device-install.sh index 61c72bc2e..56e1abdb2 100755 --- a/bin/device-install.sh +++ b/bin/device-install.sh @@ -42,8 +42,8 @@ while [ $# -gt 0 ]; do exit 0 ;; -p) - ESPTOOL_PORT="$2" - shift # Shift past the option argument + ESPTOOL_CMD="$ESPTOOL_CMD --port $2" + shift ;; -P) PYTHON="$2" diff --git a/bin/device-update.bat b/bin/device-update.bat index ecfeec187..d9a4bd19a 100755 --- a/bin/device-update.bat +++ b/bin/device-update.bat @@ -16,7 +16,7 @@ ECHO. ECHO Usage: %SCRIPT_NAME% -f filename [-p PORT] [-P python] ECHO. ECHO Options: -ECHO -f filename The .bin file to flash. Custom to your device type and region. (required) +ECHO -f filename The update .bin file to flash. Custom to your device type and region. (required) ECHO The file must be located in this current directory. ECHO -p PORT Set the environment variable for ESPTOOL_PORT. ECHO If not set, ESPTOOL iterates all ports (Dangerous). @@ -28,7 +28,7 @@ ECHO Example: %SCRIPT_NAME% -f firmware-t-deck-tft-2.6.0.0b106d4-update.bin -p C GOTO eof :version -ECHO %SCRIPT_NAME% [Version 2.6.0] +ECHO %SCRIPT_NAME% [Version 2.6.1] ECHO Meshtastic GOTO eof @@ -53,6 +53,7 @@ IF "__!FILENAME!__"=="____" ( CALL :LOG_MESSAGE DEBUG "Missing -f filename input." GOTO help ) ELSE ( + CALL :LOG_MESSAGE DEBUG "Filename: !FILENAME!" IF NOT "__!FILENAME: =!__"=="__!FILENAME!__" ( CALL :LOG_MESSAGE ERROR "Filename containing spaces are not supported." GOTO help @@ -62,7 +63,6 @@ IF "__!FILENAME!__"=="____" ( SET "FILENAME=!FILENAME:./=!" ) -CALL :LOG_MESSAGE DEBUG "Filename: !FILENAME!" CALL :LOG_MESSAGE DEBUG "Checking if !FILENAME! exists..." IF NOT EXIST !FILENAME! ( CALL :LOG_MESSAGE ERROR "File does not exist: !FILENAME!. Terminating." @@ -71,7 +71,7 @@ IF NOT EXIST !FILENAME! ( IF "!FILENAME:update=!"=="!FILENAME!" ( CALL :LOG_MESSAGE DEBUG "We are NOT working with a *update* file. !FILENAME!" - CALL :LOG_MESSAGE INFO "Use script device-install.bat to flash update !FILENAME!." + CALL :LOG_MESSAGE INFO "Use script device-install.bat to flash !FILENAME!." GOTO eof ) ELSE ( CALL :LOG_MESSAGE DEBUG "We are working with a *update* file. !FILENAME!" @@ -95,7 +95,7 @@ IF NOT "__%PYTHON%__"=="____" ( CALL :LOG_MESSAGE DEBUG "Checking esptool command !ESPTOOL_CMD!..." !ESPTOOL_CMD! >nul 2>&1 -IF %ERRORLEVEL% GTR 2 ( +IF %ERRORLEVEL% GEQ 2 ( @REM esptool exits with code 1 if help is displayed. CALL :LOG_MESSAGE ERROR "esptool not found: !ESPTOOL_CMD!" EXIT /B 1 @@ -110,6 +110,7 @@ CALL :LOG_MESSAGE DEBUG "Using esptool command: !ESPTOOL_CMD!" IF "__!ESPTOOL_PORT!__" == "____" ( CALL :LOG_MESSAGE WARN "Using esptool port: UNSET." ) ELSE ( + SET "ESPTOOL_CMD=!ESPTOOL_CMD! --port !ESPTOOL_PORT!" CALL :LOG_MESSAGE INFO "Using esptool port: !ESPTOOL_PORT!." ) CALL :LOG_MESSAGE INFO "Using esptool baud: !ESPTOOL_BAUD!." diff --git a/bin/device-update.sh b/bin/device-update.sh index 67281dc4f..ae7b52ea2 100755 --- a/bin/device-update.sh +++ b/bin/device-update.sh @@ -35,8 +35,8 @@ while getopts ":hp:P:f:" opt; do show_help exit 0 ;; - p) export ESPTOOL_PORT=${OPTARG} - ;; + p) ESPTOOL_CMD="$ESPTOOL_CMD --port ${OPTARG}" + ;; P) PYTHON=${OPTARG} ;; f) FILENAME=${OPTARG} From 6673cb929226c4b6abf256ad96993585b2231f15 Mon Sep 17 00:00:00 2001 From: Austin Date: Tue, 18 Mar 2025 21:19:51 -0400 Subject: [PATCH 288/381] Increase MAX_NUM_NODES on high-flash ESP32_S3 (#6311) --- arch/nrf52/nrf52.ini | 1 - bin/device-install.bat | 52 ++++++----- bin/device-install.sh | 86 ++++++++++++++----- src/mesh/mesh-pb-constants.h | 22 ++++- variants/CDEBYTE_E77-MBL/variant.h | 1 - .../crowpanel-esp32s3-5-epaper/platformio.ini | 3 + variants/diy/platformio.ini | 3 +- variants/dreamcatcher/platformio.ini | 6 +- variants/esp32-s3-pico/platformio.ini | 1 + .../heltec_capsule_sensor_v3/platformio.ini | 2 +- variants/heltec_v3/platformio.ini | 4 +- .../heltec_vision_master_e213/platformio.ini | 4 +- .../heltec_vision_master_e290/platformio.ini | 2 + .../heltec_vision_master_t190/platformio.ini | 4 +- variants/heltec_wireless_paper/platformio.ini | 2 + .../heltec_wireless_paper_v1/platformio.ini | 1 + .../heltec_wireless_tracker/platformio.ini | 1 + .../platformio.ini | 1 + variants/heltec_wsl_v3/platformio.ini | 3 +- variants/icarus/platformio.ini | 4 +- variants/m5stack_cores3/platformio.ini | 1 + variants/mesh-tab/platformio.ini | 1 - variants/picomputer-s3/platformio.ini | 3 +- variants/rak3172/variant.h | 1 - .../seeed-sensecap-indicator/platformio.ini | 3 +- variants/seeed_xiao_s3/platformio.ini | 2 +- variants/station-g2/platformio.ini | 5 +- variants/t-deck/platformio.ini | 3 +- variants/t-eth-elite/platformio.ini | 3 +- variants/t-watch-s3/platformio.ini | 1 + variants/tbeam-s3-core/platformio.ini | 1 + variants/tracksenger/platformio.ini | 3 + variants/unphone/platformio.ini | 3 +- variants/wio-e5/variant.h | 1 - 34 files changed, 155 insertions(+), 79 deletions(-) diff --git a/arch/nrf52/nrf52.ini b/arch/nrf52/nrf52.ini index 606cabac6..d4e88af1f 100644 --- a/arch/nrf52/nrf52.ini +++ b/arch/nrf52/nrf52.ini @@ -17,7 +17,6 @@ build_flags = -DLFS_NO_ASSERT ; Disable LFS assertions , see https://github.com/meshtastic/firmware/pull/3818 -DMESHTASTIC_EXCLUDE_AUDIO=1 -DMESHTASTIC_EXCLUDE_PAXCOUNTER=1 - -DMAX_NUM_NODES=80 build_src_filter = ${arduino_base.build_src_filter} - - - - - - - - - - diff --git a/bin/device-install.bat b/bin/device-install.bat index 7eb5c1b30..3ffca0b63 100755 --- a/bin/device-install.bat +++ b/bin/device-install.bat @@ -7,12 +7,19 @@ SET "DEBUG=0" SET "PYTHON=" SET "WEB_APP=0" SET "TFT_BUILD=0" -SET "TFT8=0" -SET "TFT16=0" +SET "BIGDB8=0" +SET "BIGDB16=0" SET "ESPTOOL_BAUD=115200" SET "ESPTOOL_CMD=" SET "LOGCOUNTER=0" +@REM FIXME: Determine mcu from PlatformIO variant, this is unmaintainable. +SET "S3=s3 v3 t-deck wireless-paper wireless-tracker station-g2 unphone" +SET "C3=esp32c3" +@REM FIXME: Determine flash size from PlatformIO variant, this is unmaintainable. +SET "BIGDB_8MB=picomputer-s3 unphone seeed-sensecap-indicator crowpanel-esp32s3 heltec_capsule_sensor_v3 heltec-v3 heltec-vision-master-e213 heltec-vision-master-e290 heltec-vision-master-t190 heltec-wireless-paper heltec-wireless-tracker heltec-wsl-v3 icarus seeed-xiao-s3 tbeam-s3-core tracksenger" +SET "BIGDB_16MB=t-deck mesh-tab t-energy-s3 dreamcatcher ESP32-S3-Pico m5stack-cores3 station-g2 t-eth-elite t-watch-s3" + GOTO getopts :help ECHO Flash image file to device, but first erasing and writing system information. @@ -134,44 +141,36 @@ IF NOT "!FILENAME:-tft-=!"=="!FILENAME!" ( CALL :LOG_MESSAGE ERROR "Cannot enable WebUI (--web) and MUI." & GOTO eof ) SET "TFT_BUILD=1" - GOTO tft ) ELSE ( CALL :LOG_MESSAGE DEBUG "We are NOT working with a *-tft-* file. !FILENAME!" - GOTO no_tft ) -:tft -SET "TFT8MB=picomputer-s3 unphone seeed-sensecap-indicator" -FOR %%a IN (%TFT8MB%) DO ( +FOR %%a IN (%BIGDB_8MB%) DO ( IF NOT "!FILENAME:%%a=!"=="!FILENAME!" ( - @REM We are working with any of %TFT8MB%. - SET "TFT8=1" - GOTO end_loop_tft8mb + @REM We are working with any of %BIGDB_8MB%. + SET "BIGDB8=1" + GOTO end_loop_bigdb_8mb ) ) -:end_loop_tft8mb +:end_loop_bigdb_8mb -SET "TFT16MB=t-deck" -FOR %%a IN (%TFT16MB%) DO ( +FOR %%a IN (%BIGDB_16MB%) DO ( IF NOT "!FILENAME:%%a=!"=="!FILENAME!" ( - @REM We are working with any of %TFT16MB%. - SET "TFT16=1" - GOTO end_loop_tft16mb + @REM We are working with any of %BIGDB_16MB%. + SET "BIGDB16=1" + GOTO end_loop_bigdb_16mb ) ) -:end_loop_tft16mb +:end_loop_bigdb_16mb -IF %TFT8% EQU 1 CALL :LOG_MESSAGE INFO "tft and MUI 8mb selected." -IF %TFT16% EQU 1 CALL :LOG_MESSAGE INFO "tft and MUI 16mb selected." - -:no_tft +IF %BIGDB8% EQU 1 CALL :LOG_MESSAGE INFO "BigDB 8mb partition selected." +IF %BIGDB16% EQU 1 CALL :LOG_MESSAGE INFO "BigDB 16mb partition selected." @REM Extract BASENAME from %FILENAME% for later use. SET "BASENAME=!FILENAME:firmware-=!" CALL :LOG_MESSAGE DEBUG "Computed firmware basename: !BASENAME!" @REM Account for S3 and C3 board's different OTA partition. -SET "S3=s3 v3 t-deck wireless-paper wireless-tracker station-g2 unphone" FOR %%a IN (%S3%) DO ( IF NOT "!FILENAME:%%a=!"=="!FILENAME!" ( @REM We are working with any of %S3%. @@ -180,7 +179,6 @@ FOR %%a IN (%S3%) DO ( ) ) -SET "C3=esp32c3" FOR %%a IN (%C3%) DO ( IF NOT "!FILENAME:%%a=!"=="!FILENAME!" ( @REM We are working with any of %C3%. @@ -209,14 +207,14 @@ CALL :LOG_MESSAGE DEBUG "Set SPIFFS_FILENAME to: !SPIFFS_FILENAME!" SET "OTA_OFFSET=0x260000" SET "SPIFFS_OFFSET=0x300000" -@REM Offsets for MUI 8mb. -IF %TFT8% EQU 1 IF %TFT_BUILD% EQU 1 ( +@REM Offsets for BigDB 8mb. +IF %BIGDB8% EQU 1 ( SET "OTA_OFFSET=0x340000" SET "SPIFFS_OFFSET=0x670000" ) -@REM Offsets for MUI 16mb. -IF %TFT16% EQU 1 IF %TFT_BUILD% EQU 1 ( +@REM Offsets for BigDB 16mb. +IF %BIGDB16% EQU 1 ( SET "OTA_OFFSET=0x650000" SET "SPIFFS_OFFSET=0xc90000" ) diff --git a/bin/device-install.sh b/bin/device-install.sh index 56e1abdb2..b5322b9d1 100755 --- a/bin/device-install.sh +++ b/bin/device-install.sh @@ -2,9 +2,48 @@ PYTHON=${PYTHON:-$(which python3 python | head -n 1)} WEB_APP=false -TFT8=false -TFT16=false TFT_BUILD=false +MCU="" + +# Variant groups +BIGDB_8MB=( + "picomputer-s3" + "unphone" + "seeed-sensecap-indicator" + "crowpanel-esp32s3" + "heltec_capsule_sensor_v3" + "heltec-v3" + "heltec-vision-master-e213" + "heltec-vision-master-e290" + "heltec-vision-master-t190" + "heltec-wireless-paper" + "heltec-wireless-tracker" + "heltec-wsl-v3" + "icarus" + "seeed-xiao-s3" + "tbeam-s3-core" + "tracksenger" +) +BIGDB_16MB=( + "t-deck" + "mesh-tab" + "t-energy-s3" + "dreamcatcher" + "ESP32-S3-Pico" + "m5stack-cores3" + "station-g2" + "t-eth-elite" + "t-watch-s3" +) +S3_VARIANTS=( + "s3" + "-v3" + "t-deck" + "wireless-paper" + "wireless-tracker" + "station-g2" + "unphone" +) # Determine the correct esptool command to use if "$PYTHON" -m esptool version >/dev/null 2>&1; then @@ -78,21 +117,13 @@ if [[ $FILENAME != firmware-* ]]; then exit 1 fi -# Check if FILENAME contains "-tft-" and set target partitionScheme accordingly. +# Check if FILENAME contains "-tft-" and prevent web/mui comingling. if [[ ${FILENAME//-tft-/} != "$FILENAME" ]]; then TFT_BUILD=true if [[ $WEB_APP == true ]] && [[ $TFT_BUILD == true ]]; then echo "Cannot enable WebUI (--web) and MUI." exit 1 fi - - if [[ $FILENAME == *"picomputer-s3"* || $FILENAME == *"unphone"* || $FILENAME == *"seeed-sensecap-indicator"* ]]; then - TFT8=true - fi - - if [[ $FILENAME == *"t-deck"* ]]; then - TFT16=true - fi fi # Extract BASENAME from %FILENAME% for later use. @@ -105,20 +136,31 @@ if [ -f "${FILENAME}" ] && [ -n "${FILENAME##*"update"*}" ]; then # Default OTA Offset OTA_OFFSET=0x260000 - # littlefs* offset for MUI 8mb and OTA OFFSET. - if [ "$TFT8" = true ] && [ "$TFT_BUILD" = true ]; then - OFFSET=0x670000 - OTA_OFFSET=0x340000 - fi + # littlefs* offset for BigDB 8mb and OTA OFFSET. + for variant in "${BIGDB_8MB[@]}"; do + if [ -n "${FILENAME##*"$variant"*}" ]; then + OFFSET=0x670000 + OTA_OFFSET=0x340000 + fi + done - # littlefs* offset for MUI 16mb and OTA OFFSET. - if [ "$TFT16" = true ] && [ "$TFT_BUILD" = true ]; then - OFFSET=0xc90000 - OTA_OFFSET=0x650000 - fi + # littlefs* offset for BigDB 16mb and OTA OFFSET. + for variant in "${BIGDB_16MB[@]}"; do + if [ -n "${FILENAME##*"$variant"*}" ]; then + OFFSET=0xc90000 + OTA_OFFSET=0x650000 + fi + done # Account for S3 board's different OTA partition - if [ -n "${FILENAME##*"s3"*}" ] && [ -n "${FILENAME##*"-v3"*}" ] && [ -n "${FILENAME##*"t-deck"*}" ] && [ -n "${FILENAME##*"wireless-paper"*}" ] && [ -n "${FILENAME##*"wireless-tracker"*}" ] && [ -n "${FILENAME##*"station-g2"*}" ] && [ -n "${FILENAME##*"unphone"*}" ]; then + # FIXME: Use PlatformIO info to determine MCU type, this is unmaintainable + for variant in "${S3_VARIANTS[@]}"; do + if [ -n "${FILENAME##*"$variant"*}" ]; then + MCU="esp32s3" + fi + done + + if [ "$MCU" != "esp32s3" ]; then if [ -n "${FILENAME##*"esp32c3"*}" ]; then OTAFILE=bleota.bin else diff --git a/src/mesh/mesh-pb-constants.h b/src/mesh/mesh-pb-constants.h index f91c48560..1c86653dc 100644 --- a/src/mesh/mesh-pb-constants.h +++ b/src/mesh/mesh-pb-constants.h @@ -18,10 +18,30 @@ #define MAX_RX_TOPHONE 32 #endif -/// max number of nodes allowed in the mesh +/// max number of nodes allowed in the nodeDB #ifndef MAX_NUM_NODES +#if defined(ARCH_STM32WL) +#define MAX_NUM_NODES 10 +#elif defined(ARCH_NRF52) +#define MAX_NUM_NODES 80 +#elif defined(CONFIG_IDF_TARGET_ESP32S3) +#include "Esp.h" +static inline int get_max_num_nodes() +{ + uint32_t flash_size = ESP.getFlashChipSize() / (1024 * 1024); // Convert Bytes to MB + if (flash_size >= 15) { + return 250; + } else if (flash_size >= 7) { + return 200; + } else { + return 100; + } +} +#define MAX_NUM_NODES get_max_num_nodes() +#else #define MAX_NUM_NODES 100 #endif +#endif /// Max number of channels allowed #define MAX_NUM_CHANNELS (member_size(meshtastic_ChannelFile, channels) / member_size(meshtastic_ChannelFile, channels[0])) diff --git a/variants/CDEBYTE_E77-MBL/variant.h b/variants/CDEBYTE_E77-MBL/variant.h index 7331dcedc..52801dac7 100644 --- a/variants/CDEBYTE_E77-MBL/variant.h +++ b/variants/CDEBYTE_E77-MBL/variant.h @@ -14,7 +14,6 @@ Do not expect a working Meshtastic device with this target. #define _VARIANT_EBYTE_E77_ #define USE_STM32WLx -#define MAX_NUM_NODES 10 #define LED_PIN PB4 // LED1 // #define LED_PIN PB3 // LED2 diff --git a/variants/crowpanel-esp32s3-5-epaper/platformio.ini b/variants/crowpanel-esp32s3-5-epaper/platformio.ini index 7e95a5fcf..36816d616 100644 --- a/variants/crowpanel-esp32s3-5-epaper/platformio.ini +++ b/variants/crowpanel-esp32s3-5-epaper/platformio.ini @@ -5,6 +5,7 @@ board_build.flash_mode = qio board_build.psram_type = opi board_upload.flash_size = 8MB board_upload.maximum_size = 8388608 +board_build.partitions = default_8MB.csv board = esp32-s3-devkitc-1 ;upload_port = /dev/ttyUSB0 board_level = extra @@ -32,6 +33,7 @@ board_build.flash_mode = qio board_build.psram_type = opi board_upload.flash_size = 8MB board_upload.maximum_size = 8388608 +board_build.partitions = default_8MB.csv board = esp32-s3-devkitc-1 ;upload_port = /dev/ttyUSB0 board_level = extra @@ -59,6 +61,7 @@ board_build.flash_mode = qio board_build.psram_type = opi board_upload.flash_size = 8MB board_upload.maximum_size = 8388608 +board_build.partitions = default_8MB.csv board = esp32-s3-devkitc-1 ;upload_port = /dev/ttyUSB0 board_level = extra diff --git a/variants/diy/platformio.ini b/variants/diy/platformio.ini index 229f48bbf..825c464a2 100644 --- a/variants/diy/platformio.ini +++ b/variants/diy/platformio.ini @@ -88,6 +88,7 @@ debug_tool = jlink [env:t-energy-s3_e22] extends = esp32s3_base board = esp32-s3-devkitc-1 +board_build.partitions = default_16MB.csv board_level = extra board_upload.flash_size = 16MB ;Specify the FLASH capacity as 16MB board_build.arduino.memory_type = qio_opi ;Enable internal PSRAM @@ -100,4 +101,4 @@ build_flags = -D BOARD_HAS_PSRAM -D ARDUINO_USB_MODE=0 -D ARDUINO_USB_CDC_ON_BOOT=1 - -I variants/diy/t-energy-s3_e22 \ No newline at end of file + -I variants/diy/t-energy-s3_e22 diff --git a/variants/dreamcatcher/platformio.ini b/variants/dreamcatcher/platformio.ini index c57849d96..6527d89be 100644 --- a/variants/dreamcatcher/platformio.ini +++ b/variants/dreamcatcher/platformio.ini @@ -1,6 +1,7 @@ [env:dreamcatcher] ; 2301, latest revision extends = esp32s3_base board = esp32s3box +board_build.partitions = default_16MB.csv board_level = extra build_flags = @@ -8,7 +9,7 @@ build_flags = -D PRIVATE_HW -D OTHERNET_DC_REV=2301 -I variants/dreamcatcher - -DARDUINO_USB_CDC_ON_BOOT=1 + -D ARDUINO_USB_CDC_ON_BOOT=1 lib_deps = ${esp32s3_base.lib_deps} earlephilhower/ESP8266Audio@^1.9.9 @@ -17,6 +18,7 @@ lib_deps = ${esp32s3_base.lib_deps} [env:dreamcatcher-2206] extends = esp32s3_base board = esp32s3box +board_build.partitions = default_16MB.csv board_level = extra build_flags = @@ -24,4 +26,4 @@ build_flags = -D PRIVATE_HW -D OTHERNET_DC_REV=2206 -I variants/dreamcatcher - -DARDUINO_USB_CDC_ON_BOOT=1 \ No newline at end of file + -D ARDUINO_USB_CDC_ON_BOOT=1 diff --git a/variants/esp32-s3-pico/platformio.ini b/variants/esp32-s3-pico/platformio.ini index 20a41ba56..69969c601 100644 --- a/variants/esp32-s3-pico/platformio.ini +++ b/variants/esp32-s3-pico/platformio.ini @@ -4,6 +4,7 @@ board_level = extra extends = esp32s3_base upload_protocol = esptool board = esp32-s3-pico +board_build.partitions = default_16MB.csv board_upload.use_1200bps_touch = yes board_upload.wait_for_upload_port = yes diff --git a/variants/heltec_capsule_sensor_v3/platformio.ini b/variants/heltec_capsule_sensor_v3/platformio.ini index b5ffb65c2..8d1c039c1 100644 --- a/variants/heltec_capsule_sensor_v3/platformio.ini +++ b/variants/heltec_capsule_sensor_v3/platformio.ini @@ -2,7 +2,7 @@ extends = esp32s3_base board = heltec_wifi_lora_32_V3 board_check = true - +board_build.partitions = default_8MB.csv build_flags = ${esp32s3_base.build_flags} -I variants/heltec_capsule_sensor_v3 -D HELTEC_CAPSULE_SENSOR_V3 diff --git a/variants/heltec_v3/platformio.ini b/variants/heltec_v3/platformio.ini index e8f73e1ef..4be96b019 100644 --- a/variants/heltec_v3/platformio.ini +++ b/variants/heltec_v3/platformio.ini @@ -2,7 +2,7 @@ extends = esp32s3_base board = heltec_wifi_lora_32_V3 board_check = true -# Temporary until espressif creates a release with this new target +board_build.partitions = default_8MB.csv build_flags = ${esp32s3_base.build_flags} -D HELTEC_V3 -I variants/heltec_v3 - -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. \ No newline at end of file + -D GPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. diff --git a/variants/heltec_vision_master_e213/platformio.ini b/variants/heltec_vision_master_e213/platformio.ini index 6ba597200..4bed30324 100644 --- a/variants/heltec_vision_master_e213/platformio.ini +++ b/variants/heltec_vision_master_e213/platformio.ini @@ -1,8 +1,9 @@ [env:heltec-vision-master-e213] extends = esp32s3_base board = heltec_vision_master_e213 +board_build.partitions = default_8MB.csv build_flags = - ${esp32s3_base.build_flags} + ${esp32s3_base.build_flags} -Ivariants/heltec_vision_master_e213 -DHELTEC_VISION_MASTER_E213 -DUSE_EINK @@ -22,6 +23,7 @@ upload_speed = 115200 [env:heltec-vision-master-e213-inkhud] extends = esp32s3_base, inkhud board = heltec_vision_master_e213 +board_build.partitions = default_8MB.csv build_src_filter = ${esp32_base.build_src_filter} ${inkhud.build_src_filter} diff --git a/variants/heltec_vision_master_e290/platformio.ini b/variants/heltec_vision_master_e290/platformio.ini index cfea81a7e..d28c2015b 100644 --- a/variants/heltec_vision_master_e290/platformio.ini +++ b/variants/heltec_vision_master_e290/platformio.ini @@ -2,6 +2,7 @@ [env:heltec-vision-master-e290] extends = esp32s3_base board = heltec_vision_master_e290 +board_build.partitions = default_8MB.csv build_flags = ${esp32s3_base.build_flags} -I variants/heltec_vision_master_e290 @@ -26,6 +27,7 @@ upload_speed = 115200 [env:heltec-vision-master-e290-inkhud] extends = esp32s3_base, inkhud board = heltec_vision_master_e290 +board_build.partitions = default_8MB.csv build_src_filter = ${esp32_base.build_src_filter} ${inkhud.build_src_filter} diff --git a/variants/heltec_vision_master_t190/platformio.ini b/variants/heltec_vision_master_t190/platformio.ini index 0c504d62b..53b56f57d 100644 --- a/variants/heltec_vision_master_t190/platformio.ini +++ b/variants/heltec_vision_master_t190/platformio.ini @@ -1,11 +1,11 @@ [env:heltec-vision-master-t190] extends = esp32s3_base board = heltec_vision_master_t190 +board_build.partitions = default_8MB.csv build_flags = ${esp32s3_base.build_flags} -Ivariants/heltec_vision_master_t190 - -DHELTEC_VISION_MASTER_T190 - ; -D PRIVATE_HW + -DHELTEC_VISION_MASTER_T190 lib_deps = ${esp32s3_base.lib_deps} lewisxhe/PCF8563_Library@^1.0.1 diff --git a/variants/heltec_wireless_paper/platformio.ini b/variants/heltec_wireless_paper/platformio.ini index 9979e1c1d..bd25a932a 100644 --- a/variants/heltec_wireless_paper/platformio.ini +++ b/variants/heltec_wireless_paper/platformio.ini @@ -2,6 +2,7 @@ [env:heltec-wireless-paper] extends = esp32s3_base board = heltec_wifi_lora_32_V3 +board_build.partitions = default_8MB.csv build_flags = ${esp32s3_base.build_flags} -I variants/heltec_wireless_paper @@ -23,6 +24,7 @@ upload_speed = 115200 [env:heltec-wireless-paper-inkhud] extends = esp32s3_base, inkhud board = heltec_wifi_lora_32_V3 +board_build.partitions = default_8MB.csv build_src_filter = ${esp32_base.build_src_filter} ${inkhud.build_src_filter} diff --git a/variants/heltec_wireless_paper_v1/platformio.ini b/variants/heltec_wireless_paper_v1/platformio.ini index 2ce7559f9..ec5fe2408 100644 --- a/variants/heltec_wireless_paper_v1/platformio.ini +++ b/variants/heltec_wireless_paper_v1/platformio.ini @@ -2,6 +2,7 @@ extends = esp32s3_base board_level = extra board = heltec_wifi_lora_32_V3 +board_build.partitions = default_8MB.csv build_flags = ${esp32s3_base.build_flags} -I variants/heltec_wireless_paper_v1 diff --git a/variants/heltec_wireless_tracker/platformio.ini b/variants/heltec_wireless_tracker/platformio.ini index 4f686d289..5c19c37e6 100644 --- a/variants/heltec_wireless_tracker/platformio.ini +++ b/variants/heltec_wireless_tracker/platformio.ini @@ -1,6 +1,7 @@ [env:heltec-wireless-tracker] extends = esp32s3_base board = heltec_wireless_tracker +board_build.partitions = default_8MB.csv upload_protocol = esptool build_flags = diff --git a/variants/heltec_wireless_tracker_V1_0/platformio.ini b/variants/heltec_wireless_tracker_V1_0/platformio.ini index 5f512b816..08b0ae95c 100644 --- a/variants/heltec_wireless_tracker_V1_0/platformio.ini +++ b/variants/heltec_wireless_tracker_V1_0/platformio.ini @@ -2,6 +2,7 @@ extends = esp32s3_base board_level = extra board = heltec_wireless_tracker +board_build.partitions = default_8MB.csv upload_protocol = esptool build_flags = ${esp32s3_base.build_flags} -I variants/heltec_wireless_tracker_V1_0 diff --git a/variants/heltec_wsl_v3/platformio.ini b/variants/heltec_wsl_v3/platformio.ini index c95659156..bc3e6ada1 100644 --- a/variants/heltec_wsl_v3/platformio.ini +++ b/variants/heltec_wsl_v3/platformio.ini @@ -1,7 +1,8 @@ [env:heltec-wsl-v3] extends = esp32s3_base board = heltec_wifi_lora_32_V3 +board_build.partitions = default_8MB.csv # Temporary until espressif creates a release with this new target build_flags = ${esp32s3_base.build_flags} -D HELTEC_WSL_V3 -I variants/heltec_wsl_v3 - -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. \ No newline at end of file + -D GPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. diff --git a/variants/icarus/platformio.ini b/variants/icarus/platformio.ini index b1dc01fc1..b4ea125cf 100644 --- a/variants/icarus/platformio.ini +++ b/variants/icarus/platformio.ini @@ -4,6 +4,7 @@ board = icarus board_level = extra board_check = true board_build.mcu = esp32s3 +board_build.partitions = default_8MB.csv upload_protocol = esptool upload_speed = 921600 platform_packages = platformio/framework-arduinoespressif32@https://github.com/PowerFeather/powerfeather-meshtastic-arduino-lib/releases/download/2.0.16a/esp32-2.0.16.zip @@ -15,5 +16,4 @@ build_unflags = build_flags = ${esp32s3_base.build_flags} -D PRIVATE_HW -I variants/icarus -DBOARD_HAS_PSRAM - - -DARDUINO_USB_MODE=0 \ No newline at end of file + -DARDUINO_USB_MODE=0 diff --git a/variants/m5stack_cores3/platformio.ini b/variants/m5stack_cores3/platformio.ini index fc73fabae..2253e75e2 100644 --- a/variants/m5stack_cores3/platformio.ini +++ b/variants/m5stack_cores3/platformio.ini @@ -3,6 +3,7 @@ extends = esp32s3_base board = m5stack-cores3 board_check = true +board_build.partitions = default_16MB.csv upload_protocol = esptool build_flags = ${esp32_base.build_flags} diff --git a/variants/mesh-tab/platformio.ini b/variants/mesh-tab/platformio.ini index 9e3429ac5..728fa5100 100644 --- a/variants/mesh-tab/platformio.ini +++ b/variants/mesh-tab/platformio.ini @@ -28,7 +28,6 @@ build_flags = ${esp32s3_base.build_flags} -D USE_LOG_DEBUG -D LOG_DEBUG_INC=\"DebugConfiguration.h\" -D RADIOLIB_SPI_PARANOID=0 - -D MAX_NUM_NODES=250 -D MAX_THREADS=40 -D HAS_SCREEN=0 -D HAS_TFT=1 diff --git a/variants/picomputer-s3/platformio.ini b/variants/picomputer-s3/platformio.ini index 7f769253c..df2d0dfdc 100644 --- a/variants/picomputer-s3/platformio.ini +++ b/variants/picomputer-s3/platformio.ini @@ -2,6 +2,7 @@ extends = esp32s3_base board = bpi_picow_esp32_s3 board_check = true +board_build.partitions = default_8MB.csv ;OpenOCD flash method ;upload_protocol = esp-builtin ;Normal method @@ -22,7 +23,6 @@ build_src_filter = [env:picomputer-s3-tft] extends = env:picomputer-s3 -board_build.partitions = default_8MB.csv ; just for test build_flags = ${env:picomputer-s3.build_flags} @@ -35,7 +35,6 @@ build_flags = -D INPUTDRIVER_MATRIX_TYPE=1 -D USE_PIN_BUZZER=PIN_BUZZER -D USE_SX127x - -D MAX_NUM_NODES=200 -D HAS_SCREEN=0 -D HAS_TFT=1 -D RAM_SIZE=1024 diff --git a/variants/rak3172/variant.h b/variants/rak3172/variant.h index 21de65b2c..dd12fe393 100644 --- a/variants/rak3172/variant.h +++ b/variants/rak3172/variant.h @@ -7,6 +7,5 @@ Do not expect a working Meshtastic device with this target. #define _VARIANT_RAK3172_ #define USE_STM32WLx -#define MAX_NUM_NODES 10 #endif \ No newline at end of file diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index d351713d7..da11953b7 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -6,6 +6,7 @@ platform_packages = board = seeed-sensecap-indicator board_check = true +board_build.partitions = default_8MB.csv upload_protocol = esptool build_flags = ${esp32_base.build_flags} @@ -32,7 +33,6 @@ lib_deps = ${esp32s3_base.lib_deps} extends = env:seeed-sensecap-indicator board_level = main upload_speed = 460800 -board_build.partitions = default_8MB.csv ; must be here for some reason, board.json is not enough !? build_flags = ${env:seeed-sensecap-indicator.build_flags} @@ -46,7 +46,6 @@ build_flags = -D INPUTDRIVER_BUTTON_TYPE=38 -D HAS_TELEMETRY=0 -D CONFIG_DISABLE_HAL_LOCKS=1 - -D MAX_NUM_NODES=250 -D HAS_SCREEN=0 -D HAS_TFT=1 -D DISPLAY_SET_RESOLUTION diff --git a/variants/seeed_xiao_s3/platformio.ini b/variants/seeed_xiao_s3/platformio.ini index 3d10d7136..9d935e2e0 100644 --- a/variants/seeed_xiao_s3/platformio.ini +++ b/variants/seeed_xiao_s3/platformio.ini @@ -2,7 +2,7 @@ extends = esp32s3_base board = seeed-xiao-s3 board_check = true -board_build.mcu = esp32s3 +board_build.partitions = default_8MB.csv upload_protocol = esptool upload_speed = 921600 lib_deps = diff --git a/variants/station-g2/platformio.ini b/variants/station-g2/platformio.ini index b674c8bae..4ddd28f1c 100755 --- a/variants/station-g2/platformio.ini +++ b/variants/station-g2/platformio.ini @@ -2,6 +2,7 @@ extends = esp32s3_base board = station-g2 board_check = true +board_build.partitions = default_16MB.csv board_build.mcu = esp32s3 upload_protocol = esptool ;upload_port = /dev/ttyACM0 @@ -13,6 +14,6 @@ build_unflags = -DARDUINO_USB_MODE=1 build_flags = ${esp32s3_base.build_flags} -D STATION_G2 -I variants/station-g2 - -DBOARD_HAS_PSRAM + -DBOARD_HAS_PSRAM -DSTATION_G2 - -DARDUINO_USB_MODE=0 \ No newline at end of file + -DARDUINO_USB_MODE=0 diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index a0005c9c6..4671a5a9b 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -3,6 +3,7 @@ extends = esp32s3_base board = t-deck board_check = true +board_build.partitions = default_16MB.csv upload_protocol = esptool build_flags = ${esp32s3_base.build_flags} @@ -20,7 +21,6 @@ lib_deps = ${esp32s3_base.lib_deps} [env:t-deck-tft] extends = env:t-deck -board_build.partitions = default_16MB.csv build_flags = ${env:t-deck.build_flags} @@ -38,7 +38,6 @@ build_flags = -D INPUTDRIVER_ENCODER_DOWN=15 -D INPUTDRIVER_ENCODER_BTN=0 -D INPUTDRIVER_BUTTON_TYPE=0 - -D MAX_NUM_NODES=250 -D HAS_SDCARD -D HAS_SCREEN=0 -D HAS_TFT=1 diff --git a/variants/t-eth-elite/platformio.ini b/variants/t-eth-elite/platformio.ini index 8c2f3bc37..ec6c82a5d 100644 --- a/variants/t-eth-elite/platformio.ini +++ b/variants/t-eth-elite/platformio.ini @@ -2,11 +2,12 @@ extends = esp32s3_base board = esp32s3box board_check = true +board_build.partitions = default_16MB.csv build_flags = ${esp32s3_base.build_flags} -D T_ETH_ELITE -I variants/t-eth-elite - -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. + -D GPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. lib_ignore = Ethernet diff --git a/variants/t-watch-s3/platformio.ini b/variants/t-watch-s3/platformio.ini index 8f48cf6c4..f98237943 100644 --- a/variants/t-watch-s3/platformio.ini +++ b/variants/t-watch-s3/platformio.ini @@ -3,6 +3,7 @@ extends = esp32s3_base board = t-watch-s3 board_check = true +board_build.partitions = default_16MB.csv upload_protocol = esptool build_flags = ${esp32_base.build_flags} diff --git a/variants/tbeam-s3-core/platformio.ini b/variants/tbeam-s3-core/platformio.ini index e50d506b9..a7bdf963f 100644 --- a/variants/tbeam-s3-core/platformio.ini +++ b/variants/tbeam-s3-core/platformio.ini @@ -2,6 +2,7 @@ [env:tbeam-s3-core] extends = esp32s3_base board = tbeam-s3-core +board_build.partitions = default_8MB.csv board_check = true lib_deps = diff --git a/variants/tracksenger/platformio.ini b/variants/tracksenger/platformio.ini index 796a3b7d5..b36b9c45a 100644 --- a/variants/tracksenger/platformio.ini +++ b/variants/tracksenger/platformio.ini @@ -1,6 +1,7 @@ [env:tracksenger] extends = esp32s3_base board = heltec_wireless_tracker +board_build.partitions = default_8MB.csv upload_protocol = esp-builtin build_flags = @@ -16,6 +17,7 @@ lib_deps = [env:tracksenger-lcd] extends = esp32s3_base board = heltec_wireless_tracker +board_build.partitions = default_8MB.csv upload_protocol = esp-builtin build_flags = @@ -31,6 +33,7 @@ lib_deps = [env:tracksenger-oled] extends = esp32s3_base board = heltec_wireless_tracker +board_build.partitions = default_8MB.csv upload_protocol = esp-builtin build_flags = diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini index 88f6e7469..18efbb157 100644 --- a/variants/unphone/platformio.ini +++ b/variants/unphone/platformio.ini @@ -3,6 +3,7 @@ [env:unphone] extends = esp32s3_base board = unphone +board_build.partitions = default_8MB.csv upload_speed = 921600 monitor_speed = 115200 monitor_filters = esp32_exception_decoder @@ -32,7 +33,6 @@ lib_deps = ${esp32s3_base.lib_deps} [env:unphone-tft] extends = env:unphone -board_build.partitions = default_8MB.csv build_flags = ${env:unphone.build_flags} -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 @@ -42,7 +42,6 @@ build_flags = -D MESHTASTIC_EXCLUDE_SERIAL=1 -D MESHTASTIC_EXCLUDE_SOCKETAPI=1 -D INPUTDRIVER_BUTTON_TYPE=21 - -D MAX_NUM_NODES=200 -D MAX_THREADS=40 -D HAS_SCREEN=0 -D HAS_TFT=1 diff --git a/variants/wio-e5/variant.h b/variants/wio-e5/variant.h index ac92915bb..1de424d1d 100644 --- a/variants/wio-e5/variant.h +++ b/variants/wio-e5/variant.h @@ -13,7 +13,6 @@ Do not expect a working Meshtastic device with this target. #define _VARIANT_WIOE5_ #define USE_STM32WLx -#define MAX_NUM_NODES 10 #define LED_PIN PB5 #define LED_STATE_ON 1 From 22aa2d7582df3f22caddff975d5e651407dd5472 Mon Sep 17 00:00:00 2001 From: Bob Reese Date: Tue, 18 Mar 2025 20:20:15 -0500 Subject: [PATCH 289/381] Fixed UF2 generation problem with sys.executable path has spaces in it (#6346) --- bin/platformio-custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/platformio-custom.py b/bin/platformio-custom.py index af228899f..600f9447f 100644 --- a/bin/platformio-custom.py +++ b/bin/platformio-custom.py @@ -83,7 +83,7 @@ if platform.name == "espressif32": if platform.name == "nordicnrf52": env.AddPostAction("$BUILD_DIR/${PROGNAME}.hex", - env.VerboseAction(f"{sys.executable} ./bin/uf2conv.py $BUILD_DIR/firmware.hex -c -f 0xADA52840 -o $BUILD_DIR/firmware.uf2", + env.VerboseAction(f"\"{sys.executable}\" ./bin/uf2conv.py $BUILD_DIR/firmware.hex -c -f 0xADA52840 -o $BUILD_DIR/firmware.uf2", "Generating UF2 file")) Import("projenv") From 077759e15d734a1ac2b057b9c82a7c5346a6da33 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 19 Mar 2025 05:11:42 -0500 Subject: [PATCH 290/381] Upgrade trunk (#6347) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index b0561679a..fc22d55ac 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -10,13 +10,13 @@ lint: enabled: - prettier@3.5.3 - trufflehog@3.88.17 - - yamllint@1.36.0 + - yamllint@1.36.2 - bandit@1.8.3 - checkov@3.2.386 - terrascan@1.19.9 - trivy@0.60.0 - taplo@0.9.3 - - ruff@0.10.0 + - ruff@0.11.0 - isort@6.0.1 - markdownlint@0.44.0 - oxipng@9.1.4 From f8ad02aab3cf92d4d3fa1b65ed8d41c1807f5766 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 19 Mar 2025 06:20:50 -0500 Subject: [PATCH 291/381] Update version.properties --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 79fae04ed..4c2cefef3 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 6 -build = 1 +build = 2 From f41afb14b15aed9f565df93f341a5bff3120f11b Mon Sep 17 00:00:00 2001 From: Jorropo Date: Thu, 20 Mar 2025 11:41:29 +0100 Subject: [PATCH 292/381] raise the multicast UDP TTL limit (#6343) Since 96ba94843b25f787148e3353a7476ed175518b3b we don't spray packets to all machines on the network. So we can allow ourself to raise the TTL limit, this allows users who run L3 IGMP Routing infrastructure to pass meshtastic frames over UDP. Co-authored-by: Ben Meadors --- src/mesh/udp/UdpMulticastThread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/udp/UdpMulticastThread.h b/src/mesh/udp/UdpMulticastThread.h index e5eb28d00..ab1c7bc93 100644 --- a/src/mesh/udp/UdpMulticastThread.h +++ b/src/mesh/udp/UdpMulticastThread.h @@ -22,7 +22,7 @@ class UdpMulticastThread : public concurrency::OSThread void start() { - if (udp.listenMulticast(udpIpAddress, UDP_MULTICAST_DEFAUL_PORT)) { + if (udp.listenMulticast(udpIpAddress, UDP_MULTICAST_DEFAUL_PORT, 64)) { LOG_DEBUG("UDP Listening on IP: %s", WiFi.localIP().toString().c_str()); udp.onPacket([this](AsyncUDPPacket packet) { onReceive(packet); }); } else { From d1068fd1e451146d2982b17ee27838a60fb26b5b Mon Sep 17 00:00:00 2001 From: Jorropo Date: Thu, 20 Mar 2025 14:47:39 +0100 Subject: [PATCH 293/381] Add UDP multicast support on linux. (#6342) * Add UDP multicast support on linux. Closes #6326 We tested it an it works. This is really hacky to say the least. * Add libuv to Linux packaging * Trunkadunk * Correct ref * Add libuv1-dev to setup-native --------- Co-authored-by: vidplace7 Co-authored-by: Ben Meadors --- .devcontainer/Dockerfile | 1 + .github/actions/setup-native/action.yml | 2 +- Dockerfile | 4 ++-- alpine.Dockerfile | 4 ++-- arch/portduino/portduino.ini | 4 +++- debian/control | 1 + meshtasticd.spec.rpkg | 1 + src/main.cpp | 5 +++++ src/mesh/udp/UdpMulticastThread.h | 15 ++++++++++++++- 9 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 4b9f069ab..30af24bd2 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -29,6 +29,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ gpg \ gnupg2 \ libusb-1.0-0-dev \ + libuv1-dev \ libi2c-dev \ libxcb-xkb-dev \ libxkbcommon-dev \ diff --git a/.github/actions/setup-native/action.yml b/.github/actions/setup-native/action.yml index 36c95d943..05f95cd40 100644 --- a/.github/actions/setup-native/action.yml +++ b/.github/actions/setup-native/action.yml @@ -11,4 +11,4 @@ runs: - name: Install libs needed for native build shell: bash run: | - sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev libusb-1.0-0-dev libi2c-dev + sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev libusb-1.0-0-dev libi2c-dev libuv1-dev diff --git a/Dockerfile b/Dockerfile index fd1bb6164..733a46325 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ ENV TZ=Etc/UTC ENV PIP_ROOT_USER_ACTION=ignore RUN apt-get update && apt-get install --no-install-recommends -y \ wget g++ zip git ca-certificates \ - libgpiod-dev libyaml-cpp-dev libbluetooth-dev libi2c-dev \ + libgpiod-dev libyaml-cpp-dev libbluetooth-dev libi2c-dev libuv1-dev \ libusb-1.0-0-dev libulfius-dev liborcania-dev libssl-dev pkg-config \ && apt-get clean && rm -rf /var/lib/apt/lists/* \ && pip install --no-cache-dir -U platformio \ @@ -38,7 +38,7 @@ ENV TZ=Etc/UTC USER root RUN apt-get update && apt-get --no-install-recommends -y install \ - libc-bin libc6 libgpiod2 libyaml-cpp0.7 libi2c0 libulfius2.7 libusb-1.0-0-dev liborcania2.3 libssl3 \ + libc-bin libc6 libgpiod2 libyaml-cpp0.7 libi2c0 libuv1 libusb-1.0-0-dev liborcania2.3 libulfius2.7 libssl3 \ && apt-get clean && rm -rf /var/lib/apt/lists/* \ && mkdir -p /var/lib/meshtasticd \ && mkdir -p /etc/meshtasticd/config.d \ diff --git a/alpine.Dockerfile b/alpine.Dockerfile index b6d91a75a..17afc2964 100644 --- a/alpine.Dockerfile +++ b/alpine.Dockerfile @@ -9,7 +9,7 @@ FROM python:3.13-alpine3.21 AS builder ENV PIP_ROOT_USER_ACTION=ignore RUN apk --no-cache add \ bash g++ libstdc++-dev linux-headers zip git ca-certificates libgpiod-dev yaml-cpp-dev bluez-dev \ - libusb-dev i2c-tools-dev openssl-dev pkgconf argp-standalone \ + libusb-dev i2c-tools-dev libuv-dev openssl-dev pkgconf argp-standalone \ && rm -rf /var/cache/apk/* \ && pip install --no-cache-dir -U platformio \ && mkdir /tmp/firmware @@ -32,7 +32,7 @@ FROM alpine:3.21 USER root RUN apk --no-cache add \ - libstdc++ libgpiod yaml-cpp libusb i2c-tools \ + libstdc++ libgpiod yaml-cpp libusb i2c-tools libuv \ && rm -rf /var/cache/apk/* \ && mkdir -p /var/lib/meshtasticd \ && mkdir -p /etc/meshtasticd/config.d \ diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 7ea6a77a2..734a4f91e 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -1,6 +1,6 @@ ; The Portduino based 'native' environment. Currently supported on Linux targets with real LoRa hardware (or simulated). [portduino_base] -platform = https://github.com/meshtastic/platform-native.git#562d189828f09fbf4c4093b3c0104bae9d8e9ff9 +platform = https://github.com/meshtastic/platform-native.git#df71ed0040e9aad767a002829330965b78fc452a framework = arduino build_src_filter = @@ -34,10 +34,12 @@ build_flags = -Isrc/platform/portduino -DRADIOLIB_EEPROM_UNSUPPORTED -DPORTDUINO_LINUX_HARDWARE + -DHAS_UDP_MULTICAST -lpthread -lstdc++fs -lbluetooth -lgpiod -lyaml-cpp -li2c + -luv -std=c++17 diff --git a/debian/control b/debian/control index b3a8eb58e..693cd6aa5 100644 --- a/debian/control +++ b/debian/control @@ -17,6 +17,7 @@ Build-Depends: debhelper-compat (= 13), libbluetooth-dev, libusb-1.0-0-dev, libi2c-dev, + libuv1-dev, openssl, libssl-dev, libulfius-dev, diff --git a/meshtasticd.spec.rpkg b/meshtasticd.spec.rpkg index 0a0f03557..a09261056 100644 --- a/meshtasticd.spec.rpkg +++ b/meshtasticd.spec.rpkg @@ -36,6 +36,7 @@ BuildRequires: pkgconfig(libgpiod) BuildRequires: pkgconfig(bluez) BuildRequires: pkgconfig(libusb-1.0) BuildRequires: libi2c-devel +BuildRequires: pkgconfig(libuv) # Web components: BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(liborcania) diff --git a/src/main.cpp b/src/main.cpp index 797d911d1..e9e0c9d4b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -822,6 +822,11 @@ void setup() #ifdef HAS_UDP_MULTICAST LOG_DEBUG("Start multicast thread"); udpThread = new UdpMulticastThread(); +#ifdef ARCH_PORTDUINO + // FIXME: portduino does not ever call onNetworkConnected so call it here because I don't know what happen if I call + // onNetworkConnected there + udpThread->start(); +#endif #endif service = new MeshService(); service->init(); diff --git a/src/mesh/udp/UdpMulticastThread.h b/src/mesh/udp/UdpMulticastThread.h index ab1c7bc93..e2c3be369 100644 --- a/src/mesh/udp/UdpMulticastThread.h +++ b/src/mesh/udp/UdpMulticastThread.h @@ -23,7 +23,12 @@ class UdpMulticastThread : public concurrency::OSThread void start() { if (udp.listenMulticast(udpIpAddress, UDP_MULTICAST_DEFAUL_PORT, 64)) { +#if !defined(ARCH_PORTDUINO) + // FIXME(PORTDUINO): arduino lacks IPAddress::toString() LOG_DEBUG("UDP Listening on IP: %s", WiFi.localIP().toString().c_str()); +#else + LOG_DEBUG("UDP Listening"); +#endif udp.onPacket([this](AsyncUDPPacket packet) { onReceive(packet); }); } else { LOG_DEBUG("Failed to listen on UDP"); @@ -33,7 +38,10 @@ class UdpMulticastThread : public concurrency::OSThread void onReceive(AsyncUDPPacket packet) { size_t packetLength = packet.length(); +#ifndef ARCH_PORTDUINO + // FIXME(PORTDUINO): arduino lacks IPAddress::toString() LOG_DEBUG("UDP broadcast from: %s, len=%u", packet.remoteIP().toString().c_str(), packetLength); +#endif meshtastic_MeshPacket mp; LOG_DEBUG("Decoding MeshPacket from UDP len=%u", packetLength); bool isPacketDecoded = pb_decode_from_bytes(packet.data(), packetLength, &meshtastic_MeshPacket_msg, &mp); @@ -48,9 +56,14 @@ class UdpMulticastThread : public concurrency::OSThread bool onSend(const meshtastic_MeshPacket *mp) { - if (!mp || WiFi.status() != WL_CONNECTED) { + if (!mp || !udp) { return false; } +#if !defined(ARCH_PORTDUINO) + if (WiFi.status() != WL_CONNECTED) { + return false; + } +#endif LOG_DEBUG("Broadcasting packet over UDP (id=%u)", mp->id); uint8_t buffer[meshtastic_MeshPacket_size]; size_t encodedLength = pb_encode_to_bytes(buffer, sizeof(buffer), &meshtastic_MeshPacket_msg, mp); From 46235f6f8beb07b88639a3026525435c9877ee55 Mon Sep 17 00:00:00 2001 From: Austin Date: Thu, 20 Mar 2025 09:49:28 -0400 Subject: [PATCH 294/381] RP2xx0: Add UDP Multicast support (#6327) --- src/mesh/udp/UdpMulticastThread.h | 2 +- variants/rpipico2w/platformio.ini | 3 ++- variants/rpipicow/platformio.ini | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mesh/udp/UdpMulticastThread.h b/src/mesh/udp/UdpMulticastThread.h index e2c3be369..7067cced9 100644 --- a/src/mesh/udp/UdpMulticastThread.h +++ b/src/mesh/udp/UdpMulticastThread.h @@ -83,4 +83,4 @@ class UdpMulticastThread : public concurrency::OSThread IPAddress udpIpAddress; AsyncUDP udp; }; -#endif // ARCH_ESP32 \ No newline at end of file +#endif // HAS_UDP_MULTICAST \ No newline at end of file diff --git a/variants/rpipico2w/platformio.ini b/variants/rpipico2w/platformio.ini index 351774221..282be1a42 100644 --- a/variants/rpipico2w/platformio.ini +++ b/variants/rpipico2w/platformio.ini @@ -23,8 +23,9 @@ build_flags = ${rp2350_base.build_flags} -DHAS_WIFI=1 -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m33" -fexceptions # for exception handling in MQTT + -DHAS_UDP_MULTICAST=1 build_src_filter = ${rp2350_base.build_src_filter} + lib_deps = ${rp2350_base.lib_deps} ${networking_base.lib_deps} -debug_build_flags = ${rp2350_base.build_flags}, -g \ No newline at end of file +debug_build_flags = ${rp2350_base.build_flags}, -g diff --git a/variants/rpipicow/platformio.ini b/variants/rpipicow/platformio.ini index 7a43ece3b..4b714434a 100644 --- a/variants/rpipicow/platformio.ini +++ b/variants/rpipicow/platformio.ini @@ -10,9 +10,10 @@ build_flags = ${rp2040_base.build_flags} -DHW_SPI1_DEVICE -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" -fexceptions # for exception handling in MQTT + -DHAS_UDP_MULTICAST=1 build_src_filter = ${rp2040_base.build_src_filter} + lib_deps = ${rp2040_base.lib_deps} ${networking_base.lib_deps} debug_build_flags = ${rp2040_base.build_flags}, -g -debug_tool = cmsis-dap ; for e.g. Picotool \ No newline at end of file +debug_tool = cmsis-dap ; for e.g. Picotool From 0d95b1afcc56a5c027e6fc5a8465ac580d52f722 Mon Sep 17 00:00:00 2001 From: raulperdomo <36527079+raulperdomo@users.noreply.github.com> Date: Thu, 20 Mar 2025 11:40:13 -0400 Subject: [PATCH 295/381] Added bounds checking to memcpy and use memory-safe strlcpy (#6351) * Added bounds checking to memcpy and use memory-safe strlcpy for reading serial data in processWXSerial() function. * Fixed linting with trunk --- src/modules/SerialModule.cpp | 134 ++++++++++++++++++----------------- 1 file changed, 68 insertions(+), 66 deletions(-) diff --git a/src/modules/SerialModule.cpp b/src/modules/SerialModule.cpp index 811d1ec91..34ece2312 100644 --- a/src/modules/SerialModule.cpp +++ b/src/modules/SerialModule.cpp @@ -468,81 +468,83 @@ void SerialModule::processWXSerial() // Extract the current line char line[meshtastic_Constants_DATA_PAYLOAD_LEN]; memset(line, '\0', sizeof(line)); - memcpy(line, &serialBytes[lineStart], lineEnd - lineStart); - if (strstr(line, "Wind") != NULL) // we have a wind line - { - gotwind = true; - // Find the positions of "=" signs in the line - char *windDirPos = strstr(line, "WindDir = "); - char *windSpeedPos = strstr(line, "WindSpeed = "); - char *windGustPos = strstr(line, "WindGust = "); + if (lineEnd - lineStart < sizeof(line) - 1) { + memcpy(line, &serialBytes[lineStart], lineEnd - lineStart); + if (strstr(line, "Wind") != NULL) // we have a wind line + { + gotwind = true; + // Find the positions of "=" signs in the line + char *windDirPos = strstr(line, "WindDir = "); + char *windSpeedPos = strstr(line, "WindSpeed = "); + char *windGustPos = strstr(line, "WindGust = "); - if (windDirPos != NULL) { - // Extract data after "=" for WindDir - strcpy(windDir, windDirPos + 15); // Add 15 to skip "WindDir = " - double radians = GeoCoord::toRadians(strtof(windDir, nullptr)); - dir_sum_sin += sin(radians); - dir_sum_cos += cos(radians); - dirCount++; - } else if (windSpeedPos != NULL) { - // Extract data after "=" for WindSpeed - strcpy(windVel, windSpeedPos + 15); // Add 15 to skip "WindSpeed = " - float newv = strtof(windVel, nullptr); - velSum += newv; - velCount++; - if (newv < lull || lull == -1) - lull = newv; + if (windDirPos != NULL) { + // Extract data after "=" for WindDir + strlcpy(windDir, windDirPos + 15, sizeof(windDir)); // Add 15 to skip "WindDir = " + double radians = GeoCoord::toRadians(strtof(windDir, nullptr)); + dir_sum_sin += sin(radians); + dir_sum_cos += cos(radians); + dirCount++; + } else if (windSpeedPos != NULL) { + // Extract data after "=" for WindSpeed + strlcpy(windVel, windSpeedPos + 15, sizeof(windVel)); // Add 15 to skip "WindSpeed = " + float newv = strtof(windVel, nullptr); + velSum += newv; + velCount++; + if (newv < lull || lull == -1) + lull = newv; - } else if (windGustPos != NULL) { - strcpy(windGust, windGustPos + 15); // Add 15 to skip "WindSpeed = " - float newg = strtof(windGust, nullptr); - if (newg > gust) - gust = newg; - } + } else if (windGustPos != NULL) { + strlcpy(windGust, windGustPos + 15, sizeof(windGust)); // Add 15 to skip "WindSpeed = " + float newg = strtof(windGust, nullptr); + if (newg > gust) + gust = newg; + } - // these are also voltage data we care about possibly - } else if (strstr(line, "BatVoltage") != NULL) { // we have a battVoltage line - char *batVoltagePos = strstr(line, "BatVoltage = "); - if (batVoltagePos != NULL) { - strcpy(batVoltage, batVoltagePos + 17); // 18 for ws 80, 17 for ws85 - batVoltageF = strtof(batVoltage, nullptr); - break; // last possible data we want so break - } - } else if (strstr(line, "CapVoltage") != NULL) { // we have a cappVoltage line - char *capVoltagePos = strstr(line, "CapVoltage = "); - if (capVoltagePos != NULL) { - strcpy(capVoltage, capVoltagePos + 17); // 18 for ws 80, 17 for ws85 - capVoltageF = strtof(capVoltage, nullptr); - } - // GXTS04Temp = 24.4 - } else if (strstr(line, "GXTS04Temp") != NULL) { // we have a temperature line - char *tempPos = strstr(line, "GXTS04Temp = "); - if (tempPos != NULL) { - strcpy(temperature, tempPos + 15); // 15 spaces for ws85 - temperatureF = strtof(temperature, nullptr); - } + // these are also voltage data we care about possibly + } else if (strstr(line, "BatVoltage") != NULL) { // we have a battVoltage line + char *batVoltagePos = strstr(line, "BatVoltage = "); + if (batVoltagePos != NULL) { + strlcpy(batVoltage, batVoltagePos + 17, sizeof(batVoltage)); // 18 for ws 80, 17 for ws85 + batVoltageF = strtof(batVoltage, nullptr); + break; // last possible data we want so break + } + } else if (strstr(line, "CapVoltage") != NULL) { // we have a cappVoltage line + char *capVoltagePos = strstr(line, "CapVoltage = "); + if (capVoltagePos != NULL) { + strlcpy(capVoltage, capVoltagePos + 17, sizeof(capVoltage)); // 18 for ws 80, 17 for ws85 + capVoltageF = strtof(capVoltage, nullptr); + } + // GXTS04Temp = 24.4 + } else if (strstr(line, "GXTS04Temp") != NULL) { // we have a temperature line + char *tempPos = strstr(line, "GXTS04Temp = "); + if (tempPos != NULL) { + strlcpy(temperature, tempPos + 15, sizeof(temperature)); // 15 spaces for ws85 + temperatureF = strtof(temperature, nullptr); + } - } else if (strstr(line, "RainIntSum") != NULL) { // we have a rainsum line - // LOG_INFO(line); - char *pos = strstr(line, "RainIntSum = "); - if (pos != NULL) { - strcpy(rainStr, pos + 17); // 17 spaces for ws85 - rainSum = int(strtof(rainStr, nullptr)); - } - - } else if (strstr(line, "Rain") != NULL) { // we have a rain line - if (strstr(line, "WaveRain") == NULL) { // skip WaveRain lines though. + } else if (strstr(line, "RainIntSum") != NULL) { // we have a rainsum line // LOG_INFO(line); - char *pos = strstr(line, "Rain = "); + char *pos = strstr(line, "RainIntSum = "); if (pos != NULL) { - strcpy(rainStr, pos + 17); // 17 spaces for ws85 - rain = strtof(rainStr, nullptr); + strlcpy(rainStr, pos + 17, sizeof(rainStr)); // 17 spaces for ws85 + rainSum = int(strtof(rainStr, nullptr)); + } + + } else if (strstr(line, "Rain") != NULL) { // we have a rain line + if (strstr(line, "WaveRain") == NULL) { // skip WaveRain lines though. + // LOG_INFO(line); + char *pos = strstr(line, "Rain = "); + if (pos != NULL) { + strlcpy(rainStr, pos + 17, sizeof(rainStr)); // 17 spaces for ws85 + rain = strtof(rainStr, nullptr); + } } } - } - // Update lineStart for the next line - lineStart = lineEnd + 1; + // Update lineStart for the next line + lineStart = lineEnd + 1; + } } } break; From 31c0e8fa2ca0cce903e73749454324c672c18b4c Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 20 Mar 2025 21:39:33 +0300 Subject: [PATCH 296/381] Support WiFi OTA (#6352) * Support WiFi OTA * Fix trunk warnings * Make getVersion() check for project name too --------- Co-authored-by: Ben Meadors --- src/mesh/NodeDB.cpp | 10 ++++ src/modules/AdminModule.cpp | 25 ++++++--- src/platform/esp32/WiFiOTA.cpp | 92 +++++++++++++++++++++++++++++++ src/platform/esp32/WiFiOTA.h | 18 ++++++ src/platform/esp32/main-esp32.cpp | 17 ++++-- 5 files changed, 149 insertions(+), 13 deletions(-) create mode 100644 src/platform/esp32/WiFiOTA.cpp create mode 100644 src/platform/esp32/WiFiOTA.h diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index e8efa7566..a9130c3a9 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -51,6 +51,10 @@ #include #endif +#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_WIFI +#include +#endif + NodeDB *nodeDB = nullptr; // we have plenty of ram so statically alloc this tempbuf (for now) @@ -635,6 +639,12 @@ void NodeDB::installDefaultConfig(bool preserveKey = false) config.display.wake_on_tap_or_motion = true; #endif +#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_WIFI + if (WiFiOTA::isUpdated()) { + WiFiOTA::recoverConfig(&config.network); + } +#endif + initConfigIntervals(); } diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index ae25ea3fc..c04c26a5a 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -10,6 +10,9 @@ #if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_BLUETOOTH #include "BleOta.h" #endif +#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_WIFI +#include "WiFiOTA.h" +#endif #include "Router.h" #include "configuration.h" #include "main.h" @@ -194,19 +197,23 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta } case meshtastic_AdminMessage_reboot_ota_seconds_tag: { int32_t s = r->reboot_ota_seconds; -#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_BLUETOOTH - if (BleOta::getOtaAppVersion().isEmpty()) { - LOG_INFO("No OTA firmware available, scheduling regular reboot in %d seconds", s); - screen->startAlert("Rebooting..."); - } else { +#if defined(ARCH_ESP32) +#if !MESHTASTIC_EXCLUDE_BLUETOOTH + if (!BleOta::getOtaAppVersion().isEmpty()) { screen->startFirmwareUpdateScreen(); BleOta::switchToOtaApp(); - LOG_INFO("Reboot to OTA in %d seconds", s); + LOG_INFO("Rebooting to BLE OTA"); } -#else - LOG_INFO("Not on ESP32, scheduling regular reboot in %d seconds", s); - screen->startAlert("Rebooting..."); #endif +#if !MESHTASTIC_EXCLUDE_WIFI + if (WiFiOTA::trySwitchToOTA()) { + screen->startFirmwareUpdateScreen(); + WiFiOTA::saveConfig(&config.network); + LOG_INFO("Rebooting to WiFi OTA"); + } +#endif +#endif + LOG_INFO("Reboot in %d seconds", s); rebootAtMsec = (s < 0) ? 0 : (millis() + s * 1000); break; } diff --git a/src/platform/esp32/WiFiOTA.cpp b/src/platform/esp32/WiFiOTA.cpp new file mode 100644 index 000000000..eac124dda --- /dev/null +++ b/src/platform/esp32/WiFiOTA.cpp @@ -0,0 +1,92 @@ +#include "WiFiOTA.h" +#include "configuration.h" +#include +#include + +namespace WiFiOTA +{ + +static const char *nvsNamespace = "ota-wifi"; +static const char *appProjectName = "OTA-WiFi"; + +static bool updated = false; + +bool isUpdated() +{ + return updated; +} + +void initialize() +{ + Preferences prefs; + prefs.begin(nvsNamespace); + if (prefs.getBool("updated")) { + LOG_INFO("First boot after OTA update"); + updated = true; + prefs.putBool("updated", false); + } + prefs.end(); +} + +void recoverConfig(meshtastic_Config_NetworkConfig *network) +{ + LOG_INFO("Recovering WiFi settings after OTA update"); + + Preferences prefs; + prefs.begin(nvsNamespace, true); + String ssid = prefs.getString("ssid"); + String psk = prefs.getString("psk"); + prefs.end(); + + network->wifi_enabled = true; + strncpy(network->wifi_ssid, ssid.c_str(), sizeof(network->wifi_ssid)); + strncpy(network->wifi_psk, psk.c_str(), sizeof(network->wifi_psk)); +} + +void saveConfig(meshtastic_Config_NetworkConfig *network) +{ + LOG_INFO("Saving WiFi settings for upcoming OTA update"); + + Preferences prefs; + prefs.begin(nvsNamespace); + prefs.putString("ssid", network->wifi_ssid); + prefs.putString("psk", network->wifi_psk); + prefs.putBool("updated", false); + prefs.end(); +} + +const esp_partition_t *getAppPartition() +{ + return esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_OTA_1, NULL); +} + +bool getAppDesc(const esp_partition_t *part, esp_app_desc_t *app_desc) +{ + if (esp_ota_get_partition_description(part, app_desc) != ESP_OK) + return false; + if (strcmp(app_desc->project_name, appProjectName) != 0) + return false; + return true; +} + +bool trySwitchToOTA() +{ + const esp_partition_t *part = getAppPartition(); + esp_app_desc_t app_desc; + if (!getAppDesc(part, &app_desc)) + return false; + if (esp_ota_set_boot_partition(part) != ESP_OK) + return false; + return true; +} + +String getVersion() +{ + const esp_partition_t *part = getAppPartition(); + esp_app_desc_t app_desc; + if (!getAppDesc(part, &app_desc)) + return String(); + return String(app_desc.version); +} + +} // namespace WiFiOTA diff --git a/src/platform/esp32/WiFiOTA.h b/src/platform/esp32/WiFiOTA.h new file mode 100644 index 000000000..61860ed5e --- /dev/null +++ b/src/platform/esp32/WiFiOTA.h @@ -0,0 +1,18 @@ +#ifndef WIFIOTA_H +#define WIFIOTA_H + +#include "mesh-pb-constants.h" +#include + +namespace WiFiOTA +{ +void initialize(); +bool isUpdated(); + +void recoverConfig(meshtastic_Config_NetworkConfig *network); +void saveConfig(meshtastic_Config_NetworkConfig *network); +bool trySwitchToOTA(); +String getVersion(); +} // namespace WiFiOTA + +#endif // WIFIOTA_H diff --git a/src/platform/esp32/main-esp32.cpp b/src/platform/esp32/main-esp32.cpp index 3b3557e95..d0fe31f21 100644 --- a/src/platform/esp32/main-esp32.cpp +++ b/src/platform/esp32/main-esp32.cpp @@ -9,6 +9,8 @@ #include "nimble/NimbleBluetooth.h" #endif +#include + #if HAS_WIFI #include "mesh/wifi/WiFiAPClient.h" #endif @@ -139,12 +141,19 @@ void esp32Setup() #if !MESHTASTIC_EXCLUDE_BLUETOOTH String BLEOTA = BleOta::getOtaAppVersion(); if (BLEOTA.isEmpty()) { - LOG_INFO("No OTA firmware available"); + LOG_INFO("No BLE OTA firmware available"); } else { - LOG_INFO("OTA firmware version %s", BLEOTA.c_str()); + LOG_INFO("BLE OTA firmware version %s", BLEOTA.c_str()); } -#else - LOG_INFO("No OTA firmware available"); +#endif +#if !MESHTASTIC_EXCLUDE_WIFI + String version = WiFiOTA::getVersion(); + if (version.isEmpty()) { + LOG_INFO("No WiFi OTA firmware available"); + } else { + LOG_INFO("WiFi OTA firmware version %s", version.c_str()); + } + WiFiOTA::initialize(); #endif // enableModemSleep(); From ae27aaaf4304d43828a6d2597993ee3b46038ab2 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Fri, 21 Mar 2025 21:54:42 +1100 Subject: [PATCH 297/381] Remove unnecessary null pointer checks (#6358) As reported by @elfring, we had several points in our code where it was unnecessary to check pointers were non-null before deleting them. Fixes https://github.com/meshtastic/firmware/issues/6170 --- src/AudioThread.h | 6 ++---- src/mesh/CryptoEngine.cpp | 6 ++---- src/motion/AccelerometerThread.h | 8 +++----- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/AudioThread.h b/src/AudioThread.h index 6d560ec55..04ff64a6e 100644 --- a/src/AudioThread.h +++ b/src/AudioThread.h @@ -41,10 +41,8 @@ class AudioThread : public concurrency::OSThread delete i2sRtttl; i2sRtttl = nullptr; } - if (rtttlFile != nullptr) { - delete rtttlFile; - rtttlFile = nullptr; - } + delete rtttlFile; + rtttlFile = nullptr; setCPUFast(false); } diff --git a/src/mesh/CryptoEngine.cpp b/src/mesh/CryptoEngine.cpp index 4613a6218..6dffbe2b7 100644 --- a/src/mesh/CryptoEngine.cpp +++ b/src/mesh/CryptoEngine.cpp @@ -161,10 +161,8 @@ void CryptoEngine::hash(uint8_t *bytes, size_t numBytes) void CryptoEngine::aesSetKey(const uint8_t *key_bytes, size_t key_len) { - if (aes) { - delete aes; - aes = nullptr; - } + delete aes; + aes = nullptr; if (key_len != 0) { aes = new AESSmall256(); aes->setKey(key_bytes, key_len); diff --git a/src/motion/AccelerometerThread.h b/src/motion/AccelerometerThread.h index 6e517d6b0..dd6413d64 100755 --- a/src/motion/AccelerometerThread.h +++ b/src/motion/AccelerometerThread.h @@ -160,13 +160,11 @@ class AccelerometerThread : public concurrency::OSThread void clean() { isInitialised = false; - if (sensor != nullptr) { - delete sensor; - sensor = nullptr; - } + delete sensor; + sensor = nullptr; } }; #endif -#endif \ No newline at end of file +#endif From e4d3ec1f596bb03ba1187d77dfe9599bca7f6174 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 21 Mar 2025 05:54:57 -0500 Subject: [PATCH 298/381] Upgrade trunk (#6360) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index fc22d55ac..c451bb66d 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -9,10 +9,10 @@ plugins: lint: enabled: - prettier@3.5.3 - - trufflehog@3.88.17 + - trufflehog@3.88.18 - yamllint@1.36.2 - bandit@1.8.3 - - checkov@3.2.386 + - checkov@3.2.388 - terrascan@1.19.9 - trivy@0.60.0 - taplo@0.9.3 From cff93adb5e5b4606a7225354ccb108fda34486b0 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Fri, 21 Mar 2025 21:58:52 +1100 Subject: [PATCH 299/381] [WIP] LS20031 setup support (#5737) LS20031 is a MTK3339-based chip. Therefore, it should share some heritage with other MTK3333 or MTK3339 chips. Re-use the L76B commands for setup. --- src/gps/GPS.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 7f490ea3c..c33cb2975 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -1200,12 +1200,12 @@ GnssModel_t GPS::probe(int serialSpeed) PROBE_SIMPLE("LC86", "$PQTMVERNO*58", "$PQTMVERNO,LC86", GNSS_MODEL_AG3352, 500); PROBE_SIMPLE("L76K", "$PCAS06,0*1B", "$GPTXT,01,01,02,SW=", GNSS_MODEL_MTK, 500); - // Close all NMEA sentences, valid for L76B MTK platform (Waveshare Pico GPS) + // Close all NMEA sentences, valid for MTK3333 and MTK3339 platforms _serial_gps->write("$PMTK514,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*2E\r\n"); delay(20); std::vector mtk = {{"L76B", "Quectel-L76B", GNSS_MODEL_MTK_L76B}, {"PA1616S", "1616S", GNSS_MODEL_MTK_PA1616S}, - {"LS20031", "MC-1513", GNSS_MODEL_LS20031}}; + {"LS20031", "MC-1513", GNSS_MODEL_MTK_L76B}}; PROBE_FAMILY("MTK Family", "$PMTK605*31", mtk, 500); uint8_t cfg_rate[] = {0xB5, 0x62, 0x06, 0x08, 0x00, 0x00, 0x00, 0x00}; From 5acaf8f897db6c4d77af370a9db6ee471aa27b3b Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Fri, 21 Mar 2025 21:59:20 +1100 Subject: [PATCH 300/381] Enable range test on Linux Native (#6356) The Range Test Module was defined-out by architecture. No reason it shouldn't work, so add PORTDUINO to the list of architectures that compile this module. Tested on Ubuntu. Enables without crashing, will send packets on the set time. However, for now the CSV file download does not appear to work. Partially fixes https://github.com/meshtastic/firmware/issues/5618 --- src/modules/RangeTestModule.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/RangeTestModule.cpp b/src/modules/RangeTestModule.cpp index cad1d51f1..6f3d69acf 100644 --- a/src/modules/RangeTestModule.cpp +++ b/src/modules/RangeTestModule.cpp @@ -31,7 +31,7 @@ uint32_t packetSequence = 0; int32_t RangeTestModule::runOnce() { -#if defined(ARCH_ESP32) || defined(ARCH_NRF52) +#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_PORTDUINO) /* Uncomment the preferences below if you want to use the module @@ -130,7 +130,7 @@ void RangeTestModuleRadio::sendPayload(NodeNum dest, bool wantReplies) ProcessMessage RangeTestModuleRadio::handleReceived(const meshtastic_MeshPacket &mp) { -#if defined(ARCH_ESP32) || defined(ARCH_NRF52) +#if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_PORTDUINO) if (moduleConfig.range_test.enabled) { From fd7a1f2ccb3f561c03215993c87cacb967188660 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 21 Mar 2025 14:28:23 +0100 Subject: [PATCH 301/381] [create-pull-request] automated change (#6365) --- protobufs | 2 +- src/mesh/generated/meshtastic/mesh.pb.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/protobufs b/protobufs index 14ec20586..b4e24c3a8 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 14ec205865592fcfa798065bb001a549fc77b438 +Subproject commit b4e24c3a868f9e5fd782d2e256b05456d578923b diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 991aeb8d2..daee04f90 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -235,6 +235,8 @@ typedef enum _meshtastic_HardwareModel { meshtastic_HardwareModel_THINKNODE_M2 = 90, /* Lilygo T-ETH-Elite */ meshtastic_HardwareModel_T_ETH_ELITE = 91, + /* Heltec HRI-3621 industrial probe */ + meshtastic_HardwareModel_HELTEC_SENSOR_HUB = 92, /* ------------------------------------------------------------------------------------------------------------------------------------------ Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. ------------------------------------------------------------------------------------------------------------------------------------------ */ From 848a3ed6a1860e31d9454a03f52e8a93ee5aabf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Fri, 21 Mar 2025 16:12:27 +0100 Subject: [PATCH 302/381] implement littlefs for stm32 (#5987) Co-authored-by: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Co-authored-by: Ben Meadors Co-authored-by: Daniel Peter Chokola Co-authored-by: Mark Trevor Birss Co-authored-by: Austin --- arch/stm32/stm32.ini | 28 +- extra_scripts/extra_stm32.py | 22 + src/FSCommon.cpp | 60 +- src/FSCommon.h | 12 +- src/mesh/STM32WLE5JCInterface.cpp | 6 +- src/modules/Modules.cpp | 2 + src/platform/stm32wl/LittleFS.cpp | 198 ++ src/platform/stm32wl/LittleFS.h | 41 + src/platform/stm32wl/STM32_LittleFS.cpp | 283 ++ src/platform/stm32wl/STM32_LittleFS.h | 107 + src/platform/stm32wl/STM32_LittleFS_File.cpp | 394 +++ src/platform/stm32wl/STM32_LittleFS_File.h | 108 + src/platform/stm32wl/littlefs/lfs.c | 2531 ++++++++++++++++++ src/platform/stm32wl/littlefs/lfs.h | 476 ++++ src/platform/stm32wl/littlefs/lfs_util.c | 28 + src/platform/stm32wl/littlefs/lfs_util.h | 199 ++ src/shutdown.h | 2 + variants/CDEBYTE_E77-MBL/platformio.ini | 35 +- variants/rak3172/platformio.ini | 39 +- variants/rak3172/variant.h | 10 +- variants/wio-e5/platformio.ini | 35 +- variants/wio-e5/variant.h | 5 + 22 files changed, 4466 insertions(+), 155 deletions(-) create mode 100755 extra_scripts/extra_stm32.py create mode 100644 src/platform/stm32wl/LittleFS.cpp create mode 100644 src/platform/stm32wl/LittleFS.h create mode 100644 src/platform/stm32wl/STM32_LittleFS.cpp create mode 100644 src/platform/stm32wl/STM32_LittleFS.h create mode 100644 src/platform/stm32wl/STM32_LittleFS_File.cpp create mode 100644 src/platform/stm32wl/STM32_LittleFS_File.h create mode 100644 src/platform/stm32wl/littlefs/lfs.c create mode 100644 src/platform/stm32wl/littlefs/lfs.h create mode 100644 src/platform/stm32wl/littlefs/lfs_util.c create mode 100644 src/platform/stm32wl/littlefs/lfs_util.h diff --git a/arch/stm32/stm32.ini b/arch/stm32/stm32.ini index efa1ab0e4..d5e615f5f 100644 --- a/arch/stm32/stm32.ini +++ b/arch/stm32/stm32.ini @@ -1,13 +1,14 @@ [stm32_base] extends = arduino_base -platform = platformio/ststm32 -platform_packages = platformio/framework-arduinoststm32@^4.20900.0 +platform = ststm32 +platform_packages = platformio/framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32.git#2.9.0 +extra_scripts = + ${env.extra_scripts} + post:extra_scripts/extra_stm32.py build_type = release -;board_build.flash_offset = 0x08000000 - -build_flags = +build_flags = ${arduino_base.build_flags} -flto -Isrc/platform/stm32wl -g @@ -18,27 +19,24 @@ build_flags = -DMESHTASTIC_EXCLUDE_SCREEN -DMESHTASTIC_EXCLUDE_MQTT -DMESHTASTIC_EXCLUDE_BLUETOOTH - -DMESHTASTIC_EXCLUDE_PKI -DMESHTASTIC_EXCLUDE_GPS -; -DVECT_TAB_OFFSET=0x08000000 - -DconfigUSE_CMSIS_RTOS_V2=1 -; -DSPI_MODE_0=SPI_MODE0 + ;-DDEBUG_MUTE -fmerge-all-constants -ffunction-sections -fdata-sections - -build_src_filter = + +build_src_filter = ${arduino_base.build_src_filter} - - - - - - - - - - - - - - board_upload.offset_address = 0x08000000 upload_protocol = stlink +debug_tool = stlink lib_deps = ${env.lib_deps} - charlesbaynham/OSFS@^1.2.3 - jgromes/RadioLib@7.0.2 - https://github.com/caveman99/Crypto.git#f61ae26a53f7a2d0ba5511625b8bf8eff3a35d5e + ${radiolib_base.lib_deps} + https://github.com/caveman99/Crypto.git#eae9c768054118a9399690f8af202853d1ae8516 lib_ignore = mathertel/OneButton@2.6.1 - Wire \ No newline at end of file + Wire diff --git a/extra_scripts/extra_stm32.py b/extra_scripts/extra_stm32.py new file mode 100755 index 000000000..f3bd8c514 --- /dev/null +++ b/extra_scripts/extra_stm32.py @@ -0,0 +1,22 @@ +# trunk-ignore-all(ruff/F821) +# trunk-ignore-all(flake8/F821): For SConstruct imports + +Import("env") +# Custom HEX from ELF +env.AddPostAction( + "$BUILD_DIR/${PROGNAME}.elf", + env.VerboseAction( + " ".join( + [ + "$OBJCOPY", + "-O", + "ihex", + "-R", + ".eeprom", + "$BUILD_DIR/${PROGNAME}.elf", + "$BUILD_DIR/${PROGNAME}.hex", + ] + ), + "Building $BUILD_DIR/${PROGNAME}.hex", + ), +) diff --git a/src/FSCommon.cpp b/src/FSCommon.cpp index 31fe69c93..88f0764b5 100644 --- a/src/FSCommon.cpp +++ b/src/FSCommon.cpp @@ -29,30 +29,6 @@ SPIClass SPI1(HSPI); #endif // HAS_SDCARD -#if defined(ARCH_STM32WL) - -uint16_t OSFS::startOfEEPROM = 1; -uint16_t OSFS::endOfEEPROM = 2048; - -// 3) How do I read from the medium? -void OSFS::readNBytes(uint16_t address, unsigned int num, byte *output) -{ - for (uint16_t i = address; i < address + num; i++) { - *output = EEPROM.read(i); - output++; - } -} - -// 4) How to I write to the medium? -void OSFS::writeNBytes(uint16_t address, unsigned int num, const byte *input) -{ - for (uint16_t i = address; i < address + num; i++) { - EEPROM.update(i, *input); - input++; - } -} -#endif - /** * @brief Copies a file from one location to another. * @@ -62,33 +38,7 @@ void OSFS::writeNBytes(uint16_t address, unsigned int num, const byte *input) */ bool copyFile(const char *from, const char *to) { -#ifdef ARCH_STM32WL - unsigned char cbuffer[2048]; - - // Var to hold the result of actions - OSFS::result r; - - r = OSFS::getFile(from, cbuffer); - - if (r == notfound) { - LOG_ERROR("Failed to open source file %s", from); - return false; - } else if (r == noerr) { - r = OSFS::newFile(to, cbuffer, true); - if (r == noerr) { - return true; - } else { - LOG_ERROR("OSFS Error %d", r); - return false; - } - - } else { - LOG_ERROR("OSFS Error %d", r); - return false; - } - return true; - -#elif defined(FSCom) +#ifdef FSCom // take SPI Lock concurrency::LockGuard g(spiLock); unsigned char cbuffer[16]; @@ -127,13 +77,7 @@ bool copyFile(const char *from, const char *to) */ bool renameFile(const char *pathFrom, const char *pathTo) { -#ifdef ARCH_STM32WL - if (copyFile(pathFrom, pathTo) && (OSFS::deleteFile(pathFrom) == OSFS::result::NO_ERROR)) { - return true; - } else { - return false; - } -#elif defined(FSCom) +#ifdef FSCom #ifdef ARCH_ESP32 // take SPI Lock diff --git a/src/FSCommon.h b/src/FSCommon.h index 10ce4aeec..fdc0b76ec 100644 --- a/src/FSCommon.h +++ b/src/FSCommon.h @@ -15,13 +15,11 @@ #endif #if defined(ARCH_STM32WL) -// STM32WL series 2 Kbytes (8 rows of 256 bytes) -#include -#include - -// Useful consts -const OSFS::result noerr = OSFS::result::NO_ERROR; -const OSFS::result notfound = OSFS::result::FILE_NOT_FOUND; +// STM32WL +#include "LittleFS.h" +#define FSCom InternalFS +#define FSBegin() FSCom.begin() +using namespace STM32_LittleFS_Namespace; #endif #if defined(ARCH_RP2040) diff --git a/src/mesh/STM32WLE5JCInterface.cpp b/src/mesh/STM32WLE5JCInterface.cpp index ad1f675b6..6a340dd28 100644 --- a/src/mesh/STM32WLE5JCInterface.cpp +++ b/src/mesh/STM32WLE5JCInterface.cpp @@ -18,8 +18,10 @@ bool STM32WLE5JCInterface::init() { RadioLibInterface::init(); - // https://github.com/Seeed-Studio/LoRaWan-E5-Node/blob/main/Middlewares/Third_Party/SubGHz_Phy/stm32_radio_driver/radio_driver.c +// https://github.com/Seeed-Studio/LoRaWan-E5-Node/blob/main/Middlewares/Third_Party/SubGHz_Phy/stm32_radio_driver/radio_driver.c +#if (!defined(_VARIANT_RAK3172_)) setTCXOVoltage(1.7); +#endif lora.setRfSwitchTable(rfswitch_pins, rfswitch_table); @@ -42,4 +44,4 @@ bool STM32WLE5JCInterface::init() return res == RADIOLIB_ERR_NONE; } -#endif // ARCH_STM32WL \ No newline at end of file +#endif // ARCH_STM32WL diff --git a/src/modules/Modules.cpp b/src/modules/Modules.cpp index f386147d0..e2a4a970c 100644 --- a/src/modules/Modules.cpp +++ b/src/modules/Modules.cpp @@ -7,7 +7,9 @@ #include "input/SerialKeyboardImpl.h" #include "input/TrackballInterruptImpl1.h" #include "input/UpDownInterruptImpl1.h" +#if !MESHTASTIC_EXCLUDE_I2C #include "input/cardKbI2cImpl.h" +#endif #include "input/kbMatrixImpl.h" #endif #if !MESHTASTIC_EXCLUDE_ADMIN diff --git a/src/platform/stm32wl/LittleFS.cpp b/src/platform/stm32wl/LittleFS.cpp new file mode 100644 index 000000000..40f32eca8 --- /dev/null +++ b/src/platform/stm32wl/LittleFS.cpp @@ -0,0 +1,198 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2019 hathach for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "LittleFS.h" +#include "stm32wlxx_hal_flash.h" + +/********************************************************************************************************************** + * Macro definitions + **********************************************************************************************************************/ +/** This macro is used to suppress compiler messages about a parameter not being used in a function. */ +#define LFS_UNUSED(p) (void)((p)) + +#define STM32WL_PAGE_SIZE (FLASH_PAGE_SIZE) +#define STM32WL_PAGE_COUNT (FLASH_PAGE_NB) +#define STM32WL_FLASH_BASE (FLASH_BASE) + +/* + * FLASH_SIZE from stm32wle5xx.h will read the actual FLASH size from the chip. + * FLASH_END_ADDR is calculated from FLASH_SIZE. + * Use the last 28 KiB of the FLASH + */ +#define LFS_FLASH_TOTAL_SIZE (14 * 2048) /* needs to be a multiple of LFS_BLOCK_SIZE */ +#define LFS_BLOCK_SIZE (2048) +#define LFS_FLASH_ADDR_END (FLASH_END_ADDR) +#define LFS_FLASH_ADDR_BASE (LFS_FLASH_ADDR_END - LFS_FLASH_TOTAL_SIZE + 1) + +#if !CFG_DEBUG +#define _LFS_DBG(fmt, ...) +#else +#define _LFS_DBG(fmt, ...) printf("%s:%d (%s): " fmt "\n", __FILE__, __LINE__, __func__, __VA_ARGS__) +#endif + +//--------------------------------------------------------------------+ +// LFS Disk IO +//--------------------------------------------------------------------+ + +static int _internal_flash_read(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, void *buffer, lfs_size_t size) +{ + LFS_UNUSED(c); + + if (!buffer || !size) { + _LFS_DBG("%s Invalid parameter!\r\n", __func__); + return LFS_ERR_INVAL; + } + + lfs_block_t address = LFS_FLASH_ADDR_BASE + (block * STM32WL_PAGE_SIZE + off); + + memcpy(buffer, (void *)address, size); + + return LFS_ERR_OK; +} + +// Program a region in a block. The block must have previously +// been erased. Negative error codes are propogated to the user. +// May return LFS_ERR_CORRUPT if the block should be considered bad. +static int _internal_flash_prog(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, const void *buffer, lfs_size_t size) +{ + lfs_block_t address = LFS_FLASH_ADDR_BASE + (block * STM32WL_PAGE_SIZE + off); + HAL_StatusTypeDef hal_rc = HAL_OK; + uint32_t dw_count = size / 8; + uint64_t *bufp = (uint64_t *)buffer; + + LFS_UNUSED(c); + + _LFS_DBG("Programming %d bytes/%d doublewords at address 0x%08x/block %d, offset %d.", size, dw_count, address, block, off); + if (HAL_FLASH_Unlock() != HAL_OK) { + return LFS_ERR_IO; + } + for (uint32_t i = 0; i < dw_count; i++) { + if ((address < LFS_FLASH_ADDR_BASE) || (address > LFS_FLASH_ADDR_END)) { + _LFS_DBG("Wanted to program out of bound of FLASH: 0x%08x.\n", address); + HAL_FLASH_Lock(); + return LFS_ERR_INVAL; + } + hal_rc = HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, address, *bufp); + if (hal_rc != HAL_OK) { + /* Error occurred while writing data in Flash memory. + * User can add here some code to deal with this error. + */ + _LFS_DBG("Program error at (0x%08x), 0x%X, error: 0x%08x\n", address, hal_rc, HAL_FLASH_GetError()); + } + address += 8; + bufp += 1; + } + if (HAL_FLASH_Lock() != HAL_OK) { + return LFS_ERR_IO; + } + + return hal_rc == HAL_OK ? LFS_ERR_OK : LFS_ERR_IO; // If HAL_OK, return LFS_ERR_OK, else return LFS_ERR_IO +} + +// Erase a block. A block must be erased before being programmed. +// The state of an erased block is undefined. Negative error codes +// are propogated to the user. +// May return LFS_ERR_CORRUPT if the block should be considered bad. +static int _internal_flash_erase(const struct lfs_config *c, lfs_block_t block) +{ + lfs_block_t address = LFS_FLASH_ADDR_BASE + (block * STM32WL_PAGE_SIZE); + HAL_StatusTypeDef hal_rc; + FLASH_EraseInitTypeDef EraseInitStruct = {.TypeErase = FLASH_TYPEERASE_PAGES, .Page = 0, .NbPages = 1}; + uint32_t PAGEError = 0; + + LFS_UNUSED(c); + + if ((address < LFS_FLASH_ADDR_BASE) || (address > LFS_FLASH_ADDR_END)) { + _LFS_DBG("Wanted to erase out of bound of FLASH: 0x%08x.\n", address); + return LFS_ERR_INVAL; + } + /* calculate the absolute page, i.e. what the ST wants */ + EraseInitStruct.Page = (address - STM32WL_FLASH_BASE) / STM32WL_PAGE_SIZE; + _LFS_DBG("Erasing block %d at 0x%08x... ", block, address); + HAL_FLASH_Unlock(); + hal_rc = HAL_FLASHEx_Erase(&EraseInitStruct, &PAGEError); + HAL_FLASH_Lock(); + + return hal_rc == HAL_OK ? LFS_ERR_OK : LFS_ERR_IO; // If HAL_OK, return LFS_ERR_OK, else return LFS_ERR_IO +} + +// Sync the state of the underlying block device. Negative error codes +// are propogated to the user. +static int _internal_flash_sync(const struct lfs_config *c) +{ + LFS_UNUSED(c); + // write function performs no caching. No need for sync. + + return LFS_ERR_OK; +} + +static struct lfs_config _InternalFSConfig = {.context = NULL, + + .read = _internal_flash_read, + .prog = _internal_flash_prog, + .erase = _internal_flash_erase, + .sync = _internal_flash_sync, + + .read_size = LFS_BLOCK_SIZE, + .prog_size = LFS_BLOCK_SIZE, + .block_size = LFS_BLOCK_SIZE, + .block_count = LFS_FLASH_TOTAL_SIZE / LFS_BLOCK_SIZE, + .lookahead = 128, + + .read_buffer = NULL, + .prog_buffer = NULL, + .lookahead_buffer = NULL, + .file_buffer = NULL}; + +LittleFS InternalFS; + +//--------------------------------------------------------------------+ +// +//--------------------------------------------------------------------+ + +LittleFS::LittleFS(void) : STM32_LittleFS(&_InternalFSConfig) {} + +bool LittleFS::begin(void) +{ + if (FLASH_BASE >= LFS_FLASH_ADDR_BASE) { + /* There is not enough space on this device for a filesystem. */ + return false; + } + // failed to mount, erase all pages then format and mount again + if (!STM32_LittleFS::begin()) { + // Erase all pages of internal flash region for Filesystem. + for (uint32_t addr = LFS_FLASH_ADDR_BASE; addr < (LFS_FLASH_ADDR_END + 1); addr += STM32WL_PAGE_SIZE) { + _internal_flash_erase(&_InternalFSConfig, (addr - LFS_FLASH_ADDR_BASE) / STM32WL_PAGE_SIZE); + } + + // lfs format + this->format(); + + // mount again if still failed, give up + if (!STM32_LittleFS::begin()) + return false; + } + + return true; +} diff --git a/src/platform/stm32wl/LittleFS.h b/src/platform/stm32wl/LittleFS.h new file mode 100644 index 000000000..6c3c47f91 --- /dev/null +++ b/src/platform/stm32wl/LittleFS.h @@ -0,0 +1,41 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2019 hathach for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef INTERNALFILESYSTEM_H_ +#define INTERNALFILESYSTEM_H_ + +#include "STM32_LittleFS.h" + +class LittleFS : public STM32_LittleFS +{ + public: + LittleFS(void); + + // overwrite to also perform low level format (sector erase of whole flash region) + bool begin(void); +}; + +extern LittleFS InternalFS; + +#endif /* INTERNALFILESYSTEM_H_ */ diff --git a/src/platform/stm32wl/STM32_LittleFS.cpp b/src/platform/stm32wl/STM32_LittleFS.cpp new file mode 100644 index 000000000..97e79e61e --- /dev/null +++ b/src/platform/stm32wl/STM32_LittleFS.cpp @@ -0,0 +1,283 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2019 Ha Thach for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "STM32_LittleFS.h" +#include +#include + +#define memclr(buffer, size) memset(buffer, 0, size) +#define varclr(_var) memclr(_var, sizeof(*(_var))) + +using namespace STM32_LittleFS_Namespace; + +//--------------------------------------------------------------------+ +// Implementation +//--------------------------------------------------------------------+ + +STM32_LittleFS::STM32_LittleFS(void) : STM32_LittleFS(NULL) {} + +STM32_LittleFS::STM32_LittleFS(struct lfs_config *cfg) +{ + varclr(&_lfs); + _lfs_cfg = cfg; + _mounted = false; +} + +STM32_LittleFS::~STM32_LittleFS() {} + +// Initialize and mount the file system +// Return true if mounted successfully else probably corrupted. +// User should format the disk and try again +bool STM32_LittleFS::begin(struct lfs_config *cfg) +{ + _lockFS(); + + bool ret; + // not a loop, just an quick way to short-circuit on error + do { + if (_mounted) { + ret = true; + break; + } + if (cfg) { + _lfs_cfg = cfg; + } + if (nullptr == _lfs_cfg) { + ret = false; + break; + } + // actually attempt to mount, and log error if one occurs + int err = lfs_mount(&_lfs, _lfs_cfg); + PRINT_LFS_ERR(err); + _mounted = (err == LFS_ERR_OK); + ret = _mounted; + } while (0); + + _unlockFS(); + return ret; +} + +// Tear down and unmount file system +void STM32_LittleFS::end(void) +{ + _lockFS(); + + if (_mounted) { + _mounted = false; + int err = lfs_unmount(&_lfs); + PRINT_LFS_ERR(err); + (void)err; + } + + _unlockFS(); +} + +bool STM32_LittleFS::format(void) +{ + _lockFS(); + + int err = LFS_ERR_OK; + bool attemptMount = _mounted; + // not a loop, just an quick way to short-circuit on error + do { + // if already mounted: umount first -> format -> remount + if (_mounted) { + _mounted = false; + err = lfs_unmount(&_lfs); + if (LFS_ERR_OK != err) { + PRINT_LFS_ERR(err); + break; + } + } + err = lfs_format(&_lfs, _lfs_cfg); + if (LFS_ERR_OK != err) { + PRINT_LFS_ERR(err); + break; + } + + if (attemptMount) { + err = lfs_mount(&_lfs, _lfs_cfg); + if (LFS_ERR_OK != err) { + PRINT_LFS_ERR(err); + break; + } + _mounted = true; + } + // success! + } while (0); + + _unlockFS(); + return LFS_ERR_OK == err; +} + +// Open a file or folder +STM32_LittleFS_Namespace::File STM32_LittleFS::open(char const *filepath, uint8_t mode) +{ + // No lock is required here ... the File() object will synchronize with the mutex provided + return STM32_LittleFS_Namespace::File(filepath, mode, *this); +} + +// Check if file or folder exists +bool STM32_LittleFS::exists(char const *filepath) +{ + struct lfs_info info; + _lockFS(); + + bool ret = (0 == lfs_stat(&_lfs, filepath, &info)); + + _unlockFS(); + return ret; +} + +// Create a directory, create intermediate parent if needed +bool STM32_LittleFS::mkdir(char const *filepath) +{ + bool ret = true; + const char *slash = filepath; + if (slash[0] == '/') + slash++; // skip root '/' + + _lockFS(); + + // make intermediate parent directory(ies) + while (NULL != (slash = strchr(slash, '/'))) { + char parent[slash - filepath + 1] = {0}; + memcpy(parent, filepath, slash - filepath); + + int rc = lfs_mkdir(&_lfs, parent); + if (rc != LFS_ERR_OK && rc != LFS_ERR_EXIST) { + PRINT_LFS_ERR(rc); + ret = false; + break; + } + slash++; + } + // make the final requested directory + if (ret) { + int rc = lfs_mkdir(&_lfs, filepath); + if (rc != LFS_ERR_OK && rc != LFS_ERR_EXIST) { + PRINT_LFS_ERR(rc); + ret = false; + } + } + + _unlockFS(); + return ret; +} + +// Remove a file +bool STM32_LittleFS::remove(char const *filepath) +{ + _lockFS(); + + int err = lfs_remove(&_lfs, filepath); + PRINT_LFS_ERR(err); + + _unlockFS(); + return LFS_ERR_OK == err; +} + +// Rename a file +bool STM32_LittleFS::rename(char const *oldfilepath, char const *newfilepath) +{ + _lockFS(); + + int err = lfs_rename(&_lfs, oldfilepath, newfilepath); + PRINT_LFS_ERR(err); + + _unlockFS(); + return LFS_ERR_OK == err; +} + +// Remove a folder +bool STM32_LittleFS::rmdir(char const *filepath) +{ + _lockFS(); + + int err = lfs_remove(&_lfs, filepath); + PRINT_LFS_ERR(err); + + _unlockFS(); + return LFS_ERR_OK == err; +} + +// Remove a folder recursively +bool STM32_LittleFS::rmdir_r(char const *filepath) +{ + /* lfs is modified to remove non-empty folder, + According to below issue, comment these 2 line won't corrupt filesystem + at least when using LFS v1. If moving to LFS v2, see tracked issue + to see if issues (such as the orphans in threaded linked list) are resolved. + https://github.com/ARMmbed/littlefs/issues/43 + */ + _lockFS(); + + int err = lfs_remove(&_lfs, filepath); + PRINT_LFS_ERR(err); + + _unlockFS(); + return LFS_ERR_OK == err; +} + +//------------- Debug -------------// +#if CFG_DEBUG + +const char *dbg_strerr_lfs(int32_t err) +{ + switch (err) { + case LFS_ERR_OK: + return "LFS_ERR_OK"; + case LFS_ERR_IO: + return "LFS_ERR_IO"; + case LFS_ERR_CORRUPT: + return "LFS_ERR_CORRUPT"; + case LFS_ERR_NOENT: + return "LFS_ERR_NOENT"; + case LFS_ERR_EXIST: + return "LFS_ERR_EXIST"; + case LFS_ERR_NOTDIR: + return "LFS_ERR_NOTDIR"; + case LFS_ERR_ISDIR: + return "LFS_ERR_ISDIR"; + case LFS_ERR_NOTEMPTY: + return "LFS_ERR_NOTEMPTY"; + case LFS_ERR_BADF: + return "LFS_ERR_BADF"; + case LFS_ERR_INVAL: + return "LFS_ERR_INVAL"; + case LFS_ERR_NOSPC: + return "LFS_ERR_NOSPC"; + case LFS_ERR_NOMEM: + return "LFS_ERR_NOMEM"; + + default: + static char errcode[10]; + sprintf(errcode, "%ld", err); + return errcode; + } + + return NULL; +} + +#endif diff --git a/src/platform/stm32wl/STM32_LittleFS.h b/src/platform/stm32wl/STM32_LittleFS.h new file mode 100644 index 000000000..2ab531ee5 --- /dev/null +++ b/src/platform/stm32wl/STM32_LittleFS.h @@ -0,0 +1,107 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2019 Ha Thach for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef STM32_LITTLEFS_H_ +#define STM32_LITTLEFS_H_ + +#include + +// Internal Flash uses ARM Little FileSystem +// https://github.com/ARMmbed/littlefs +#include "../../freertosinc.h" // tied to FreeRTOS for serialization +#include "STM32_LittleFS_File.h" +#include "littlefs/lfs.h" + +class STM32_LittleFS +{ + public: + STM32_LittleFS(void); + STM32_LittleFS(struct lfs_config *cfg); + virtual ~STM32_LittleFS(); + + bool begin(struct lfs_config *cfg = NULL); + void end(void); + + // Open the specified file/directory with the supplied mode (e.g. read or + // write, etc). Returns a File object for interacting with the file. + // Note that currently only one file can be open at a time. + STM32_LittleFS_Namespace::File open(char const *filename, uint8_t mode = STM32_LittleFS_Namespace::FILE_O_READ); + + // Methods to determine if the requested file path exists. + bool exists(char const *filepath); + + // Create the requested directory hierarchy--if intermediate directories + // do not exist they will be created. + bool mkdir(char const *filepath); + + // Delete the file. + bool remove(char const *filepath); + + // Rename the file. + bool rename(char const *oldfilepath, char const *newfilepath); + + // Delete a folder (must be empty) + bool rmdir(char const *filepath); + + // Delete a folder (recursively) + bool rmdir_r(char const *filepath); + + // format file system + bool format(void); + + /*------------------------------------------------------------------*/ + /* INTERNAL USAGE ONLY + * Although declare as public, it is meant to be invoked by internal + * code. User should not call these directly + *------------------------------------------------------------------*/ + lfs_t *_getFS(void) { return &_lfs; } + void _lockFS(void) + { /* no-op */ + } + void _unlockFS(void) + { /* no-op */ + } + + protected: + bool _mounted; + struct lfs_config *_lfs_cfg; + lfs_t _lfs; +}; + +#if !CFG_DEBUG +#define VERIFY_LFS(...) _GET_3RD_ARG(__VA_ARGS__, VERIFY_ERR_2ARGS, VERIFY_ERR_1ARGS)(__VA_ARGS__, NULL) +#define PRINT_LFS_ERR(_err) +#else +#define VERIFY_LFS(...) _GET_3RD_ARG(__VA_ARGS__, VERIFY_ERR_2ARGS, VERIFY_ERR_1ARGS)(__VA_ARGS__, dbg_strerr_lfs) +#define PRINT_LFS_ERR(_err) \ + do { \ + if (_err) { \ + printf("%s:%d, LFS error: %d\n", __FILE__, __LINE__, _err); \ + } \ + } while (0) // LFS_ERR are of type int, VERIFY_MESS expects long_int + +const char *dbg_strerr_lfs(int32_t err); +#endif + +#endif /* STM32_LITTLEFS_H_ */ diff --git a/src/platform/stm32wl/STM32_LittleFS_File.cpp b/src/platform/stm32wl/STM32_LittleFS_File.cpp new file mode 100644 index 000000000..5e2d4c86c --- /dev/null +++ b/src/platform/stm32wl/STM32_LittleFS_File.cpp @@ -0,0 +1,394 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2019 Ha Thach for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "STM32_LittleFS.h" +#include + +#define rtos_malloc malloc +#define rtos_free free + +//--------------------------------------------------------------------+ +// MACRO TYPEDEF CONSTANT ENUM DECLARATION +//--------------------------------------------------------------------+ + +using namespace STM32_LittleFS_Namespace; + +File::File(STM32_LittleFS &fs) +{ + _fs = &fs; + _is_dir = false; + _name[0] = 0; + _name[LFS_NAME_MAX] = 0; + _dir_path = NULL; + + _dir = NULL; + _file = NULL; +} + +File::File(char const *filename, uint8_t mode, STM32_LittleFS &fs) : File(fs) +{ + // public constructor calls public API open(), which will obtain the mutex + this->open(filename, mode); +} + +bool File::_open_file(char const *filepath, uint8_t mode) +{ + int flags = (mode == FILE_O_READ) ? LFS_O_RDONLY : (mode == FILE_O_WRITE) ? (LFS_O_RDWR | LFS_O_CREAT) : 0; + + if (flags) { + _file = (lfs_file_t *)rtos_malloc(sizeof(lfs_file_t)); + if (!_file) + return false; + + int rc = lfs_file_open(_fs->_getFS(), _file, filepath, flags); + + if (rc) { + // failed to open + PRINT_LFS_ERR(rc); + // free memory + rtos_free(_file); + _file = NULL; + return false; + } + + // move to end of file + if (mode == FILE_O_WRITE) + lfs_file_seek(_fs->_getFS(), _file, 0, LFS_SEEK_END); + + _is_dir = false; + } + + return true; +} + +bool File::_open_dir(char const *filepath) +{ + _dir = (lfs_dir_t *)rtos_malloc(sizeof(lfs_dir_t)); + if (!_dir) + return false; + + int rc = lfs_dir_open(_fs->_getFS(), _dir, filepath); + + if (rc) { + // failed to open + PRINT_LFS_ERR(rc); + // free memory + rtos_free(_dir); + _dir = NULL; + return false; + } + + _is_dir = true; + + _dir_path = (char *)rtos_malloc(strlen(filepath) + 1); + strcpy(_dir_path, filepath); + + return true; +} + +bool File::open(char const *filepath, uint8_t mode) +{ + bool ret = false; + _fs->_lockFS(); + + ret = this->_open(filepath, mode); + + _fs->_unlockFS(); + return ret; +} + +bool File::_open(char const *filepath, uint8_t mode) +{ + bool ret = false; + + // close if currently opened + if (this->isOpen()) + _close(); + + struct lfs_info info; + int rc = lfs_stat(_fs->_getFS(), filepath, &info); + + if (LFS_ERR_OK == rc) { + // file existed, open file or directory accordingly + ret = (info.type == LFS_TYPE_REG) ? _open_file(filepath, mode) : _open_dir(filepath); + } else if (LFS_ERR_NOENT == rc) { + // file not existed, only proceed with FILE_O_WRITE mode + if (mode == FILE_O_WRITE) + ret = _open_file(filepath, mode); + } else { + PRINT_LFS_ERR(rc); + } + + // save bare file name + if (ret) { + char const *splash = strrchr(filepath, '/'); + strncpy(_name, splash ? (splash + 1) : filepath, LFS_NAME_MAX); + } + return ret; +} + +size_t File::write(uint8_t ch) +{ + return write(&ch, 1); +} + +size_t File::write(uint8_t const *buf, size_t size) +{ + lfs_ssize_t wrcount = 0; + _fs->_lockFS(); + + if (!this->_is_dir) { + wrcount = lfs_file_write(_fs->_getFS(), _file, buf, size); + if (wrcount < 0) { + wrcount = 0; + } + } + + _fs->_unlockFS(); + return wrcount; +} + +int File::read(void) +{ + // this thin wrapper relies on called function to synchronize + int ret = -1; + uint8_t ch; + if (read(&ch, 1) > 0) { + ret = static_cast(ch); + } + return ret; +} + +int File::read(void *buf, uint16_t nbyte) +{ + int ret = 0; + _fs->_lockFS(); + + if (!this->_is_dir) { + ret = lfs_file_read(_fs->_getFS(), _file, buf, nbyte); + } + + _fs->_unlockFS(); + return ret; +} + +int File::peek(void) +{ + int ret = -1; + _fs->_lockFS(); + + if (!this->_is_dir) { + uint32_t pos = lfs_file_tell(_fs->_getFS(), _file); + uint8_t ch = 0; + if (lfs_file_read(_fs->_getFS(), _file, &ch, 1) > 0) { + ret = static_cast(ch); + } + (void)lfs_file_seek(_fs->_getFS(), _file, pos, LFS_SEEK_SET); + } + + _fs->_unlockFS(); + return ret; +} + +int File::available(void) +{ + int ret = 0; + _fs->_lockFS(); + + if (!this->_is_dir) { + uint32_t size = lfs_file_size(_fs->_getFS(), _file); + uint32_t pos = lfs_file_tell(_fs->_getFS(), _file); + ret = size - pos; + } + + _fs->_unlockFS(); + return ret; +} + +bool File::seek(uint32_t pos) +{ + bool ret = false; + _fs->_lockFS(); + + if (!this->_is_dir) { + ret = lfs_file_seek(_fs->_getFS(), _file, pos, LFS_SEEK_SET) >= 0; + } + + _fs->_unlockFS(); + return ret; +} + +uint32_t File::position(void) +{ + uint32_t ret = 0; + _fs->_lockFS(); + + if (!this->_is_dir) { + ret = lfs_file_tell(_fs->_getFS(), _file); + } + + _fs->_unlockFS(); + return ret; +} + +uint32_t File::size(void) +{ + uint32_t ret = 0; + _fs->_lockFS(); + + if (!this->_is_dir) { + ret = lfs_file_size(_fs->_getFS(), _file); + } + + _fs->_unlockFS(); + return ret; +} + +bool File::truncate(uint32_t pos) +{ + int32_t ret = LFS_ERR_ISDIR; + _fs->_lockFS(); + if (!this->_is_dir) { + ret = lfs_file_truncate(_fs->_getFS(), _file, pos); + } + _fs->_unlockFS(); + return (ret == 0); +} + +bool File::truncate(void) +{ + int32_t ret = LFS_ERR_ISDIR; + uint32_t pos; + _fs->_lockFS(); + if (!this->_is_dir) { + pos = lfs_file_tell(_fs->_getFS(), _file); + ret = lfs_file_truncate(_fs->_getFS(), _file, pos); + } + _fs->_unlockFS(); + return (ret == 0); +} + +void File::flush(void) +{ + _fs->_lockFS(); + + if (!this->_is_dir) { + lfs_file_sync(_fs->_getFS(), _file); + } + + _fs->_unlockFS(); + return; +} + +void File::close(void) +{ + _fs->_lockFS(); + this->_close(); + _fs->_unlockFS(); +} + +void File::_close(void) +{ + if (this->isOpen()) { + if (this->_is_dir) { + lfs_dir_close(_fs->_getFS(), _dir); + rtos_free(_dir); + _dir = NULL; + + if (this->_dir_path) + rtos_free(_dir_path); + _dir_path = NULL; + } else { + lfs_file_close(this->_fs->_getFS(), _file); + rtos_free(_file); + _file = NULL; + } + } +} + +File::operator bool(void) +{ + return isOpen(); +} + +bool File::isOpen(void) +{ + return (_file != NULL) || (_dir != NULL); +} + +// WARNING -- although marked as `const`, the values pointed +// to may change. For example, if the same File +// object has `open()` called with a different +// file or directory name, this same pointer will +// suddenly (unexpectedly?) have different values. +char const *File::name(void) +{ + return this->_name; +} + +bool File::isDirectory(void) +{ + return this->_is_dir; +} + +File File::openNextFile(uint8_t mode) +{ + _fs->_lockFS(); + + File ret(*_fs); + if (this->_is_dir) { + struct lfs_info info; + int rc; + + // lfs_dir_read returns 0 when reaching end of directory, 1 if found an entry + // Skip the "." and ".." entries ... + do { + rc = lfs_dir_read(_fs->_getFS(), _dir, &info); + } while (rc == 1 && (!strcmp(".", info.name) || !strcmp("..", info.name))); + + if (rc == 1) { + // string cat name with current folder + char filepath[strlen(_dir_path) + 1 + strlen(info.name) + 1]; // potential for significant stack usage + strcpy(filepath, _dir_path); + if (!(_dir_path[0] == '/' && _dir_path[1] == 0)) + strcat(filepath, "/"); // only add '/' if cwd is not root + strcat(filepath, info.name); + + (void)ret._open(filepath, mode); // return value is ignored ... caller is expected to check isOpened() + } else if (rc < 0) { + PRINT_LFS_ERR(rc); + } + } + _fs->_unlockFS(); + return ret; +} + +void File::rewindDirectory(void) +{ + _fs->_lockFS(); + if (this->_is_dir) { + lfs_dir_rewind(_fs->_getFS(), _dir); + } + _fs->_unlockFS(); +} diff --git a/src/platform/stm32wl/STM32_LittleFS_File.h b/src/platform/stm32wl/STM32_LittleFS_File.h new file mode 100644 index 000000000..0a021dc54 --- /dev/null +++ b/src/platform/stm32wl/STM32_LittleFS_File.h @@ -0,0 +1,108 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2019 Ha Thach for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef STM32_LITTLEFS_FILE_H_ +#define STM32_LITTLEFS_FILE_H_ + +#include "littlefs/lfs.h" + +// Forward declaration +class STM32_LittleFS; + +namespace STM32_LittleFS_Namespace +{ + +// avoid conflict with other FileSystem FILE_READ/FILE_WRITE +enum { + FILE_O_READ = 0, + FILE_O_WRITE = 1, +}; + +class File : public Stream +{ + public: + File(STM32_LittleFS &fs); + File(char const *filename, uint8_t mode, STM32_LittleFS &fs); + + public: + bool open(char const *filename, uint8_t mode); + + //------------- Stream API -------------// + virtual size_t write(uint8_t ch); + virtual size_t write(uint8_t const *buf, size_t size); + size_t write(const char *str) + { + if (str == NULL) + return 0; + return write((const uint8_t *)str, strlen(str)); + } + size_t write(const char *buffer, size_t size) { return write((const uint8_t *)buffer, size); } + + virtual int read(void); + int read(void *buf, uint16_t nbyte); + + virtual int peek(void); + virtual int available(void); + virtual void flush(void); + + bool seek(uint32_t pos); + uint32_t position(void); + uint32_t size(void); + + bool truncate(uint32_t pos); + bool truncate(void); + + void close(void); + + operator bool(void); + + bool isOpen(void); + char const *name(void); + + bool isDirectory(void); + File openNextFile(uint8_t mode = FILE_O_READ); + void rewindDirectory(void); + + private: + STM32_LittleFS *_fs; + + bool _is_dir; + + union { + lfs_file_t *_file; + lfs_dir_t *_dir; + }; + + char *_dir_path; + char _name[LFS_NAME_MAX + 1]; + + bool _open(char const *filepath, uint8_t mode); + bool _open_file(char const *filepath, uint8_t mode); + bool _open_dir(char const *filepath); + void _close(void); +}; + +} // namespace STM32_LittleFS_Namespace + +#endif /* STM32_LITTLEFS_FILE_H_ */ diff --git a/src/platform/stm32wl/littlefs/lfs.c b/src/platform/stm32wl/littlefs/lfs.c new file mode 100644 index 000000000..522614486 --- /dev/null +++ b/src/platform/stm32wl/littlefs/lfs.c @@ -0,0 +1,2531 @@ +/* + * The little filesystem + * + * Copyright (c) 2017, Arm Limited. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ +#include "lfs.h" +#include "lfs_util.h" + +#include + +/// Caching block device operations /// +static int lfs_cache_read(lfs_t *lfs, lfs_cache_t *rcache, const lfs_cache_t *pcache, lfs_block_t block, lfs_off_t off, + void *buffer, lfs_size_t size) +{ + uint8_t *data = buffer; + LFS_ASSERT(block < lfs->cfg->block_count); + + while (size > 0) { + if (pcache && block == pcache->block && off >= pcache->off && off < pcache->off + lfs->cfg->prog_size) { + // is already in pcache? + lfs_size_t diff = lfs_min(size, lfs->cfg->prog_size - (off - pcache->off)); + memcpy(data, &pcache->buffer[off - pcache->off], diff); + + data += diff; + off += diff; + size -= diff; + continue; + } + + if (block == rcache->block && off >= rcache->off && off < rcache->off + lfs->cfg->read_size) { + // is already in rcache? + lfs_size_t diff = lfs_min(size, lfs->cfg->read_size - (off - rcache->off)); + memcpy(data, &rcache->buffer[off - rcache->off], diff); + + data += diff; + off += diff; + size -= diff; + continue; + } + + if (off % lfs->cfg->read_size == 0 && size >= lfs->cfg->read_size) { + // bypass cache? + lfs_size_t diff = size - (size % lfs->cfg->read_size); + int err = lfs->cfg->read(lfs->cfg, block, off, data, diff); + if (err) { + return err; + } + + data += diff; + off += diff; + size -= diff; + continue; + } + + // load to cache, first condition can no longer fail + rcache->block = block; + rcache->off = off - (off % lfs->cfg->read_size); + int err = lfs->cfg->read(lfs->cfg, rcache->block, rcache->off, rcache->buffer, lfs->cfg->read_size); + if (err) { + return err; + } + } + + return 0; +} + +static int lfs_cache_cmp(lfs_t *lfs, lfs_cache_t *rcache, const lfs_cache_t *pcache, lfs_block_t block, lfs_off_t off, + const void *buffer, lfs_size_t size) +{ + const uint8_t *data = buffer; + + for (lfs_off_t i = 0; i < size; i++) { + uint8_t c; + int err = lfs_cache_read(lfs, rcache, pcache, block, off + i, &c, 1); + if (err) { + return err; + } + + if (c != data[i]) { + return false; + } + } + + return true; +} + +static int lfs_cache_crc(lfs_t *lfs, lfs_cache_t *rcache, const lfs_cache_t *pcache, lfs_block_t block, lfs_off_t off, + lfs_size_t size, uint32_t *crc) +{ + for (lfs_off_t i = 0; i < size; i++) { + uint8_t c; + int err = lfs_cache_read(lfs, rcache, pcache, block, off + i, &c, 1); + if (err) { + return err; + } + + lfs_crc(crc, &c, 1); + } + + return 0; +} + +static inline void lfs_cache_drop(lfs_t *lfs, lfs_cache_t *rcache) +{ + // do not zero, cheaper if cache is readonly or only going to be + // written with identical data (during relocates) + (void)lfs; + rcache->block = 0xffffffff; +} + +static inline void lfs_cache_zero(lfs_t *lfs, lfs_cache_t *pcache) +{ + // zero to avoid information leak + memset(pcache->buffer, 0xff, lfs->cfg->prog_size); + pcache->block = 0xffffffff; +} + +static int lfs_cache_flush(lfs_t *lfs, lfs_cache_t *pcache, lfs_cache_t *rcache) +{ + if (pcache->block != 0xffffffff) { + int err = lfs->cfg->prog(lfs->cfg, pcache->block, pcache->off, pcache->buffer, lfs->cfg->prog_size); + if (err) { + return err; + } + + if (rcache) { + int res = lfs_cache_cmp(lfs, rcache, NULL, pcache->block, pcache->off, pcache->buffer, lfs->cfg->prog_size); + if (res < 0) { + return res; + } + + if (!res) { + return LFS_ERR_CORRUPT; + } + } + + lfs_cache_zero(lfs, pcache); + } + + return 0; +} + +static int lfs_cache_prog(lfs_t *lfs, lfs_cache_t *pcache, lfs_cache_t *rcache, lfs_block_t block, lfs_off_t off, + const void *buffer, lfs_size_t size) +{ + const uint8_t *data = buffer; + LFS_ASSERT(block < lfs->cfg->block_count); + + while (size > 0) { + if (block == pcache->block && off >= pcache->off && off < pcache->off + lfs->cfg->prog_size) { + // is already in pcache? + lfs_size_t diff = lfs_min(size, lfs->cfg->prog_size - (off - pcache->off)); + memcpy(&pcache->buffer[off - pcache->off], data, diff); + + data += diff; + off += diff; + size -= diff; + + if (off % lfs->cfg->prog_size == 0) { + // eagerly flush out pcache if we fill up + int err = lfs_cache_flush(lfs, pcache, rcache); + if (err) { + return err; + } + } + + continue; + } + + // pcache must have been flushed, either by programming and + // entire block or manually flushing the pcache + LFS_ASSERT(pcache->block == 0xffffffff); + + if (off % lfs->cfg->prog_size == 0 && size >= lfs->cfg->prog_size) { + // bypass pcache? + lfs_size_t diff = size - (size % lfs->cfg->prog_size); + int err = lfs->cfg->prog(lfs->cfg, block, off, data, diff); + if (err) { + return err; + } + + if (rcache) { + int res = lfs_cache_cmp(lfs, rcache, NULL, block, off, data, diff); + if (res < 0) { + return res; + } + + if (!res) { + return LFS_ERR_CORRUPT; + } + } + + data += diff; + off += diff; + size -= diff; + continue; + } + + // prepare pcache, first condition can no longer fail + pcache->block = block; + pcache->off = off - (off % lfs->cfg->prog_size); + } + + return 0; +} + +/// General lfs block device operations /// +static int lfs_bd_read(lfs_t *lfs, lfs_block_t block, lfs_off_t off, void *buffer, lfs_size_t size) +{ + // if we ever do more than writes to alternating pairs, + // this may need to consider pcache + return lfs_cache_read(lfs, &lfs->rcache, NULL, block, off, buffer, size); +} + +static int lfs_bd_prog(lfs_t *lfs, lfs_block_t block, lfs_off_t off, const void *buffer, lfs_size_t size) +{ + return lfs_cache_prog(lfs, &lfs->pcache, NULL, block, off, buffer, size); +} + +static int lfs_bd_cmp(lfs_t *lfs, lfs_block_t block, lfs_off_t off, const void *buffer, lfs_size_t size) +{ + return lfs_cache_cmp(lfs, &lfs->rcache, NULL, block, off, buffer, size); +} + +static int lfs_bd_crc(lfs_t *lfs, lfs_block_t block, lfs_off_t off, lfs_size_t size, uint32_t *crc) +{ + return lfs_cache_crc(lfs, &lfs->rcache, NULL, block, off, size, crc); +} + +static int lfs_bd_erase(lfs_t *lfs, lfs_block_t block) +{ + return lfs->cfg->erase(lfs->cfg, block); +} + +static int lfs_bd_sync(lfs_t *lfs) +{ + lfs_cache_drop(lfs, &lfs->rcache); + + int err = lfs_cache_flush(lfs, &lfs->pcache, NULL); + if (err) { + return err; + } + + return lfs->cfg->sync(lfs->cfg); +} + +/// Internal operations predeclared here /// +int lfs_traverse(lfs_t *lfs, int (*cb)(void *, lfs_block_t), void *data); +static int lfs_pred(lfs_t *lfs, const lfs_block_t dir[2], lfs_dir_t *pdir); +static int lfs_parent(lfs_t *lfs, const lfs_block_t dir[2], lfs_dir_t *parent, lfs_entry_t *entry); +static int lfs_moved(lfs_t *lfs, const void *e); +static int lfs_relocate(lfs_t *lfs, const lfs_block_t oldpair[2], const lfs_block_t newpair[2]); +int lfs_deorphan(lfs_t *lfs); + +/// Block allocator /// +static int lfs_alloc_lookahead(void *p, lfs_block_t block) +{ + lfs_t *lfs = p; + + lfs_block_t off = ((block - lfs->free.off) + lfs->cfg->block_count) % lfs->cfg->block_count; + + if (off < lfs->free.size) { + lfs->free.buffer[off / 32] |= 1U << (off % 32); + } + + return 0; +} + +static int lfs_alloc(lfs_t *lfs, lfs_block_t *block) +{ + while (true) { + while (lfs->free.i != lfs->free.size) { + lfs_block_t off = lfs->free.i; + lfs->free.i += 1; + lfs->free.ack -= 1; + + if (!(lfs->free.buffer[off / 32] & (1U << (off % 32)))) { + // found a free block + *block = (lfs->free.off + off) % lfs->cfg->block_count; + + // eagerly find next off so an alloc ack can + // discredit old lookahead blocks + while (lfs->free.i != lfs->free.size && (lfs->free.buffer[lfs->free.i / 32] & (1U << (lfs->free.i % 32)))) { + lfs->free.i += 1; + lfs->free.ack -= 1; + } + + return 0; + } + } + + // check if we have looked at all blocks since last ack + if (lfs->free.ack == 0) { + LFS_WARN("No more free space %" PRIu32, lfs->free.i + lfs->free.off); + return LFS_ERR_NOSPC; + } + + lfs->free.off = (lfs->free.off + lfs->free.size) % lfs->cfg->block_count; + lfs->free.size = lfs_min(lfs->cfg->lookahead, lfs->free.ack); + lfs->free.i = 0; + + // find mask of free blocks from tree + memset(lfs->free.buffer, 0, lfs->cfg->lookahead / 8); + int err = lfs_traverse(lfs, lfs_alloc_lookahead, lfs); + if (err) { + return err; + } + } +} + +static void lfs_alloc_ack(lfs_t *lfs) +{ + lfs->free.ack = lfs->cfg->block_count; +} + +/// Endian swapping functions /// +static void lfs_dir_fromle32(struct lfs_disk_dir *d) +{ + d->rev = lfs_fromle32(d->rev); + d->size = lfs_fromle32(d->size); + d->tail[0] = lfs_fromle32(d->tail[0]); + d->tail[1] = lfs_fromle32(d->tail[1]); +} + +static void lfs_dir_tole32(struct lfs_disk_dir *d) +{ + d->rev = lfs_tole32(d->rev); + d->size = lfs_tole32(d->size); + d->tail[0] = lfs_tole32(d->tail[0]); + d->tail[1] = lfs_tole32(d->tail[1]); +} + +static void lfs_entry_fromle32(struct lfs_disk_entry *d) +{ + d->u.dir[0] = lfs_fromle32(d->u.dir[0]); + d->u.dir[1] = lfs_fromle32(d->u.dir[1]); +} + +static void lfs_entry_tole32(struct lfs_disk_entry *d) +{ + d->u.dir[0] = lfs_tole32(d->u.dir[0]); + d->u.dir[1] = lfs_tole32(d->u.dir[1]); +} + +static void lfs_superblock_fromle32(struct lfs_disk_superblock *d) +{ + d->root[0] = lfs_fromle32(d->root[0]); + d->root[1] = lfs_fromle32(d->root[1]); + d->block_size = lfs_fromle32(d->block_size); + d->block_count = lfs_fromle32(d->block_count); + d->version = lfs_fromle32(d->version); +} + +static void lfs_superblock_tole32(struct lfs_disk_superblock *d) +{ + d->root[0] = lfs_tole32(d->root[0]); + d->root[1] = lfs_tole32(d->root[1]); + d->block_size = lfs_tole32(d->block_size); + d->block_count = lfs_tole32(d->block_count); + d->version = lfs_tole32(d->version); +} + +/// Metadata pair and directory operations /// +static inline void lfs_pairswap(lfs_block_t pair[2]) +{ + lfs_block_t t = pair[0]; + pair[0] = pair[1]; + pair[1] = t; +} + +static inline bool lfs_pairisnull(const lfs_block_t pair[2]) +{ + return pair[0] == 0xffffffff || pair[1] == 0xffffffff; +} + +static inline int lfs_paircmp(const lfs_block_t paira[2], const lfs_block_t pairb[2]) +{ + return !(paira[0] == pairb[0] || paira[1] == pairb[1] || paira[0] == pairb[1] || paira[1] == pairb[0]); +} + +static inline bool lfs_pairsync(const lfs_block_t paira[2], const lfs_block_t pairb[2]) +{ + return (paira[0] == pairb[0] && paira[1] == pairb[1]) || (paira[0] == pairb[1] && paira[1] == pairb[0]); +} + +static inline lfs_size_t lfs_entry_size(const lfs_entry_t *entry) +{ + return 4 + entry->d.elen + entry->d.alen + entry->d.nlen; +} + +static int lfs_dir_alloc(lfs_t *lfs, lfs_dir_t *dir) +{ + // allocate pair of dir blocks + for (int i = 0; i < 2; i++) { + int err = lfs_alloc(lfs, &dir->pair[i]); + if (err) { + return err; + } + } + + // rather than clobbering one of the blocks we just pretend + // the revision may be valid + int err = lfs_bd_read(lfs, dir->pair[0], 0, &dir->d.rev, 4); + if (err && err != LFS_ERR_CORRUPT) { + return err; + } + + if (err != LFS_ERR_CORRUPT) { + dir->d.rev = lfs_fromle32(dir->d.rev); + } + + // set defaults + dir->d.rev += 1; + dir->d.size = sizeof(dir->d) + 4; + dir->d.tail[0] = 0xffffffff; + dir->d.tail[1] = 0xffffffff; + dir->off = sizeof(dir->d); + + // don't write out yet, let caller take care of that + return 0; +} + +static int lfs_dir_fetch(lfs_t *lfs, lfs_dir_t *dir, const lfs_block_t pair[2]) +{ + // copy out pair, otherwise may be aliasing dir + const lfs_block_t tpair[2] = {pair[0], pair[1]}; + bool valid = false; + + // check both blocks for the most recent revision + for (int i = 0; i < 2; i++) { + struct lfs_disk_dir test; + int err = lfs_bd_read(lfs, tpair[i], 0, &test, sizeof(test)); + lfs_dir_fromle32(&test); + if (err) { + if (err == LFS_ERR_CORRUPT) { + continue; + } + return err; + } + + if (valid && lfs_scmp(test.rev, dir->d.rev) < 0) { + continue; + } + + if ((0x7fffffff & test.size) < sizeof(test) + 4 || (0x7fffffff & test.size) > lfs->cfg->block_size) { + continue; + } + + uint32_t crc = 0xffffffff; + lfs_dir_tole32(&test); + lfs_crc(&crc, &test, sizeof(test)); + lfs_dir_fromle32(&test); + err = lfs_bd_crc(lfs, tpair[i], sizeof(test), (0x7fffffff & test.size) - sizeof(test), &crc); + if (err) { + if (err == LFS_ERR_CORRUPT) { + continue; + } + return err; + } + + if (crc != 0) { + continue; + } + + valid = true; + + // setup dir in case it's valid + dir->pair[0] = tpair[(i + 0) % 2]; + dir->pair[1] = tpair[(i + 1) % 2]; + dir->off = sizeof(dir->d); + dir->d = test; + } + + if (!valid) { + LFS_ERROR("Corrupted dir pair at %" PRIu32 " %" PRIu32, tpair[0], tpair[1]); + return LFS_ERR_CORRUPT; + } + + return 0; +} + +struct lfs_region { + lfs_off_t oldoff; + lfs_size_t oldlen; + const void *newdata; + lfs_size_t newlen; +}; + +static int lfs_dir_commit(lfs_t *lfs, lfs_dir_t *dir, const struct lfs_region *regions, int count) +{ + // increment revision count + dir->d.rev += 1; + + // keep pairs in order such that pair[0] is most recent + lfs_pairswap(dir->pair); + for (int i = 0; i < count; i++) { + dir->d.size += regions[i].newlen - regions[i].oldlen; + } + + const lfs_block_t oldpair[2] = {dir->pair[0], dir->pair[1]}; + bool relocated = false; + + while (true) { + + int err = lfs_bd_erase(lfs, dir->pair[0]); + if (err) { + if (err == LFS_ERR_CORRUPT) { + goto relocate; + } + return err; + } + + uint32_t crc = 0xffffffff; + lfs_dir_tole32(&dir->d); + lfs_crc(&crc, &dir->d, sizeof(dir->d)); + err = lfs_bd_prog(lfs, dir->pair[0], 0, &dir->d, sizeof(dir->d)); + lfs_dir_fromle32(&dir->d); + if (err) { + if (err == LFS_ERR_CORRUPT) { + goto relocate; + } + return err; + } + + int i = 0; + lfs_off_t oldoff = sizeof(dir->d); + lfs_off_t newoff = sizeof(dir->d); + while (newoff < (0x7fffffff & dir->d.size) - 4) { + if (i < count && regions[i].oldoff == oldoff) { + lfs_crc(&crc, regions[i].newdata, regions[i].newlen); + err = lfs_bd_prog(lfs, dir->pair[0], newoff, regions[i].newdata, regions[i].newlen); + if (err) { + if (err == LFS_ERR_CORRUPT) { + goto relocate; + } + return err; + } + + oldoff += regions[i].oldlen; + newoff += regions[i].newlen; + i += 1; + } else { + uint8_t data; + err = lfs_bd_read(lfs, oldpair[1], oldoff, &data, 1); + if (err) { + return err; + } + + lfs_crc(&crc, &data, 1); + err = lfs_bd_prog(lfs, dir->pair[0], newoff, &data, 1); + if (err) { + if (err == LFS_ERR_CORRUPT) { + goto relocate; + } + return err; + } + + oldoff += 1; + newoff += 1; + } + } + + crc = lfs_tole32(crc); + err = lfs_bd_prog(lfs, dir->pair[0], newoff, &crc, 4); + crc = lfs_fromle32(crc); + if (err) { + if (err == LFS_ERR_CORRUPT) { + goto relocate; + } + return err; + } + + err = lfs_bd_sync(lfs); + if (err) { + if (err == LFS_ERR_CORRUPT) { + goto relocate; + } + return err; + } + + // successful commit, check checksum to make sure + uint32_t ncrc = 0xffffffff; + err = lfs_bd_crc(lfs, dir->pair[0], 0, (0x7fffffff & dir->d.size) - 4, &ncrc); + if (err) { + return err; + } + + if (ncrc != crc) { + goto relocate; + } + + break; + relocate: + // commit was corrupted + LFS_DEBUG("Bad block at %" PRIu32, dir->pair[0]); + + // drop caches and prepare to relocate block + relocated = true; + lfs_cache_drop(lfs, &lfs->pcache); + + // can't relocate superblock, filesystem is now frozen + if (lfs_paircmp(oldpair, (const lfs_block_t[2]){0, 1}) == 0) { + LFS_WARN("Superblock %" PRIu32 " has become unwritable", oldpair[0]); + return LFS_ERR_CORRUPT; + } + + // relocate half of pair + err = lfs_alloc(lfs, &dir->pair[0]); + if (err) { + return err; + } + } + + if (relocated) { + // update references if we relocated + LFS_DEBUG("Relocating %" PRIu32 " %" PRIu32 " to %" PRIu32 " %" PRIu32, oldpair[0], oldpair[1], dir->pair[0], + dir->pair[1]); + int err = lfs_relocate(lfs, oldpair, dir->pair); + if (err) { + return err; + } + } + + // shift over any directories that are affected + for (lfs_dir_t *d = lfs->dirs; d; d = d->next) { + if (lfs_paircmp(d->pair, dir->pair) == 0) { + d->pair[0] = dir->pair[0]; + d->pair[1] = dir->pair[1]; + } + } + + return 0; +} + +static int lfs_dir_update(lfs_t *lfs, lfs_dir_t *dir, lfs_entry_t *entry, const void *data) +{ + lfs_entry_tole32(&entry->d); + int err = lfs_dir_commit(lfs, dir, + (struct lfs_region[]){{entry->off, sizeof(entry->d), &entry->d, sizeof(entry->d)}, + {entry->off + sizeof(entry->d), entry->d.nlen, data, entry->d.nlen}}, + data ? 2 : 1); + lfs_entry_fromle32(&entry->d); + return err; +} + +static int lfs_dir_append(lfs_t *lfs, lfs_dir_t *dir, lfs_entry_t *entry, const void *data) +{ + // check if we fit, if top bit is set we do not and move on + while (true) { + if (dir->d.size + lfs_entry_size(entry) <= lfs->cfg->block_size) { + entry->off = dir->d.size - 4; + + lfs_entry_tole32(&entry->d); + int err = lfs_dir_commit( + lfs, dir, + (struct lfs_region[]){{entry->off, 0, &entry->d, sizeof(entry->d)}, {entry->off, 0, data, entry->d.nlen}}, 2); + lfs_entry_fromle32(&entry->d); + return err; + } + + // we need to allocate a new dir block + if (!(0x80000000 & dir->d.size)) { + lfs_dir_t olddir = *dir; + int err = lfs_dir_alloc(lfs, dir); + if (err) { + return err; + } + + dir->d.tail[0] = olddir.d.tail[0]; + dir->d.tail[1] = olddir.d.tail[1]; + entry->off = dir->d.size - 4; + lfs_entry_tole32(&entry->d); + err = lfs_dir_commit( + lfs, dir, + (struct lfs_region[]){{entry->off, 0, &entry->d, sizeof(entry->d)}, {entry->off, 0, data, entry->d.nlen}}, 2); + lfs_entry_fromle32(&entry->d); + if (err) { + return err; + } + + olddir.d.size |= 0x80000000; + olddir.d.tail[0] = dir->pair[0]; + olddir.d.tail[1] = dir->pair[1]; + return lfs_dir_commit(lfs, &olddir, NULL, 0); + } + + int err = lfs_dir_fetch(lfs, dir, dir->d.tail); + if (err) { + return err; + } + } +} + +static int lfs_dir_remove(lfs_t *lfs, lfs_dir_t *dir, lfs_entry_t *entry) +{ + // check if we should just drop the directory block + if ((dir->d.size & 0x7fffffff) == sizeof(dir->d) + 4 + lfs_entry_size(entry)) { + lfs_dir_t pdir; + int res = lfs_pred(lfs, dir->pair, &pdir); + if (res < 0) { + return res; + } + + if (pdir.d.size & 0x80000000) { + pdir.d.size &= dir->d.size | 0x7fffffff; + pdir.d.tail[0] = dir->d.tail[0]; + pdir.d.tail[1] = dir->d.tail[1]; + return lfs_dir_commit(lfs, &pdir, NULL, 0); + } + } + + // shift out the entry + int err = lfs_dir_commit(lfs, dir, + (struct lfs_region[]){ + {entry->off, lfs_entry_size(entry), NULL, 0}, + }, + 1); + if (err) { + return err; + } + + // shift over any files/directories that are affected + for (lfs_file_t *f = lfs->files; f; f = f->next) { + if (lfs_paircmp(f->pair, dir->pair) == 0) { + if (f->poff == entry->off) { + f->pair[0] = 0xffffffff; + f->pair[1] = 0xffffffff; + } else if (f->poff > entry->off) { + f->poff -= lfs_entry_size(entry); + } + } + } + + for (lfs_dir_t *d = lfs->dirs; d; d = d->next) { + if (lfs_paircmp(d->pair, dir->pair) == 0) { + if (d->off > entry->off) { + d->off -= lfs_entry_size(entry); + d->pos -= lfs_entry_size(entry); + } + } + } + + return 0; +} + +static int lfs_dir_next(lfs_t *lfs, lfs_dir_t *dir, lfs_entry_t *entry) +{ + while (dir->off + sizeof(entry->d) > (0x7fffffff & dir->d.size) - 4) { + if (!(0x80000000 & dir->d.size)) { + entry->off = dir->off; + return LFS_ERR_NOENT; + } + + int err = lfs_dir_fetch(lfs, dir, dir->d.tail); + if (err) { + return err; + } + + dir->off = sizeof(dir->d); + dir->pos += sizeof(dir->d) + 4; + } + + int err = lfs_bd_read(lfs, dir->pair[0], dir->off, &entry->d, sizeof(entry->d)); + lfs_entry_fromle32(&entry->d); + if (err) { + return err; + } + + entry->off = dir->off; + dir->off += lfs_entry_size(entry); + dir->pos += lfs_entry_size(entry); + return 0; +} + +static int lfs_dir_find(lfs_t *lfs, lfs_dir_t *dir, lfs_entry_t *entry, const char **path) +{ + const char *pathname = *path; + size_t pathlen; + entry->d.type = LFS_TYPE_DIR; + entry->d.elen = sizeof(entry->d) - 4; + entry->d.alen = 0; + entry->d.nlen = 0; + entry->d.u.dir[0] = lfs->root[0]; + entry->d.u.dir[1] = lfs->root[1]; + + while (true) { + nextname: + // skip slashes + pathname += strspn(pathname, "/"); + pathlen = strcspn(pathname, "/"); + + // skip '.' and root '..' + if ((pathlen == 1 && memcmp(pathname, ".", 1) == 0) || (pathlen == 2 && memcmp(pathname, "..", 2) == 0)) { + pathname += pathlen; + goto nextname; + } + + // skip if matched by '..' in name + const char *suffix = pathname + pathlen; + size_t sufflen; + int depth = 1; + while (true) { + suffix += strspn(suffix, "/"); + sufflen = strcspn(suffix, "/"); + if (sufflen == 0) { + break; + } + + if (sufflen == 2 && memcmp(suffix, "..", 2) == 0) { + depth -= 1; + if (depth == 0) { + pathname = suffix + sufflen; + goto nextname; + } + } else { + depth += 1; + } + + suffix += sufflen; + } + + // found path + if (pathname[0] == '\0') { + return 0; + } + + // update what we've found + *path = pathname; + + // continue on if we hit a directory + if (entry->d.type != LFS_TYPE_DIR) { + return LFS_ERR_NOTDIR; + } + + int err = lfs_dir_fetch(lfs, dir, entry->d.u.dir); + if (err) { + return err; + } + + // find entry matching name + while (true) { + err = lfs_dir_next(lfs, dir, entry); + if (err) { + return err; + } + + if (((0x7f & entry->d.type) != LFS_TYPE_REG && (0x7f & entry->d.type) != LFS_TYPE_DIR) || entry->d.nlen != pathlen) { + continue; + } + + int res = lfs_bd_cmp(lfs, dir->pair[0], entry->off + 4 + entry->d.elen + entry->d.alen, pathname, pathlen); + if (res < 0) { + return res; + } + + // found match + if (res) { + break; + } + } + + // check that entry has not been moved + if (entry->d.type & 0x80) { + int moved = lfs_moved(lfs, &entry->d.u); + if (moved < 0 || moved) { + return (moved < 0) ? moved : LFS_ERR_NOENT; + } + + entry->d.type &= ~0x80; + } + + // to next name + pathname += pathlen; + } +} + +/// Top level directory operations /// +int lfs_mkdir(lfs_t *lfs, const char *path) +{ + // deorphan if we haven't yet, needed at most once after poweron + if (!lfs->deorphaned) { + int err = lfs_deorphan(lfs); + if (err) { + return err; + } + } + + // fetch parent directory + lfs_dir_t cwd; + lfs_entry_t entry; + int err = lfs_dir_find(lfs, &cwd, &entry, &path); + if (err != LFS_ERR_NOENT || strchr(path, '/') != NULL) { + return err ? err : LFS_ERR_EXIST; + } + + // build up new directory + lfs_alloc_ack(lfs); + + lfs_dir_t dir; + err = lfs_dir_alloc(lfs, &dir); + if (err) { + return err; + } + dir.d.tail[0] = cwd.d.tail[0]; + dir.d.tail[1] = cwd.d.tail[1]; + + err = lfs_dir_commit(lfs, &dir, NULL, 0); + if (err) { + return err; + } + + entry.d.type = LFS_TYPE_DIR; + entry.d.elen = sizeof(entry.d) - 4; + entry.d.alen = 0; + entry.d.nlen = strlen(path); + entry.d.u.dir[0] = dir.pair[0]; + entry.d.u.dir[1] = dir.pair[1]; + + cwd.d.tail[0] = dir.pair[0]; + cwd.d.tail[1] = dir.pair[1]; + + err = lfs_dir_append(lfs, &cwd, &entry, path); + if (err) { + return err; + } + + lfs_alloc_ack(lfs); + return 0; +} + +int lfs_dir_open(lfs_t *lfs, lfs_dir_t *dir, const char *path) +{ + dir->pair[0] = lfs->root[0]; + dir->pair[1] = lfs->root[1]; + + lfs_entry_t entry; + int err = lfs_dir_find(lfs, dir, &entry, &path); + if (err) { + return err; + } else if (entry.d.type != LFS_TYPE_DIR) { + return LFS_ERR_NOTDIR; + } + + err = lfs_dir_fetch(lfs, dir, entry.d.u.dir); + if (err) { + return err; + } + + // setup head dir + // special offset for '.' and '..' + dir->head[0] = dir->pair[0]; + dir->head[1] = dir->pair[1]; + dir->pos = sizeof(dir->d) - 2; + dir->off = sizeof(dir->d); + + // add to list of directories + dir->next = lfs->dirs; + lfs->dirs = dir; + + return 0; +} + +int lfs_dir_close(lfs_t *lfs, lfs_dir_t *dir) +{ + // remove from list of directories + for (lfs_dir_t **p = &lfs->dirs; *p; p = &(*p)->next) { + if (*p == dir) { + *p = dir->next; + break; + } + } + + return 0; +} + +int lfs_dir_read(lfs_t *lfs, lfs_dir_t *dir, struct lfs_info *info) +{ + memset(info, 0, sizeof(*info)); + + // special offset for '.' and '..' + if (dir->pos == sizeof(dir->d) - 2) { + info->type = LFS_TYPE_DIR; + strcpy(info->name, "."); + dir->pos += 1; + return 1; + } else if (dir->pos == sizeof(dir->d) - 1) { + info->type = LFS_TYPE_DIR; + strcpy(info->name, ".."); + dir->pos += 1; + return 1; + } + + lfs_entry_t entry; + while (true) { + int err = lfs_dir_next(lfs, dir, &entry); + if (err) { + return (err == LFS_ERR_NOENT) ? 0 : err; + } + + if ((0x7f & entry.d.type) != LFS_TYPE_REG && (0x7f & entry.d.type) != LFS_TYPE_DIR) { + continue; + } + + // check that entry has not been moved + if (entry.d.type & 0x80) { + int moved = lfs_moved(lfs, &entry.d.u); + if (moved < 0) { + return moved; + } + + if (moved) { + continue; + } + + entry.d.type &= ~0x80; + } + + break; + } + + info->type = entry.d.type; + if (info->type == LFS_TYPE_REG) { + info->size = entry.d.u.file.size; + } + + int err = lfs_bd_read(lfs, dir->pair[0], entry.off + 4 + entry.d.elen + entry.d.alen, info->name, entry.d.nlen); + if (err) { + return err; + } + + return 1; +} + +int lfs_dir_seek(lfs_t *lfs, lfs_dir_t *dir, lfs_off_t off) +{ + // simply walk from head dir + int err = lfs_dir_rewind(lfs, dir); + if (err) { + return err; + } + dir->pos = off; + + while (off > (0x7fffffff & dir->d.size)) { + off -= 0x7fffffff & dir->d.size; + if (!(0x80000000 & dir->d.size)) { + return LFS_ERR_INVAL; + } + + err = lfs_dir_fetch(lfs, dir, dir->d.tail); + if (err) { + return err; + } + } + + dir->off = off; + return 0; +} + +lfs_soff_t lfs_dir_tell(lfs_t *lfs, lfs_dir_t *dir) +{ + (void)lfs; + return dir->pos; +} + +int lfs_dir_rewind(lfs_t *lfs, lfs_dir_t *dir) +{ + // reload the head dir + int err = lfs_dir_fetch(lfs, dir, dir->head); + if (err) { + return err; + } + + dir->pair[0] = dir->head[0]; + dir->pair[1] = dir->head[1]; + dir->pos = sizeof(dir->d) - 2; + dir->off = sizeof(dir->d); + return 0; +} + +/// File index list operations /// +static int lfs_ctz_index(lfs_t *lfs, lfs_off_t *off) +{ + lfs_off_t size = *off; + lfs_off_t b = lfs->cfg->block_size - 2 * 4; + lfs_off_t i = size / b; + if (i == 0) { + return 0; + } + + i = (size - 4 * (lfs_popc(i - 1) + 2)) / b; + *off = size - b * i - 4 * lfs_popc(i); + return i; +} + +static int lfs_ctz_find(lfs_t *lfs, lfs_cache_t *rcache, const lfs_cache_t *pcache, lfs_block_t head, lfs_size_t size, + lfs_size_t pos, lfs_block_t *block, lfs_off_t *off) +{ + if (size == 0) { + *block = 0xffffffff; + *off = 0; + return 0; + } + + lfs_off_t current = lfs_ctz_index(lfs, &(lfs_off_t){size - 1}); + lfs_off_t target = lfs_ctz_index(lfs, &pos); + + while (current > target) { + lfs_size_t skip = lfs_min(lfs_npw2(current - target + 1) - 1, lfs_ctz(current)); + + int err = lfs_cache_read(lfs, rcache, pcache, head, 4 * skip, &head, 4); + head = lfs_fromle32(head); + if (err) { + return err; + } + + LFS_ASSERT(head >= 2 && head <= lfs->cfg->block_count); + current -= 1 << skip; + } + + *block = head; + *off = pos; + return 0; +} + +static int lfs_ctz_extend(lfs_t *lfs, lfs_cache_t *rcache, lfs_cache_t *pcache, lfs_block_t head, lfs_size_t size, + lfs_block_t *block, lfs_off_t *off) +{ + while (true) { + // go ahead and grab a block + lfs_block_t nblock; + int err = lfs_alloc(lfs, &nblock); + if (err) { + return err; + } + LFS_ASSERT(nblock >= 2 && nblock <= lfs->cfg->block_count); + + if (true) { + err = lfs_bd_erase(lfs, nblock); + if (err) { + if (err == LFS_ERR_CORRUPT) { + goto relocate; + } + return err; + } + + if (size == 0) { + *block = nblock; + *off = 0; + return 0; + } + + size -= 1; + lfs_off_t index = lfs_ctz_index(lfs, &size); + size += 1; + + // just copy out the last block if it is incomplete + if (size != lfs->cfg->block_size) { + for (lfs_off_t i = 0; i < size; i++) { + uint8_t data; + err = lfs_cache_read(lfs, rcache, NULL, head, i, &data, 1); + if (err) { + return err; + } + + err = lfs_cache_prog(lfs, pcache, rcache, nblock, i, &data, 1); + if (err) { + if (err == LFS_ERR_CORRUPT) { + goto relocate; + } + return err; + } + } + + *block = nblock; + *off = size; + return 0; + } + + // append block + index += 1; + lfs_size_t skips = lfs_ctz(index) + 1; + + for (lfs_off_t i = 0; i < skips; i++) { + head = lfs_tole32(head); + err = lfs_cache_prog(lfs, pcache, rcache, nblock, 4 * i, &head, 4); + head = lfs_fromle32(head); + if (err) { + if (err == LFS_ERR_CORRUPT) { + goto relocate; + } + return err; + } + + if (i != skips - 1) { + err = lfs_cache_read(lfs, rcache, NULL, head, 4 * i, &head, 4); + head = lfs_fromle32(head); + if (err) { + return err; + } + } + + LFS_ASSERT(head >= 2 && head <= lfs->cfg->block_count); + } + + *block = nblock; + *off = 4 * skips; + return 0; + } + + relocate: + LFS_DEBUG("Bad block at %" PRIu32, nblock); + + // just clear cache and try a new block + lfs_cache_drop(lfs, &lfs->pcache); + } +} + +static int lfs_ctz_traverse(lfs_t *lfs, lfs_cache_t *rcache, const lfs_cache_t *pcache, lfs_block_t head, lfs_size_t size, + int (*cb)(void *, lfs_block_t), void *data) +{ + if (size == 0) { + return 0; + } + + lfs_off_t index = lfs_ctz_index(lfs, &(lfs_off_t){size - 1}); + + while (true) { + int err = cb(data, head); + if (err) { + return err; + } + + if (index == 0) { + return 0; + } + + lfs_block_t heads[2]; + int count = 2 - (index & 1); + err = lfs_cache_read(lfs, rcache, pcache, head, 0, &heads, count * 4); + heads[0] = lfs_fromle32(heads[0]); + heads[1] = lfs_fromle32(heads[1]); + if (err) { + return err; + } + + for (int i = 0; i < count - 1; i++) { + err = cb(data, heads[i]); + if (err) { + return err; + } + } + + head = heads[count - 1]; + index -= count; + } +} + +/// Top level file operations /// +int lfs_file_opencfg(lfs_t *lfs, lfs_file_t *file, const char *path, int flags, const struct lfs_file_config *cfg) +{ + // deorphan if we haven't yet, needed at most once after poweron + if ((flags & 3) != LFS_O_RDONLY && !lfs->deorphaned) { + int err = lfs_deorphan(lfs); + if (err) { + return err; + } + } + + // allocate entry for file if it doesn't exist + lfs_dir_t cwd; + lfs_entry_t entry; + int err = lfs_dir_find(lfs, &cwd, &entry, &path); + if (err && (err != LFS_ERR_NOENT || strchr(path, '/') != NULL)) { + return err; + } + + if (err == LFS_ERR_NOENT) { + if (!(flags & LFS_O_CREAT)) { + return LFS_ERR_NOENT; + } + + // create entry to remember name + entry.d.type = LFS_TYPE_REG; + entry.d.elen = sizeof(entry.d) - 4; + entry.d.alen = 0; + entry.d.nlen = strlen(path); + entry.d.u.file.head = 0xffffffff; + entry.d.u.file.size = 0; + err = lfs_dir_append(lfs, &cwd, &entry, path); + if (err) { + return err; + } + } else if (entry.d.type == LFS_TYPE_DIR) { + return LFS_ERR_ISDIR; + } else if (flags & LFS_O_EXCL) { + return LFS_ERR_EXIST; + } + + // setup file struct + file->cfg = cfg; + file->pair[0] = cwd.pair[0]; + file->pair[1] = cwd.pair[1]; + file->poff = entry.off; + file->head = entry.d.u.file.head; + file->size = entry.d.u.file.size; + file->flags = flags; + file->pos = 0; + + if (flags & LFS_O_TRUNC) { + if (file->size != 0) { + file->flags |= LFS_F_DIRTY; + } + file->head = 0xffffffff; + file->size = 0; + } + + // allocate buffer if needed + file->cache.block = 0xffffffff; + if (file->cfg && file->cfg->buffer) { + file->cache.buffer = file->cfg->buffer; + } else if (lfs->cfg->file_buffer) { + if (lfs->files) { + // already in use + return LFS_ERR_NOMEM; + } + file->cache.buffer = lfs->cfg->file_buffer; + } else if ((file->flags & 3) == LFS_O_RDONLY) { + file->cache.buffer = lfs_malloc(lfs->cfg->read_size); + if (!file->cache.buffer) { + return LFS_ERR_NOMEM; + } + } else { + file->cache.buffer = lfs_malloc(lfs->cfg->prog_size); + if (!file->cache.buffer) { + return LFS_ERR_NOMEM; + } + } + + // zero to avoid information leak + lfs_cache_drop(lfs, &file->cache); + if ((file->flags & 3) != LFS_O_RDONLY) { + lfs_cache_zero(lfs, &file->cache); + } + + // add to list of files + file->next = lfs->files; + lfs->files = file; + + return 0; +} + +int lfs_file_open(lfs_t *lfs, lfs_file_t *file, const char *path, int flags) +{ + return lfs_file_opencfg(lfs, file, path, flags, NULL); +} + +int lfs_file_close(lfs_t *lfs, lfs_file_t *file) +{ + int err = lfs_file_sync(lfs, file); + + // remove from list of files + for (lfs_file_t **p = &lfs->files; *p; p = &(*p)->next) { + if (*p == file) { + *p = file->next; + break; + } + } + + // clean up memory + if (!(file->cfg && file->cfg->buffer) && !lfs->cfg->file_buffer) { + lfs_free(file->cache.buffer); + } + + return err; +} + +static int lfs_file_relocate(lfs_t *lfs, lfs_file_t *file) +{ +relocate: + LFS_DEBUG("Bad block at %" PRIu32, file->block); + + // just relocate what exists into new block + lfs_block_t nblock; + int err = lfs_alloc(lfs, &nblock); + if (err) { + return err; + } + + err = lfs_bd_erase(lfs, nblock); + if (err) { + if (err == LFS_ERR_CORRUPT) { + goto relocate; + } + return err; + } + + // either read from dirty cache or disk + for (lfs_off_t i = 0; i < file->off; i++) { + uint8_t data; + err = lfs_cache_read(lfs, &lfs->rcache, &file->cache, file->block, i, &data, 1); + if (err) { + return err; + } + + err = lfs_cache_prog(lfs, &lfs->pcache, &lfs->rcache, nblock, i, &data, 1); + if (err) { + if (err == LFS_ERR_CORRUPT) { + goto relocate; + } + return err; + } + } + + // copy over new state of file + memcpy(file->cache.buffer, lfs->pcache.buffer, lfs->cfg->prog_size); + file->cache.block = lfs->pcache.block; + file->cache.off = lfs->pcache.off; + lfs_cache_zero(lfs, &lfs->pcache); + + file->block = nblock; + return 0; +} + +static int lfs_file_flush(lfs_t *lfs, lfs_file_t *file) +{ + if (file->flags & LFS_F_READING) { + // just drop read cache + lfs_cache_drop(lfs, &file->cache); + file->flags &= ~LFS_F_READING; + } + + if (file->flags & LFS_F_WRITING) { + lfs_off_t pos = file->pos; + + // copy over anything after current branch + lfs_file_t orig = { + .head = file->head, + .size = file->size, + .flags = LFS_O_RDONLY, + .pos = file->pos, + .cache = lfs->rcache, + }; + lfs_cache_drop(lfs, &lfs->rcache); + + while (file->pos < file->size) { + // copy over a byte at a time, leave it up to caching + // to make this efficient + uint8_t data; + lfs_ssize_t res = lfs_file_read(lfs, &orig, &data, 1); + if (res < 0) { + return res; + } + + res = lfs_file_write(lfs, file, &data, 1); + if (res < 0) { + return res; + } + + // keep our reference to the rcache in sync + if (lfs->rcache.block != 0xffffffff) { + lfs_cache_drop(lfs, &orig.cache); + lfs_cache_drop(lfs, &lfs->rcache); + } + } + + // write out what we have + while (true) { + int err = lfs_cache_flush(lfs, &file->cache, &lfs->rcache); + if (err) { + if (err == LFS_ERR_CORRUPT) { + goto relocate; + } + return err; + } + + break; + relocate: + err = lfs_file_relocate(lfs, file); + if (err) { + return err; + } + } + + // actual file updates + file->head = file->block; + file->size = file->pos; + file->flags &= ~LFS_F_WRITING; + file->flags |= LFS_F_DIRTY; + + file->pos = pos; + } + + return 0; +} + +int lfs_file_sync(lfs_t *lfs, lfs_file_t *file) +{ + int err = lfs_file_flush(lfs, file); + if (err) { + return err; + } + + if ((file->flags & LFS_F_DIRTY) && !(file->flags & LFS_F_ERRED) && !lfs_pairisnull(file->pair)) { + // update dir entry + lfs_dir_t cwd; + err = lfs_dir_fetch(lfs, &cwd, file->pair); + if (err) { + return err; + } + + lfs_entry_t entry = {.off = file->poff}; + err = lfs_bd_read(lfs, cwd.pair[0], entry.off, &entry.d, sizeof(entry.d)); + lfs_entry_fromle32(&entry.d); + if (err) { + return err; + } + + LFS_ASSERT(entry.d.type == LFS_TYPE_REG); + entry.d.u.file.head = file->head; + entry.d.u.file.size = file->size; + + err = lfs_dir_update(lfs, &cwd, &entry, NULL); + if (err) { + return err; + } + + file->flags &= ~LFS_F_DIRTY; + } + + return 0; +} + +lfs_ssize_t lfs_file_read(lfs_t *lfs, lfs_file_t *file, void *buffer, lfs_size_t size) +{ + uint8_t *data = buffer; + lfs_size_t nsize = size; + + if ((file->flags & 3) == LFS_O_WRONLY) { + return LFS_ERR_BADF; + } + + if (file->flags & LFS_F_WRITING) { + // flush out any writes + int err = lfs_file_flush(lfs, file); + if (err) { + return err; + } + } + + if (file->pos >= file->size) { + // eof if past end + return 0; + } + + size = lfs_min(size, file->size - file->pos); + nsize = size; + + while (nsize > 0) { + // check if we need a new block + if (!(file->flags & LFS_F_READING) || file->off == lfs->cfg->block_size) { + int err = lfs_ctz_find(lfs, &file->cache, NULL, file->head, file->size, file->pos, &file->block, &file->off); + if (err) { + return err; + } + + file->flags |= LFS_F_READING; + } + + // read as much as we can in current block + lfs_size_t diff = lfs_min(nsize, lfs->cfg->block_size - file->off); + int err = lfs_cache_read(lfs, &file->cache, NULL, file->block, file->off, data, diff); + if (err) { + return err; + } + + file->pos += diff; + file->off += diff; + data += diff; + nsize -= diff; + } + + return size; +} + +lfs_ssize_t lfs_file_write(lfs_t *lfs, lfs_file_t *file, const void *buffer, lfs_size_t size) +{ + const uint8_t *data = buffer; + lfs_size_t nsize = size; + + if ((file->flags & 3) == LFS_O_RDONLY) { + return LFS_ERR_BADF; + } + + if (file->flags & LFS_F_READING) { + // drop any reads + int err = lfs_file_flush(lfs, file); + if (err) { + return err; + } + } + + if ((file->flags & LFS_O_APPEND) && file->pos < file->size) { + file->pos = file->size; + } + + if (!(file->flags & LFS_F_WRITING) && file->pos > file->size) { + // fill with zeros + lfs_off_t pos = file->pos; + file->pos = file->size; + + while (file->pos < pos) { + lfs_ssize_t res = lfs_file_write(lfs, file, &(uint8_t){0}, 1); + if (res < 0) { + return res; + } + } + } + + while (nsize > 0) { + // check if we need a new block + if (!(file->flags & LFS_F_WRITING) || file->off == lfs->cfg->block_size) { + if (!(file->flags & LFS_F_WRITING) && file->pos > 0) { + // find out which block we're extending from + int err = lfs_ctz_find(lfs, &file->cache, NULL, file->head, file->size, file->pos - 1, &file->block, &file->off); + if (err) { + file->flags |= LFS_F_ERRED; + return err; + } + + // mark cache as dirty since we may have read data into it + lfs_cache_zero(lfs, &file->cache); + } + + // extend file with new blocks + lfs_alloc_ack(lfs); + int err = lfs_ctz_extend(lfs, &lfs->rcache, &file->cache, file->block, file->pos, &file->block, &file->off); + if (err) { + file->flags |= LFS_F_ERRED; + return err; + } + + file->flags |= LFS_F_WRITING; + } + + // program as much as we can in current block + lfs_size_t diff = lfs_min(nsize, lfs->cfg->block_size - file->off); + while (true) { + int err = lfs_cache_prog(lfs, &file->cache, &lfs->rcache, file->block, file->off, data, diff); + if (err) { + if (err == LFS_ERR_CORRUPT) { + goto relocate; + } + file->flags |= LFS_F_ERRED; + return err; + } + + break; + relocate: + err = lfs_file_relocate(lfs, file); + if (err) { + file->flags |= LFS_F_ERRED; + return err; + } + } + + file->pos += diff; + file->off += diff; + data += diff; + nsize -= diff; + + lfs_alloc_ack(lfs); + } + + file->flags &= ~LFS_F_ERRED; + return size; +} + +lfs_soff_t lfs_file_seek(lfs_t *lfs, lfs_file_t *file, lfs_soff_t off, int whence) +{ + // write out everything beforehand, may be noop if rdonly + int err = lfs_file_flush(lfs, file); + if (err) { + return err; + } + + // update pos + if (whence == LFS_SEEK_SET) { + file->pos = off; + } else if (whence == LFS_SEEK_CUR) { + if (off < 0 && (lfs_off_t)-off > file->pos) { + return LFS_ERR_INVAL; + } + + file->pos = file->pos + off; + } else if (whence == LFS_SEEK_END) { + if (off < 0 && (lfs_off_t)-off > file->size) { + return LFS_ERR_INVAL; + } + + file->pos = file->size + off; + } + + return file->pos; +} + +int lfs_file_truncate(lfs_t *lfs, lfs_file_t *file, lfs_off_t size) +{ + if ((file->flags & 3) == LFS_O_RDONLY) { + return LFS_ERR_BADF; + } + + lfs_off_t oldsize = lfs_file_size(lfs, file); + if (size < oldsize) { + // need to flush since directly changing metadata + int err = lfs_file_flush(lfs, file); + if (err) { + return err; + } + + // lookup new head in ctz skip list + err = lfs_ctz_find(lfs, &file->cache, NULL, file->head, file->size, size, &file->head, &(lfs_off_t){0}); + if (err) { + return err; + } + + file->size = size; + file->flags |= LFS_F_DIRTY; + } else if (size > oldsize) { + lfs_off_t pos = file->pos; + + // flush+seek if not already at end + if (file->pos != oldsize) { + int err = lfs_file_seek(lfs, file, 0, LFS_SEEK_END); + if (err < 0) { + return err; + } + } + + // fill with zeros + while (file->pos < size) { + lfs_ssize_t res = lfs_file_write(lfs, file, &(uint8_t){0}, 1); + if (res < 0) { + return res; + } + } + + // restore pos + int err = lfs_file_seek(lfs, file, pos, LFS_SEEK_SET); + if (err < 0) { + return err; + } + } + + return 0; +} + +lfs_soff_t lfs_file_tell(lfs_t *lfs, lfs_file_t *file) +{ + (void)lfs; + return file->pos; +} + +int lfs_file_rewind(lfs_t *lfs, lfs_file_t *file) +{ + lfs_soff_t res = lfs_file_seek(lfs, file, 0, LFS_SEEK_SET); + if (res < 0) { + return res; + } + + return 0; +} + +lfs_soff_t lfs_file_size(lfs_t *lfs, lfs_file_t *file) +{ + (void)lfs; + if (file->flags & LFS_F_WRITING) { + return lfs_max(file->pos, file->size); + } else { + return file->size; + } +} + +/// General fs operations /// +int lfs_stat(lfs_t *lfs, const char *path, struct lfs_info *info) +{ + lfs_dir_t cwd; + lfs_entry_t entry; + int err = lfs_dir_find(lfs, &cwd, &entry, &path); + if (err) { + return err; + } + + memset(info, 0, sizeof(*info)); + info->type = entry.d.type; + if (info->type == LFS_TYPE_REG) { + info->size = entry.d.u.file.size; + } + + if (lfs_paircmp(entry.d.u.dir, lfs->root) == 0) { + strcpy(info->name, "/"); + } else { + err = lfs_bd_read(lfs, cwd.pair[0], entry.off + 4 + entry.d.elen + entry.d.alen, info->name, entry.d.nlen); + if (err) { + return err; + } + } + + return 0; +} + +int lfs_remove(lfs_t *lfs, const char *path) +{ + // deorphan if we haven't yet, needed at most once after poweron + if (!lfs->deorphaned) { + int err = lfs_deorphan(lfs); + if (err) { + return err; + } + } + + lfs_dir_t cwd; + lfs_entry_t entry; + int err = lfs_dir_find(lfs, &cwd, &entry, &path); + if (err) { + return err; + } + + lfs_dir_t dir; + if (entry.d.type == LFS_TYPE_DIR) { + // must be empty before removal, checking size + // without masking top bit checks for any case where + // dir is not empty + err = lfs_dir_fetch(lfs, &dir, entry.d.u.dir); + if (err) { + return err; + } /* else if (dir.d.size != sizeof(dir.d)+4) { + return LFS_ERR_NOTEMPTY; + } allow to remove non-empty folder, + According to below issue, comment these 2 line won't corrupt filesystem + https://github.com/ARMmbed/littlefs/issues/43 */ + } + + // remove the entry + err = lfs_dir_remove(lfs, &cwd, &entry); + if (err) { + return err; + } + + // if we were a directory, find pred, replace tail + if (entry.d.type == LFS_TYPE_DIR) { + int res = lfs_pred(lfs, dir.pair, &cwd); + if (res < 0) { + return res; + } + + LFS_ASSERT(res); // must have pred + cwd.d.tail[0] = dir.d.tail[0]; + cwd.d.tail[1] = dir.d.tail[1]; + + err = lfs_dir_commit(lfs, &cwd, NULL, 0); + if (err) { + return err; + } + } + + return 0; +} + +int lfs_rename(lfs_t *lfs, const char *oldpath, const char *newpath) +{ + // deorphan if we haven't yet, needed at most once after poweron + if (!lfs->deorphaned) { + int err = lfs_deorphan(lfs); + if (err) { + return err; + } + } + + // find old entry + lfs_dir_t oldcwd; + lfs_entry_t oldentry; + int err = lfs_dir_find(lfs, &oldcwd, &oldentry, &oldpath); + if (err) { + return err; + } + + // allocate new entry + lfs_dir_t newcwd; + lfs_entry_t preventry; + err = lfs_dir_find(lfs, &newcwd, &preventry, &newpath); + if (err && (err != LFS_ERR_NOENT || strchr(newpath, '/') != NULL)) { + return err; + } + + bool prevexists = (err != LFS_ERR_NOENT); + bool samepair = (lfs_paircmp(oldcwd.pair, newcwd.pair) == 0); + + // must have same type + if (prevexists && preventry.d.type != oldentry.d.type) { + return LFS_ERR_ISDIR; + } + + lfs_dir_t dir; + if (prevexists && preventry.d.type == LFS_TYPE_DIR) { + // must be empty before removal, checking size + // without masking top bit checks for any case where + // dir is not empty + err = lfs_dir_fetch(lfs, &dir, preventry.d.u.dir); + if (err) { + return err; + } else if (dir.d.size != sizeof(dir.d) + 4) { + return LFS_ERR_NOTEMPTY; + } + } + + // mark as moving + oldentry.d.type |= 0x80; + err = lfs_dir_update(lfs, &oldcwd, &oldentry, NULL); + if (err) { + return err; + } + + // update pair if newcwd == oldcwd + if (samepair) { + newcwd = oldcwd; + } + + // move to new location + lfs_entry_t newentry = preventry; + newentry.d = oldentry.d; + newentry.d.type &= ~0x80; + newentry.d.nlen = strlen(newpath); + + if (prevexists) { + err = lfs_dir_update(lfs, &newcwd, &newentry, newpath); + if (err) { + return err; + } + } else { + err = lfs_dir_append(lfs, &newcwd, &newentry, newpath); + if (err) { + return err; + } + } + + // update pair if newcwd == oldcwd + if (samepair) { + oldcwd = newcwd; + } + + // remove old entry + err = lfs_dir_remove(lfs, &oldcwd, &oldentry); + if (err) { + return err; + } + + // if we were a directory, find pred, replace tail + if (prevexists && preventry.d.type == LFS_TYPE_DIR) { + int res = lfs_pred(lfs, dir.pair, &newcwd); + if (res < 0) { + return res; + } + + LFS_ASSERT(res); // must have pred + newcwd.d.tail[0] = dir.d.tail[0]; + newcwd.d.tail[1] = dir.d.tail[1]; + + err = lfs_dir_commit(lfs, &newcwd, NULL, 0); + if (err) { + return err; + } + } + + return 0; +} + +/// Filesystem operations /// +static void lfs_deinit(lfs_t *lfs) +{ + // free allocated memory + if (!lfs->cfg->read_buffer) { + lfs_free(lfs->rcache.buffer); + } + + if (!lfs->cfg->prog_buffer) { + lfs_free(lfs->pcache.buffer); + } + + if (!lfs->cfg->lookahead_buffer) { + lfs_free(lfs->free.buffer); + } +} + +static int lfs_init(lfs_t *lfs, const struct lfs_config *cfg) +{ + lfs->cfg = cfg; + + // setup read cache + if (lfs->cfg->read_buffer) { + lfs->rcache.buffer = lfs->cfg->read_buffer; + } else { + lfs->rcache.buffer = lfs_malloc(lfs->cfg->read_size); + if (!lfs->rcache.buffer) { + goto cleanup; + } + } + + // setup program cache + if (lfs->cfg->prog_buffer) { + lfs->pcache.buffer = lfs->cfg->prog_buffer; + } else { + lfs->pcache.buffer = lfs_malloc(lfs->cfg->prog_size); + if (!lfs->pcache.buffer) { + goto cleanup; + } + } + + // zero to avoid information leaks + lfs_cache_zero(lfs, &lfs->pcache); + lfs_cache_drop(lfs, &lfs->rcache); + + // setup lookahead, round down to nearest 32-bits + LFS_ASSERT(lfs->cfg->lookahead % 32 == 0); + LFS_ASSERT(lfs->cfg->lookahead > 0); + if (lfs->cfg->lookahead_buffer) { + lfs->free.buffer = lfs->cfg->lookahead_buffer; + } else { + lfs->free.buffer = lfs_malloc(lfs->cfg->lookahead / 8); + if (!lfs->free.buffer) { + goto cleanup; + } + } + + // check that program and read sizes are multiples of the block size + LFS_ASSERT(lfs->cfg->prog_size % lfs->cfg->read_size == 0); + LFS_ASSERT(lfs->cfg->block_size % lfs->cfg->prog_size == 0); + + // check that the block size is large enough to fit ctz pointers + LFS_ASSERT(4 * lfs_npw2(0xffffffff / (lfs->cfg->block_size - 2 * 4)) <= lfs->cfg->block_size); + + // setup default state + lfs->root[0] = 0xffffffff; + lfs->root[1] = 0xffffffff; + lfs->files = NULL; + lfs->dirs = NULL; + lfs->deorphaned = false; + + return 0; + +cleanup: + lfs_deinit(lfs); + return LFS_ERR_NOMEM; +} + +int lfs_format(lfs_t *lfs, const struct lfs_config *cfg) +{ + int err = 0; + if (true) { + err = lfs_init(lfs, cfg); + if (err) { + return err; + } + + // create free lookahead + memset(lfs->free.buffer, 0, lfs->cfg->lookahead / 8); + lfs->free.off = 0; + lfs->free.size = lfs_min(lfs->cfg->lookahead, lfs->cfg->block_count); + lfs->free.i = 0; + lfs_alloc_ack(lfs); + + // create superblock dir + lfs_dir_t superdir; + err = lfs_dir_alloc(lfs, &superdir); + if (err) { + goto cleanup; + } + + // write root directory + lfs_dir_t root; + err = lfs_dir_alloc(lfs, &root); + if (err) { + goto cleanup; + } + + err = lfs_dir_commit(lfs, &root, NULL, 0); + if (err) { + goto cleanup; + } + + lfs->root[0] = root.pair[0]; + lfs->root[1] = root.pair[1]; + + // write superblocks + lfs_superblock_t superblock = { + .off = sizeof(superdir.d), + .d.type = LFS_TYPE_SUPERBLOCK, + .d.elen = sizeof(superblock.d) - sizeof(superblock.d.magic) - 4, + .d.nlen = sizeof(superblock.d.magic), + .d.version = LFS_DISK_VERSION, + .d.magic = {"littlefs"}, + .d.block_size = lfs->cfg->block_size, + .d.block_count = lfs->cfg->block_count, + .d.root = {lfs->root[0], lfs->root[1]}, + }; + superdir.d.tail[0] = root.pair[0]; + superdir.d.tail[1] = root.pair[1]; + superdir.d.size = sizeof(superdir.d) + sizeof(superblock.d) + 4; + + // write both pairs to be safe + lfs_superblock_tole32(&superblock.d); + bool valid = false; + for (int i = 0; i < 2; i++) { + err = lfs_dir_commit( + lfs, &superdir, + (struct lfs_region[]){{sizeof(superdir.d), sizeof(superblock.d), &superblock.d, sizeof(superblock.d)}}, 1); + if (err && err != LFS_ERR_CORRUPT) { + goto cleanup; + } + + valid = valid || !err; + } + + if (!valid) { + err = LFS_ERR_CORRUPT; + goto cleanup; + } + + // sanity check that fetch works + err = lfs_dir_fetch(lfs, &superdir, (const lfs_block_t[2]){0, 1}); + if (err) { + goto cleanup; + } + + lfs_alloc_ack(lfs); + } + +cleanup: + lfs_deinit(lfs); + return err; +} + +int lfs_mount(lfs_t *lfs, const struct lfs_config *cfg) +{ + int err = 0; + if (true) { + err = lfs_init(lfs, cfg); + if (err) { + return err; + } + + // setup free lookahead + lfs->free.off = 0; + lfs->free.size = 0; + lfs->free.i = 0; + lfs_alloc_ack(lfs); + + // load superblock + lfs_dir_t dir; + lfs_superblock_t superblock; + err = lfs_dir_fetch(lfs, &dir, (const lfs_block_t[2]){0, 1}); + if (err && err != LFS_ERR_CORRUPT) { + goto cleanup; + } + + if (!err) { + err = lfs_bd_read(lfs, dir.pair[0], sizeof(dir.d), &superblock.d, sizeof(superblock.d)); + lfs_superblock_fromle32(&superblock.d); + if (err) { + goto cleanup; + } + + lfs->root[0] = superblock.d.root[0]; + lfs->root[1] = superblock.d.root[1]; + } + + if (err || memcmp(superblock.d.magic, "littlefs", 8) != 0) { + LFS_ERROR("Invalid superblock at %d %d", 0, 1); + err = LFS_ERR_CORRUPT; + goto cleanup; + } + + uint16_t major_version = (0xffff & (superblock.d.version >> 16)); + uint16_t minor_version = (0xffff & (superblock.d.version >> 0)); + if ((major_version != LFS_DISK_VERSION_MAJOR || minor_version > LFS_DISK_VERSION_MINOR)) { + LFS_ERROR("Invalid version %d.%d", major_version, minor_version); + err = LFS_ERR_INVAL; + goto cleanup; + } + + return 0; + } + +cleanup: + + lfs_deinit(lfs); + return err; +} + +int lfs_unmount(lfs_t *lfs) +{ + lfs_deinit(lfs); + return 0; +} + +/// Littlefs specific operations /// +int lfs_traverse(lfs_t *lfs, int (*cb)(void *, lfs_block_t), void *data) +{ + if (lfs_pairisnull(lfs->root)) { + return 0; + } + + // iterate over metadata pairs + lfs_dir_t dir; + lfs_entry_t entry; + lfs_block_t cwd[2] = {0, 1}; + + while (true) { + for (int i = 0; i < 2; i++) { + int err = cb(data, cwd[i]); + if (err) { + return err; + } + } + + int err = lfs_dir_fetch(lfs, &dir, cwd); + if (err) { + return err; + } + + // iterate over contents + while (dir.off + sizeof(entry.d) <= (0x7fffffff & dir.d.size) - 4) { + err = lfs_bd_read(lfs, dir.pair[0], dir.off, &entry.d, sizeof(entry.d)); + lfs_entry_fromle32(&entry.d); + if (err) { + return err; + } + + dir.off += lfs_entry_size(&entry); + if ((0x70 & entry.d.type) == (0x70 & LFS_TYPE_REG)) { + err = lfs_ctz_traverse(lfs, &lfs->rcache, NULL, entry.d.u.file.head, entry.d.u.file.size, cb, data); + if (err) { + return err; + } + } + } + + cwd[0] = dir.d.tail[0]; + cwd[1] = dir.d.tail[1]; + + if (lfs_pairisnull(cwd)) { + break; + } + } + + // iterate over any open files + for (lfs_file_t *f = lfs->files; f; f = f->next) { + if (f->flags & LFS_F_DIRTY) { + int err = lfs_ctz_traverse(lfs, &lfs->rcache, &f->cache, f->head, f->size, cb, data); + if (err) { + return err; + } + } + + if (f->flags & LFS_F_WRITING) { + int err = lfs_ctz_traverse(lfs, &lfs->rcache, &f->cache, f->block, f->pos, cb, data); + if (err) { + return err; + } + } + } + + return 0; +} + +static int lfs_pred(lfs_t *lfs, const lfs_block_t dir[2], lfs_dir_t *pdir) +{ + if (lfs_pairisnull(lfs->root)) { + return 0; + } + + // iterate over all directory directory entries + int err = lfs_dir_fetch(lfs, pdir, (const lfs_block_t[2]){0, 1}); + if (err) { + return err; + } + + while (!lfs_pairisnull(pdir->d.tail)) { + if (lfs_paircmp(pdir->d.tail, dir) == 0) { + return true; + } + + err = lfs_dir_fetch(lfs, pdir, pdir->d.tail); + if (err) { + return err; + } + } + + return false; +} + +static int lfs_parent(lfs_t *lfs, const lfs_block_t dir[2], lfs_dir_t *parent, lfs_entry_t *entry) +{ + if (lfs_pairisnull(lfs->root)) { + return 0; + } + + parent->d.tail[0] = 0; + parent->d.tail[1] = 1; + + // iterate over all directory directory entries + while (!lfs_pairisnull(parent->d.tail)) { + int err = lfs_dir_fetch(lfs, parent, parent->d.tail); + if (err) { + return err; + } + + while (true) { + err = lfs_dir_next(lfs, parent, entry); + if (err && err != LFS_ERR_NOENT) { + return err; + } + + if (err == LFS_ERR_NOENT) { + break; + } + + if (((0x70 & entry->d.type) == (0x70 & LFS_TYPE_DIR)) && lfs_paircmp(entry->d.u.dir, dir) == 0) { + return true; + } + } + } + + return false; +} + +static int lfs_moved(lfs_t *lfs, const void *e) +{ + if (lfs_pairisnull(lfs->root)) { + return 0; + } + + // skip superblock + lfs_dir_t cwd; + int err = lfs_dir_fetch(lfs, &cwd, (const lfs_block_t[2]){0, 1}); + if (err) { + return err; + } + + // iterate over all directory directory entries + lfs_entry_t entry; + while (!lfs_pairisnull(cwd.d.tail)) { + err = lfs_dir_fetch(lfs, &cwd, cwd.d.tail); + if (err) { + return err; + } + + while (true) { + err = lfs_dir_next(lfs, &cwd, &entry); + if (err && err != LFS_ERR_NOENT) { + return err; + } + + if (err == LFS_ERR_NOENT) { + break; + } + + if (!(0x80 & entry.d.type) && memcmp(&entry.d.u, e, sizeof(entry.d.u)) == 0) { + return true; + } + } + } + + return false; +} + +static int lfs_relocate(lfs_t *lfs, const lfs_block_t oldpair[2], const lfs_block_t newpair[2]) +{ + // find parent + lfs_dir_t parent; + lfs_entry_t entry; + int res = lfs_parent(lfs, oldpair, &parent, &entry); + if (res < 0) { + return res; + } + + if (res) { + // update disk, this creates a desync + entry.d.u.dir[0] = newpair[0]; + entry.d.u.dir[1] = newpair[1]; + + int err = lfs_dir_update(lfs, &parent, &entry, NULL); + if (err) { + return err; + } + + // update internal root + if (lfs_paircmp(oldpair, lfs->root) == 0) { + LFS_DEBUG("Relocating root %" PRIu32 " %" PRIu32, newpair[0], newpair[1]); + lfs->root[0] = newpair[0]; + lfs->root[1] = newpair[1]; + } + + // clean up bad block, which should now be a desync + return lfs_deorphan(lfs); + } + + // find pred + res = lfs_pred(lfs, oldpair, &parent); + if (res < 0) { + return res; + } + + if (res) { + // just replace bad pair, no desync can occur + parent.d.tail[0] = newpair[0]; + parent.d.tail[1] = newpair[1]; + + return lfs_dir_commit(lfs, &parent, NULL, 0); + } + + // couldn't find dir, must be new + return 0; +} + +int lfs_deorphan(lfs_t *lfs) +{ + lfs->deorphaned = true; + + if (lfs_pairisnull(lfs->root)) { + return 0; + } + + lfs_dir_t pdir = {.d.size = 0x80000000}; + lfs_dir_t cwd = {.d.tail[0] = 0, .d.tail[1] = 1}; + + // iterate over all directory directory entries + for (lfs_size_t i = 0; i < lfs->cfg->block_count; i++) { + if (lfs_pairisnull(cwd.d.tail)) { + return 0; + } + + int err = lfs_dir_fetch(lfs, &cwd, cwd.d.tail); + if (err) { + return err; + } + + // check head blocks for orphans + if (!(0x80000000 & pdir.d.size)) { + // check if we have a parent + lfs_dir_t parent; + lfs_entry_t entry; + int res = lfs_parent(lfs, pdir.d.tail, &parent, &entry); + if (res < 0) { + return res; + } + + if (!res) { + // we are an orphan + LFS_DEBUG("Found orphan %" PRIu32 " %" PRIu32, pdir.d.tail[0], pdir.d.tail[1]); + + pdir.d.tail[0] = cwd.d.tail[0]; + pdir.d.tail[1] = cwd.d.tail[1]; + + err = lfs_dir_commit(lfs, &pdir, NULL, 0); + if (err) { + return err; + } + + return 0; + } + + if (!lfs_pairsync(entry.d.u.dir, pdir.d.tail)) { + // we have desynced + LFS_DEBUG("Found desync %" PRIu32 " %" PRIu32, entry.d.u.dir[0], entry.d.u.dir[1]); + + pdir.d.tail[0] = entry.d.u.dir[0]; + pdir.d.tail[1] = entry.d.u.dir[1]; + + err = lfs_dir_commit(lfs, &pdir, NULL, 0); + if (err) { + return err; + } + + return 0; + } + } + + // check entries for moves + lfs_entry_t entry; + while (true) { + err = lfs_dir_next(lfs, &cwd, &entry); + if (err && err != LFS_ERR_NOENT) { + return err; + } + + if (err == LFS_ERR_NOENT) { + break; + } + + // found moved entry + if (entry.d.type & 0x80) { + int moved = lfs_moved(lfs, &entry.d.u); + if (moved < 0) { + return moved; + } + + if (moved) { + LFS_DEBUG("Found move %" PRIu32 " %" PRIu32, entry.d.u.dir[0], entry.d.u.dir[1]); + err = lfs_dir_remove(lfs, &cwd, &entry); + if (err) { + return err; + } + } else { + LFS_DEBUG("Found partial move %" PRIu32 " %" PRIu32, entry.d.u.dir[0], entry.d.u.dir[1]); + entry.d.type &= ~0x80; + err = lfs_dir_update(lfs, &cwd, &entry, NULL); + if (err) { + return err; + } + } + } + } + + memcpy(&pdir, &cwd, sizeof(pdir)); + } + + // If we reached here, we have more directory pairs than blocks in the + // filesystem... So something must be horribly wrong + return LFS_ERR_CORRUPT; +} diff --git a/src/platform/stm32wl/littlefs/lfs.h b/src/platform/stm32wl/littlefs/lfs.h new file mode 100644 index 000000000..f243c404b --- /dev/null +++ b/src/platform/stm32wl/littlefs/lfs.h @@ -0,0 +1,476 @@ +/* + * The little filesystem + * + * Copyright (c) 2017, Arm Limited. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ +#ifndef LFS_H +#define LFS_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/// Version info /// + +// Software library version +// Major (top-nibble), incremented on backwards incompatible changes +// Minor (bottom-nibble), incremented on feature additions +#define LFS_VERSION 0x00010006 +#define LFS_VERSION_MAJOR (0xffff & (LFS_VERSION >> 16)) +#define LFS_VERSION_MINOR (0xffff & (LFS_VERSION >> 0)) + +// Version of On-disk data structures +// Major (top-nibble), incremented on backwards incompatible changes +// Minor (bottom-nibble), incremented on feature additions +#define LFS_DISK_VERSION 0x00010001 +#define LFS_DISK_VERSION_MAJOR (0xffff & (LFS_DISK_VERSION >> 16)) +#define LFS_DISK_VERSION_MINOR (0xffff & (LFS_DISK_VERSION >> 0)) + +/// Definitions /// + +// Type definitions +typedef uint32_t lfs_size_t; +typedef uint32_t lfs_off_t; + +typedef int32_t lfs_ssize_t; +typedef int32_t lfs_soff_t; + +typedef uint32_t lfs_block_t; + +// Max name size in bytes +#ifndef LFS_NAME_MAX +#define LFS_NAME_MAX 255 +#endif + +// Possible error codes, these are negative to allow +// valid positive return values +enum lfs_error { + LFS_ERR_OK = 0, // No error + LFS_ERR_IO = -5, // Error during device operation + LFS_ERR_CORRUPT = -52, // Corrupted + LFS_ERR_NOENT = -2, // No directory entry + LFS_ERR_EXIST = -17, // Entry already exists + LFS_ERR_NOTDIR = -20, // Entry is not a dir + LFS_ERR_ISDIR = -21, // Entry is a dir + LFS_ERR_NOTEMPTY = -39, // Dir is not empty + LFS_ERR_BADF = -9, // Bad file number + LFS_ERR_INVAL = -22, // Invalid parameter + LFS_ERR_NOSPC = -28, // No space left on device + LFS_ERR_NOMEM = -12, // No more memory available +}; + +// File types +enum lfs_type { + LFS_TYPE_REG = 0x11, + LFS_TYPE_DIR = 0x22, + LFS_TYPE_SUPERBLOCK = 0x2e, +}; + +// File open flags +enum lfs_open_flags { + // open flags + LFS_O_RDONLY = 1, // Open a file as read only + LFS_O_WRONLY = 2, // Open a file as write only + LFS_O_RDWR = 3, // Open a file as read and write + LFS_O_CREAT = 0x0100, // Create a file if it does not exist + LFS_O_EXCL = 0x0200, // Fail if a file already exists + LFS_O_TRUNC = 0x0400, // Truncate the existing file to zero size + LFS_O_APPEND = 0x0800, // Move to end of file on every write + + // internally used flags + LFS_F_DIRTY = 0x10000, // File does not match storage + LFS_F_WRITING = 0x20000, // File has been written since last flush + LFS_F_READING = 0x40000, // File has been read since last flush + LFS_F_ERRED = 0x80000, // An error occured during write +}; + +// File seek flags +enum lfs_whence_flags { + LFS_SEEK_SET = 0, // Seek relative to an absolute position + LFS_SEEK_CUR = 1, // Seek relative to the current file position + LFS_SEEK_END = 2, // Seek relative to the end of the file +}; + +// Configuration provided during initialization of the littlefs +struct lfs_config { + // Opaque user provided context that can be used to pass + // information to the block device operations + void *context; + + // Read a region in a block. Negative error codes are propogated + // to the user. + int (*read)(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, void *buffer, lfs_size_t size); + + // Program a region in a block. The block must have previously + // been erased. Negative error codes are propogated to the user. + // May return LFS_ERR_CORRUPT if the block should be considered bad. + int (*prog)(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, const void *buffer, lfs_size_t size); + + // Erase a block. A block must be erased before being programmed. + // The state of an erased block is undefined. Negative error codes + // are propogated to the user. + // May return LFS_ERR_CORRUPT if the block should be considered bad. + int (*erase)(const struct lfs_config *c, lfs_block_t block); + + // Sync the state of the underlying block device. Negative error codes + // are propogated to the user. + int (*sync)(const struct lfs_config *c); + + // Minimum size of a block read. This determines the size of read buffers. + // This may be larger than the physical read size to improve performance + // by caching more of the block device. + lfs_size_t read_size; + + // Minimum size of a block program. This determines the size of program + // buffers. This may be larger than the physical program size to improve + // performance by caching more of the block device. + // Must be a multiple of the read size. + lfs_size_t prog_size; + + // Size of an erasable block. This does not impact ram consumption and + // may be larger than the physical erase size. However, this should be + // kept small as each file currently takes up an entire block. + // Must be a multiple of the program size. + lfs_size_t block_size; + + // Number of erasable blocks on the device. + lfs_size_t block_count; + + // Number of blocks to lookahead during block allocation. A larger + // lookahead reduces the number of passes required to allocate a block. + // The lookahead buffer requires only 1 bit per block so it can be quite + // large with little ram impact. Should be a multiple of 32. + lfs_size_t lookahead; + + // Optional, statically allocated read buffer. Must be read sized. + void *read_buffer; + + // Optional, statically allocated program buffer. Must be program sized. + void *prog_buffer; + + // Optional, statically allocated lookahead buffer. Must be 1 bit per + // lookahead block. + void *lookahead_buffer; + + // Optional, statically allocated buffer for files. Must be program sized. + // If enabled, only one file may be opened at a time. + void *file_buffer; +}; + +// Optional configuration provided during lfs_file_opencfg +struct lfs_file_config { + // Optional, statically allocated buffer for files. Must be program sized. + // If NULL, malloc will be used by default. + void *buffer; +}; + +// File info structure +struct lfs_info { + // Type of the file, either LFS_TYPE_REG or LFS_TYPE_DIR + uint8_t type; + + // Size of the file, only valid for REG files + lfs_size_t size; + + // Name of the file stored as a null-terminated string + char name[LFS_NAME_MAX + 1]; +}; + +/// littlefs data structures /// +typedef struct lfs_entry { + lfs_off_t off; + + struct lfs_disk_entry { + uint8_t type; + uint8_t elen; + uint8_t alen; + uint8_t nlen; + union { + struct { + lfs_block_t head; + lfs_size_t size; + } file; + lfs_block_t dir[2]; + } u; + } d; +} lfs_entry_t; + +typedef struct lfs_cache { + lfs_block_t block; + lfs_off_t off; + uint8_t *buffer; +} lfs_cache_t; + +typedef struct lfs_file { + struct lfs_file *next; + lfs_block_t pair[2]; + lfs_off_t poff; + + lfs_block_t head; + lfs_size_t size; + + const struct lfs_file_config *cfg; + uint32_t flags; + lfs_off_t pos; + lfs_block_t block; + lfs_off_t off; + lfs_cache_t cache; +} lfs_file_t; + +typedef struct lfs_dir { + struct lfs_dir *next; + lfs_block_t pair[2]; + lfs_off_t off; + + lfs_block_t head[2]; + lfs_off_t pos; + + struct lfs_disk_dir { + uint32_t rev; + lfs_size_t size; + lfs_block_t tail[2]; + } d; +} lfs_dir_t; + +typedef struct lfs_superblock { + lfs_off_t off; + + struct lfs_disk_superblock { + uint8_t type; + uint8_t elen; + uint8_t alen; + uint8_t nlen; + lfs_block_t root[2]; + uint32_t block_size; + uint32_t block_count; + uint32_t version; + char magic[8]; + } d; +} lfs_superblock_t; + +typedef struct lfs_free { + lfs_block_t off; + lfs_block_t size; + lfs_block_t i; + lfs_block_t ack; + uint32_t *buffer; +} lfs_free_t; + +// The littlefs type +typedef struct lfs { + const struct lfs_config *cfg; + + lfs_block_t root[2]; + lfs_file_t *files; + lfs_dir_t *dirs; + + lfs_cache_t rcache; + lfs_cache_t pcache; + + lfs_free_t free; + bool deorphaned; +} lfs_t; + +/// Filesystem functions /// + +// Format a block device with the littlefs +// +// Requires a littlefs object and config struct. This clobbers the littlefs +// object, and does not leave the filesystem mounted. The config struct must +// be zeroed for defaults and backwards compatibility. +// +// Returns a negative error code on failure. +int lfs_format(lfs_t *lfs, const struct lfs_config *config); + +// Mounts a littlefs +// +// Requires a littlefs object and config struct. Multiple filesystems +// may be mounted simultaneously with multiple littlefs objects. Both +// lfs and config must be allocated while mounted. The config struct must +// be zeroed for defaults and backwards compatibility. +// +// Returns a negative error code on failure. +int lfs_mount(lfs_t *lfs, const struct lfs_config *config); + +// Unmounts a littlefs +// +// Does nothing besides releasing any allocated resources. +// Returns a negative error code on failure. +int lfs_unmount(lfs_t *lfs); + +/// General operations /// + +// Removes a file or directory +// +// If removing a directory, the directory must be empty. +// Returns a negative error code on failure. +int lfs_remove(lfs_t *lfs, const char *path); + +// Rename or move a file or directory +// +// If the destination exists, it must match the source in type. +// If the destination is a directory, the directory must be empty. +// +// Returns a negative error code on failure. +int lfs_rename(lfs_t *lfs, const char *oldpath, const char *newpath); + +// Find info about a file or directory +// +// Fills out the info structure, based on the specified file or directory. +// Returns a negative error code on failure. +int lfs_stat(lfs_t *lfs, const char *path, struct lfs_info *info); + +/// File operations /// + +// Open a file +// +// The mode that the file is opened in is determined by the flags, which +// are values from the enum lfs_open_flags that are bitwise-ored together. +// +// Returns a negative error code on failure. +int lfs_file_open(lfs_t *lfs, lfs_file_t *file, const char *path, int flags); + +// Open a file with extra configuration +// +// The mode that the file is opened in is determined by the flags, which +// are values from the enum lfs_open_flags that are bitwise-ored together. +// +// The config struct provides additional config options per file as described +// above. The config struct must be allocated while the file is open, and the +// config struct must be zeroed for defaults and backwards compatibility. +// +// Returns a negative error code on failure. +int lfs_file_opencfg(lfs_t *lfs, lfs_file_t *file, const char *path, int flags, const struct lfs_file_config *config); + +// Close a file +// +// Any pending writes are written out to storage as though +// sync had been called and releases any allocated resources. +// +// Returns a negative error code on failure. +int lfs_file_close(lfs_t *lfs, lfs_file_t *file); + +// Synchronize a file on storage +// +// Any pending writes are written out to storage. +// Returns a negative error code on failure. +int lfs_file_sync(lfs_t *lfs, lfs_file_t *file); + +// Read data from file +// +// Takes a buffer and size indicating where to store the read data. +// Returns the number of bytes read, or a negative error code on failure. +lfs_ssize_t lfs_file_read(lfs_t *lfs, lfs_file_t *file, void *buffer, lfs_size_t size); + +// Write data to file +// +// Takes a buffer and size indicating the data to write. The file will not +// actually be updated on the storage until either sync or close is called. +// +// Returns the number of bytes written, or a negative error code on failure. +lfs_ssize_t lfs_file_write(lfs_t *lfs, lfs_file_t *file, const void *buffer, lfs_size_t size); + +// Change the position of the file +// +// The change in position is determined by the offset and whence flag. +// Returns the old position of the file, or a negative error code on failure. +lfs_soff_t lfs_file_seek(lfs_t *lfs, lfs_file_t *file, lfs_soff_t off, int whence); + +// Truncates the size of the file to the specified size +// +// Returns a negative error code on failure. +int lfs_file_truncate(lfs_t *lfs, lfs_file_t *file, lfs_off_t size); + +// Return the position of the file +// +// Equivalent to lfs_file_seek(lfs, file, 0, LFS_SEEK_CUR) +// Returns the position of the file, or a negative error code on failure. +lfs_soff_t lfs_file_tell(lfs_t *lfs, lfs_file_t *file); + +// Change the position of the file to the beginning of the file +// +// Equivalent to lfs_file_seek(lfs, file, 0, LFS_SEEK_CUR) +// Returns a negative error code on failure. +int lfs_file_rewind(lfs_t *lfs, lfs_file_t *file); + +// Return the size of the file +// +// Similar to lfs_file_seek(lfs, file, 0, LFS_SEEK_END) +// Returns the size of the file, or a negative error code on failure. +lfs_soff_t lfs_file_size(lfs_t *lfs, lfs_file_t *file); + +/// Directory operations /// + +// Create a directory +// +// Returns a negative error code on failure. +int lfs_mkdir(lfs_t *lfs, const char *path); + +// Open a directory +// +// Once open a directory can be used with read to iterate over files. +// Returns a negative error code on failure. +int lfs_dir_open(lfs_t *lfs, lfs_dir_t *dir, const char *path); + +// Close a directory +// +// Releases any allocated resources. +// Returns a negative error code on failure. +int lfs_dir_close(lfs_t *lfs, lfs_dir_t *dir); + +// Read an entry in the directory +// +// Fills out the info structure, based on the specified file or directory. +// Returns a negative error code on failure. +int lfs_dir_read(lfs_t *lfs, lfs_dir_t *dir, struct lfs_info *info); + +// Change the position of the directory +// +// The new off must be a value previous returned from tell and specifies +// an absolute offset in the directory seek. +// +// Returns a negative error code on failure. +int lfs_dir_seek(lfs_t *lfs, lfs_dir_t *dir, lfs_off_t off); + +// Return the position of the directory +// +// The returned offset is only meant to be consumed by seek and may not make +// sense, but does indicate the current position in the directory iteration. +// +// Returns the position of the directory, or a negative error code on failure. +lfs_soff_t lfs_dir_tell(lfs_t *lfs, lfs_dir_t *dir); + +// Change the position of the directory to the beginning of the directory +// +// Returns a negative error code on failure. +int lfs_dir_rewind(lfs_t *lfs, lfs_dir_t *dir); + +/// Miscellaneous littlefs specific operations /// + +// Traverse through all blocks in use by the filesystem +// +// The provided callback will be called with each block address that is +// currently in use by the filesystem. This can be used to determine which +// blocks are in use or how much of the storage is available. +// +// Returns a negative error code on failure. +int lfs_traverse(lfs_t *lfs, int (*cb)(void *, lfs_block_t), void *data); + +// Prunes any recoverable errors that may have occured in the filesystem +// +// Not needed to be called by user unless an operation is interrupted +// but the filesystem is still mounted. This is already called on first +// allocation. +// +// Returns a negative error code on failure. +int lfs_deorphan(lfs_t *lfs); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/platform/stm32wl/littlefs/lfs_util.c b/src/platform/stm32wl/littlefs/lfs_util.c new file mode 100644 index 000000000..0b352c51f --- /dev/null +++ b/src/platform/stm32wl/littlefs/lfs_util.c @@ -0,0 +1,28 @@ +/* + * lfs util functions + * + * Copyright (c) 2017, Arm Limited. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ +#include "lfs_util.h" + +// Only compile if user does not provide custom config +#ifndef LFS_CONFIG + +// Software CRC implementation with small lookup table +void lfs_crc(uint32_t *restrict crc, const void *buffer, size_t size) +{ + static const uint32_t rtable[16] = { + 0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac, 0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c, + 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c, + }; + + const uint8_t *data = buffer; + + for (size_t i = 0; i < size; i++) { + *crc = (*crc >> 4) ^ rtable[(*crc ^ (data[i] >> 0)) & 0xf]; + *crc = (*crc >> 4) ^ rtable[(*crc ^ (data[i] >> 4)) & 0xf]; + } +} + +#endif diff --git a/src/platform/stm32wl/littlefs/lfs_util.h b/src/platform/stm32wl/littlefs/lfs_util.h new file mode 100644 index 000000000..5c8469f88 --- /dev/null +++ b/src/platform/stm32wl/littlefs/lfs_util.h @@ -0,0 +1,199 @@ +/* + * lfs utility functions + * + * Copyright (c) 2017, Arm Limited. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ +#ifndef LFS_UTIL_H +#define LFS_UTIL_H + +// Users can override lfs_util.h with their own configuration by defining +// LFS_CONFIG as a header file to include (-DLFS_CONFIG=lfs_config.h). +// +// If LFS_CONFIG is used, none of the default utils will be emitted and must be +// provided by the config file. To start I would suggest copying lfs_util.h and +// modifying as needed. +#ifdef LFS_CONFIG +#define LFS_STRINGIZE(x) LFS_STRINGIZE2(x) +#define LFS_STRINGIZE2(x) #x +#include LFS_STRINGIZE(LFS_CONFIG) +#else + +// System includes +#include +#include +#include + +#ifndef LFS_NO_MALLOC +#include +#endif +#ifndef LFS_NO_ASSERT +#include +#endif + +#if !CFG_DEBUG +#define LFS_NO_DEBUG +#define LFS_NO_WARN +#define LFS_NO_ERROR +#endif + +#if !defined(LFS_NO_DEBUG) || !defined(LFS_NO_WARN) || !defined(LFS_NO_ERROR) +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// Macros, may be replaced by system specific wrappers. Arguments to these +// macros must not have side-effects as the macros can be removed for a smaller +// code footprint + +// Logging functions +#ifndef LFS_NO_DEBUG +#define LFS_DEBUG(fmt, ...) printf("lfs debug:%d: " fmt "\n", __LINE__, __VA_ARGS__) +#else +#define LFS_DEBUG(fmt, ...) +#endif + +#ifndef LFS_NO_WARN +#define LFS_WARN(fmt, ...) printf("lfs warn:%d: " fmt "\n", __LINE__, __VA_ARGS__) +#else +#define LFS_WARN(fmt, ...) +#endif + +#ifndef LFS_NO_ERROR +#define LFS_ERROR(fmt, ...) printf("lfs error:%d: " fmt "\n", __LINE__, __VA_ARGS__) +#else +#define LFS_ERROR(fmt, ...) +#endif + +// Runtime assertions +#ifndef LFS_NO_ASSERT +#define LFS_ASSERT(test) assert(test) +#else +#define LFS_ASSERT(test) +#endif + +// Builtin functions, these may be replaced by more efficient +// toolchain-specific implementations. LFS_NO_INTRINSICS falls back to a more +// expensive basic C implementation for debugging purposes + +// Min/max functions for unsigned 32-bit numbers +static inline uint32_t lfs_max(uint32_t a, uint32_t b) +{ + return (a > b) ? a : b; +} + +static inline uint32_t lfs_min(uint32_t a, uint32_t b) +{ + return (a < b) ? a : b; +} + +// Find the next smallest power of 2 less than or equal to a +static inline uint32_t lfs_npw2(uint32_t a) +{ +#if !defined(LFS_NO_INTRINSICS) && (defined(__GNUC__) || defined(__CC_ARM)) + return 32 - __builtin_clz(a - 1); +#else + uint32_t r = 0; + uint32_t s; + a -= 1; + s = (a > 0xffff) << 4; + a >>= s; + r |= s; + s = (a > 0xff) << 3; + a >>= s; + r |= s; + s = (a > 0xf) << 2; + a >>= s; + r |= s; + s = (a > 0x3) << 1; + a >>= s; + r |= s; + return (r | (a >> 1)) + 1; +#endif +} + +// Count the number of trailing binary zeros in a +// lfs_ctz(0) may be undefined +static inline uint32_t lfs_ctz(uint32_t a) +{ +#if !defined(LFS_NO_INTRINSICS) && defined(__GNUC__) + return __builtin_ctz(a); +#else + return lfs_npw2((a & -a) + 1) - 1; +#endif +} + +// Count the number of binary ones in a +static inline uint32_t lfs_popc(uint32_t a) +{ +#if !defined(LFS_NO_INTRINSICS) && (defined(__GNUC__) || defined(__CC_ARM)) + return __builtin_popcount(a); +#else + a = a - ((a >> 1) & 0x55555555); + a = (a & 0x33333333) + ((a >> 2) & 0x33333333); + return (((a + (a >> 4)) & 0xf0f0f0f) * 0x1010101) >> 24; +#endif +} + +// Find the sequence comparison of a and b, this is the distance +// between a and b ignoring overflow +static inline int lfs_scmp(uint32_t a, uint32_t b) +{ + return (int)(unsigned)(a - b); +} + +// Convert from 32-bit little-endian to native order +static inline uint32_t lfs_fromle32(uint32_t a) +{ +#if !defined(LFS_NO_INTRINSICS) && ((defined(BYTE_ORDER) && BYTE_ORDER == ORDER_LITTLE_ENDIAN) || \ + (defined(__BYTE_ORDER) && __BYTE_ORDER == __ORDER_LITTLE_ENDIAN) || \ + (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) + return a; +#elif !defined(LFS_NO_INTRINSICS) && \ + ((defined(BYTE_ORDER) && BYTE_ORDER == ORDER_BIG_ENDIAN) || (defined(__BYTE_ORDER) && __BYTE_ORDER == __ORDER_BIG_ENDIAN) || \ + (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) + return __builtin_bswap32(a); +#else + return (((uint8_t *)&a)[0] << 0) | (((uint8_t *)&a)[1] << 8) | (((uint8_t *)&a)[2] << 16) | (((uint8_t *)&a)[3] << 24); +#endif +} + +// Convert to 32-bit little-endian from native order +static inline uint32_t lfs_tole32(uint32_t a) +{ + return lfs_fromle32(a); +} + +// Calculate CRC-32 with polynomial = 0x04c11db7 +void lfs_crc(uint32_t *crc, const void *buffer, size_t size); + +// Allocate memory, only used if buffers are not provided to littlefs +static inline void *lfs_malloc(size_t size) +{ +#ifndef LFS_NO_MALLOC + return malloc(size); +#else + (void)size; + return NULL; +#endif +} + +// Deallocate memory, only used if buffers are not provided to littlefs +static inline void lfs_free(void *p) +{ +#ifndef LFS_NO_MALLOC + free(p); +#else + (void)p; +#endif +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif +#endif diff --git a/src/shutdown.h b/src/shutdown.h index c2ba6f670..f02cb7964 100644 --- a/src/shutdown.h +++ b/src/shutdown.h @@ -32,6 +32,8 @@ void powerCommandsCheck() delete screen; LOG_DEBUG("final reboot!"); reboot(); +#elif defined(ARCH_STM32WL) + HAL_NVIC_SystemReset(); #else rebootAtMsec = -1; LOG_WARN("FIXME implement reboot for this platform. Note that some settings require a restart to be applied"); diff --git a/variants/CDEBYTE_E77-MBL/platformio.ini b/variants/CDEBYTE_E77-MBL/platformio.ini index a8d90f676..3252a56ea 100644 --- a/variants/CDEBYTE_E77-MBL/platformio.ini +++ b/variants/CDEBYTE_E77-MBL/platformio.ini @@ -3,6 +3,7 @@ extends = stm32_base ; `ebyte_e77_dev` was added in this commit. Remove when a new release is used in the base. platform = https://github.com/platformio/platform-ststm32.git#3208828db447f4373cd303b7f7393c8fc0dae623 board = ebyte_e77_dev +board_upload.maximum_size = 233472 ; reserve the last 28KB for filesystem board_level = extra build_flags = ${stm32_base.build_flags} @@ -11,31 +12,19 @@ build_flags = -DPIN_SERIAL_RX=PA3 -DPIN_SERIAL_TX=PA2 -DHAL_DAC_MODULE_ONLY - -DHAL_ADC_MODULE_DISABLED - -DHAL_COMP_MODULE_DISABLED - -DHAL_CRC_MODULE_DISABLED - -DHAL_CRYP_MODULE_DISABLED - -DHAL_GTZC_MODULE_DISABLED - -DHAL_HSEM_MODULE_DISABLED - -DHAL_I2C_MODULE_DISABLED - -DHAL_I2S_MODULE_DISABLED - -DHAL_IPCC_MODULE_DISABLED - -DHAL_IRDA_MODULE_DISABLED - -DHAL_IWDG_MODULE_DISABLED - -DHAL_LPTIM_MODULE_DISABLED - -DHAL_PKA_MODULE_DISABLED - -DHAL_RNG_MODULE_DISABLED - -DHAL_RTC_MODULE_DISABLED - -DHAL_SMARTCARD_MODULE_DISABLED - -DHAL_SMBUS_MODULE_DISABLED - -DHAL_TIM_MODULE_DISABLED - -DHAL_WWDG_MODULE_DISABLED - -DHAL_EXTI_MODULE_DISABLED - -DHAL_SAI_MODULE_DISABLED - -DHAL_ICACHE_MODULE_DISABLED + -DHAL_RNG_MODULE_ENABLED -DRADIOLIB_EXCLUDE_SX128X=1 -DRADIOLIB_EXCLUDE_SX127X=1 -DRADIOLIB_EXCLUDE_LR11X0=1 -; -D PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF + -DMESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR=1 + -DMESHTASTIC_EXCLUDE_I2C=1 + -DMESHTASTIC_EXCLUDE_WIFI=1 + -DMESHTASTIC_EXCLUDE_BLUETOOTH=1 + -DMESHTASTIC_EXCLUDE_GPS=1 + -DMESHTASTIC_EXCLUDE_SCREEN=1 + -DMESHTASTIC_EXCLUDE_MQTT=1 + -DMESHTASTIC_EXCLUDE_POWERMON=1 + ;-DPIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF + ;-DCFG_DEBUG upload_port = stlink \ No newline at end of file diff --git a/variants/rak3172/platformio.ini b/variants/rak3172/platformio.ini index 58ea32088..456697aef 100644 --- a/variants/rak3172/platformio.ini +++ b/variants/rak3172/platformio.ini @@ -1,36 +1,23 @@ [env:rak3172] extends = stm32_base board = wiscore_rak3172 +board_upload.maximum_size = 233472 ; reserve the last 28KB for filesystem build_flags = ${stm32_base.build_flags} -Ivariants/rak3172 - -DSERIAL_UART_INSTANCE=1 - -DPIN_SERIAL_RX=PB7 - -DPIN_SERIAL_TX=PB6 -DHAL_DAC_MODULE_ONLY - -DHAL_ADC_MODULE_DISABLED - -DHAL_COMP_MODULE_DISABLED - -DHAL_CRC_MODULE_DISABLED - -DHAL_CRYP_MODULE_DISABLED - -DHAL_GTZC_MODULE_DISABLED - -DHAL_HSEM_MODULE_DISABLED - -DHAL_I2C_MODULE_DISABLED - -DHAL_I2S_MODULE_DISABLED - -DHAL_IPCC_MODULE_DISABLED - -DHAL_IRDA_MODULE_DISABLED - -DHAL_IWDG_MODULE_DISABLED - -DHAL_LPTIM_MODULE_DISABLED - -DHAL_PKA_MODULE_DISABLED - -DHAL_RNG_MODULE_DISABLED - -DHAL_RTC_MODULE_DISABLED - -DHAL_SMARTCARD_MODULE_DISABLED - -DHAL_SMBUS_MODULE_DISABLED - -DHAL_TIM_MODULE_DISABLED - -DHAL_WWDG_MODULE_DISABLED - -DHAL_EXTI_MODULE_DISABLED - -DHAL_SAI_MODULE_DISABLED - -DHAL_ICACHE_MODULE_DISABLED + -DHAL_RNG_MODULE_ENABLED -DRADIOLIB_EXCLUDE_SX128X=1 -DRADIOLIB_EXCLUDE_SX127X=1 -DRADIOLIB_EXCLUDE_LR11X0=1 -upload_port = stlink \ No newline at end of file + -DMESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR=1 + -DMESHTASTIC_EXCLUDE_I2C=1 + -DMESHTASTIC_EXCLUDE_WIFI=1 + -DMESHTASTIC_EXCLUDE_BLUETOOTH=1 + -DMESHTASTIC_EXCLUDE_GPS=1 + -DMESHTASTIC_EXCLUDE_SCREEN=1 + -DMESHTASTIC_EXCLUDE_MQTT=1 + -DMESHTASTIC_EXCLUDE_POWERMON=1 + ;-DPIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF + ;-DCFG_DEBUG +upload_port = stlink diff --git a/variants/rak3172/variant.h b/variants/rak3172/variant.h index dd12fe393..45752b481 100644 --- a/variants/rak3172/variant.h +++ b/variants/rak3172/variant.h @@ -1,3 +1,8 @@ +/* +STM32WLE5 Core Module for LoRaWAN® RAK3372 +https://store.rakwireless.com/products/wisblock-core-module-rak3372 +*/ + /* This variant is a work in progress. Do not expect a working Meshtastic device with this target. @@ -8,4 +13,7 @@ Do not expect a working Meshtastic device with this target. #define USE_STM32WLx -#endif \ No newline at end of file +#define LED_PIN PA0 // Green LED +#define LED_STATE_ON 1 + +#endif diff --git a/variants/wio-e5/platformio.ini b/variants/wio-e5/platformio.ini index e9d4ca946..e746ae2f0 100644 --- a/variants/wio-e5/platformio.ini +++ b/variants/wio-e5/platformio.ini @@ -1,6 +1,7 @@ [env:wio-e5] extends = stm32_base board = lora_e5_dev_board +board_upload.maximum_size = 233472 ; reserve the last 28KB for filesystem build_flags = ${stm32_base.build_flags} -Ivariants/wio-e5 @@ -8,31 +9,19 @@ build_flags = -DPIN_SERIAL_RX=PB7 -DPIN_SERIAL_TX=PB6 -DHAL_DAC_MODULE_ONLY - -DHAL_ADC_MODULE_DISABLED - -DHAL_COMP_MODULE_DISABLED - -DHAL_CRC_MODULE_DISABLED - -DHAL_CRYP_MODULE_DISABLED - -DHAL_GTZC_MODULE_DISABLED - -DHAL_HSEM_MODULE_DISABLED - -DHAL_I2C_MODULE_DISABLED - -DHAL_I2S_MODULE_DISABLED - -DHAL_IPCC_MODULE_DISABLED - -DHAL_IRDA_MODULE_DISABLED - -DHAL_IWDG_MODULE_DISABLED - -DHAL_LPTIM_MODULE_DISABLED - -DHAL_PKA_MODULE_DISABLED - -DHAL_RNG_MODULE_DISABLED - -DHAL_RTC_MODULE_DISABLED - -DHAL_SMARTCARD_MODULE_DISABLED - -DHAL_SMBUS_MODULE_DISABLED - -DHAL_TIM_MODULE_DISABLED - -DHAL_WWDG_MODULE_DISABLED - -DHAL_EXTI_MODULE_DISABLED - -DHAL_SAI_MODULE_DISABLED - -DHAL_ICACHE_MODULE_DISABLED + -DHAL_RNG_MODULE_ENABLED -DRADIOLIB_EXCLUDE_SX128X=1 -DRADIOLIB_EXCLUDE_SX127X=1 -DRADIOLIB_EXCLUDE_LR11X0=1 -; -D PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF + -DMESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR=1 + -DMESHTASTIC_EXCLUDE_I2C=1 + -DMESHTASTIC_EXCLUDE_WIFI=1 + -DMESHTASTIC_EXCLUDE_BLUETOOTH=1 + -DMESHTASTIC_EXCLUDE_GPS=1 + -DMESHTASTIC_EXCLUDE_SCREEN=1 + -DMESHTASTIC_EXCLUDE_MQTT=1 + -DMESHTASTIC_EXCLUDE_POWERMON=1 + ;-DPIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF + ;-DCFG_DEBUG upload_port = stlink \ No newline at end of file diff --git a/variants/wio-e5/variant.h b/variants/wio-e5/variant.h index 1de424d1d..5421eaeb9 100644 --- a/variants/wio-e5/variant.h +++ b/variants/wio-e5/variant.h @@ -17,4 +17,9 @@ Do not expect a working Meshtastic device with this target. #define LED_PIN PB5 #define LED_STATE_ON 1 +#if (defined(LED_BUILTIN) && LED_BUILTIN == PNUM_NOT_DEFINED) +#undef LED_BUILTIN +#define LED_BUILTIN (LED_PIN) +#endif + #endif From 0951fdd49b67c00c3c075b4236b12af7fb04d507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Fri, 21 Mar 2025 16:12:49 +0100 Subject: [PATCH 303/381] Add support for Heltec HRI-3621 industrial sensor hub (#6366) --- src/ButtonThread.cpp | 2 +- src/Power.cpp | 4 +- .../Telemetry/EnvironmentTelemetry.cpp | 7 +-- src/modules/Telemetry/EnvironmentTelemetry.h | 5 ++ src/platform/esp32/architecture.h | 2 + variants/heltec_sensor_hub/platformio.ini | 11 +++++ variants/heltec_sensor_hub/variant.h | 46 +++++++++++++++++++ 7 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 variants/heltec_sensor_hub/platformio.ini create mode 100644 variants/heltec_sensor_hub/variant.h diff --git a/src/ButtonThread.cpp b/src/ButtonThread.cpp index ec0bc5fc2..12f81353c 100644 --- a/src/ButtonThread.cpp +++ b/src/ButtonThread.cpp @@ -47,7 +47,7 @@ ButtonThread::ButtonThread() : OSThread("Button") #ifdef USERPREFS_BUTTON_PIN int pin = config.device.button_gpio ? config.device.button_gpio : USERPREFS_BUTTON_PIN; // Resolved button pin #endif -#if defined(HELTEC_CAPSULE_SENSOR_V3) +#if defined(HELTEC_CAPSULE_SENSOR_V3) || defined(HELTEC_SENSOR_HUB) this->userButton = OneButton(pin, false, false); #elif defined(BUTTON_ACTIVE_LOW) this->userButton = OneButton(pin, BUTTON_ACTIVE_LOW, BUTTON_ACTIVE_PULLUP); diff --git a/src/Power.cpp b/src/Power.cpp index 5768e9908..8c2ef998d 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -391,7 +391,7 @@ class AnalogBatteryLevel : public HasBatteryLevel virtual bool isVbusIn() override { #ifdef EXT_PWR_DETECT -#ifdef HELTEC_CAPSULE_SENSOR_V3 +#if defined(HELTEC_CAPSULE_SENSOR_V3) || defined(HELTEC_SENSOR_HUB) // if external powered that pin will be pulled down if (digitalRead(EXT_PWR_DETECT) == LOW) { return true; @@ -541,7 +541,7 @@ Power::Power() : OSThread("Power") bool Power::analogInit() { #ifdef EXT_PWR_DETECT -#ifdef HELTEC_CAPSULE_SENSOR_V3 +#if defined(HELTEC_CAPSULE_SENSOR_V3) || defined(HELTEC_SENSOR_HUB) pinMode(EXT_PWR_DETECT, INPUT_PULLUP); #else pinMode(EXT_PWR_DETECT, INPUT); diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index 8835c985d..8c0507e77 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -98,7 +98,8 @@ int32_t EnvironmentTelemetryModule::runOnce() // moduleConfig.telemetry.environment_screen_enabled = 1; // moduleConfig.telemetry.environment_update_interval = 15; - if (!(moduleConfig.telemetry.environment_measurement_enabled || moduleConfig.telemetry.environment_screen_enabled)) { + if (!(moduleConfig.telemetry.environment_measurement_enabled || moduleConfig.telemetry.environment_screen_enabled || + ENVIRONMENTAL_TELEMETRY_MODULE_ENABLE)) { // If this module is not enabled, and the user doesn't want the display screen don't waste any OSThread time on it return disable(); } @@ -107,7 +108,7 @@ int32_t EnvironmentTelemetryModule::runOnce() // This is the first time the OSThread library has called this function, so do some setup firstTime = 0; - if (moduleConfig.telemetry.environment_measurement_enabled) { + if (moduleConfig.telemetry.environment_measurement_enabled || ENVIRONMENTAL_TELEMETRY_MODULE_ENABLE) { LOG_INFO("Environment Telemetry: init"); #ifdef SENSECAP_INDICATOR result = indicatorSensor.runOnce(); @@ -178,7 +179,7 @@ int32_t EnvironmentTelemetryModule::runOnce() return result == UINT32_MAX ? disable() : setStartDelay(); } else { // if we somehow got to a second run of this module with measurement disabled, then just wait forever - if (!moduleConfig.telemetry.environment_measurement_enabled) { + if (!moduleConfig.telemetry.environment_measurement_enabled && !ENVIRONMENTAL_TELEMETRY_MODULE_ENABLE) { return disable(); } else { #if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR_EXTERNAL diff --git a/src/modules/Telemetry/EnvironmentTelemetry.h b/src/modules/Telemetry/EnvironmentTelemetry.h index 6e0f850ef..d70c063fc 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.h +++ b/src/modules/Telemetry/EnvironmentTelemetry.h @@ -3,6 +3,11 @@ #if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR #pragma once + +#ifndef ENVIRONMENTAL_TELEMETRY_MODULE_ENABLE +#define ENVIRONMENTAL_TELEMETRY_MODULE_ENABLE 0 +#endif + #include "../mesh/generated/meshtastic/telemetry.pb.h" #include "NodeDB.h" #include "ProtobufModule.h" diff --git a/src/platform/esp32/architecture.h b/src/platform/esp32/architecture.h index e4f8b49a0..631df0fe4 100644 --- a/src/platform/esp32/architecture.h +++ b/src/platform/esp32/architecture.h @@ -178,6 +178,8 @@ #define HW_VENDOR meshtastic_HardwareModel_MESH_TAB #elif defined(T_ETH_ELITE) #define HW_VENDOR meshtastic_HardwareModel_T_ETH_ELITE +#elif defined(HELTEC_SENSOR_HUB) +#define HW_VENDOR meshtastic_HardwareModel_HELTEC_SENSOR_HUB #endif // ----------------------------------------------------------------------------- diff --git a/variants/heltec_sensor_hub/platformio.ini b/variants/heltec_sensor_hub/platformio.ini new file mode 100644 index 000000000..53f84fab4 --- /dev/null +++ b/variants/heltec_sensor_hub/platformio.ini @@ -0,0 +1,11 @@ +[env:heltec_sensor_hub] +extends = esp32s3_base +board = heltec_wifi_lora_32_V3 +board_check = true + +build_flags = + ${esp32s3_base.build_flags} -I variants/heltec_sensor_hub + -D HELTEC_SENSOR_HUB + +lib_deps = ${esp32s3_base.lib_deps} + adafruit/Adafruit NeoPixel @ ^1.12.0 diff --git a/variants/heltec_sensor_hub/variant.h b/variants/heltec_sensor_hub/variant.h new file mode 100644 index 000000000..771cefee3 --- /dev/null +++ b/variants/heltec_sensor_hub/variant.h @@ -0,0 +1,46 @@ +#define EXT_PWR_DETECT 20 + +#define BUTTON_PIN 17 + +#define BATTERY_PIN 7 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage +#define ADC_CHANNEL ADC1_GPIO7_CHANNEL +#define ADC_ATTENUATION ADC_ATTEN_DB_2_5 // lower dB for high resistance voltage divider +#define ADC_MULTIPLIER (4.9 * 1.045) +#define ADC_CTRL 34 // active HIGH, powers the voltage divider. Only on 1.1 +#define ADC_CTRL_ENABLED HIGH + +#define HAS_NEOPIXEL // Enable the use of neopixels +#define NEOPIXEL_COUNT 1 // How many neopixels are connected +#define NEOPIXEL_DATA 18 // gpio pin used to send data to the neopixels +#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use + +#define USE_SX1262 +#define LORA_DIO0 RADIOLIB_NC +#define LORA_RESET 12 +#define LORA_DIO1 14 // SX1262 IRQ +#define LORA_DIO2 13 // SX1262 BUSY + +#define LORA_SCK 9 +#define LORA_MISO 11 +#define LORA_MOSI 10 +#define LORA_CS 8 + +#define SX126X_CS LORA_CS +#define SX126X_DIO1 LORA_DIO1 +#define SX126X_BUSY LORA_DIO2 +#define SX126X_RESET LORA_RESET + +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 + +#define I2C_SDA 1 +#define I2C_SCL 2 +#define HAS_SCREEN 0 +#define SENSOR_POWER_CTRL_PIN 33 +#define SENSOR_POWER_ON 1 + +#define PERIPHERAL_WARMUP_MS 100 + +#define ESP32S3_WAKE_TYPE ESP_EXT1_WAKEUP_ANY_HIGH + +#define ENVIRONMENTAL_TELEMETRY_MODULE_ENABLE 1 \ No newline at end of file From 1e4a0134e6ed6d455e54cd21f64232389280781b Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Sat, 22 Mar 2025 11:55:11 +1100 Subject: [PATCH 304/381] Remove unnecessary null pointer check (#6370) Further pointed out by @elfring, this patch removes one more unnecessary null pointer check. https://github.com/meshtastic/firmware/issues/6170#issuecomment-2744002798 --- src/mesh/CryptoEngine.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mesh/CryptoEngine.cpp b/src/mesh/CryptoEngine.cpp index 6dffbe2b7..d32b73855 100644 --- a/src/mesh/CryptoEngine.cpp +++ b/src/mesh/CryptoEngine.cpp @@ -223,10 +223,8 @@ void CryptoEngine::decrypt(uint32_t fromNode, uint64_t packetId, size_t numBytes // Generic implementation of AES-CTR encryption. void CryptoEngine::encryptAESCtr(CryptoKey _key, uint8_t *_nonce, size_t numBytes, uint8_t *bytes) { - if (ctr) { - delete ctr; - ctr = nullptr; - } + delete ctr; + ctr = nullptr; if (_key.length == 16) ctr = new CTR(); else From cf7f0f9d0895602df3453a4f5cfea843f4e09744 Mon Sep 17 00:00:00 2001 From: dfsx1 <60702962+dfsx1@users.noreply.github.com> Date: Sun, 23 Mar 2025 10:49:06 +0000 Subject: [PATCH 305/381] Fix NodeInfo exploit overwriting publicKey in NodeDB (#6372) Co-authored-by: dfsx1 --- src/mesh/NodeDB.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index a9130c3a9..666276f83 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -1437,13 +1437,14 @@ bool NodeDB::updateUser(uint32_t nodeId, meshtastic_User &p, uint8_t channelInde #if !(MESHTASTIC_EXCLUDE_PKI) if (p.public_key.size > 0) { printBytes("Incoming Pubkey: ", p.public_key.bytes, 32); - if (info->user.public_key.size > 0) { // if we have a key for this user already, don't overwrite with a new one - LOG_INFO("Public Key set for node, not updating!"); - // we copy the key into the incoming packet, to prevent overwrite - memcpy(p.public_key.bytes, info->user.public_key.bytes, 32); - } else { - LOG_INFO("Update Node Pubkey!"); - } + } + if (info->user.public_key.size > 0) { // if we have a key for this user already, don't overwrite with a new one + LOG_INFO("Public Key set for node, not updating!"); + // we copy the key into the incoming packet, to prevent overwrite + p.public_key.size = 32; + memcpy(p.public_key.bytes, info->user.public_key.bytes, 32); + } else if (p.public_key.size > 0) { + LOG_INFO("Update Node Pubkey!"); } #endif From 1ee800e9011e54abf6a9546947c6b34244e96766 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sun, 23 Mar 2025 12:33:26 +0100 Subject: [PATCH 306/381] add MUI/inkHUD to bug report template (#6376) --- .github/ISSUE_TEMPLATE/Bug Report.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/Bug Report.yml b/.github/ISSUE_TEMPLATE/Bug Report.yml index f638b9018..bc77e8c1b 100644 --- a/.github/ISSUE_TEMPLATE/Bug Report.yml +++ b/.github/ISSUE_TEMPLATE/Bug Report.yml @@ -72,6 +72,15 @@ body: validations: required: true + - type: checkboxes + id: mui + attributes: + label: Is this bug report about any UI component firmware like InkHUD or Meshtatic UI (MUI)? + options: + - label: Meshtastic UI aka MUI colorTFT + - label: InkHUD ePaper + - label: OLED slide UI on any display + - type: input id: version attributes: From daa4186d654ff13c354ad55fdd326fa8832a1410 Mon Sep 17 00:00:00 2001 From: Andrew Yong Date: Sun, 23 Mar 2025 23:32:55 +0800 Subject: [PATCH 307/381] [esp32] Define BUTTON_PIN (-1) by default, fixes #6213 (#6371) Signed-off-by: Andrew Yong --- src/configuration.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/configuration.h b/src/configuration.h index fd4a5b196..1a4dbbcc3 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -110,6 +110,11 @@ along with this program. If not, see . // Define if screen should be mirrored left to right // #define SCREEN_MIRROR +// Define BUTTON_PIN to ensure button setup is always done +#ifndef BUTTON_PIN +#define BUTTON_PIN (-1) +#endif + // I2C Keyboards (M5Stack, RAK14004, T-Deck) #define CARDKB_ADDR 0x5F #define TDECK_KB_ADDR 0x55 From e722a97987031fc0affd715b55957b6f62b787f7 Mon Sep 17 00:00:00 2001 From: Chloe Bethel Date: Mon, 24 Mar 2025 22:26:59 +0000 Subject: [PATCH 308/381] Don't use assert() in MeshService to guard queueing packets (#6388) --- src/mesh/MeshService.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/mesh/MeshService.cpp b/src/mesh/MeshService.cpp index f293559ad..297c7b2ed 100644 --- a/src/mesh/MeshService.cpp +++ b/src/mesh/MeshService.cpp @@ -309,7 +309,10 @@ void MeshService::sendToPhone(meshtastic_MeshPacket *p) } } - assert(toPhoneQueue.enqueue(p, 0)); + if (toPhoneQueue.enqueue(p, 0) == false) { + LOG_CRIT("Failed to queue a packet into toPhoneQueue!"); + abort(); + } fromNum++; } @@ -323,7 +326,10 @@ void MeshService::sendMqttMessageToClientProxy(meshtastic_MqttClientProxyMessage releaseMqttClientProxyMessageToPool(d); } - assert(toPhoneMqttProxyQueue.enqueue(m, 0)); + if (toPhoneMqttProxyQueue.enqueue(m, 0) == false) { + LOG_CRIT("Failed to queue a packet into toPhoneMqttProxyQueue!"); + abort(); + } fromNum++; } @@ -337,7 +343,10 @@ void MeshService::sendClientNotification(meshtastic_ClientNotification *n) releaseClientNotificationToPool(d); } - assert(toPhoneClientNotificationQueue.enqueue(n, 0)); + if (toPhoneClientNotificationQueue.enqueue(n, 0) == false) { + LOG_CRIT("Failed to queue a notification into toPhoneClientNotificationQueue!"); + abort(); + } fromNum++; } From e9d8a3d7f95fa3a4e27514321a1c942d04239b72 Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Tue, 25 Mar 2025 01:30:17 +0100 Subject: [PATCH 309/381] MUI: increase stack, cache and drawbuffer (#6389) * increase stack, cache and drawbuffer * bump device-ui lib * T-Deck map: switch to full redraw --- platformio.ini | 2 +- src/graphics/tftSetup.cpp | 2 +- variants/portduino/platformio.ini | 3 ++- variants/t-deck/platformio.ini | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/platformio.ini b/platformio.ini index 7f71d2f58..3de5b715f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -94,7 +94,7 @@ lib_deps = [device-ui_base] lib_deps = - https://github.com/meshtastic/device-ui.git#74e739ed4532ca10393df9fc89ae5a22f0bab2b1 + https://github.com/meshtastic/device-ui.git#7a6ffba3c86901b0e3234b6c056aa803b4cd8854 ; Common libs for environmental measurements in telemetry module ; (not included in native / portduino) diff --git a/src/graphics/tftSetup.cpp b/src/graphics/tftSetup.cpp index c31659c62..cacb02694 100644 --- a/src/graphics/tftSetup.cpp +++ b/src/graphics/tftSetup.cpp @@ -119,7 +119,7 @@ void tftSetup(void) #ifdef ARCH_ESP32 tftSleepObserver.observe(¬ifyLightSleep); endSleepObserver.observe(¬ifyLightSleepEnd); - xTaskCreatePinnedToCore(tft_task_handler, "tft", 8192, NULL, 1, NULL, 0); + xTaskCreatePinnedToCore(tft_task_handler, "tft", 10240, NULL, 1, NULL, 0); #endif } diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 9bf3313ce..7a3392eb4 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -27,6 +27,7 @@ build_flags = ${native_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunctio -D USE_X11=1 -D HAS_TFT=1 -D HAS_SCREEN=0 + -D LV_CACHE_DEF_SIZE=6291456 -D LV_BUILD_TEST=0 -D LV_USE_LIBINPUT=1 -D LV_LVGL_H_INCLUDE_SIMPLE @@ -56,7 +57,7 @@ build_flags = ${native_base.build_flags} -O0 -fsanitize=address -lX11 -linput -l -D USE_X11=1 -D HAS_TFT=1 -D HAS_SCREEN=0 -; -D CALIBRATE_TOUCH=0 + -D LV_CACHE_DEF_SIZE=6291456 -D LV_BUILD_TEST=0 -D LV_USE_LOG=1 -D LV_USE_SYSMON=1 diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 4671a5a9b..14fbee6cf 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -42,7 +42,7 @@ build_flags = -D HAS_SCREEN=0 -D HAS_TFT=1 -D USE_I2S_BUZZER - -D RAM_SIZE=4096 + -D RAM_SIZE=5120 -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE -D LV_COMP_CONF_INCLUDE_SIMPLE @@ -66,6 +66,7 @@ build_flags = -D VIEW_320x240 ; -D USE_DOUBLE_BUFFER -D USE_PACKET_API + -D MAP_FULL_REDRAW lib_deps = ${env:t-deck.lib_deps} From 3afe84c4f4ca3e01faff4e503eae887173c989a4 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Tue, 25 Mar 2025 01:30:47 +0100 Subject: [PATCH 310/381] linux-native: allow multiple processes to all bind to the same multicast 2tuple (#6391) * cleanup UdpMulticastThread.h preprocessor rules a tiny bit * bump platform-native to allow for multiple multicast listeners on the same machine --------- Co-authored-by: Ben Meadors --- arch/portduino/portduino.ini | 2 +- src/mesh/udp/UdpMulticastThread.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 734a4f91e..55234914f 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -1,6 +1,6 @@ ; The Portduino based 'native' environment. Currently supported on Linux targets with real LoRa hardware (or simulated). [portduino_base] -platform = https://github.com/meshtastic/platform-native.git#df71ed0040e9aad767a002829330965b78fc452a +platform = https://github.com/meshtastic/platform-native.git#e82ba1a19b6cd1dc55cbde29b33ea8dd0640014f framework = arduino build_src_filter = diff --git a/src/mesh/udp/UdpMulticastThread.h b/src/mesh/udp/UdpMulticastThread.h index 7067cced9..88824dc4d 100644 --- a/src/mesh/udp/UdpMulticastThread.h +++ b/src/mesh/udp/UdpMulticastThread.h @@ -23,7 +23,7 @@ class UdpMulticastThread : public concurrency::OSThread void start() { if (udp.listenMulticast(udpIpAddress, UDP_MULTICAST_DEFAUL_PORT, 64)) { -#if !defined(ARCH_PORTDUINO) +#ifndef ARCH_PORTDUINO // FIXME(PORTDUINO): arduino lacks IPAddress::toString() LOG_DEBUG("UDP Listening on IP: %s", WiFi.localIP().toString().c_str()); #else @@ -59,7 +59,7 @@ class UdpMulticastThread : public concurrency::OSThread if (!mp || !udp) { return false; } -#if !defined(ARCH_PORTDUINO) +#ifndef ARCH_PORTDUINO if (WiFi.status() != WL_CONNECTED) { return false; } From 0ddb507055d15b25941e672f54c88819d5050cb1 Mon Sep 17 00:00:00 2001 From: Austin Date: Mon, 24 Mar 2025 20:38:47 -0400 Subject: [PATCH 311/381] userPrefs: Add WiFi SSID/PW, and UDP multicast configs (#6387) --- src/mesh/NodeDB.cpp | 16 ++++++++++++++++ userPrefs.jsonc | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 666276f83..0269c1dfc 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -628,6 +628,22 @@ void NodeDB::installDefaultConfig(bool preserveKey = false) meshtastic_Config_PositionConfig_PositionFlags_SPEED | meshtastic_Config_PositionConfig_PositionFlags_HEADING | meshtastic_Config_PositionConfig_PositionFlags_DOP | meshtastic_Config_PositionConfig_PositionFlags_SATINVIEW); +#ifdef USERPREFS_NETWORK_ENABLED_PROTOCOLS + config.network.enabled_protocols = USERPREFS_NETWORK_ENABLED_PROTOCOLS; +#endif + +#ifdef USERPREFS_NETWORK_WIFI_ENABLED + config.network.wifi_enabled = USERPREFS_NETWORK_WIFI_ENABLED; +#endif + +#ifdef USERPREFS_NETWORK_WIFI_SSID + strncpy(config.network.wifi_ssid, USERPREFS_NETWORK_WIFI_SSID, sizeof(config.network.wifi_ssid)); +#endif + +#ifdef USERPREFS_NETWORK_WIFI_PSK + strncpy(config.network.wifi_psk, USERPREFS_NETWORK_WIFI_PSK, sizeof(config.network.wifi_psk)); +#endif + #ifdef DISPLAY_FLIP_SCREEN config.display.flip_screen = true; #endif diff --git a/userPrefs.jsonc b/userPrefs.jsonc index 6a3fdbb55..d522ad272 100644 --- a/userPrefs.jsonc +++ b/userPrefs.jsonc @@ -40,5 +40,9 @@ // "USERPREFS_OEM_IMAGE_WIDTH": "50", // "USERPREFS_OEM_IMAGE_HEIGHT": "28", // "USERPREFS_OEM_IMAGE_DATA": "{ 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xC0, 0x07, 0x80, 0x0F, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x18, 0xFF, 0xFF, 0x61, 0x00, 0x00, 0x00, 0x0C, 0xFF, 0xFF, 0xC7, 0x00, 0x00, 0x00, 0x0C, 0xFF, 0xFF, 0xC7, 0x00, 0x00, 0x00, 0x18, 0xFF, 0xFF, 0x67, 0x00, 0x00, 0x00, 0x18, 0x1F, 0xF0, 0x67, 0x00, 0x00, 0x00, 0x30, 0x1F, 0xF8, 0x33, 0x00, 0x00, 0x00, 0x30, 0x00, 0xFC, 0x31, 0x00, 0x00, 0x00, 0x60, 0x00, 0xFE, 0x18, 0x00, 0x00, 0x00, 0x60, 0x00, 0x7E, 0x18, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x3F, 0x0C, 0x00, 0x00, 0x00, 0xC0, 0x80, 0x1F, 0x0C, 0x00, 0x00, 0x00, 0x80, 0x81, 0x1F, 0x06, 0x00, 0x00, 0x00, 0x80, 0xC1, 0x0F, 0x06, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0xE6, 0x8F, 0x01, 0x00, 0x00, 0x00, 0x00, 0xEE, 0xC7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x0C, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00}", + // "USERPREFS_NETWORK_ENABLED_PROTOCOLS": "1", // Enable UDP mesh + // "USERPREFS_NETWORK_WIFI_ENABLED": "true", + // "USERPREFS_NETWORK_WIFI_SSID": "wifi_ssid", + // "USERPREFS_NETWORK_WIFI_PSK": "wifi_psk", "USERPREFS_TZ_STRING": "tzplaceholder " } From e5f8218d34611649d806114a329b1c40e7b67fa9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 25 Mar 2025 07:00:54 -0500 Subject: [PATCH 312/381] Upgrade trunk (#6383) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index c451bb66d..b44f46a51 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -12,11 +12,11 @@ lint: - trufflehog@3.88.18 - yamllint@1.36.2 - bandit@1.8.3 - - checkov@3.2.388 + - checkov@3.2.390 - terrascan@1.19.9 - trivy@0.60.0 - taplo@0.9.3 - - ruff@0.11.0 + - ruff@0.11.1 - isort@6.0.1 - markdownlint@0.44.0 - oxipng@9.1.4 From 33f2b7144f2a548f7a76389d6aca22bddcdbf8e9 Mon Sep 17 00:00:00 2001 From: Austin Date: Tue, 25 Mar 2025 12:39:19 -0400 Subject: [PATCH 313/381] Default to UDP enabled if it's available (#6394) --- src/mesh/NodeDB.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 0269c1dfc..df0fbcedd 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -628,8 +628,13 @@ void NodeDB::installDefaultConfig(bool preserveKey = false) meshtastic_Config_PositionConfig_PositionFlags_SPEED | meshtastic_Config_PositionConfig_PositionFlags_HEADING | meshtastic_Config_PositionConfig_PositionFlags_DOP | meshtastic_Config_PositionConfig_PositionFlags_SATINVIEW); +// Set default value for 'Mesh via UDP' +#if HAS_UDP_MULTICAST #ifdef USERPREFS_NETWORK_ENABLED_PROTOCOLS config.network.enabled_protocols = USERPREFS_NETWORK_ENABLED_PROTOCOLS; +#else + config.network.enabled_protocols = 1; +#endif #endif #ifdef USERPREFS_NETWORK_WIFI_ENABLED From eb375d8e6220a57f2e69a75645ad4cd0c2a057ef Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 25 Mar 2025 14:55:37 -0500 Subject: [PATCH 314/381] [create-pull-request] automated change (#6396) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protobufs b/protobufs index b4e24c3a8..b4044f8f9 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit b4e24c3a868f9e5fd782d2e256b05456d578923b +Subproject commit b4044f8f9f3681d4d20521dbe13ee42c96eae353 From 53a7afff41f0cbb664d07ba49ee03f7025ccc009 Mon Sep 17 00:00:00 2001 From: nledevil Date: Tue, 25 Mar 2025 16:57:06 -0500 Subject: [PATCH 315/381] Adding Variants for Hackerboxes ESP32C3 OLED kit and the ESP32 IO Kit (#6319) --- variants/hackerboxes_esp32_io/platformio.ini | 12 +++++++ variants/hackerboxes_esp32_io/variant.h | 30 ++++++++++++++++ .../hackerboxes_esp32c3_oled/platformio.ini | 14 ++++++++ variants/hackerboxes_esp32c3_oled/variant.h | 36 +++++++++++++++++++ 4 files changed, 92 insertions(+) create mode 100644 variants/hackerboxes_esp32_io/platformio.ini create mode 100644 variants/hackerboxes_esp32_io/variant.h create mode 100644 variants/hackerboxes_esp32c3_oled/platformio.ini create mode 100644 variants/hackerboxes_esp32c3_oled/variant.h diff --git a/variants/hackerboxes_esp32_io/platformio.ini b/variants/hackerboxes_esp32_io/platformio.ini new file mode 100644 index 000000000..f024dac3e --- /dev/null +++ b/variants/hackerboxes_esp32_io/platformio.ini @@ -0,0 +1,12 @@ +[env:hackerboxes-esp32-io] +extends = esp32_base +board = esp32dev +board_level = extra +build_flags = + ${esp32_base.build_flags} + -D PRIVATE_HW + -I variants/hackerboxes_esp32_io +monitor_speed = 115200 +upload_protocol = esptool +;upload_port = /dev/ttyUSB0 +upload_speed = 921600 \ No newline at end of file diff --git a/variants/hackerboxes_esp32_io/variant.h b/variants/hackerboxes_esp32_io/variant.h new file mode 100644 index 000000000..06f0032ee --- /dev/null +++ b/variants/hackerboxes_esp32_io/variant.h @@ -0,0 +1,30 @@ +#define BUTTON_PIN 0 + +// HACKBOX LoRa IO Kit +// Uses a ESP-32-WROOM and a RA-01SH (SX1262) LoRa Board + +#define LED_PIN 2 // LED +#define LED_STATE_ON 1 // State when LED is lit + +#define HAS_SCREEN 0 +#define HAS_GPS 0 +#undef GPS_RX_PIN +#undef GPS_TX_PIN + +#define USE_SX1262 +#define LORA_SCK 18 +#define LORA_MISO 19 +#define LORA_MOSI 23 +#define LORA_CS 5 +#define LORA_DIO0 RADIOLIB_NC +#define LORA_RESET 27 +#define LORA_DIO1 33 +#define LORA_DIO2 RADIOLIB_NC +#define LORA_BUSY 32 + +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_CS LORA_CS +#define SX126X_DIO1 LORA_DIO1 +#define SX126X_BUSY LORA_BUSY +#define SX126X_RESET LORA_RESET +#define SX126X_MAX_POWER 22 // Max power of the RA-01SH is 22db \ No newline at end of file diff --git a/variants/hackerboxes_esp32c3_oled/platformio.ini b/variants/hackerboxes_esp32c3_oled/platformio.ini new file mode 100644 index 000000000..4fcbf2ade --- /dev/null +++ b/variants/hackerboxes_esp32c3_oled/platformio.ini @@ -0,0 +1,14 @@ +[env:hackerboxes-esp32c3-oled] +extends = esp32c3_base +board = esp32-c3-devkitm-1 +board_level = extra +build_flags = + ${esp32_base.build_flags} + -D PRIVATE_HW + -D ARDUINO_USB_MODE=1 + -D ARDUINO_USB_CDC_ON_BOOT=1 + -I variants/hackerboxes_esp32c3_oled +monitor_speed = 115200 +upload_protocol = esptool +;upload_port = /dev/ttyUSB0 +upload_speed = 921600 \ No newline at end of file diff --git a/variants/hackerboxes_esp32c3_oled/variant.h b/variants/hackerboxes_esp32c3_oled/variant.h new file mode 100644 index 000000000..7432a9941 --- /dev/null +++ b/variants/hackerboxes_esp32c3_oled/variant.h @@ -0,0 +1,36 @@ +#define BUTTON_PIN 9 + +// Hackerboxes LoRa ESP32-C3 OLED Kit +// Uses a ESP32-C3 OLED Board and a RA-01SH (SX1262) LoRa Board + +#define LED_PIN 8 // LED +#define LED_STATE_ON 1 // State when LED is lit + +#define HAS_SCREEN 0 +#define HAS_GPS 0 +#undef GPS_RX_PIN +#undef GPS_TX_PIN + +// #define USE_SSD1306_72_40 +// #define I2C_SDA 5 // I2C pins for this board +// #define I2C_SCL 6 // +// #define TFT_WIDTH 72 +// #define TFT_HEIGHT 40 + +#define USE_SX1262 +#define LORA_SCK 4 +#define LORA_MISO 7 +#define LORA_MOSI 3 +#define LORA_CS 1 +#define LORA_DIO0 RADIOLIB_NC +#define LORA_RESET 0 +#define LORA_DIO1 20 +#define LORA_DIO2 RADIOLIB_NC +#define LORA_BUSY 10 + +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_CS LORA_CS +#define SX126X_DIO1 LORA_DIO1 +#define SX126X_BUSY LORA_BUSY +#define SX126X_RESET LORA_RESET +#define SX126X_MAX_POWER 22 // Max power of the RA-01SH is 22db \ No newline at end of file From d28af68b5a540a08b31fbc71c61fa87d4177fbfa Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Tue, 25 Mar 2025 18:49:22 -0500 Subject: [PATCH 316/381] Update version.properties --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 4c2cefef3..9d6d2a464 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 6 -build = 2 +build = 3 From 13101c1bab2066998779856812bea47e7d0b148a Mon Sep 17 00:00:00 2001 From: Nasimovy Date: Wed, 26 Mar 2025 02:29:18 +0000 Subject: [PATCH 317/381] TCA8418 initial config + basic 3x4 keypad config (#6320) * add TCA8418 to configuration.h added the TCA8418 * add TCA8418 to ScanI2C.cpp add TCA8418 * add TCA8418KB to ScanI2C.h add TCA8418KB * add TCA8418KB ScanI2CTwoWire.cpp add TCA8418KB * Create TCA8418Keyboard.cpp Create TCA8418Keyboard.cpp * Create TCA8418Keyboard.h Create TCA8418Keyboard.h * add TCA8418 to kbI2cBase.cpp add TCA8418 * add TCA8418 to kbI2cBase.h add TCA8418 * add TCA8418KB to main.cpp add TCA8418KB * add TCA8418KB to cardKbI2cImpl.cpp add TCA8418KB * Update TCA8418 kbI2cBase.cpp * enable debug TCA8418 * Nokia 5130 config * Update TCA8418Keyboard.h old version in initial commit * Update ScanI2CTwoWire.cpp * add tap_interval and backlight_on to constructor * Create TCA8418-layouts.cpp TCA8418-layout 3x4 should work Nokia 5130 needs editing. * put layouts in different file + adjusted code for variable matrix sizes * rename TCA8418-layouts.cpp to TCA8418Layouts.cpp + add endif * Update TCA8418Keyboard.cpp name change layouts * forgot a \ * Create TCA8418Layouts.h * Update TCA8418Keyboard.cpp * add include forgot include * Update TCA8418Keyboard.cpp * Update TCA8418Keyboard.h * Update TCA8418Layouts.h * revert to keyboard layout in main TCA8418Keyboard.cpp * fixed the address * changed ordering of constructor * reflect changes #6371 * edit config.h * bug fix fast pressing multiple buttons + clean up scanI2CTwoWire.cpp * trunked --------- Co-authored-by: Ben Meadors Co-authored-by: Tom Fifield --- src/configuration.h | 3 +- src/detect/ScanI2C.cpp | 6 +- src/detect/ScanI2C.h | 5 +- src/detect/ScanI2CTwoWire.cpp | 23 +- src/input/TCA8418Keyboard.cpp | 561 ++++++++++++++++++++++++++++++++++ src/input/TCA8418Keyboard.h | 83 +++++ src/input/cardKbI2cImpl.cpp | 10 +- src/input/kbI2cBase.cpp | 70 +++++ src/input/kbI2cBase.h | 4 +- src/main.cpp | 4 + 10 files changed, 750 insertions(+), 19 deletions(-) create mode 100644 src/input/TCA8418Keyboard.cpp create mode 100644 src/input/TCA8418Keyboard.h diff --git a/src/configuration.h b/src/configuration.h index 1a4dbbcc3..d9da09108 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -157,6 +157,7 @@ along with this program. If not, see . #define MLX90614_ADDR_DEF 0x5A #define CGRADSENS_ADDR 0x66 #define LTR390UV_ADDR 0x53 +#define XPOWERS_AXP192_AXP2101_ADDRESS 0x34 // same adress as TCA8418 // ----------------------------------------------------------------------------- // ACCELEROMETER @@ -374,4 +375,4 @@ along with this program. If not, see . #endif #include "DebugConfiguration.h" -#include "RF95Configuration.h" +#include "RF95Configuration.h" \ No newline at end of file diff --git a/src/detect/ScanI2C.cpp b/src/detect/ScanI2C.cpp index 4caa0f730..58e87b1c5 100644 --- a/src/detect/ScanI2C.cpp +++ b/src/detect/ScanI2C.cpp @@ -31,8 +31,8 @@ ScanI2C::FoundDevice ScanI2C::firstRTC() const ScanI2C::FoundDevice ScanI2C::firstKeyboard() const { - ScanI2C::DeviceType types[] = {CARDKB, TDECKKB, BBQ10KB, RAK14004, MPR121KB}; - return firstOfOrNONE(5, types); + ScanI2C::DeviceType types[] = {CARDKB, TDECKKB, BBQ10KB, RAK14004, MPR121KB, TCA8418KB}; + return firstOfOrNONE(6, types); } ScanI2C::FoundDevice ScanI2C::firstAccelerometer() const @@ -74,4 +74,4 @@ bool ScanI2C::DeviceAddress::operator<(const ScanI2C::DeviceAddress &other) cons || (port != NO_I2C && other.port != NO_I2C && (address < other.address)); } -ScanI2C::FoundDevice::FoundDevice(ScanI2C::DeviceType type, ScanI2C::DeviceAddress address) : type(type), address(address) {} \ No newline at end of file +ScanI2C::FoundDevice::FoundDevice(ScanI2C::DeviceType type, ScanI2C::DeviceAddress address) : type(type), address(address) {} diff --git a/src/detect/ScanI2C.h b/src/detect/ScanI2C.h index 5b6bbe629..cb61304a9 100644 --- a/src/detect/ScanI2C.h +++ b/src/detect/ScanI2C.h @@ -18,7 +18,7 @@ class ScanI2C TDECKKB, BBQ10KB, RAK14004, - PMU_AXP192_AXP2101, + PMU_AXP192_AXP2101, // has the same address as the TCA8418KB BME_680, BME_280, BMP_280, @@ -69,6 +69,7 @@ class ScanI2C DFROBOT_RAIN, DPS310, LTR390UV, + TCA8418KB, } DeviceType; // typedef uint8_t DeviceAddress; @@ -132,4 +133,4 @@ class ScanI2C private: bool shouldSuppressScreen = false; -}; +}; \ No newline at end of file diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index 8b779277d..e8506f07c 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -10,11 +10,6 @@ #include "meshUtils.h" // vformat #endif -// AXP192 and AXP2101 have the same device address, we just need to identify it in Power.cpp -#ifndef XPOWERS_AXP192_AXP2101_ADDRESS -#define XPOWERS_AXP192_AXP2101_ADDRESS 0x34 -#endif - bool in_array(uint8_t *array, int size, uint8_t lookfor) { int i; @@ -211,6 +206,18 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) } break; + case XPOWERS_AXP192_AXP2101_ADDRESS: + // Do we have the TCA8418 instead? + registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x02), 1); + if ((registerValue & 0b11100000) == 0) { + logFoundDevice("TCA8418", (uint8_t)addr.address); + type = TCA8418KB; + } else { + logFoundDevice("AXP192/AXP2101", (uint8_t)addr.address); + type = PMU_AXP192_AXP2101; + } + break; + SCAN_SIMPLE_CASE(TDECK_KB_ADDR, TDECKKB, "T-Deck keyboard", (uint8_t)addr.address); SCAN_SIMPLE_CASE(BBQ10_KB_ADDR, BBQ10KB, "BB Q10", (uint8_t)addr.address); @@ -218,9 +225,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) #ifdef HAS_NCP5623 SCAN_SIMPLE_CASE(NCP5623_ADDR, NCP5623, "NCP5623", (uint8_t)addr.address); #endif -#ifdef HAS_PMU - SCAN_SIMPLE_CASE(XPOWERS_AXP192_AXP2101_ADDRESS, PMU_AXP192_AXP2101, "AXP192/AXP2101", (uint8_t)addr.address) -#endif + case BME_ADDR: case BME_ADDR_ALTERNATE: registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xD0), 1); // GET_ID @@ -536,4 +541,4 @@ void ScanI2CTwoWire::logFoundDevice(const char *device, uint8_t address) { LOG_INFO("%s found at address 0x%x", device, address); } -#endif \ No newline at end of file +#endif diff --git a/src/input/TCA8418Keyboard.cpp b/src/input/TCA8418Keyboard.cpp new file mode 100644 index 000000000..21cd7b2d5 --- /dev/null +++ b/src/input/TCA8418Keyboard.cpp @@ -0,0 +1,561 @@ +// Based on the MPR121 Keyboard and Adafruit TCA8418 library + +#include "TCA8418Keyboard.h" +#include "configuration.h" + +#include + +// REGISTERS +// #define _TCA8418_REG_RESERVED 0x00 +#define _TCA8418_REG_CFG 0x01 // Configuration register +#define _TCA8418_REG_INT_STAT 0x02 // Interrupt status +#define _TCA8418_REG_KEY_LCK_EC 0x03 // Key lock and event counter +#define _TCA8418_REG_KEY_EVENT_A 0x04 // Key event register A +#define _TCA8418_REG_KEY_EVENT_B 0x05 // Key event register B +#define _TCA8418_REG_KEY_EVENT_C 0x06 // Key event register C +#define _TCA8418_REG_KEY_EVENT_D 0x07 // Key event register D +#define _TCA8418_REG_KEY_EVENT_E 0x08 // Key event register E +#define _TCA8418_REG_KEY_EVENT_F 0x09 // Key event register F +#define _TCA8418_REG_KEY_EVENT_G 0x0A // Key event register G +#define _TCA8418_REG_KEY_EVENT_H 0x0B // Key event register H +#define _TCA8418_REG_KEY_EVENT_I 0x0C // Key event register I +#define _TCA8418_REG_KEY_EVENT_J 0x0D // Key event register J +#define _TCA8418_REG_KP_LCK_TIMER 0x0E // Keypad lock1 to lock2 timer +#define _TCA8418_REG_UNLOCK_1 0x0F // Unlock register 1 +#define _TCA8418_REG_UNLOCK_2 0x10 // Unlock register 2 +#define _TCA8418_REG_GPIO_INT_STAT_1 0x11 // GPIO interrupt status 1 +#define _TCA8418_REG_GPIO_INT_STAT_2 0x12 // GPIO interrupt status 2 +#define _TCA8418_REG_GPIO_INT_STAT_3 0x13 // GPIO interrupt status 3 +#define _TCA8418_REG_GPIO_DAT_STAT_1 0x14 // GPIO data status 1 +#define _TCA8418_REG_GPIO_DAT_STAT_2 0x15 // GPIO data status 2 +#define _TCA8418_REG_GPIO_DAT_STAT_3 0x16 // GPIO data status 3 +#define _TCA8418_REG_GPIO_DAT_OUT_1 0x17 // GPIO data out 1 +#define _TCA8418_REG_GPIO_DAT_OUT_2 0x18 // GPIO data out 2 +#define _TCA8418_REG_GPIO_DAT_OUT_3 0x19 // GPIO data out 3 +#define _TCA8418_REG_GPIO_INT_EN_1 0x1A // GPIO interrupt enable 1 +#define _TCA8418_REG_GPIO_INT_EN_2 0x1B // GPIO interrupt enable 2 +#define _TCA8418_REG_GPIO_INT_EN_3 0x1C // GPIO interrupt enable 3 +#define _TCA8418_REG_KP_GPIO_1 0x1D // Keypad/GPIO select 1 +#define _TCA8418_REG_KP_GPIO_2 0x1E // Keypad/GPIO select 2 +#define _TCA8418_REG_KP_GPIO_3 0x1F // Keypad/GPIO select 3 +#define _TCA8418_REG_GPI_EM_1 0x20 // GPI event mode 1 +#define _TCA8418_REG_GPI_EM_2 0x21 // GPI event mode 2 +#define _TCA8418_REG_GPI_EM_3 0x22 // GPI event mode 3 +#define _TCA8418_REG_GPIO_DIR_1 0x23 // GPIO data direction 1 +#define _TCA8418_REG_GPIO_DIR_2 0x24 // GPIO data direction 2 +#define _TCA8418_REG_GPIO_DIR_3 0x25 // GPIO data direction 3 +#define _TCA8418_REG_GPIO_INT_LVL_1 0x26 // GPIO edge/level detect 1 +#define _TCA8418_REG_GPIO_INT_LVL_2 0x27 // GPIO edge/level detect 2 +#define _TCA8418_REG_GPIO_INT_LVL_3 0x28 // GPIO edge/level detect 3 +#define _TCA8418_REG_DEBOUNCE_DIS_1 0x29 // Debounce disable 1 +#define _TCA8418_REG_DEBOUNCE_DIS_2 0x2A // Debounce disable 2 +#define _TCA8418_REG_DEBOUNCE_DIS_3 0x2B // Debounce disable 3 +#define _TCA8418_REG_GPIO_PULL_1 0x2C // GPIO pull-up disable 1 +#define _TCA8418_REG_GPIO_PULL_2 0x2D // GPIO pull-up disable 2 +#define _TCA8418_REG_GPIO_PULL_3 0x2E // GPIO pull-up disable 3 +// #define _TCA8418_REG_RESERVED 0x2F + +// FIELDS CONFIG REGISTER 1 +#define _TCA8418_REG_CFG_AI 0x80 // Auto-increment for read/write +#define _TCA8418_REG_CFG_GPI_E_CGF 0x40 // Event mode config +#define _TCA8418_REG_CFG_OVR_FLOW_M 0x20 // Overflow mode enable +#define _TCA8418_REG_CFG_INT_CFG 0x10 // Interrupt config +#define _TCA8418_REG_CFG_OVR_FLOW_IEN 0x08 // Overflow interrupt enable +#define _TCA8418_REG_CFG_K_LCK_IEN 0x04 // Keypad lock interrupt enable +#define _TCA8418_REG_CFG_GPI_IEN 0x02 // GPI interrupt enable +#define _TCA8418_REG_CFG_KE_IEN 0x01 // Key events interrupt enable + +// FIELDS INT_STAT REGISTER 2 +#define _TCA8418_REG_STAT_CAD_INT 0x10 // Ctrl-alt-del seq status +#define _TCA8418_REG_STAT_OVR_FLOW_INT 0x08 // Overflow interrupt status +#define _TCA8418_REG_STAT_K_LCK_INT 0x04 // Key lock interrupt status +#define _TCA8418_REG_STAT_GPI_INT 0x02 // GPI interrupt status +#define _TCA8418_REG_STAT_K_INT 0x01 // Key events interrupt status + +// FIELDS KEY_LCK_EC REGISTER 3 +#define _TCA8418_REG_LCK_EC_K_LCK_EN 0x40 // Key lock enable +#define _TCA8418_REG_LCK_EC_LCK_2 0x20 // Keypad lock status 2 +#define _TCA8418_REG_LCK_EC_LCK_1 0x10 // Keypad lock status 1 +#define _TCA8418_REG_LCK_EC_KLEC_3 0x08 // Key event count bit 3 +#define _TCA8418_REG_LCK_EC_KLEC_2 0x04 // Key event count bit 2 +#define _TCA8418_REG_LCK_EC_KLEC_1 0x02 // Key event count bit 1 +#define _TCA8418_REG_LCK_EC_KLEC_0 0x01 // Key event count bit 0 + +// Pin IDs for matrix rows/columns +enum { + _TCA8418_ROW0, // Pin ID for row 0 + _TCA8418_ROW1, // Pin ID for row 1 + _TCA8418_ROW2, // Pin ID for row 2 + _TCA8418_ROW3, // Pin ID for row 3 + _TCA8418_ROW4, // Pin ID for row 4 + _TCA8418_ROW5, // Pin ID for row 5 + _TCA8418_ROW6, // Pin ID for row 6 + _TCA8418_ROW7, // Pin ID for row 7 + _TCA8418_COL0, // Pin ID for column 0 + _TCA8418_COL1, // Pin ID for column 1 + _TCA8418_COL2, // Pin ID for column 2 + _TCA8418_COL3, // Pin ID for column 3 + _TCA8418_COL4, // Pin ID for column 4 + _TCA8418_COL5, // Pin ID for column 5 + _TCA8418_COL6, // Pin ID for column 6 + _TCA8418_COL7, // Pin ID for column 7 + _TCA8418_COL8, // Pin ID for column 8 + _TCA8418_COL9 // Pin ID for column 9 +}; + +#define _TCA8418_COLS 3 +#define _TCA8418_ROWS 4 +#define _TCA8418_NUM_KEYS 12 + +uint8_t TCA8418TapMod[_TCA8418_NUM_KEYS] = {13, 7, 7, 7, 7, 7, + 9, 7, 9, 2, 2, 2}; // Num chars per key, Modulus for rotating through characters + +unsigned char TCA8418TapMap[_TCA8418_NUM_KEYS][13] = { + {'1', '.', ',', '?', '!', ':', ';', '-', '_', '\\', '/', '(', ')'}, // 1 + {'2', 'a', 'b', 'c', 'A', 'B', 'C'}, // 2 + {'3', 'd', 'e', 'f', 'D', 'E', 'F'}, // 3 + {'4', 'g', 'h', 'i', 'G', 'H', 'I'}, // 4 + {'5', 'j', 'k', 'l', 'J', 'K', 'L'}, // 5 + {'6', 'm', 'n', 'o', 'M', 'N', 'O'}, // 6 + {'7', 'p', 'q', 'r', 's', 'P', 'Q', 'R', 'S'}, // 7 + {'8', 't', 'u', 'v', 'T', 'U', 'V'}, // 8 + {'9', 'w', 'x', 'y', 'z', 'W', 'X', 'Y', 'Z'}, // 9 + {'*', '+'}, // * + {'0', ' '}, // 0 + {'#', '@'}, // # +}; + +unsigned char TCA8418LongPressMap[_TCA8418_NUM_KEYS] = { + _TCA8418_ESC, // 1 + _TCA8418_UP, // 2 + _TCA8418_NONE, // 3 + _TCA8418_LEFT, // 4 + _TCA8418_NONE, // 5 + _TCA8418_RIGHT, // 6 + _TCA8418_NONE, // 7 + _TCA8418_DOWN, // 8 + _TCA8418_NONE, // 9 + _TCA8418_BSP, // * + _TCA8418_NONE, // 0 + _TCA8418_NONE, // # +}; + +#define _TCA8418_LONG_PRESS_THRESHOLD 2000 +#define _TCA8418_MULTI_TAP_THRESHOLD 750 + +TCA8418Keyboard::TCA8418Keyboard() : m_wire(nullptr), m_addr(0), readCallback(nullptr), writeCallback(nullptr) +{ + state = Init; + last_key = -1; + next_key = -1; + should_backspace = false; + last_tap = 0L; + char_idx = 0; + tap_interval = 0; + backlight_on = true; + queue = ""; +} + +void TCA8418Keyboard::begin(uint8_t addr, TwoWire *wire) +{ + m_addr = addr; + m_wire = wire; + + m_wire->begin(); + + reset(); +} + +void TCA8418Keyboard::begin(i2c_com_fptr_t r, i2c_com_fptr_t w, uint8_t addr) +{ + m_addr = addr; + m_wire = nullptr; + writeCallback = w; + readCallback = r; + reset(); +} + +void TCA8418Keyboard::reset() +{ + LOG_DEBUG("TCA8418 Reset"); + // GPIO + // set default all GIO pins to INPUT + writeRegister(_TCA8418_REG_GPIO_DIR_1, 0x00); + writeRegister(_TCA8418_REG_GPIO_DIR_2, 0x00); + // Set COL9 as GPIO output + writeRegister(_TCA8418_REG_GPIO_DIR_3, 0x02); + // Switch off keyboard backlight (COL9 = LOW) + writeRegister(_TCA8418_REG_GPIO_DAT_OUT_3, 0x00); + + // add all pins to key events + writeRegister(_TCA8418_REG_GPI_EM_1, 0xFF); + writeRegister(_TCA8418_REG_GPI_EM_2, 0xFF); + writeRegister(_TCA8418_REG_GPI_EM_3, 0xFF); + + // set all pins to FALLING interrupts + writeRegister(_TCA8418_REG_GPIO_INT_LVL_1, 0x00); + writeRegister(_TCA8418_REG_GPIO_INT_LVL_2, 0x00); + writeRegister(_TCA8418_REG_GPIO_INT_LVL_3, 0x00); + + // add all pins to interrupts + writeRegister(_TCA8418_REG_GPIO_INT_EN_1, 0xFF); + writeRegister(_TCA8418_REG_GPIO_INT_EN_2, 0xFF); + writeRegister(_TCA8418_REG_GPIO_INT_EN_3, 0xFF); + + // Set keyboard matrix size + matrix(_TCA8418_ROWS, _TCA8418_COLS); + enableDebounce(); + flush(); + state = Idle; +} + +bool TCA8418Keyboard::matrix(uint8_t rows, uint8_t columns) +{ + if ((rows > 8) || (columns > 10)) + return false; + + // Skip zero size matrix + if ((rows != 0) && (columns != 0)) { + // Setup the keypad matrix. + uint8_t mask = 0x00; + for (int r = 0; r < rows; r++) { + mask <<= 1; + mask |= 1; + } + writeRegister(_TCA8418_REG_KP_GPIO_1, mask); + + mask = 0x00; + for (int c = 0; c < columns && c < 8; c++) { + mask <<= 1; + mask |= 1; + } + writeRegister(_TCA8418_REG_KP_GPIO_2, mask); + + if (columns > 8) { + if (columns == 9) + mask = 0x01; + else + mask = 0x03; + writeRegister(_TCA8418_REG_KP_GPIO_3, mask); + } + } + + return true; +} + +uint8_t TCA8418Keyboard::keyCount() const +{ + uint8_t eventCount = readRegister(_TCA8418_REG_KEY_LCK_EC); + eventCount &= 0x0F; // lower 4 bits only + return eventCount; +} + +bool TCA8418Keyboard::hasEvent() +{ + return queue.length() > 0; +} + +void TCA8418Keyboard::queueEvent(char next) +{ + if (next == _TCA8418_NONE) { + return; + } + queue.concat(next); +} + +char TCA8418Keyboard::dequeueEvent() +{ + if (queue.length() < 1) { + return _TCA8418_NONE; + } + char next = queue.charAt(0); + queue.remove(0, 1); + return next; +} + +void TCA8418Keyboard::trigger() +{ + if (keyCount() == 0) { + return; + } + if (state != Init) { + // Read the key register + uint8_t k = readRegister(_TCA8418_REG_KEY_EVENT_A); + uint8_t key = k & 0x7F; + if (k & 0x80) { + if (state == Idle) + pressed(key); + return; + } else { + if (state == Held) { + released(); + } + state = Idle; + return; + } + } else { + reset(); + } +} + +void TCA8418Keyboard::pressed(uint8_t key) +{ + if (state == Init || state == Busy) { + return; + } + uint8_t next_key = 0; + int row = (key - 1) / 10; + int col = (key - 1) % 10; + + if (row >= _TCA8418_ROWS || col >= _TCA8418_COLS) { + return; // Invalid key + } + + // Compute key index based on dynamic row/column + next_key = row * _TCA8418_COLS + col; + + // LOG_DEBUG("TCA8418: Key %u -> Next Key %u", key, next_key); + + state = Held; + uint32_t now = millis(); + tap_interval = now - last_tap; + if (tap_interval < 0) { + // Long running, millis has overflowed. + last_tap = 0; + state = Busy; + return; + } + + // Check if the key is the same as the last one or if the time interval has passed + if (next_key != last_key || tap_interval > _TCA8418_MULTI_TAP_THRESHOLD) { + char_idx = 0; // Reset char index if new key or long press + should_backspace = false; // dont backspace on new key + } else { + char_idx += 1; // Cycle through characters if same key pressed + should_backspace = true; // allow backspace on same key + } + + // Store the current key as the last key + last_key = next_key; + last_tap = now; +} + +void TCA8418Keyboard::released() +{ + if (state != Held) { + return; + } + + if (last_key < 0 || last_key > _TCA8418_NUM_KEYS) { // reset to idle if last_key out of bounds + last_key = -1; + state = Idle; + return; + } + uint32_t now = millis(); + int32_t held_interval = now - last_tap; + last_tap = now; + if (tap_interval < _TCA8418_MULTI_TAP_THRESHOLD && should_backspace) { + queueEvent(_TCA8418_BSP); + } + if (held_interval > _TCA8418_LONG_PRESS_THRESHOLD) { + queueEvent(TCA8418LongPressMap[last_key]); + // LOG_DEBUG("Long Press Key: %i Map: %i", last_key, TCA8418LongPressMap[last_key]); + } else { + queueEvent(TCA8418TapMap[last_key][(char_idx % TCA8418TapMod[last_key])]); + // LOG_DEBUG("Key Press: %i Index:%i if %i Map: %c", last_key, char_idx, TCA8418TapMod[last_key], + // TCA8418TapMap[last_key][(char_idx % TCA8418TapMod[last_key])]); + } +} + +uint8_t TCA8418Keyboard::flush() +{ + // Flush key events + uint8_t count = 0; + while (readRegister(_TCA8418_REG_KEY_EVENT_A) != 0) + count++; + // Flush gpio events + readRegister(_TCA8418_REG_GPIO_INT_STAT_1); + readRegister(_TCA8418_REG_GPIO_INT_STAT_2); + readRegister(_TCA8418_REG_GPIO_INT_STAT_3); + // Clear INT_STAT register + writeRegister(_TCA8418_REG_INT_STAT, 3); + return count; +} + +uint8_t TCA8418Keyboard::digitalRead(uint8_t pinnum) const +{ + if (pinnum > _TCA8418_COL9) + return 0xFF; + + uint8_t reg = _TCA8418_REG_GPIO_DAT_STAT_1 + pinnum / 8; + uint8_t mask = (1 << (pinnum % 8)); + + // Level 0 = low other = high + uint8_t value = readRegister(reg); + if (value & mask) + return HIGH; + return LOW; +} + +bool TCA8418Keyboard::digitalWrite(uint8_t pinnum, uint8_t level) +{ + if (pinnum > _TCA8418_COL9) + return false; + + uint8_t reg = _TCA8418_REG_GPIO_DAT_OUT_1 + pinnum / 8; + uint8_t mask = (1 << (pinnum % 8)); + + // Level 0 = low other = high + uint8_t value = readRegister(reg); + if (level == LOW) + value &= ~mask; + else + value |= mask; + writeRegister(reg, value); + return true; +} + +bool TCA8418Keyboard::pinMode(uint8_t pinnum, uint8_t mode) +{ + if (pinnum > _TCA8418_COL9) + return false; + + uint8_t idx = pinnum / 8; + uint8_t reg = _TCA8418_REG_GPIO_DIR_1 + idx; + uint8_t mask = (1 << (pinnum % 8)); + + // Mode 0 = input 1 = output + uint8_t value = readRegister(reg); + if (mode == OUTPUT) + value |= mask; + else + value &= ~mask; + writeRegister(reg, value); + + // Pullup 0 = enabled 1 = disabled + reg = _TCA8418_REG_GPIO_PULL_1 + idx; + value = readRegister(reg); + if (mode == INPUT_PULLUP) + value &= ~mask; + else + value |= mask; + writeRegister(reg, value); + + return true; +} + +bool TCA8418Keyboard::pinIRQMode(uint8_t pinnum, uint8_t mode) +{ + if (pinnum > _TCA8418_COL9) + return false; + if ((mode != RISING) && (mode != FALLING)) + return false; + + // Mode 0 = falling 1 = rising + uint8_t idx = pinnum / 8; + uint8_t reg = _TCA8418_REG_GPIO_INT_LVL_1 + idx; + uint8_t mask = (1 << (pinnum % 8)); + + uint8_t value = readRegister(reg); + if (mode == RISING) + value |= mask; + else + value &= ~mask; + writeRegister(reg, value); + + // Enable interrupt + reg = _TCA8418_REG_GPIO_INT_EN_1 + idx; + value = readRegister(reg); + value |= mask; + writeRegister(reg, value); + + return true; +} + +void TCA8418Keyboard::enableInterrupts() +{ + uint8_t value = readRegister(_TCA8418_REG_CFG); + value |= (_TCA8418_REG_CFG_GPI_IEN | _TCA8418_REG_CFG_KE_IEN); + writeRegister(_TCA8418_REG_CFG, value); +}; + +void TCA8418Keyboard::disableInterrupts() +{ + uint8_t value = readRegister(_TCA8418_REG_CFG); + value &= ~(_TCA8418_REG_CFG_GPI_IEN | _TCA8418_REG_CFG_KE_IEN); + writeRegister(_TCA8418_REG_CFG, value); +}; + +void TCA8418Keyboard::enableMatrixOverflow() +{ + uint8_t value = readRegister(_TCA8418_REG_CFG); + value |= _TCA8418_REG_CFG_OVR_FLOW_M; + writeRegister(_TCA8418_REG_CFG, value); +}; + +void TCA8418Keyboard::disableMatrixOverflow() +{ + uint8_t value = readRegister(_TCA8418_REG_CFG); + value &= ~_TCA8418_REG_CFG_OVR_FLOW_M; + writeRegister(_TCA8418_REG_CFG, value); +}; + +void TCA8418Keyboard::enableDebounce() +{ + writeRegister(_TCA8418_REG_DEBOUNCE_DIS_1, 0x00); + writeRegister(_TCA8418_REG_DEBOUNCE_DIS_2, 0x00); + writeRegister(_TCA8418_REG_DEBOUNCE_DIS_3, 0x00); +} + +void TCA8418Keyboard::disableDebounce() +{ + writeRegister(_TCA8418_REG_DEBOUNCE_DIS_1, 0xFF); + writeRegister(_TCA8418_REG_DEBOUNCE_DIS_2, 0xFF); + writeRegister(_TCA8418_REG_DEBOUNCE_DIS_3, 0xFF); +} + +void TCA8418Keyboard::setBacklight(bool on) +{ + if (on) { + digitalWrite(_TCA8418_COL9, HIGH); + } else { + digitalWrite(_TCA8418_COL9, LOW); + } +} + +uint8_t TCA8418Keyboard::readRegister(uint8_t reg) const +{ + if (m_wire) { + m_wire->beginTransmission(m_addr); + m_wire->write(reg); + m_wire->endTransmission(); + + m_wire->requestFrom(m_addr, (uint8_t)1); + if (m_wire->available() < 1) + return 0; + + return m_wire->read(); + } + if (readCallback) { + uint8_t data; + readCallback(m_addr, reg, &data, 1); + return data; + } + return 0; +} + +void TCA8418Keyboard::writeRegister(uint8_t reg, uint8_t value) +{ + uint8_t data[2]; + data[0] = reg; + data[1] = value; + + if (m_wire) { + m_wire->beginTransmission(m_addr); + m_wire->write(data, sizeof(uint8_t) * 2); + m_wire->endTransmission(); + } + if (writeCallback) { + writeCallback(m_addr, data[0], &(data[1]), 1); + } +} \ No newline at end of file diff --git a/src/input/TCA8418Keyboard.h b/src/input/TCA8418Keyboard.h new file mode 100644 index 000000000..c7f3c1f28 --- /dev/null +++ b/src/input/TCA8418Keyboard.h @@ -0,0 +1,83 @@ +// Based on the MPR121 Keyboard and Adafruit TCA8418 library +#include "configuration.h" +#include + +#define _TCA8418_NONE 0x00 +#define _TCA8418_REBOOT 0x90 +#define _TCA8418_LEFT 0xb4 +#define _TCA8418_UP 0xb5 +#define _TCA8418_DOWN 0xb6 +#define _TCA8418_RIGHT 0xb7 +#define _TCA8418_ESC 0x1b +#define _TCA8418_BSP 0x08 +#define _TCA8418_SELECT 0x0d + +class TCA8418Keyboard +{ + public: + typedef uint8_t (*i2c_com_fptr_t)(uint8_t dev_addr, uint8_t reg_addr, uint8_t *data, uint8_t len); + + enum KeyState { Init = 0, Idle, Held, Busy }; + + KeyState state; + int8_t last_key; + int8_t next_key; + bool should_backspace; + uint32_t last_tap; + uint8_t char_idx; + int32_t tap_interval; + bool backlight_on; + + String queue; + + TCA8418Keyboard(); + + void begin(uint8_t addr = XPOWERS_AXP192_AXP2101_ADDRESS, TwoWire *wire = &Wire); + void begin(i2c_com_fptr_t r, i2c_com_fptr_t w, uint8_t addr = XPOWERS_AXP192_AXP2101_ADDRESS); + + void reset(void); + // Configure the size of the keypad. + // All other rows and columns are set as inputs. + bool matrix(uint8_t rows, uint8_t columns); + + // Flush all events in the FIFO buffer + GPIO events. + uint8_t flush(void); + + // Key events available in the internal FIFO buffer. + uint8_t keyCount(void) const; + + void trigger(void); + void pressed(uint8_t key); + void released(void); + bool hasEvent(void); + char dequeueEvent(void); + void queueEvent(char); + + uint8_t digitalRead(uint8_t pinnum) const; + bool digitalWrite(uint8_t pinnum, uint8_t level); + bool pinMode(uint8_t pinnum, uint8_t mode); + bool pinIRQMode(uint8_t pinnum, uint8_t mode); // MODE FALLING or RISING + + // enable / disable interrupts for matrix and GPI pins + void enableInterrupts(); + void disableInterrupts(); + + // ignore key events when FIFO buffer is full or not. + void enableMatrixOverflow(); + void disableMatrixOverflow(); + + // debounce keys. + void enableDebounce(); + void disableDebounce(); + + void setBacklight(bool on); + + uint8_t readRegister(uint8_t reg) const; + void writeRegister(uint8_t reg, uint8_t value); + + private: + TwoWire *m_wire; + uint8_t m_addr; + i2c_com_fptr_t readCallback; + i2c_com_fptr_t writeCallback; +}; diff --git a/src/input/cardKbI2cImpl.cpp b/src/input/cardKbI2cImpl.cpp index eb9b07d6e..0d661811b 100644 --- a/src/input/cardKbI2cImpl.cpp +++ b/src/input/cardKbI2cImpl.cpp @@ -12,8 +12,8 @@ void CardKbI2cImpl::init() #if !MESHTASTIC_EXCLUDE_I2C && !defined(ARCH_PORTDUINO) && !defined(I2C_NO_RESCAN) if (cardkb_found.address == 0x00) { LOG_DEBUG("Rescan for I2C keyboard"); - uint8_t i2caddr_scan[] = {CARDKB_ADDR, TDECK_KB_ADDR, BBQ10_KB_ADDR, MPR121_KB_ADDR}; - uint8_t i2caddr_asize = 4; + uint8_t i2caddr_scan[] = {CARDKB_ADDR, TDECK_KB_ADDR, BBQ10_KB_ADDR, MPR121_KB_ADDR, XPOWERS_AXP192_AXP2101_ADDRESS}; + uint8_t i2caddr_asize = 5; auto i2cScanner = std::unique_ptr(new ScanI2CTwoWire()); #if WIRE_INTERFACES_COUNT == 2 @@ -43,6 +43,10 @@ void CardKbI2cImpl::init() // assign an arbitrary value to distinguish from other models kb_model = 0x37; break; + case ScanI2C::DeviceType::TCA8418KB: + // assign an arbitrary value to distinguish from other models + kb_model = 0x84; + break; default: // use this as default since it's also just zero LOG_WARN("kb_info.type is unknown(0x%02x), setting kb_model=0x00", kb_info.type); @@ -63,4 +67,4 @@ void CardKbI2cImpl::init() } #endif inputBroker->registerSource(this); -} \ No newline at end of file +} diff --git a/src/input/kbI2cBase.cpp b/src/input/kbI2cBase.cpp index 9b1a27745..daccc6622 100644 --- a/src/input/kbI2cBase.cpp +++ b/src/input/kbI2cBase.cpp @@ -43,6 +43,9 @@ int32_t KbI2cBase::runOnce() if (cardkb_found.address == MPR121_KB_ADDR) { MPRkeyboard.begin(MPR121_KB_ADDR, &Wire1); } + if (cardkb_found.address == XPOWERS_AXP192_AXP2101_ADDRESS) { + TCAKeyboard.begin(XPOWERS_AXP192_AXP2101_ADDRESS, &Wire1); + } break; #endif case ScanI2C::WIRE: @@ -55,6 +58,9 @@ int32_t KbI2cBase::runOnce() if (cardkb_found.address == MPR121_KB_ADDR) { MPRkeyboard.begin(MPR121_KB_ADDR, &Wire); } + if (cardkb_found.address == XPOWERS_AXP192_AXP2101_ADDRESS) { + TCAKeyboard.begin(XPOWERS_AXP192_AXP2101_ADDRESS, &Wire); + } break; case ScanI2C::NO_I2C: default: @@ -163,6 +169,70 @@ int32_t KbI2cBase::runOnce() } break; } + + case 0x84: { // Adafruit TCA8418 + TCAKeyboard.trigger(); + InputEvent e; + while (TCAKeyboard.hasEvent()) { + char nextEvent = TCAKeyboard.dequeueEvent(); + e.inputEvent = ANYKEY; + e.kbchar = 0x00; + e.source = this->_originName; + switch (nextEvent) { + case _TCA8418_NONE: + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE; + e.kbchar = 0x00; + break; + case _TCA8418_REBOOT: + e.inputEvent = ANYKEY; + e.kbchar = INPUT_BROKER_MSG_REBOOT; + break; + case _TCA8418_LEFT: + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT; + e.kbchar = 0x00; + break; + case _TCA8418_UP: + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP; + e.kbchar = 0x00; + break; + case _TCA8418_DOWN: + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_DOWN; + e.kbchar = 0x00; + break; + case _TCA8418_RIGHT: + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT; + e.kbchar = 0x00; + break; + case _TCA8418_BSP: + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_BACK; + e.kbchar = 0x08; + break; + case _TCA8418_SELECT: + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT; + e.kbchar = 0x0d; + break; + case _TCA8418_ESC: + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL; + e.kbchar = 0x1b; + break; + default: + if (nextEvent > 127) { + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE; + e.kbchar = 0x00; + break; + } + e.inputEvent = ANYKEY; + e.kbchar = nextEvent; + break; + } + if (e.inputEvent != meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE) { + LOG_DEBUG("TCA8418 Notifying: %i Char: %c", e.inputEvent, e.kbchar); + this->notifyObservers(&e); + } + } + break; + } + case 0x37: { // MPR121 MPRkeyboard.trigger(); InputEvent e; diff --git a/src/input/kbI2cBase.h b/src/input/kbI2cBase.h index dc2414fc0..d5831aafa 100644 --- a/src/input/kbI2cBase.h +++ b/src/input/kbI2cBase.h @@ -3,6 +3,7 @@ #include "BBQ10Keyboard.h" #include "InputBroker.h" #include "MPR121Keyboard.h" +#include "TCA8418Keyboard.h" #include "Wire.h" #include "concurrency/OSThread.h" @@ -21,5 +22,6 @@ class KbI2cBase : public Observable, public concurrency::OST BBQ10Keyboard Q10keyboard; MPR121Keyboard MPRkeyboard; + TCA8418Keyboard TCAKeyboard; bool is_sym = false; -}; \ No newline at end of file +}; diff --git a/src/main.cpp b/src/main.cpp index e9e0c9d4b..104982783 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -568,6 +568,10 @@ void setup() // assign an arbitrary value to distinguish from other models kb_model = 0x37; break; + case ScanI2C::DeviceType::TCA8418KB: + // assign an arbitrary value to distinguish from other models + kb_model = 0x84; + break; default: // use this as default since it's also just zero LOG_WARN("kb_info.type is unknown(0x%02x), setting kb_model=0x00", kb_info.type); From 6429eca5e47aa1d438012a9886632a5cdbbec898 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Wed, 26 Mar 2025 08:10:56 +0100 Subject: [PATCH 318/381] udp-multicast: do not listen for incoming udp multicast packets if disabled (#6397) Currently the config flag only control if packets are sent, not received. As we discussed in VC this is not what was intended. --- src/main.cpp | 4 +++- src/mesh/wifi/WiFiAPClient.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 104982783..f65c3fcd1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -829,7 +829,9 @@ void setup() #ifdef ARCH_PORTDUINO // FIXME: portduino does not ever call onNetworkConnected so call it here because I don't know what happen if I call // onNetworkConnected there - udpThread->start(); + if (config.network.enabled_protocols & meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST) { + udpThread->start(); + } #endif #endif service = new MeshService(); diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index 92388d52a..4d0b74f7c 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -133,7 +133,7 @@ static void onNetworkConnected() } #if HAS_UDP_MULTICAST - if (udpThread) { + if (udpThread && config.network.enabled_protocols & meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST) { udpThread->start(); } #endif From 83d8e3cb098cc536d5fb221bcdb1780b48fb277e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 26 Mar 2025 06:07:22 -0500 Subject: [PATCH 319/381] Upgrade trunk (#6398) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index b44f46a51..71d37bc2e 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -10,13 +10,13 @@ lint: enabled: - prettier@3.5.3 - trufflehog@3.88.18 - - yamllint@1.36.2 + - yamllint@1.37.0 - bandit@1.8.3 - - checkov@3.2.390 + - checkov@3.2.392 - terrascan@1.19.9 - trivy@0.60.0 - taplo@0.9.3 - - ruff@0.11.1 + - ruff@0.11.2 - isort@6.0.1 - markdownlint@0.44.0 - oxipng@9.1.4 @@ -28,7 +28,7 @@ lint: - shellcheck@0.10.0 - black@25.1.0 - git-diff-check - - gitleaks@8.24.0 + - gitleaks@8.24.2 - clang-format@16.0.3 ignore: - linters: [ALL] From ba81a8ad878ca6e01e0e52df361d9e1c5e6e78b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Wed, 26 Mar 2025 15:02:53 +0100 Subject: [PATCH 320/381] Fix default pin assignment --- src/configuration.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/configuration.h b/src/configuration.h index d9da09108..56c3ac2a8 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -110,11 +110,6 @@ along with this program. If not, see . // Define if screen should be mirrored left to right // #define SCREEN_MIRROR -// Define BUTTON_PIN to ensure button setup is always done -#ifndef BUTTON_PIN -#define BUTTON_PIN (-1) -#endif - // I2C Keyboards (M5Stack, RAK14004, T-Deck) #define CARDKB_ADDR 0x5F #define TDECK_KB_ADDR 0x55 @@ -203,6 +198,11 @@ along with this program. If not, see . /* Step #1: offer chance for variant-specific defines */ #include "variant.h" +// Define BUTTON_PIN to ensure button setup is always done +#ifndef BUTTON_PIN +#define BUTTON_PIN (-1) +#endif + #if defined(VEXT_ENABLE) && !defined(VEXT_ON_VALUE) // Older variant.h files might not be defining this value, so stay with the old default #define VEXT_ON_VALUE LOW From 640e731ad2a903c0e3a1651e6483da68f694346e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Wed, 26 Mar 2025 15:18:21 +0100 Subject: [PATCH 321/381] Remove button fix for further investigation --- src/configuration.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/configuration.h b/src/configuration.h index 56c3ac2a8..d5aacdbd2 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -198,11 +198,6 @@ along with this program. If not, see . /* Step #1: offer chance for variant-specific defines */ #include "variant.h" -// Define BUTTON_PIN to ensure button setup is always done -#ifndef BUTTON_PIN -#define BUTTON_PIN (-1) -#endif - #if defined(VEXT_ENABLE) && !defined(VEXT_ON_VALUE) // Older variant.h files might not be defining this value, so stay with the old default #define VEXT_ON_VALUE LOW @@ -375,4 +370,4 @@ along with this program. If not, see . #endif #include "DebugConfiguration.h" -#include "RF95Configuration.h" \ No newline at end of file +#include "RF95Configuration.h" From 6c17694b64a391b06bded312f063d0e480380a81 Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Thu, 27 Mar 2025 11:06:41 +0200 Subject: [PATCH 322/381] CrowPanel e-Ink Updates for 4.2 and 2.9 inch (#6401) * Update platformio.ini * Update EInkDisplay2.cpp * Update EInkDisplay2.h --- src/graphics/EInkDisplay2.cpp | 5 +++-- src/graphics/EInkDisplay2.h | 3 ++- variants/crowpanel-esp32s3-5-epaper/platformio.ini | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index a640e3560..1bf1bc300 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -166,7 +166,8 @@ bool EInkDisplay::connect() } #elif defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_VISION_MASTER_E213) || \ - defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) || defined(CROWPANEL_ESP32S3_5_EPAPER) + defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) || defined(CROWPANEL_ESP32S3_5_EPAPER) || \ + defined(CROWPANEL_ESP32S3_4_EPAPER) || defined(CROWPANEL_ESP32S3_2_EPAPER) { // Start HSPI hspi = new SPIClass(HSPI); @@ -182,7 +183,7 @@ bool EInkDisplay::connect() // Init GxEPD2 adafruitDisplay->init(); adafruitDisplay->setRotation(3); -#if defined(CROWPANEL_ESP32S3_5_EPAPER) +#if defined(CROWPANEL_ESP32S3_5_EPAPER) || defined(CROWPANEL_ESP32S3_4_EPAPER) adafruitDisplay->setRotation(0); #endif } diff --git a/src/graphics/EInkDisplay2.h b/src/graphics/EInkDisplay2.h index efbf45f0f..9c1c8d18e 100644 --- a/src/graphics/EInkDisplay2.h +++ b/src/graphics/EInkDisplay2.h @@ -68,7 +68,8 @@ class EInkDisplay : public OLEDDisplay // If display uses HSPI #if defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_WIRELESS_PAPER_V1_0) || defined(HELTEC_VISION_MASTER_E213) || \ - defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) || defined(CROWPANEL_ESP32S3_5_EPAPER) + defined(HELTEC_VISION_MASTER_E290) || defined(TLORA_T3S3_EPAPER) || defined(CROWPANEL_ESP32S3_5_EPAPER) || \ + defined(CROWPANEL_ESP32S3_4_EPAPER) || defined(CROWPANEL_ESP32S3_2_EPAPER) SPIClass *hspi = NULL; #endif diff --git a/variants/crowpanel-esp32s3-5-epaper/platformio.ini b/variants/crowpanel-esp32s3-5-epaper/platformio.ini index 36816d616..c9786690b 100644 --- a/variants/crowpanel-esp32s3-5-epaper/platformio.ini +++ b/variants/crowpanel-esp32s3-5-epaper/platformio.ini @@ -39,7 +39,7 @@ board = esp32-s3-devkitc-1 board_level = extra upload_protocol = esptool build_flags = - ${esp32_base.build_flags} -D CROWPANEL_ESP32S3_5_EPAPER -I variants/crowpanel-esp32s3-5-epaper + ${esp32_base.build_flags} -D CROWPANEL_ESP32S3_4_EPAPER -I variants/crowpanel-esp32s3-5-epaper -D PRIVATE_HW -DBOARD_HAS_PSRAM -DGPS_POWER_TOGGLE @@ -67,7 +67,7 @@ board = esp32-s3-devkitc-1 board_level = extra upload_protocol = esptool build_flags = - ${esp32_base.build_flags} -D CROWPANEL_ESP32S3_5_EPAPER -I variants/crowpanel-esp32s3-5-epaper + ${esp32_base.build_flags} -D CROWPANEL_ESP32S3_2_EPAPER -I variants/crowpanel-esp32s3-5-epaper -D PRIVATE_HW -DBOARD_HAS_PSRAM -DGPS_POWER_TOGGLE From 52527b24a72bb4552ce0000e1919cc71a30ae1db Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Thu, 27 Mar 2025 12:02:27 +0200 Subject: [PATCH 323/381] Update lora-Adafruit-RFM9x (#6402) * Update lora-Adafruit-RFM9x * Update variant.h * Update variant.h --- bin/config.d/lora-Adafruit-RFM9x | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/config.d/lora-Adafruit-RFM9x b/bin/config.d/lora-Adafruit-RFM9x index 2d64f1f91..20295dc72 100644 --- a/bin/config.d/lora-Adafruit-RFM9x +++ b/bin/config.d/lora-Adafruit-RFM9x @@ -1,5 +1,6 @@ -# Module: RF95 # Adafruit RFM9x -# Reset: 25 -# CS: 7 -# IRQ: 22 -# Busy: 23 \ No newline at end of file +Lora: + Module: RF95 # Adafruit RFM9x + Reset: 25 + CS: 7 + IRQ: 22 +# Busy: 23 From 769f0623be6a7d7503c56bc1b6e468114dacdff0 Mon Sep 17 00:00:00 2001 From: Austin Date: Thu, 27 Mar 2025 08:46:16 -0400 Subject: [PATCH 324/381] Fix: T-Watch-S3 has 8MB Flash (#6407) --- bin/device-install.bat | 4 ++-- bin/device-install.sh | 2 +- variants/t-watch-s3/platformio.ini | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/device-install.bat b/bin/device-install.bat index 3ffca0b63..594d973f5 100755 --- a/bin/device-install.bat +++ b/bin/device-install.bat @@ -17,8 +17,8 @@ SET "LOGCOUNTER=0" SET "S3=s3 v3 t-deck wireless-paper wireless-tracker station-g2 unphone" SET "C3=esp32c3" @REM FIXME: Determine flash size from PlatformIO variant, this is unmaintainable. -SET "BIGDB_8MB=picomputer-s3 unphone seeed-sensecap-indicator crowpanel-esp32s3 heltec_capsule_sensor_v3 heltec-v3 heltec-vision-master-e213 heltec-vision-master-e290 heltec-vision-master-t190 heltec-wireless-paper heltec-wireless-tracker heltec-wsl-v3 icarus seeed-xiao-s3 tbeam-s3-core tracksenger" -SET "BIGDB_16MB=t-deck mesh-tab t-energy-s3 dreamcatcher ESP32-S3-Pico m5stack-cores3 station-g2 t-eth-elite t-watch-s3" +SET "BIGDB_8MB=picomputer-s3 unphone seeed-sensecap-indicator crowpanel-esp32s3 heltec_capsule_sensor_v3 heltec-v3 heltec-vision-master-e213 heltec-vision-master-e290 heltec-vision-master-t190 heltec-wireless-paper heltec-wireless-tracker heltec-wsl-v3 icarus seeed-xiao-s3 tbeam-s3-core t-watch-s3 tracksenger" +SET "BIGDB_16MB=t-deck mesh-tab t-energy-s3 dreamcatcher ESP32-S3-Pico m5stack-cores3 station-g2 t-eth-elite" GOTO getopts :help diff --git a/bin/device-install.sh b/bin/device-install.sh index b5322b9d1..bacf48f69 100755 --- a/bin/device-install.sh +++ b/bin/device-install.sh @@ -22,6 +22,7 @@ BIGDB_8MB=( "icarus" "seeed-xiao-s3" "tbeam-s3-core" + "t-watch-s3" "tracksenger" ) BIGDB_16MB=( @@ -33,7 +34,6 @@ BIGDB_16MB=( "m5stack-cores3" "station-g2" "t-eth-elite" - "t-watch-s3" ) S3_VARIANTS=( "s3" diff --git a/variants/t-watch-s3/platformio.ini b/variants/t-watch-s3/platformio.ini index f98237943..d650b1f11 100644 --- a/variants/t-watch-s3/platformio.ini +++ b/variants/t-watch-s3/platformio.ini @@ -3,7 +3,7 @@ extends = esp32s3_base board = t-watch-s3 board_check = true -board_build.partitions = default_16MB.csv +board_build.partitions = default_8MB.csv upload_protocol = esptool build_flags = ${esp32_base.build_flags} From 4590ef2e7b16cb7e745691d1b358f7f92fbfe570 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 27 Mar 2025 08:31:57 -0500 Subject: [PATCH 325/381] Revert "TCA8418 initial config + basic 3x4 keypad config (#6320)" (#6410) This reverts commit 13101c1bab2066998779856812bea47e7d0b148a. --- src/configuration.h | 1 - src/detect/ScanI2C.cpp | 6 +- src/detect/ScanI2C.h | 5 +- src/detect/ScanI2CTwoWire.cpp | 23 +- src/input/TCA8418Keyboard.cpp | 561 ---------------------------------- src/input/TCA8418Keyboard.h | 83 ----- src/input/cardKbI2cImpl.cpp | 10 +- src/input/kbI2cBase.cpp | 70 ----- src/input/kbI2cBase.h | 4 +- src/main.cpp | 4 - 10 files changed, 18 insertions(+), 749 deletions(-) delete mode 100644 src/input/TCA8418Keyboard.cpp delete mode 100644 src/input/TCA8418Keyboard.h diff --git a/src/configuration.h b/src/configuration.h index d5aacdbd2..fd4a5b196 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -152,7 +152,6 @@ along with this program. If not, see . #define MLX90614_ADDR_DEF 0x5A #define CGRADSENS_ADDR 0x66 #define LTR390UV_ADDR 0x53 -#define XPOWERS_AXP192_AXP2101_ADDRESS 0x34 // same adress as TCA8418 // ----------------------------------------------------------------------------- // ACCELEROMETER diff --git a/src/detect/ScanI2C.cpp b/src/detect/ScanI2C.cpp index 58e87b1c5..4caa0f730 100644 --- a/src/detect/ScanI2C.cpp +++ b/src/detect/ScanI2C.cpp @@ -31,8 +31,8 @@ ScanI2C::FoundDevice ScanI2C::firstRTC() const ScanI2C::FoundDevice ScanI2C::firstKeyboard() const { - ScanI2C::DeviceType types[] = {CARDKB, TDECKKB, BBQ10KB, RAK14004, MPR121KB, TCA8418KB}; - return firstOfOrNONE(6, types); + ScanI2C::DeviceType types[] = {CARDKB, TDECKKB, BBQ10KB, RAK14004, MPR121KB}; + return firstOfOrNONE(5, types); } ScanI2C::FoundDevice ScanI2C::firstAccelerometer() const @@ -74,4 +74,4 @@ bool ScanI2C::DeviceAddress::operator<(const ScanI2C::DeviceAddress &other) cons || (port != NO_I2C && other.port != NO_I2C && (address < other.address)); } -ScanI2C::FoundDevice::FoundDevice(ScanI2C::DeviceType type, ScanI2C::DeviceAddress address) : type(type), address(address) {} +ScanI2C::FoundDevice::FoundDevice(ScanI2C::DeviceType type, ScanI2C::DeviceAddress address) : type(type), address(address) {} \ No newline at end of file diff --git a/src/detect/ScanI2C.h b/src/detect/ScanI2C.h index cb61304a9..5b6bbe629 100644 --- a/src/detect/ScanI2C.h +++ b/src/detect/ScanI2C.h @@ -18,7 +18,7 @@ class ScanI2C TDECKKB, BBQ10KB, RAK14004, - PMU_AXP192_AXP2101, // has the same address as the TCA8418KB + PMU_AXP192_AXP2101, BME_680, BME_280, BMP_280, @@ -69,7 +69,6 @@ class ScanI2C DFROBOT_RAIN, DPS310, LTR390UV, - TCA8418KB, } DeviceType; // typedef uint8_t DeviceAddress; @@ -133,4 +132,4 @@ class ScanI2C private: bool shouldSuppressScreen = false; -}; \ No newline at end of file +}; diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index e8506f07c..8b779277d 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -10,6 +10,11 @@ #include "meshUtils.h" // vformat #endif +// AXP192 and AXP2101 have the same device address, we just need to identify it in Power.cpp +#ifndef XPOWERS_AXP192_AXP2101_ADDRESS +#define XPOWERS_AXP192_AXP2101_ADDRESS 0x34 +#endif + bool in_array(uint8_t *array, int size, uint8_t lookfor) { int i; @@ -206,18 +211,6 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) } break; - case XPOWERS_AXP192_AXP2101_ADDRESS: - // Do we have the TCA8418 instead? - registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x02), 1); - if ((registerValue & 0b11100000) == 0) { - logFoundDevice("TCA8418", (uint8_t)addr.address); - type = TCA8418KB; - } else { - logFoundDevice("AXP192/AXP2101", (uint8_t)addr.address); - type = PMU_AXP192_AXP2101; - } - break; - SCAN_SIMPLE_CASE(TDECK_KB_ADDR, TDECKKB, "T-Deck keyboard", (uint8_t)addr.address); SCAN_SIMPLE_CASE(BBQ10_KB_ADDR, BBQ10KB, "BB Q10", (uint8_t)addr.address); @@ -225,7 +218,9 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) #ifdef HAS_NCP5623 SCAN_SIMPLE_CASE(NCP5623_ADDR, NCP5623, "NCP5623", (uint8_t)addr.address); #endif - +#ifdef HAS_PMU + SCAN_SIMPLE_CASE(XPOWERS_AXP192_AXP2101_ADDRESS, PMU_AXP192_AXP2101, "AXP192/AXP2101", (uint8_t)addr.address) +#endif case BME_ADDR: case BME_ADDR_ALTERNATE: registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xD0), 1); // GET_ID @@ -541,4 +536,4 @@ void ScanI2CTwoWire::logFoundDevice(const char *device, uint8_t address) { LOG_INFO("%s found at address 0x%x", device, address); } -#endif +#endif \ No newline at end of file diff --git a/src/input/TCA8418Keyboard.cpp b/src/input/TCA8418Keyboard.cpp deleted file mode 100644 index 21cd7b2d5..000000000 --- a/src/input/TCA8418Keyboard.cpp +++ /dev/null @@ -1,561 +0,0 @@ -// Based on the MPR121 Keyboard and Adafruit TCA8418 library - -#include "TCA8418Keyboard.h" -#include "configuration.h" - -#include - -// REGISTERS -// #define _TCA8418_REG_RESERVED 0x00 -#define _TCA8418_REG_CFG 0x01 // Configuration register -#define _TCA8418_REG_INT_STAT 0x02 // Interrupt status -#define _TCA8418_REG_KEY_LCK_EC 0x03 // Key lock and event counter -#define _TCA8418_REG_KEY_EVENT_A 0x04 // Key event register A -#define _TCA8418_REG_KEY_EVENT_B 0x05 // Key event register B -#define _TCA8418_REG_KEY_EVENT_C 0x06 // Key event register C -#define _TCA8418_REG_KEY_EVENT_D 0x07 // Key event register D -#define _TCA8418_REG_KEY_EVENT_E 0x08 // Key event register E -#define _TCA8418_REG_KEY_EVENT_F 0x09 // Key event register F -#define _TCA8418_REG_KEY_EVENT_G 0x0A // Key event register G -#define _TCA8418_REG_KEY_EVENT_H 0x0B // Key event register H -#define _TCA8418_REG_KEY_EVENT_I 0x0C // Key event register I -#define _TCA8418_REG_KEY_EVENT_J 0x0D // Key event register J -#define _TCA8418_REG_KP_LCK_TIMER 0x0E // Keypad lock1 to lock2 timer -#define _TCA8418_REG_UNLOCK_1 0x0F // Unlock register 1 -#define _TCA8418_REG_UNLOCK_2 0x10 // Unlock register 2 -#define _TCA8418_REG_GPIO_INT_STAT_1 0x11 // GPIO interrupt status 1 -#define _TCA8418_REG_GPIO_INT_STAT_2 0x12 // GPIO interrupt status 2 -#define _TCA8418_REG_GPIO_INT_STAT_3 0x13 // GPIO interrupt status 3 -#define _TCA8418_REG_GPIO_DAT_STAT_1 0x14 // GPIO data status 1 -#define _TCA8418_REG_GPIO_DAT_STAT_2 0x15 // GPIO data status 2 -#define _TCA8418_REG_GPIO_DAT_STAT_3 0x16 // GPIO data status 3 -#define _TCA8418_REG_GPIO_DAT_OUT_1 0x17 // GPIO data out 1 -#define _TCA8418_REG_GPIO_DAT_OUT_2 0x18 // GPIO data out 2 -#define _TCA8418_REG_GPIO_DAT_OUT_3 0x19 // GPIO data out 3 -#define _TCA8418_REG_GPIO_INT_EN_1 0x1A // GPIO interrupt enable 1 -#define _TCA8418_REG_GPIO_INT_EN_2 0x1B // GPIO interrupt enable 2 -#define _TCA8418_REG_GPIO_INT_EN_3 0x1C // GPIO interrupt enable 3 -#define _TCA8418_REG_KP_GPIO_1 0x1D // Keypad/GPIO select 1 -#define _TCA8418_REG_KP_GPIO_2 0x1E // Keypad/GPIO select 2 -#define _TCA8418_REG_KP_GPIO_3 0x1F // Keypad/GPIO select 3 -#define _TCA8418_REG_GPI_EM_1 0x20 // GPI event mode 1 -#define _TCA8418_REG_GPI_EM_2 0x21 // GPI event mode 2 -#define _TCA8418_REG_GPI_EM_3 0x22 // GPI event mode 3 -#define _TCA8418_REG_GPIO_DIR_1 0x23 // GPIO data direction 1 -#define _TCA8418_REG_GPIO_DIR_2 0x24 // GPIO data direction 2 -#define _TCA8418_REG_GPIO_DIR_3 0x25 // GPIO data direction 3 -#define _TCA8418_REG_GPIO_INT_LVL_1 0x26 // GPIO edge/level detect 1 -#define _TCA8418_REG_GPIO_INT_LVL_2 0x27 // GPIO edge/level detect 2 -#define _TCA8418_REG_GPIO_INT_LVL_3 0x28 // GPIO edge/level detect 3 -#define _TCA8418_REG_DEBOUNCE_DIS_1 0x29 // Debounce disable 1 -#define _TCA8418_REG_DEBOUNCE_DIS_2 0x2A // Debounce disable 2 -#define _TCA8418_REG_DEBOUNCE_DIS_3 0x2B // Debounce disable 3 -#define _TCA8418_REG_GPIO_PULL_1 0x2C // GPIO pull-up disable 1 -#define _TCA8418_REG_GPIO_PULL_2 0x2D // GPIO pull-up disable 2 -#define _TCA8418_REG_GPIO_PULL_3 0x2E // GPIO pull-up disable 3 -// #define _TCA8418_REG_RESERVED 0x2F - -// FIELDS CONFIG REGISTER 1 -#define _TCA8418_REG_CFG_AI 0x80 // Auto-increment for read/write -#define _TCA8418_REG_CFG_GPI_E_CGF 0x40 // Event mode config -#define _TCA8418_REG_CFG_OVR_FLOW_M 0x20 // Overflow mode enable -#define _TCA8418_REG_CFG_INT_CFG 0x10 // Interrupt config -#define _TCA8418_REG_CFG_OVR_FLOW_IEN 0x08 // Overflow interrupt enable -#define _TCA8418_REG_CFG_K_LCK_IEN 0x04 // Keypad lock interrupt enable -#define _TCA8418_REG_CFG_GPI_IEN 0x02 // GPI interrupt enable -#define _TCA8418_REG_CFG_KE_IEN 0x01 // Key events interrupt enable - -// FIELDS INT_STAT REGISTER 2 -#define _TCA8418_REG_STAT_CAD_INT 0x10 // Ctrl-alt-del seq status -#define _TCA8418_REG_STAT_OVR_FLOW_INT 0x08 // Overflow interrupt status -#define _TCA8418_REG_STAT_K_LCK_INT 0x04 // Key lock interrupt status -#define _TCA8418_REG_STAT_GPI_INT 0x02 // GPI interrupt status -#define _TCA8418_REG_STAT_K_INT 0x01 // Key events interrupt status - -// FIELDS KEY_LCK_EC REGISTER 3 -#define _TCA8418_REG_LCK_EC_K_LCK_EN 0x40 // Key lock enable -#define _TCA8418_REG_LCK_EC_LCK_2 0x20 // Keypad lock status 2 -#define _TCA8418_REG_LCK_EC_LCK_1 0x10 // Keypad lock status 1 -#define _TCA8418_REG_LCK_EC_KLEC_3 0x08 // Key event count bit 3 -#define _TCA8418_REG_LCK_EC_KLEC_2 0x04 // Key event count bit 2 -#define _TCA8418_REG_LCK_EC_KLEC_1 0x02 // Key event count bit 1 -#define _TCA8418_REG_LCK_EC_KLEC_0 0x01 // Key event count bit 0 - -// Pin IDs for matrix rows/columns -enum { - _TCA8418_ROW0, // Pin ID for row 0 - _TCA8418_ROW1, // Pin ID for row 1 - _TCA8418_ROW2, // Pin ID for row 2 - _TCA8418_ROW3, // Pin ID for row 3 - _TCA8418_ROW4, // Pin ID for row 4 - _TCA8418_ROW5, // Pin ID for row 5 - _TCA8418_ROW6, // Pin ID for row 6 - _TCA8418_ROW7, // Pin ID for row 7 - _TCA8418_COL0, // Pin ID for column 0 - _TCA8418_COL1, // Pin ID for column 1 - _TCA8418_COL2, // Pin ID for column 2 - _TCA8418_COL3, // Pin ID for column 3 - _TCA8418_COL4, // Pin ID for column 4 - _TCA8418_COL5, // Pin ID for column 5 - _TCA8418_COL6, // Pin ID for column 6 - _TCA8418_COL7, // Pin ID for column 7 - _TCA8418_COL8, // Pin ID for column 8 - _TCA8418_COL9 // Pin ID for column 9 -}; - -#define _TCA8418_COLS 3 -#define _TCA8418_ROWS 4 -#define _TCA8418_NUM_KEYS 12 - -uint8_t TCA8418TapMod[_TCA8418_NUM_KEYS] = {13, 7, 7, 7, 7, 7, - 9, 7, 9, 2, 2, 2}; // Num chars per key, Modulus for rotating through characters - -unsigned char TCA8418TapMap[_TCA8418_NUM_KEYS][13] = { - {'1', '.', ',', '?', '!', ':', ';', '-', '_', '\\', '/', '(', ')'}, // 1 - {'2', 'a', 'b', 'c', 'A', 'B', 'C'}, // 2 - {'3', 'd', 'e', 'f', 'D', 'E', 'F'}, // 3 - {'4', 'g', 'h', 'i', 'G', 'H', 'I'}, // 4 - {'5', 'j', 'k', 'l', 'J', 'K', 'L'}, // 5 - {'6', 'm', 'n', 'o', 'M', 'N', 'O'}, // 6 - {'7', 'p', 'q', 'r', 's', 'P', 'Q', 'R', 'S'}, // 7 - {'8', 't', 'u', 'v', 'T', 'U', 'V'}, // 8 - {'9', 'w', 'x', 'y', 'z', 'W', 'X', 'Y', 'Z'}, // 9 - {'*', '+'}, // * - {'0', ' '}, // 0 - {'#', '@'}, // # -}; - -unsigned char TCA8418LongPressMap[_TCA8418_NUM_KEYS] = { - _TCA8418_ESC, // 1 - _TCA8418_UP, // 2 - _TCA8418_NONE, // 3 - _TCA8418_LEFT, // 4 - _TCA8418_NONE, // 5 - _TCA8418_RIGHT, // 6 - _TCA8418_NONE, // 7 - _TCA8418_DOWN, // 8 - _TCA8418_NONE, // 9 - _TCA8418_BSP, // * - _TCA8418_NONE, // 0 - _TCA8418_NONE, // # -}; - -#define _TCA8418_LONG_PRESS_THRESHOLD 2000 -#define _TCA8418_MULTI_TAP_THRESHOLD 750 - -TCA8418Keyboard::TCA8418Keyboard() : m_wire(nullptr), m_addr(0), readCallback(nullptr), writeCallback(nullptr) -{ - state = Init; - last_key = -1; - next_key = -1; - should_backspace = false; - last_tap = 0L; - char_idx = 0; - tap_interval = 0; - backlight_on = true; - queue = ""; -} - -void TCA8418Keyboard::begin(uint8_t addr, TwoWire *wire) -{ - m_addr = addr; - m_wire = wire; - - m_wire->begin(); - - reset(); -} - -void TCA8418Keyboard::begin(i2c_com_fptr_t r, i2c_com_fptr_t w, uint8_t addr) -{ - m_addr = addr; - m_wire = nullptr; - writeCallback = w; - readCallback = r; - reset(); -} - -void TCA8418Keyboard::reset() -{ - LOG_DEBUG("TCA8418 Reset"); - // GPIO - // set default all GIO pins to INPUT - writeRegister(_TCA8418_REG_GPIO_DIR_1, 0x00); - writeRegister(_TCA8418_REG_GPIO_DIR_2, 0x00); - // Set COL9 as GPIO output - writeRegister(_TCA8418_REG_GPIO_DIR_3, 0x02); - // Switch off keyboard backlight (COL9 = LOW) - writeRegister(_TCA8418_REG_GPIO_DAT_OUT_3, 0x00); - - // add all pins to key events - writeRegister(_TCA8418_REG_GPI_EM_1, 0xFF); - writeRegister(_TCA8418_REG_GPI_EM_2, 0xFF); - writeRegister(_TCA8418_REG_GPI_EM_3, 0xFF); - - // set all pins to FALLING interrupts - writeRegister(_TCA8418_REG_GPIO_INT_LVL_1, 0x00); - writeRegister(_TCA8418_REG_GPIO_INT_LVL_2, 0x00); - writeRegister(_TCA8418_REG_GPIO_INT_LVL_3, 0x00); - - // add all pins to interrupts - writeRegister(_TCA8418_REG_GPIO_INT_EN_1, 0xFF); - writeRegister(_TCA8418_REG_GPIO_INT_EN_2, 0xFF); - writeRegister(_TCA8418_REG_GPIO_INT_EN_3, 0xFF); - - // Set keyboard matrix size - matrix(_TCA8418_ROWS, _TCA8418_COLS); - enableDebounce(); - flush(); - state = Idle; -} - -bool TCA8418Keyboard::matrix(uint8_t rows, uint8_t columns) -{ - if ((rows > 8) || (columns > 10)) - return false; - - // Skip zero size matrix - if ((rows != 0) && (columns != 0)) { - // Setup the keypad matrix. - uint8_t mask = 0x00; - for (int r = 0; r < rows; r++) { - mask <<= 1; - mask |= 1; - } - writeRegister(_TCA8418_REG_KP_GPIO_1, mask); - - mask = 0x00; - for (int c = 0; c < columns && c < 8; c++) { - mask <<= 1; - mask |= 1; - } - writeRegister(_TCA8418_REG_KP_GPIO_2, mask); - - if (columns > 8) { - if (columns == 9) - mask = 0x01; - else - mask = 0x03; - writeRegister(_TCA8418_REG_KP_GPIO_3, mask); - } - } - - return true; -} - -uint8_t TCA8418Keyboard::keyCount() const -{ - uint8_t eventCount = readRegister(_TCA8418_REG_KEY_LCK_EC); - eventCount &= 0x0F; // lower 4 bits only - return eventCount; -} - -bool TCA8418Keyboard::hasEvent() -{ - return queue.length() > 0; -} - -void TCA8418Keyboard::queueEvent(char next) -{ - if (next == _TCA8418_NONE) { - return; - } - queue.concat(next); -} - -char TCA8418Keyboard::dequeueEvent() -{ - if (queue.length() < 1) { - return _TCA8418_NONE; - } - char next = queue.charAt(0); - queue.remove(0, 1); - return next; -} - -void TCA8418Keyboard::trigger() -{ - if (keyCount() == 0) { - return; - } - if (state != Init) { - // Read the key register - uint8_t k = readRegister(_TCA8418_REG_KEY_EVENT_A); - uint8_t key = k & 0x7F; - if (k & 0x80) { - if (state == Idle) - pressed(key); - return; - } else { - if (state == Held) { - released(); - } - state = Idle; - return; - } - } else { - reset(); - } -} - -void TCA8418Keyboard::pressed(uint8_t key) -{ - if (state == Init || state == Busy) { - return; - } - uint8_t next_key = 0; - int row = (key - 1) / 10; - int col = (key - 1) % 10; - - if (row >= _TCA8418_ROWS || col >= _TCA8418_COLS) { - return; // Invalid key - } - - // Compute key index based on dynamic row/column - next_key = row * _TCA8418_COLS + col; - - // LOG_DEBUG("TCA8418: Key %u -> Next Key %u", key, next_key); - - state = Held; - uint32_t now = millis(); - tap_interval = now - last_tap; - if (tap_interval < 0) { - // Long running, millis has overflowed. - last_tap = 0; - state = Busy; - return; - } - - // Check if the key is the same as the last one or if the time interval has passed - if (next_key != last_key || tap_interval > _TCA8418_MULTI_TAP_THRESHOLD) { - char_idx = 0; // Reset char index if new key or long press - should_backspace = false; // dont backspace on new key - } else { - char_idx += 1; // Cycle through characters if same key pressed - should_backspace = true; // allow backspace on same key - } - - // Store the current key as the last key - last_key = next_key; - last_tap = now; -} - -void TCA8418Keyboard::released() -{ - if (state != Held) { - return; - } - - if (last_key < 0 || last_key > _TCA8418_NUM_KEYS) { // reset to idle if last_key out of bounds - last_key = -1; - state = Idle; - return; - } - uint32_t now = millis(); - int32_t held_interval = now - last_tap; - last_tap = now; - if (tap_interval < _TCA8418_MULTI_TAP_THRESHOLD && should_backspace) { - queueEvent(_TCA8418_BSP); - } - if (held_interval > _TCA8418_LONG_PRESS_THRESHOLD) { - queueEvent(TCA8418LongPressMap[last_key]); - // LOG_DEBUG("Long Press Key: %i Map: %i", last_key, TCA8418LongPressMap[last_key]); - } else { - queueEvent(TCA8418TapMap[last_key][(char_idx % TCA8418TapMod[last_key])]); - // LOG_DEBUG("Key Press: %i Index:%i if %i Map: %c", last_key, char_idx, TCA8418TapMod[last_key], - // TCA8418TapMap[last_key][(char_idx % TCA8418TapMod[last_key])]); - } -} - -uint8_t TCA8418Keyboard::flush() -{ - // Flush key events - uint8_t count = 0; - while (readRegister(_TCA8418_REG_KEY_EVENT_A) != 0) - count++; - // Flush gpio events - readRegister(_TCA8418_REG_GPIO_INT_STAT_1); - readRegister(_TCA8418_REG_GPIO_INT_STAT_2); - readRegister(_TCA8418_REG_GPIO_INT_STAT_3); - // Clear INT_STAT register - writeRegister(_TCA8418_REG_INT_STAT, 3); - return count; -} - -uint8_t TCA8418Keyboard::digitalRead(uint8_t pinnum) const -{ - if (pinnum > _TCA8418_COL9) - return 0xFF; - - uint8_t reg = _TCA8418_REG_GPIO_DAT_STAT_1 + pinnum / 8; - uint8_t mask = (1 << (pinnum % 8)); - - // Level 0 = low other = high - uint8_t value = readRegister(reg); - if (value & mask) - return HIGH; - return LOW; -} - -bool TCA8418Keyboard::digitalWrite(uint8_t pinnum, uint8_t level) -{ - if (pinnum > _TCA8418_COL9) - return false; - - uint8_t reg = _TCA8418_REG_GPIO_DAT_OUT_1 + pinnum / 8; - uint8_t mask = (1 << (pinnum % 8)); - - // Level 0 = low other = high - uint8_t value = readRegister(reg); - if (level == LOW) - value &= ~mask; - else - value |= mask; - writeRegister(reg, value); - return true; -} - -bool TCA8418Keyboard::pinMode(uint8_t pinnum, uint8_t mode) -{ - if (pinnum > _TCA8418_COL9) - return false; - - uint8_t idx = pinnum / 8; - uint8_t reg = _TCA8418_REG_GPIO_DIR_1 + idx; - uint8_t mask = (1 << (pinnum % 8)); - - // Mode 0 = input 1 = output - uint8_t value = readRegister(reg); - if (mode == OUTPUT) - value |= mask; - else - value &= ~mask; - writeRegister(reg, value); - - // Pullup 0 = enabled 1 = disabled - reg = _TCA8418_REG_GPIO_PULL_1 + idx; - value = readRegister(reg); - if (mode == INPUT_PULLUP) - value &= ~mask; - else - value |= mask; - writeRegister(reg, value); - - return true; -} - -bool TCA8418Keyboard::pinIRQMode(uint8_t pinnum, uint8_t mode) -{ - if (pinnum > _TCA8418_COL9) - return false; - if ((mode != RISING) && (mode != FALLING)) - return false; - - // Mode 0 = falling 1 = rising - uint8_t idx = pinnum / 8; - uint8_t reg = _TCA8418_REG_GPIO_INT_LVL_1 + idx; - uint8_t mask = (1 << (pinnum % 8)); - - uint8_t value = readRegister(reg); - if (mode == RISING) - value |= mask; - else - value &= ~mask; - writeRegister(reg, value); - - // Enable interrupt - reg = _TCA8418_REG_GPIO_INT_EN_1 + idx; - value = readRegister(reg); - value |= mask; - writeRegister(reg, value); - - return true; -} - -void TCA8418Keyboard::enableInterrupts() -{ - uint8_t value = readRegister(_TCA8418_REG_CFG); - value |= (_TCA8418_REG_CFG_GPI_IEN | _TCA8418_REG_CFG_KE_IEN); - writeRegister(_TCA8418_REG_CFG, value); -}; - -void TCA8418Keyboard::disableInterrupts() -{ - uint8_t value = readRegister(_TCA8418_REG_CFG); - value &= ~(_TCA8418_REG_CFG_GPI_IEN | _TCA8418_REG_CFG_KE_IEN); - writeRegister(_TCA8418_REG_CFG, value); -}; - -void TCA8418Keyboard::enableMatrixOverflow() -{ - uint8_t value = readRegister(_TCA8418_REG_CFG); - value |= _TCA8418_REG_CFG_OVR_FLOW_M; - writeRegister(_TCA8418_REG_CFG, value); -}; - -void TCA8418Keyboard::disableMatrixOverflow() -{ - uint8_t value = readRegister(_TCA8418_REG_CFG); - value &= ~_TCA8418_REG_CFG_OVR_FLOW_M; - writeRegister(_TCA8418_REG_CFG, value); -}; - -void TCA8418Keyboard::enableDebounce() -{ - writeRegister(_TCA8418_REG_DEBOUNCE_DIS_1, 0x00); - writeRegister(_TCA8418_REG_DEBOUNCE_DIS_2, 0x00); - writeRegister(_TCA8418_REG_DEBOUNCE_DIS_3, 0x00); -} - -void TCA8418Keyboard::disableDebounce() -{ - writeRegister(_TCA8418_REG_DEBOUNCE_DIS_1, 0xFF); - writeRegister(_TCA8418_REG_DEBOUNCE_DIS_2, 0xFF); - writeRegister(_TCA8418_REG_DEBOUNCE_DIS_3, 0xFF); -} - -void TCA8418Keyboard::setBacklight(bool on) -{ - if (on) { - digitalWrite(_TCA8418_COL9, HIGH); - } else { - digitalWrite(_TCA8418_COL9, LOW); - } -} - -uint8_t TCA8418Keyboard::readRegister(uint8_t reg) const -{ - if (m_wire) { - m_wire->beginTransmission(m_addr); - m_wire->write(reg); - m_wire->endTransmission(); - - m_wire->requestFrom(m_addr, (uint8_t)1); - if (m_wire->available() < 1) - return 0; - - return m_wire->read(); - } - if (readCallback) { - uint8_t data; - readCallback(m_addr, reg, &data, 1); - return data; - } - return 0; -} - -void TCA8418Keyboard::writeRegister(uint8_t reg, uint8_t value) -{ - uint8_t data[2]; - data[0] = reg; - data[1] = value; - - if (m_wire) { - m_wire->beginTransmission(m_addr); - m_wire->write(data, sizeof(uint8_t) * 2); - m_wire->endTransmission(); - } - if (writeCallback) { - writeCallback(m_addr, data[0], &(data[1]), 1); - } -} \ No newline at end of file diff --git a/src/input/TCA8418Keyboard.h b/src/input/TCA8418Keyboard.h deleted file mode 100644 index c7f3c1f28..000000000 --- a/src/input/TCA8418Keyboard.h +++ /dev/null @@ -1,83 +0,0 @@ -// Based on the MPR121 Keyboard and Adafruit TCA8418 library -#include "configuration.h" -#include - -#define _TCA8418_NONE 0x00 -#define _TCA8418_REBOOT 0x90 -#define _TCA8418_LEFT 0xb4 -#define _TCA8418_UP 0xb5 -#define _TCA8418_DOWN 0xb6 -#define _TCA8418_RIGHT 0xb7 -#define _TCA8418_ESC 0x1b -#define _TCA8418_BSP 0x08 -#define _TCA8418_SELECT 0x0d - -class TCA8418Keyboard -{ - public: - typedef uint8_t (*i2c_com_fptr_t)(uint8_t dev_addr, uint8_t reg_addr, uint8_t *data, uint8_t len); - - enum KeyState { Init = 0, Idle, Held, Busy }; - - KeyState state; - int8_t last_key; - int8_t next_key; - bool should_backspace; - uint32_t last_tap; - uint8_t char_idx; - int32_t tap_interval; - bool backlight_on; - - String queue; - - TCA8418Keyboard(); - - void begin(uint8_t addr = XPOWERS_AXP192_AXP2101_ADDRESS, TwoWire *wire = &Wire); - void begin(i2c_com_fptr_t r, i2c_com_fptr_t w, uint8_t addr = XPOWERS_AXP192_AXP2101_ADDRESS); - - void reset(void); - // Configure the size of the keypad. - // All other rows and columns are set as inputs. - bool matrix(uint8_t rows, uint8_t columns); - - // Flush all events in the FIFO buffer + GPIO events. - uint8_t flush(void); - - // Key events available in the internal FIFO buffer. - uint8_t keyCount(void) const; - - void trigger(void); - void pressed(uint8_t key); - void released(void); - bool hasEvent(void); - char dequeueEvent(void); - void queueEvent(char); - - uint8_t digitalRead(uint8_t pinnum) const; - bool digitalWrite(uint8_t pinnum, uint8_t level); - bool pinMode(uint8_t pinnum, uint8_t mode); - bool pinIRQMode(uint8_t pinnum, uint8_t mode); // MODE FALLING or RISING - - // enable / disable interrupts for matrix and GPI pins - void enableInterrupts(); - void disableInterrupts(); - - // ignore key events when FIFO buffer is full or not. - void enableMatrixOverflow(); - void disableMatrixOverflow(); - - // debounce keys. - void enableDebounce(); - void disableDebounce(); - - void setBacklight(bool on); - - uint8_t readRegister(uint8_t reg) const; - void writeRegister(uint8_t reg, uint8_t value); - - private: - TwoWire *m_wire; - uint8_t m_addr; - i2c_com_fptr_t readCallback; - i2c_com_fptr_t writeCallback; -}; diff --git a/src/input/cardKbI2cImpl.cpp b/src/input/cardKbI2cImpl.cpp index 0d661811b..eb9b07d6e 100644 --- a/src/input/cardKbI2cImpl.cpp +++ b/src/input/cardKbI2cImpl.cpp @@ -12,8 +12,8 @@ void CardKbI2cImpl::init() #if !MESHTASTIC_EXCLUDE_I2C && !defined(ARCH_PORTDUINO) && !defined(I2C_NO_RESCAN) if (cardkb_found.address == 0x00) { LOG_DEBUG("Rescan for I2C keyboard"); - uint8_t i2caddr_scan[] = {CARDKB_ADDR, TDECK_KB_ADDR, BBQ10_KB_ADDR, MPR121_KB_ADDR, XPOWERS_AXP192_AXP2101_ADDRESS}; - uint8_t i2caddr_asize = 5; + uint8_t i2caddr_scan[] = {CARDKB_ADDR, TDECK_KB_ADDR, BBQ10_KB_ADDR, MPR121_KB_ADDR}; + uint8_t i2caddr_asize = 4; auto i2cScanner = std::unique_ptr(new ScanI2CTwoWire()); #if WIRE_INTERFACES_COUNT == 2 @@ -43,10 +43,6 @@ void CardKbI2cImpl::init() // assign an arbitrary value to distinguish from other models kb_model = 0x37; break; - case ScanI2C::DeviceType::TCA8418KB: - // assign an arbitrary value to distinguish from other models - kb_model = 0x84; - break; default: // use this as default since it's also just zero LOG_WARN("kb_info.type is unknown(0x%02x), setting kb_model=0x00", kb_info.type); @@ -67,4 +63,4 @@ void CardKbI2cImpl::init() } #endif inputBroker->registerSource(this); -} +} \ No newline at end of file diff --git a/src/input/kbI2cBase.cpp b/src/input/kbI2cBase.cpp index daccc6622..9b1a27745 100644 --- a/src/input/kbI2cBase.cpp +++ b/src/input/kbI2cBase.cpp @@ -43,9 +43,6 @@ int32_t KbI2cBase::runOnce() if (cardkb_found.address == MPR121_KB_ADDR) { MPRkeyboard.begin(MPR121_KB_ADDR, &Wire1); } - if (cardkb_found.address == XPOWERS_AXP192_AXP2101_ADDRESS) { - TCAKeyboard.begin(XPOWERS_AXP192_AXP2101_ADDRESS, &Wire1); - } break; #endif case ScanI2C::WIRE: @@ -58,9 +55,6 @@ int32_t KbI2cBase::runOnce() if (cardkb_found.address == MPR121_KB_ADDR) { MPRkeyboard.begin(MPR121_KB_ADDR, &Wire); } - if (cardkb_found.address == XPOWERS_AXP192_AXP2101_ADDRESS) { - TCAKeyboard.begin(XPOWERS_AXP192_AXP2101_ADDRESS, &Wire); - } break; case ScanI2C::NO_I2C: default: @@ -169,70 +163,6 @@ int32_t KbI2cBase::runOnce() } break; } - - case 0x84: { // Adafruit TCA8418 - TCAKeyboard.trigger(); - InputEvent e; - while (TCAKeyboard.hasEvent()) { - char nextEvent = TCAKeyboard.dequeueEvent(); - e.inputEvent = ANYKEY; - e.kbchar = 0x00; - e.source = this->_originName; - switch (nextEvent) { - case _TCA8418_NONE: - e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE; - e.kbchar = 0x00; - break; - case _TCA8418_REBOOT: - e.inputEvent = ANYKEY; - e.kbchar = INPUT_BROKER_MSG_REBOOT; - break; - case _TCA8418_LEFT: - e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT; - e.kbchar = 0x00; - break; - case _TCA8418_UP: - e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP; - e.kbchar = 0x00; - break; - case _TCA8418_DOWN: - e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_DOWN; - e.kbchar = 0x00; - break; - case _TCA8418_RIGHT: - e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT; - e.kbchar = 0x00; - break; - case _TCA8418_BSP: - e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_BACK; - e.kbchar = 0x08; - break; - case _TCA8418_SELECT: - e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT; - e.kbchar = 0x0d; - break; - case _TCA8418_ESC: - e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL; - e.kbchar = 0x1b; - break; - default: - if (nextEvent > 127) { - e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE; - e.kbchar = 0x00; - break; - } - e.inputEvent = ANYKEY; - e.kbchar = nextEvent; - break; - } - if (e.inputEvent != meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE) { - LOG_DEBUG("TCA8418 Notifying: %i Char: %c", e.inputEvent, e.kbchar); - this->notifyObservers(&e); - } - } - break; - } - case 0x37: { // MPR121 MPRkeyboard.trigger(); InputEvent e; diff --git a/src/input/kbI2cBase.h b/src/input/kbI2cBase.h index d5831aafa..dc2414fc0 100644 --- a/src/input/kbI2cBase.h +++ b/src/input/kbI2cBase.h @@ -3,7 +3,6 @@ #include "BBQ10Keyboard.h" #include "InputBroker.h" #include "MPR121Keyboard.h" -#include "TCA8418Keyboard.h" #include "Wire.h" #include "concurrency/OSThread.h" @@ -22,6 +21,5 @@ class KbI2cBase : public Observable, public concurrency::OST BBQ10Keyboard Q10keyboard; MPR121Keyboard MPRkeyboard; - TCA8418Keyboard TCAKeyboard; bool is_sym = false; -}; +}; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index f65c3fcd1..b4e8cd521 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -568,10 +568,6 @@ void setup() // assign an arbitrary value to distinguish from other models kb_model = 0x37; break; - case ScanI2C::DeviceType::TCA8418KB: - // assign an arbitrary value to distinguish from other models - kb_model = 0x84; - break; default: // use this as default since it's also just zero LOG_WARN("kb_info.type is unknown(0x%02x), setting kb_model=0x00", kb_info.type); From 1e41c994b3ec9395c1c9fb2aae25947ec6306060 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 27 Mar 2025 10:06:11 -0500 Subject: [PATCH 326/381] Add attestations and PR template --- .github/pull_request_template.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 6ccb4a105..a15b34aae 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,7 +1,6 @@ +## 🙠Thank you for sending in a pull request, here's some tips to get started! + ### ⌠(Please delete all these tips and replace them with your text) ⌠- -## Thank you for sending in a pull request, here's some tips to get started! - - Before starting on some new big chunk of code, it it is optional but highly recommended to open an issue first to say "Hey, I think this idea X should be implemented and I'm starting work on it. My general plan is Y, any feedback is appreciated." This will allow other devs to potentially save you time by not accidentially duplicating work etc... @@ -12,4 +11,17 @@ - If your PR fixes a bug, mention "fixes #bugnum" somewhere in your pull request description. - If your other co-developers have comments on your PR please tweak as needed. - Please also enable "Allow edits by maintainers". +- Please do not submit untested code. +- If you do not have the affected hardware to test your code changes adequately against regressions, please indicate this, so that contributors and commnunity members can help test your changes. - If your PR gets accepted you can request a "Contributor" role in the Meshtastic Discord + + +## 🤠Attestations +- [ ] I have tested that my proposed changes behave as described. +- [ ] I have tested that my proposed changes do not cause any obvious regressions on the following devices: + - [ ] Heltec (Lora32) V3 + - [ ] LilyGo T-Deck + - [ ] LilyGo T-Beam + - [ ] RAK WisBlock 4631 + - [ ] Seeed Studio T-1000E tracker card + - [ ] Other (please specify below) From 4e1030ef9c0c1ab573105962687fba1378c98650 Mon Sep 17 00:00:00 2001 From: Austin Date: Fri, 28 Mar 2025 07:31:24 -0400 Subject: [PATCH 327/381] Fix USERPREFS_EVENT_MODE compile error (#6408) --- src/mesh/Channels.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/Channels.cpp b/src/mesh/Channels.cpp index f1d4926db..4d061f80f 100644 --- a/src/mesh/Channels.cpp +++ b/src/mesh/Channels.cpp @@ -347,7 +347,7 @@ bool Channels::anyMqttEnabled() { #if USERPREFS_EVENT_MODE // Don't publish messages on the public MQTT broker if we are in event mode - if (mqtt && mqtt.isUsingDefaultServer()) { + if (mqtt && mqtt->isUsingDefaultServer()) { return false; } #endif From d7504921fb15d0048aeb81dd1ccf64af525e4ad1 Mon Sep 17 00:00:00 2001 From: Marco Veneziano Date: Fri, 28 Mar 2025 12:45:04 +0100 Subject: [PATCH 328/381] Add missing board definition for MESHLINK (#6404) Co-authored-by: Ben Meadors --- src/platform/nrf52/architecture.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/platform/nrf52/architecture.h b/src/platform/nrf52/architecture.h index bf7fce29a..71db98da6 100644 --- a/src/platform/nrf52/architecture.h +++ b/src/platform/nrf52/architecture.h @@ -75,6 +75,8 @@ #define HW_VENDOR meshtastic_HardwareModel_PRIVATE_HW #elif defined(HELTEC_T114) #define HW_VENDOR meshtastic_HardwareModel_HELTEC_MESH_NODE_T114 +#elif defined(MESHLINK) +#define HW_VENDOR meshtastic_HardwareModel_MESHLINK #elif defined(SEEED_XIAO_NRF52840_KIT) #define HW_VENDOR meshtastic_HardwareModel_XIAO_NRF52_KIT #else From a2387c79ee05f599f4d998687e86e8b1e5518495 Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Fri, 28 Mar 2025 16:18:47 +0100 Subject: [PATCH 329/381] fix: SenseCAP Indicator sporadic touch crash (#6432) * fix indicator touch crash * replace wrong .ini * delete wrong .ini --- platformio.ini | 2 +- variants/seeed-sensecap-indicator/platformio.ini | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/platformio.ini b/platformio.ini index 3de5b715f..542374637 100644 --- a/platformio.ini +++ b/platformio.ini @@ -94,7 +94,7 @@ lib_deps = [device-ui_base] lib_deps = - https://github.com/meshtastic/device-ui.git#7a6ffba3c86901b0e3234b6c056aa803b4cd8854 + https://github.com/meshtastic/device-ui.git#b1e862e8b2a604a8d911e9d7a27f6e80f1176c21 ; Common libs for environmental measurements in telemetry module ; (not included in native / portduino) diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index da11953b7..ca1639e4d 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -24,7 +24,7 @@ build_flags = ${esp32_base.build_flags} -DUSE_ARDUINO_HAL_GPIO lib_deps = ${esp32s3_base.lib_deps} - https://github.com/mverch67/LovyanGFX#develop + https://github.com/mverch67/LovyanGFX#4c76238c1344162a234ae917b27651af146d6fb2 earlephilhower/ESP8266Audio@^1.9.9 earlephilhower/ESP8266SAM@^1.0.1 @@ -49,7 +49,7 @@ build_flags = -D HAS_SCREEN=0 -D HAS_TFT=1 -D DISPLAY_SET_RESOLUTION - -D USE_I2S_BUZZER + -D USE_PIN_BUZZER -D RAM_SIZE=4096 -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE @@ -65,10 +65,9 @@ build_flags = -D LGFX_DRIVER=LGFX_INDICATOR -D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_INDICATOR.h\" -D VIEW_320x240 -; -D USE_DOUBLE_BUFFER -D USE_PACKET_API lib_deps = ${env:seeed-sensecap-indicator.lib_deps} ${device-ui_base.lib_deps} - https://github.com/bitbank2/bb_captouch.git#8f2f06462ff597847921739376a299db93612417 ; alternative touch library supporting FT6x36 + https://github.com/mverch67/bb_captouch.git#8626412fe650d808a267791c0eae6e5860c85a5d ; alternative touch library supporting FT6x36 From 4a12b4eb32e3a4c16e9cb819ddf460c61a38704e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Fri, 28 Mar 2025 21:22:17 +0100 Subject: [PATCH 330/381] add Thinknode-M1 (#6435) * ThinkNode M1 * Update Epaper Driver * Your day isn't complete unless trunk has complained about your formatting at least once. --- boards/ThinkNode-M1.json | 53 +++++ src/Power.cpp | 9 + src/graphics/EInkDisplay2.cpp | 10 +- src/graphics/Screen.cpp | 5 + src/main.cpp | 29 ++- src/modules/SerialModule.cpp | 9 +- src/platform/nrf52/architecture.h | 2 + src/platform/nrf52/main-nrf52.cpp | 48 ++++- src/power.h | 5 + src/sleep.cpp | 1 + variants/ELECROW-ThinkNode-M1/platformio.ini | 29 +++ variants/ELECROW-ThinkNode-M1/variant.cpp | 44 ++++ variants/ELECROW-ThinkNode-M1/variant.h | 205 +++++++++++++++++++ 13 files changed, 435 insertions(+), 14 deletions(-) create mode 100644 boards/ThinkNode-M1.json create mode 100644 variants/ELECROW-ThinkNode-M1/platformio.ini create mode 100644 variants/ELECROW-ThinkNode-M1/variant.cpp create mode 100644 variants/ELECROW-ThinkNode-M1/variant.h diff --git a/boards/ThinkNode-M1.json b/boards/ThinkNode-M1.json new file mode 100644 index 000000000..e55da3ec7 --- /dev/null +++ b/boards/ThinkNode-M1.json @@ -0,0 +1,53 @@ +{ + "build": { + "arduino": { + "ldscript": "nrf52840_s140_v6.ld" + }, + "core": "nRF5", + "cpu": "cortex-m4", + "extra_flags": "-DARDUINO_NRF52840_TTGO_EINK -DNRF52840_XXAA", + "f_cpu": "64000000L", + "hwids": [ + ["0x239A", "0x4405"], + ["0x239A", "0x0029"], + ["0x239A", "0x002A"] + ], + "usb_product": "elecrow_eink", + "mcu": "nrf52840", + "variant": "ELECROW-ThinkNode-M1", + "variants_dir": "variants", + "bsp": { + "name": "adafruit" + }, + "softdevice": { + "sd_flags": "-DS140", + "sd_name": "s140", + "sd_version": "6.1.1", + "sd_fwid": "0x00B6" + }, + "bootloader": { + "settings_addr": "0xFF000" + } + }, + "connectivity": ["bluetooth"], + "debug": { + "jlink_device": "nRF52840_xxAA", + "onboard_tools": ["jlink"], + "svd_path": "nrf52840.svd", + "openocd_target": "nrf52840-mdk-rs" + }, + "frameworks": ["arduino"], + "name": "elecrow eink", + "upload": { + "maximum_ram_size": 248832, + "maximum_size": 815104, + "speed": 115200, + "protocol": "nrfutil", + "protocols": ["jlink", "nrfjprog", "nrfutil", "stlink"], + "use_1200bps_touch": true, + "require_upload_port": true, + "wait_for_upload_port": true + }, + "url": "FIXME", + "vendor": "ELECROW" +} diff --git a/src/Power.cpp b/src/Power.cpp index 8c2ef998d..20447ad63 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -713,6 +713,9 @@ void Power::readPowerStatus() const PowerStatus powerStatus2 = PowerStatus(hasBattery, usbPowered, isCharging, batteryVoltageMv, batteryChargePercent); LOG_DEBUG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d", powerStatus2.getHasUSB(), powerStatus2.getIsCharging(), powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent()); +#if defined(ELECROW_ThinkNode_M1) + power_num = powerStatus2.getBatteryVoltageMv(); +#endif newStatus.notifyObservers(&powerStatus2); #ifdef DEBUG_HEAP if (lastheap != memGet.getFreeHeap()) { @@ -759,6 +762,9 @@ void Power::readPowerStatus() if (batteryLevel && powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) { if (batteryLevel->getBattVoltage() < OCV[NUM_OCV_POINTS - 1]) { low_voltage_counter++; +#if defined(ELECROW_ThinkNode_M1) + low_voltage_counter_led3 = low_voltage_counter; +#endif LOG_DEBUG("Low voltage counter: %d/10", low_voltage_counter); if (low_voltage_counter > 10) { #ifdef ARCH_NRF52 @@ -771,6 +777,9 @@ void Power::readPowerStatus() } } else { low_voltage_counter = 0; +#if defined(ELECROW_ThinkNode_M1) + low_voltage_counter_led3 = low_voltage_counter; +#endif } } } diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index 1bf1bc300..96c6b44c1 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -128,16 +128,24 @@ bool EInkDisplay::connect() #ifdef PIN_EINK_EN // backlight power, HIGH is backlight on, LOW is off pinMode(PIN_EINK_EN, OUTPUT); +#ifdef ELECROW_ThinkNode_M1 digitalWrite(PIN_EINK_EN, LOW); +#else + digitalWrite(PIN_EINK_EN, HIGH); +#endif #endif -#if defined(TTGO_T_ECHO) +#if defined(TTGO_T_ECHO) || defined(ELECROW_ThinkNode_M1) { auto lowLevel = new EINK_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, SPI1); adafruitDisplay = new GxEPD2_BW(*lowLevel); adafruitDisplay->init(); +#ifdef ELECROW_ThinkNode_M1 + adafruitDisplay->setRotation(4); +#else adafruitDisplay->setRotation(3); +#endif adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight); } #elif defined(MESHLINK) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 0c18f3287..635cd5164 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1641,6 +1641,11 @@ void Screen::handleSetOn(bool on, FrameCallback einkScreensaver) setScreensaverFrames(einkScreensaver); #endif LOG_INFO("Turn off screen"); +#ifdef ELECROW_ThinkNode_M1 + if (digitalRead(PIN_EINK_EN) == HIGH) { + digitalWrite(PIN_EINK_EN, LOW); + } +#endif dispdev->displayOff(); #ifdef USE_ST7789 SPI1.end(); diff --git a/src/main.cpp b/src/main.cpp index b4e8cd521..2e0470fa1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -262,6 +262,27 @@ void printInfo() #ifndef PIO_UNIT_TESTING void setup() { +// power on peripherals +#if defined(PIN_POWER_EN) + pinMode(PIN_POWER_EN, OUTPUT); + digitalWrite(PIN_POWER_EN, HIGH); +#endif + +#ifdef LED_POWER + pinMode(LED_POWER, OUTPUT); + digitalWrite(LED_POWER, HIGH); +#endif + +#ifdef POWER_LED + pinMode(POWER_LED, OUTPUT); + digitalWrite(POWER_LED, HIGH); +#endif + +#ifdef USER_LED + pinMode(USER_LED, OUTPUT); + digitalWrite(USER_LED, LOW); +#endif + #if defined(T_DECK) // GPIO10 manages all peripheral power supplies // Turn on peripheral power immediately after MUC starts. @@ -325,13 +346,6 @@ void setup() initDeepSleep(); - // power on peripherals -#if defined(PIN_POWER_EN) - pinMode(PIN_POWER_EN, OUTPUT); - digitalWrite(PIN_POWER_EN, HIGH); - // digitalWrite(PIN_POWER_EN1, INPUT); -#endif - #if defined(LORA_TCXO_GPIO) pinMode(LORA_TCXO_GPIO, OUTPUT); digitalWrite(LORA_TCXO_GPIO, HIGH); @@ -1303,5 +1317,4 @@ void loop() mainDelay.delay(delayMsec); } } - #endif diff --git a/src/modules/SerialModule.cpp b/src/modules/SerialModule.cpp index 34ece2312..f3f23b080 100644 --- a/src/modules/SerialModule.cpp +++ b/src/modules/SerialModule.cpp @@ -60,7 +60,7 @@ SerialModule *serialModule; SerialModuleRadio *serialModuleRadio; -#if defined(TTGO_T_ECHO) || defined(CANARYONE) || defined(MESHLINK) +#if defined(TTGO_T_ECHO) || defined(CANARYONE) || defined(MESHLINK) || defined(ELECROW_ThinkNode_M1) SerialModule::SerialModule() : StreamAPI(&Serial), concurrency::OSThread("Serial") {} static Print *serialPrint = &Serial; #elif defined(CONFIG_IDF_TARGET_ESP32C6) @@ -158,7 +158,7 @@ int32_t SerialModule::runOnce() Serial.begin(baud); Serial.setTimeout(moduleConfig.serial.timeout > 0 ? moduleConfig.serial.timeout : TIMEOUT); } -#elif !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(MESHLINK) +#elif !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1) if (moduleConfig.serial.rxd && moduleConfig.serial.txd) { #ifdef ARCH_RP2040 Serial2.setFIFOSize(RX_BUFFER); @@ -214,7 +214,7 @@ int32_t SerialModule::runOnce() } } -#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(MESHLINK) +#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1) else if ((moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_WS85)) { processWXSerial(); @@ -416,7 +416,8 @@ uint32_t SerialModule::getBaudRate() */ void SerialModule::processWXSerial() { -#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(MESHLINK) +#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(MESHLINK) && \ + !defined(ELECROW_ThinkNode_M1) static unsigned int lastAveraged = 0; static unsigned int averageIntervalMillis = 300000; // 5 minutes hard coded. static double dir_sum_sin = 0; diff --git a/src/platform/nrf52/architecture.h b/src/platform/nrf52/architecture.h index 71db98da6..1a06f173a 100644 --- a/src/platform/nrf52/architecture.h +++ b/src/platform/nrf52/architecture.h @@ -53,6 +53,8 @@ #define HW_VENDOR meshtastic_HardwareModel_RAK4631 #elif defined(TTGO_T_ECHO) #define HW_VENDOR meshtastic_HardwareModel_T_ECHO +#elif defined(ELECROW_ThinkNode_M1) +#define HW_VENDOR meshtastic_HardwareModel_NRF52_UNKNOWN // HW_VENDOR meshtastic_HardwareModel_ThinkNode_M1 #elif defined(NANO_G2_ULTRA) #define HW_VENDOR meshtastic_HardwareModel_NANO_G2_ULTRA #elif defined(CANARYONE) diff --git a/src/platform/nrf52/main-nrf52.cpp b/src/platform/nrf52/main-nrf52.cpp index 8483d21c6..53971e95a 100644 --- a/src/platform/nrf52/main-nrf52.cpp +++ b/src/platform/nrf52/main-nrf52.cpp @@ -235,6 +235,14 @@ void nrf52InitSemiHosting() void nrf52Setup() { +#ifdef USB_CHECK + pinMode(USB_CHECK, INPUT); +#endif + +#ifdef ADC_V + pinMode(ADC_V, INPUT); +#endif + uint32_t why = NRF_POWER->RESETREAS; // per // https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fpower.html @@ -275,9 +283,11 @@ void cpuDeepSleep(uint32_t msecToWake) Wire.end(); #endif SPI.end(); +#if SPI_INTERFACES_COUNT > 1 + SPI1.end(); +#endif // This may cause crashes as debug messages continue to flow. Serial.end(); - #ifdef PIN_SERIAL_RX1 Serial1.end(); #endif @@ -315,6 +325,31 @@ void cpuDeepSleep(uint32_t msecToWake) detachInterrupt(PIN_GPS_PPS); detachInterrupt(PIN_BUTTON1); #endif + +#ifdef ELECROW_ThinkNode_M1 + for (int pin = 0; pin < 48; pin++) { + if (pin == 17 || pin == 19 || pin == 20 || pin == 22 || pin == 23 || pin == 24 || pin == 25 || pin == 9 || pin == 10 || + pin == PIN_BUTTON1 || pin == PIN_BUTTON2) { + continue; + } + pinMode(pin, OUTPUT); + } + for (int pin = 0; pin < 48; pin++) { + if (pin == 17 || pin == 19 || pin == 20 || pin == 22 || pin == 23 || pin == 24 || pin == 25 || pin == 9 || pin == 10 || + pin == PIN_BUTTON1 || pin == PIN_BUTTON2) { + continue; + } + digitalWrite(pin, LOW); + } + for (int pin = 0; pin < 48; pin++) { + if (pin == 17 || pin == 19 || pin == 20 || pin == 22 || pin == 23 || pin == 24 || pin == 25 || pin == 9 || pin == 10 || + pin == PIN_BUTTON1 || pin == PIN_BUTTON2) { + continue; + } + NRF_GPIO->DIRCLR = (1 << pin); + } +#endif + // Sleepy trackers or sensors can low power "sleep" // Don't enter this if we're sleeping portMAX_DELAY, since that's a shutdown event if (msecToWake != portMAX_DELAY && @@ -333,6 +368,17 @@ void cpuDeepSleep(uint32_t msecToWake) // FIXME, use system off mode with ram retention for key state? // FIXME, use non-init RAM per // https://devzone.nordicsemi.com/f/nordic-q-a/48919/ram-retention-settings-with-softdevice-enabled + +#ifdef ELECROW_ThinkNode_M1 + nrf_gpio_cfg_input(PIN_BUTTON1, NRF_GPIO_PIN_PULLUP); // Configure the pin to be woken up as an input + nrf_gpio_pin_sense_t sense = NRF_GPIO_PIN_SENSE_LOW; + nrf_gpio_cfg_sense_set(PIN_BUTTON1, sense); + + nrf_gpio_cfg_input(PIN_BUTTON2, NRF_GPIO_PIN_PULLUP); + nrf_gpio_pin_sense_t sense1 = NRF_GPIO_PIN_SENSE_LOW; + nrf_gpio_cfg_sense_set(PIN_BUTTON2, sense1); +#endif + auto ok = sd_power_system_off(); if (ok != NRF_SUCCESS) { LOG_ERROR("FIXME: Ignoring soft device (EasyDMA pending?) and forcing system-off!"); diff --git a/src/power.h b/src/power.h index e9c0deb7c..78caa8a7d 100644 --- a/src/power.h +++ b/src/power.h @@ -84,6 +84,11 @@ class Power : private concurrency::OSThread void setStatusHandler(meshtastic::PowerStatus *handler) { statusHandler = handler; } const uint16_t OCV[11] = {OCV_ARRAY}; +#if defined(ELECROW_ThinkNode_M1) + uint8_t low_voltage_counter_led3; + int power_num = 0; +#endif + protected: meshtastic::PowerStatus *statusHandler; diff --git a/src/sleep.cpp b/src/sleep.cpp index 202b8c354..02fa8d871 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -228,6 +228,7 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false, bool skipSaveN } #ifdef PIN_POWER_EN + digitalWrite(PIN_POWER_EN, LOW); pinMode(PIN_POWER_EN, INPUT); // power off peripherals // pinMode(PIN_POWER_EN1, INPUT_PULLDOWN); #endif diff --git a/variants/ELECROW-ThinkNode-M1/platformio.ini b/variants/ELECROW-ThinkNode-M1/platformio.ini new file mode 100644 index 000000000..f37f6d310 --- /dev/null +++ b/variants/ELECROW-ThinkNode-M1/platformio.ini @@ -0,0 +1,29 @@ +; First prototype eink/nrf52840/sx1262 device +[env:thinknode_m1] +extends = nrf52840_base +board = ThinkNode-M1 +board_check = true +debug_tool = jlink + +# add -DCFG_SYSVIEW if you want to use the Segger systemview tool for OS profiling. +build_flags = ${nrf52840_base.build_flags} -Ivariants/ELECROW-ThinkNode-M1 + -DELECROW_ThinkNode_M1 + -DGPS_POWER_TOGGLE + -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" + -DEINK_DISPLAY_MODEL=GxEPD2_154_D67 + -DEINK_WIDTH=200 + -DEINK_HEIGHT=200 + -DUSE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk + -DEINK_LIMIT_FASTREFRESH=10 ; How many consecutive fast-refreshes are permitted //20 + -DEINK_LIMIT_RATE_BACKGROUND_SEC=10 ; Minimum interval between BACKGROUND updates //30 + -DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 ; Minimum interval between RESPONSIVE updates +; -DEINK_LIMIT_GHOSTING_PX=2000 ; (Optional) How much image ghosting is tolerated + -DEINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached. + +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/ELECROW-ThinkNode-M1> +lib_deps = + ${nrf52840_base.lib_deps} + https://github.com/meshtastic/GxEPD2/archive/33db3fa8ee6fc47d160bdb44f8f127c9a9203a10.zip + lewisxhe/PCF8563_Library@^1.0.1 + khoih-prog/nRF52_PWM@^1.0.1 +;upload_protocol = fs \ No newline at end of file diff --git a/variants/ELECROW-ThinkNode-M1/variant.cpp b/variants/ELECROW-ThinkNode-M1/variant.cpp new file mode 100644 index 000000000..cae079b74 --- /dev/null +++ b/variants/ELECROW-ThinkNode-M1/variant.cpp @@ -0,0 +1,44 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "variant.h" +#include "nrf.h" +#include "wiring_constants.h" +#include "wiring_digital.h" + +const uint32_t g_ADigitalPinMap[] = { + // P0 - pins 0 and 1 are hardwired for xtal and should never be enabled + 0xff, 0xff, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + + // P1 + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}; + +void initVariant() +{ + // LED1 & LED2 + pinMode(PIN_LED1, OUTPUT); + ledOff(PIN_LED1); + + pinMode(PIN_LED2, OUTPUT); + ledOff(PIN_LED2); + + pinMode(PIN_LED3, OUTPUT); + ledOff(PIN_LED3); +} diff --git a/variants/ELECROW-ThinkNode-M1/variant.h b/variants/ELECROW-ThinkNode-M1/variant.h new file mode 100644 index 000000000..3bfa360f6 --- /dev/null +++ b/variants/ELECROW-ThinkNode-M1/variant.h @@ -0,0 +1,205 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _VARIANT_ELECROW_EINK_V1_0_ +#define _VARIANT_ELECROW_EINK_V1_0_ + +/** Master clock frequency */ +#define VARIANT_MCK (64000000ul) + +#define USE_LFXO // Board uses 32khz crystal for LF + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ + +#include "WVariant.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Number of pins defined in PinDescription array +// 在PinDescription数组中定义的引脚数 +#define PINS_COUNT (48) +#define NUM_DIGITAL_PINS (48) +#define NUM_ANALOG_INPUTS (1) +#define NUM_ANALOG_OUTPUTS (0) + +#define PIN_LED1 -1 +#define PIN_LED2 -1 +#define PIN_LED3 -1 + +// LED +#define POWER_LED (32 + 6) // red +#define LED_POWER (32 + 4) +#define USER_LED (0 + 13) // green +// USB_CHECK +#define USB_CHECK (32 + 3) +#define ADC_V (0 + 8) + +#define LED_RED PIN_LED3 +#define LED_BLUE PIN_LED1 +#define LED_GREEN PIN_LED2 +#define LED_BUILTIN LED_BLUE +#define LED_CONN PIN_GREEN +#define LED_STATE_ON 0 // State when LED is lit // LEDç¯äº®æ—¶çš„çŠ¶æ€ +#define M1_buzzer (0 + 6) +/* + * Buttons + */ +#define PIN_BUTTON2 (32 + 10) +#define PIN_BUTTON1 (32 + 7) + +// #define PIN_BUTTON1 (0 + 11) +// #define PIN_BUTTON1 (32 + 7) + +// #define BUTTON_CLICK_MS 400 +// #define BUTTON_TOUCH_MS 200 + +/* + * Analog pins + */ +#define PIN_A0 (4) // Battery ADC + +#define BATTERY_PIN PIN_A0 + +static const uint8_t A0 = PIN_A0; + +#define ADC_RESOLUTION 14 + +#define PIN_NFC1 (9) +#define PIN_NFC2 (10) + +/*Wire Interfaces*/ +#define WIRE_INTERFACES_COUNT 1 + +#define PIN_WIRE_SDA (26) +#define PIN_WIRE_SCL (27) + +/* touch sensor, active high */ + +#define TP_SER_IO (0 + 11) + +#define PIN_RTC_INT (0 + 16) // Interrupt from the PCF8563 RTC + +/* +External serial flash WP25R1635FZUIL0 +*/ + +// QSPI Pins +#define PIN_QSPI_SCK (32 + 14) +#define PIN_QSPI_CS (32 + 15) +#define PIN_QSPI_IO0 (32 + 12) // MOSI if using two bit interface +#define PIN_QSPI_IO1 (32 + 13) // MISO if using two bit interface +#define PIN_QSPI_IO2 (0 + 7) // WP if using two bit interface (i.e. not used) +#define PIN_QSPI_IO3 (0 + 5) // HOLD if using two bit interface (i.e. not used) + +// On-board QSPI Flash +#define EXTERNAL_FLASH_DEVICES MX25R1635F +#define EXTERNAL_FLASH_USE_QSPI + +/* + * Lora radio + */ +#define SX126X_POWER_EN (0 + 21) +#define USE_SX1262 +#define SX126X_CS (0 + 24) // FIXME - we really should define LORA_CS instead +#define SX126X_DIO1 (0 + 20) +// Note DIO2 is attached internally to the module to an analog switch for TX/RX switching +// #define SX1262_DIO3 (0 + 21) // This is used as an *output* from the sx1262 and connected internally to power the tcxo, do not +// drive from the main +#define SX126X_BUSY (0 + 17) +#define SX126X_RESET (0 + 25) +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 3.3 + +#define PIN_EINK_EN (32 + 11) // Note: this is really just backlight power +#define PIN_EINK_CS (0 + 30) +#define PIN_EINK_BUSY (0 + 3) +#define PIN_EINK_DC (0 + 28) +#define PIN_EINK_RES (0 + 2) +#define PIN_EINK_SCLK (0 + 31) +#define PIN_EINK_MOSI (0 + 29) // also called SDI + +// Controls power for all peripherals (eink + GPS + LoRa + Sensor) +#define PIN_POWER_EN (0 + 12) + +#define USE_EINK + +#define PIN_SPI1_MISO (32 + 7) +#define PIN_SPI1_MOSI PIN_EINK_MOSI +#define PIN_SPI1_SCK PIN_EINK_SCLK + +/* + * GPS pins + */ +// #define HAS_GPS 1 +#define GPS_L76K +#define GPS_BAUDRATE 9600 +#define PIN_GPS_REINIT (32 + 5) // An output to reset L76K GPS. As per datasheet, low for > 100ms will reset the L76K +#define PIN_GPS_STANDBY (32 + 2) // An output to wake GPS, low means allow sleep, high means force wake +// Seems to be missing on this new board +// #define PIN_GPS_PPS (32 + 4) // Pulse per second input from the GPS +#define GPS_TX_PIN (32 + 9) // This is for bits going TOWARDS the CPU +#define GPS_RX_PIN (32 + 8) // This is for bits going TOWARDS the GPS + +#define GPS_THREAD_INTERVAL 50 + +#define PIN_GPS_PPS (32 + 1) // GPS开关判断 + +#define PIN_SERIAL1_RX GPS_TX_PIN +#define PIN_SERIAL1_TX GPS_RX_PIN + +// PCF8563 RTC Module +#define PCF8563_RTC 0x51 + +/* + * SPI Interfaces + */ +#define SPI_INTERFACES_COUNT 2 + +// For LORA, spi 0 +#define PIN_SPI_MISO (0 + 23) +#define PIN_SPI_MOSI (0 + 22) +#define PIN_SPI_SCK (0 + 19) + +#define PIN_PWR_EN (0 + 6) + +// To debug via the segger JLINK console rather than the CDC-ACM serial device +// #define USE_SEGGER + +// Battery +// The battery sense is hooked to pin A0 (4) +// it is defined in the anlaolgue pin section of this file +// and has 12 bit resolution +#define BATTERY_SENSE_RESOLUTION_BITS 12 +#define BATTERY_SENSE_RESOLUTION 4096.0 +#undef AREF_VOLTAGE +#define AREF_VOLTAGE 3.0 +#define VBAT_AR_INTERNAL AR_INTERNAL_3_0 +#define ADC_MULTIPLIER (2.02F) + +// #define HAS_RTC 0 +// #define HAS_SCREEN 0 + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file From 02237f5ac643c7319a2d431cfcf5545e9bc6ac94 Mon Sep 17 00:00:00 2001 From: Austin Date: Fri, 28 Mar 2025 16:59:42 -0400 Subject: [PATCH 331/381] Portduino: Return CH341 Product Strng (#6436) --- src/platform/portduino/PortduinoGlue.cpp | 5 ++++- src/platform/portduino/USBHal.h | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index 9da65c92c..7b13971b4 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -210,7 +210,10 @@ void portduinoSetup() } char serial[9] = {0}; ch341Hal->getSerialString(serial, 8); - std::cout << "Serial " << serial << std::endl; + std::cout << "CH341 Serial " << serial << std::endl; + char product_string[96] = {0}; + ch341Hal->getProductString(product_string, 95); + std::cout << "CH341 Product " << product_string << std::endl; if (strlen(serial) == 8 && settingsStrings[mac_address].length() < 12) { uint8_t hash[32] = {0}; memcpy(hash, serial, 8); diff --git a/src/platform/portduino/USBHal.h b/src/platform/portduino/USBHal.h index 0d6b361f4..ce2a5cfd3 100644 --- a/src/platform/portduino/USBHal.h +++ b/src/platform/portduino/USBHal.h @@ -61,6 +61,12 @@ class Ch341Hal : public RadioLibHal strncpy(_serial, pinedio.serial_number, len); } + void getProductString(char *_product_string, size_t len) + { + len = len > 95 ? 95 : len; + strncpy(_product_string, pinedio.product_string, len); + } + void init() override {} void term() override {} From 89cde1a8e61344f1f0ff80a12bd338f587c529a0 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Fri, 28 Mar 2025 22:10:33 +0100 Subject: [PATCH 332/381] udp-multicast: bump platform-native to UDP with error handling support (#6433) Co-authored-by: Ben Meadors --- arch/portduino/portduino.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 55234914f..3b5ec1a9b 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -1,6 +1,6 @@ ; The Portduino based 'native' environment. Currently supported on Linux targets with real LoRa hardware (or simulated). [portduino_base] -platform = https://github.com/meshtastic/platform-native.git#e82ba1a19b6cd1dc55cbde29b33ea8dd0640014f +platform = https://github.com/meshtastic/platform-native.git#c5bd469ab9b5a6966321e09557b27d906961da63 framework = arduino build_src_filter = From 6c7c0770f921b43a189aa96a87e403dfbc62ae53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 29 Mar 2025 01:55:00 +0100 Subject: [PATCH 333/381] add ThinkNode M2 Support (#6354) * [WIP] Base firmware pending support for 2nd button * Update button behaviour. Still WIP * [WIP] Base firmware pending support for 2nd button * Update button behaviour. Still WIP * change env to lowercase Co-authored-by: rcarteraz * yea - well - what else is new? * fix secondary button behavior and update trunk --------- Co-authored-by: rcarteraz --- .trunk/trunk.yaml | 2 +- protobufs | 2 +- src/ButtonThread.cpp | 64 ++++++++++++++++++-- src/ButtonThread.h | 10 ++- src/Power.cpp | 6 +- src/buzz/buzz.cpp | 13 +++- src/buzz/buzz.h | 1 + src/main.cpp | 7 ++- src/platform/esp32/architecture.h | 2 + src/platform/esp32/main-esp32.cpp | 5 ++ src/power.h | 2 +- variants/ELECROW-ThinkNode-M2/pins_arduino.h | 28 +++++++++ variants/ELECROW-ThinkNode-M2/platformio.ini | 7 +++ variants/ELECROW-ThinkNode-M2/variant.h | 64 ++++++++++++++++++++ 14 files changed, 201 insertions(+), 12 deletions(-) create mode 100644 variants/ELECROW-ThinkNode-M2/pins_arduino.h create mode 100644 variants/ELECROW-ThinkNode-M2/platformio.ini create mode 100644 variants/ELECROW-ThinkNode-M2/variant.h diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 71d37bc2e..8f938ce9e 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -12,7 +12,7 @@ lint: - trufflehog@3.88.18 - yamllint@1.37.0 - bandit@1.8.3 - - checkov@3.2.392 + - checkov@3.2.394 - terrascan@1.19.9 - trivy@0.60.0 - taplo@0.9.3 diff --git a/protobufs b/protobufs index b4044f8f9..14ec20586 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit b4044f8f9f3681d4d20521dbe13ee42c96eae353 +Subproject commit 14ec205865592fcfa798065bb001a549fc77b438 diff --git a/src/ButtonThread.cpp b/src/ButtonThread.cpp index 12f81353c..2363f804c 100644 --- a/src/ButtonThread.cpp +++ b/src/ButtonThread.cpp @@ -73,23 +73,28 @@ ButtonThread::ButtonThread() : OSThread("Button") userButton.setDebounceMs(1); userButton.attachDoubleClick(userButtonDoublePressed); userButton.attachMultiClick(userButtonMultiPressed, this); // Reference to instance: get click count from non-static OneButton -#ifndef T_DECK // T-Deck immediately wakes up after shutdown, so disable this function +#if !defined(T_DECK) && \ + !defined( \ + ELECROW_ThinkNode_M2) // T-Deck immediately wakes up after shutdown, Thinknode M2 has this on the smaller ALT button userButton.attachLongPressStart(userButtonPressedLongStart); userButton.attachLongPressStop(userButtonPressedLongStop); #endif #endif #ifdef BUTTON_PIN_ALT - userButtonAlt = OneButton(BUTTON_PIN_ALT, true, true); +#if defined(ELECROW_ThinkNode_M2) + this->userButtonAlt = OneButton(BUTTON_PIN_ALT, false, false); +#else + this->userButtonAlt = OneButton(BUTTON_PIN_ALT, true, true); +#endif #ifdef INPUT_PULLUP_SENSE // Some platforms (nrf52) have a SENSE variant which allows wake from sleep - override what OneButton did pinMode(BUTTON_PIN_ALT, INPUT_PULLUP_SENSE); #endif - userButtonAlt.attachClick(userButtonPressed); + userButtonAlt.attachClick(userButtonPressedScreen); userButtonAlt.setClickMs(BUTTON_CLICK_MS); userButtonAlt.setPressMs(BUTTON_LONGPRESS_MS); userButtonAlt.setDebounceMs(1); - userButtonAlt.attachDoubleClick(userButtonDoublePressed); userButtonAlt.attachLongPressStart(userButtonPressedLongStart); userButtonAlt.attachLongPressStop(userButtonPressedLongStop); #endif @@ -117,6 +122,40 @@ int32_t ButtonThread::runOnce() canSleep = true; // Assume we should not keep the board awake #if defined(BUTTON_PIN) || defined(USERPREFS_BUTTON_PIN) + // #if defined(ELECROW_ThinkNode_M1) || defined(ELECROW_ThinkNode_M2) + // buzzer_updata(); + // if (buttonPressed) { + // buttonPressed = false; // 清除标志 + // LOG_INFO("PIN_BUTTON2 pressed!"); // 䏲壿‰“å°ä¿¡æ¯ + // // off_currentTime = millis(); + // while (digitalRead(PIN_BUTTON2) == HIGH) { + // if (cont < 40) { + // // unsigned long currentTime = millis(); // 获å–当剿—¶é—´ + // // if (currentTime - off_currentTime >= 1000) { + // cont++; + // // off_currentTime = currentTime; + // // } + // delay(100); + // } else { + + // currentState = OFF; + // isBuzzing = false; + // cont = 0; + // BEEP_STATE = false; + // analogWrite(M2_buzzer, 0); + // pinMode(M2_buzzer, INPUT); + // screen->setOn(false); + // cont = 0; + // LOG_INFO("GGGGGGGGGGGGGGGGGGGGGGGGG"); + // pinMode(1, OUTPUT); + // digitalWrite(1, LOW); + // pinMode(6, OUTPUT); + // digitalWrite(6, LOW); + // } + // } + // } + + // #endif userButton.tick(); canSleep &= userButton.isIdle(); #elif defined(ARCH_PORTDUINO) @@ -166,6 +205,14 @@ int32_t ButtonThread::runOnce() break; } + case BUTTON_EVENT_PRESSED_SCREEN: { + // turn screen on or off + screen_flag = !screen_flag; + if (screen) + screen->setOn(screen_flag); + break; + } + case BUTTON_EVENT_DOUBLE_PRESSED: { LOG_BUTTON("Double press!"); service->refreshLocalMeshNode(); @@ -192,7 +239,16 @@ int32_t ButtonThread::runOnce() screen->forceDisplay(true); // Force a new UI frame, then force an EInk update } break; +#elif defined(ELECROW_ThinkNode_M2) + case 3: + LOG_INFO("3 clicks: toggle buzzer"); + buzzer_flag = !buzzer_flag; + if (buzzer_flag) { + playBeep(); + } + break; #endif + #if defined(USE_EINK) && defined(PIN_EINK_EN) // i.e. T-Echo // 4 clicks: toggle backlight case 4: diff --git a/src/ButtonThread.h b/src/ButtonThread.h index 54b833d03..a8f1f77c3 100644 --- a/src/ButtonThread.h +++ b/src/ButtonThread.h @@ -24,6 +24,7 @@ class ButtonThread : public concurrency::OSThread enum ButtonEventType { BUTTON_EVENT_NONE, BUTTON_EVENT_PRESSED, + BUTTON_EVENT_PRESSED_SCREEN, BUTTON_EVENT_DOUBLE_PRESSED, BUTTON_EVENT_MULTI_PRESSED, BUTTON_EVENT_LONG_PRESSED, @@ -42,7 +43,6 @@ class ButtonThread : public concurrency::OSThread int beforeLightSleep(void *unused); int afterLightSleep(esp_sleep_wakeup_cause_t cause); #endif - private: #if defined(BUTTON_PIN) || defined(ARCH_PORTDUINO) || defined(USERPREFS_BUTTON_PIN) static OneButton userButton; // Static - accessed from an interrupt @@ -64,6 +64,8 @@ class ButtonThread : public concurrency::OSThread // set during IRQ static volatile ButtonEventType btnEvent; + bool buzzer_flag = false; + bool screen_flag = true; // Store click count during callback, for later use volatile int multipressClickCount = 0; @@ -72,6 +74,12 @@ class ButtonThread : public concurrency::OSThread // IRQ callbacks static void userButtonPressed() { btnEvent = BUTTON_EVENT_PRESSED; } + static void userButtonPressedScreen() + { + if (millis() > c_holdOffTime) { + btnEvent = BUTTON_EVENT_PRESSED_SCREEN; + } + } static void userButtonDoublePressed() { btnEvent = BUTTON_EVENT_DOUBLE_PRESSED; } static void userButtonMultiPressed(void *callerThread); // Retrieve click count from non-static Onebutton while still valid static void userButtonPressedLongStart(); diff --git a/src/Power.cpp b/src/Power.cpp index 20447ad63..ec3550869 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -713,7 +713,7 @@ void Power::readPowerStatus() const PowerStatus powerStatus2 = PowerStatus(hasBattery, usbPowered, isCharging, batteryVoltageMv, batteryChargePercent); LOG_DEBUG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d", powerStatus2.getHasUSB(), powerStatus2.getIsCharging(), powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent()); -#if defined(ELECROW_ThinkNode_M1) +#if defined(ELECROW_ThinkNode_M1) || defined(POWER_CFG) power_num = powerStatus2.getBatteryVoltageMv(); #endif newStatus.notifyObservers(&powerStatus2); @@ -759,6 +759,7 @@ void Power::readPowerStatus() // If we have a battery at all and it is less than 0%, force deep sleep if we have more than 10 low readings in // a row. NOTE: min LiIon/LiPo voltage is 2.0 to 2.5V, current OCV min is set to 3100 that is large enough. // + if (batteryLevel && powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) { if (batteryLevel->getBattVoltage() < OCV[NUM_OCV_POINTS - 1]) { low_voltage_counter++; @@ -781,6 +782,9 @@ void Power::readPowerStatus() low_voltage_counter_led3 = low_voltage_counter; #endif } +#ifdef POWER_CFG + low_voltage_counter_led3 = low_voltage_counter; +#endif } } diff --git a/src/buzz/buzz.cpp b/src/buzz/buzz.cpp index 8db9602bc..6ba2f4140 100644 --- a/src/buzz/buzz.cpp +++ b/src/buzz/buzz.cpp @@ -30,8 +30,11 @@ struct ToneDuration { #define NOTE_B3 247 #define NOTE_CS4 277 -const int DURATION_1_8 = 125; // 1/8 note -const int DURATION_1_4 = 250; // 1/4 note +const int DURATION_1_8 = 125; // 1/8 note +const int DURATION_1_4 = 250; // 1/4 note +const int DURATION_1_2 = 500; // 1/2 note +const int DURATION_3_4 = 750; // 1/4 note +const int DURATION_1_1 = 1000; // 1/1 note void playTones(const ToneDuration *tone_durations, int size) { @@ -55,6 +58,12 @@ void playBeep() playTones(melody, sizeof(melody) / sizeof(ToneDuration)); } +void playLongBeep() +{ + ToneDuration melody[] = {{NOTE_B3, DURATION_1_1}}; + playTones(melody, sizeof(melody) / sizeof(ToneDuration)); +} + void playGPSEnableBeep() { ToneDuration melody[] = {{NOTE_C3, DURATION_1_8}, {NOTE_FS3, DURATION_1_4}, {NOTE_CS4, DURATION_1_4}}; diff --git a/src/buzz/buzz.h b/src/buzz/buzz.h index c52c3020c..adeaca73d 100644 --- a/src/buzz/buzz.h +++ b/src/buzz/buzz.h @@ -1,6 +1,7 @@ #pragma once void playBeep(); +void playLongBeep(); void playStartMelody(); void playShutdownMelody(); void playGPSEnableBeep(); diff --git a/src/main.cpp b/src/main.cpp index 2e0470fa1..59cd6d8e9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -262,7 +262,12 @@ void printInfo() #ifndef PIO_UNIT_TESTING void setup() { -// power on peripherals + +#ifdef POWER_CHRG + pinMode(POWER_CHRG, OUTPUT); + digitalWrite(POWER_CHRG, HIGH); +#endif + #if defined(PIN_POWER_EN) pinMode(PIN_POWER_EN, OUTPUT); digitalWrite(PIN_POWER_EN, HIGH); diff --git a/src/platform/esp32/architecture.h b/src/platform/esp32/architecture.h index 631df0fe4..0af6d4d04 100644 --- a/src/platform/esp32/architecture.h +++ b/src/platform/esp32/architecture.h @@ -144,6 +144,8 @@ #define HW_VENDOR meshtastic_HardwareModel_HELTEC_HT62 #elif defined(EBYTE_ESP32_S3) #define HW_VENDOR meshtastic_HardwareModel_EBYTE_ESP32_S3 +#elif defined(ELECROW_ThinkNode_M2) +#define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M2 #elif defined(ESP32_S3_PICO) #define HW_VENDOR meshtastic_HardwareModel_ESP32_S3_PICO #elif defined(SENSELORA_S3) diff --git a/src/platform/esp32/main-esp32.cpp b/src/platform/esp32/main-esp32.cpp index d0fe31f21..ab1e5c922 100644 --- a/src/platform/esp32/main-esp32.cpp +++ b/src/platform/esp32/main-esp32.cpp @@ -109,6 +109,11 @@ void esp32Setup() randomSeed(seed); */ +#ifdef POWER_FULL + pinMode(POWER_FULL, INPUT); + pinMode(7, INPUT); +#endif + LOG_DEBUG("Total heap: %d", ESP.getHeapSize()); LOG_DEBUG("Free heap: %d", ESP.getFreeHeap()); LOG_DEBUG("Total PSRAM: %d", ESP.getPsramSize()); diff --git a/src/power.h b/src/power.h index 78caa8a7d..97944fef7 100644 --- a/src/power.h +++ b/src/power.h @@ -84,7 +84,7 @@ class Power : private concurrency::OSThread void setStatusHandler(meshtastic::PowerStatus *handler) { statusHandler = handler; } const uint16_t OCV[11] = {OCV_ARRAY}; -#if defined(ELECROW_ThinkNode_M1) +#if defined(ELECROW_ThinkNode_M1) || defined(POWER_CFG) uint8_t low_voltage_counter_led3; int power_num = 0; #endif diff --git a/variants/ELECROW-ThinkNode-M2/pins_arduino.h b/variants/ELECROW-ThinkNode-M2/pins_arduino.h new file mode 100644 index 000000000..46415d30f --- /dev/null +++ b/variants/ELECROW-ThinkNode-M2/pins_arduino.h @@ -0,0 +1,28 @@ +// Need this file for ESP32-S3 +// No need to modify this file, changes to pins imported from variant.h +// Most is similar to https://github.com/espressif/arduino-esp32/blob/master/variants/esp32s3/pins_arduino.h + +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include +#include + +#define USB_VID 0x303a +#define USB_PID 0x1001 + +// Serial +static const uint8_t TX = UART_TX; +static const uint8_t RX = UART_RX; + +// Default SPI will be mapped to Radio +static const uint8_t SS = LORA_CS; +static const uint8_t SCK = LORA_SCK; +static const uint8_t MOSI = LORA_MOSI; +static const uint8_t MISO = LORA_MISO; + +// The default Wire will be mapped to PMU and RTC +static const uint8_t SCL = I2C_SCL; +static const uint8_t SDA = I2C_SDA; + +#endif /* Pins_Arduino_h */ diff --git a/variants/ELECROW-ThinkNode-M2/platformio.ini b/variants/ELECROW-ThinkNode-M2/platformio.ini new file mode 100644 index 000000000..c08c94a71 --- /dev/null +++ b/variants/ELECROW-ThinkNode-M2/platformio.ini @@ -0,0 +1,7 @@ +[env:thinknode_m2] +extends = esp32s3_base +board = ESP32-S3-WROOM-1-N4 +build_flags = + ${esp32s3_base.build_flags} + -D ELECROW_ThinkNode_M2 + -I variants/ELECROW-ThinkNode-M2 diff --git a/variants/ELECROW-ThinkNode-M2/variant.h b/variants/ELECROW-ThinkNode-M2/variant.h new file mode 100644 index 000000000..801d5606f --- /dev/null +++ b/variants/ELECROW-ThinkNode-M2/variant.h @@ -0,0 +1,64 @@ +// Status +#define LED_PIN_POWER 1 +#define BIAS_T_ENABLE LED_PIN_POWER +#define BIAS_T_VALUE HIGH + +#define PIN_BUTTON1 47 // 功能键 +#define PIN_BUTTON2 4 // 电æºé”® + +#define POWER_CFG +#define POWER_CHRG 6 +#define POWER_FULL 42 + +#define PIN_BUZZER 5 + +#define I2C_SCL 15 +#define I2C_SDA 16 + +#define UART_TX 43 +#define UART_RX 44 + +#define VEXT_ENABLE 46 // for OLED +#define VEXT_ON_VALUE HIGH + +#define SX126X_CS 10 +#define LORA_SCK 12 +#define LORA_MOSI 11 +#define LORA_MISO 13 +#define SX126X_RESET 21 +#define SX126X_BUSY 14 +#define SX126X_DIO1 3 +#define SX126X_DIO2_AS_RF_SWITCH +// #define SX126X_DIO3 9 +#define SX126X_DIO3_TCXO_VOLTAGE 3.3 + +#define SX126X_MAX_POWER 22 // SX126xInterface.cpp defaults to 22 if not defined, but here we define it for good practice +#define USE_SX1262 +#define LORA_CS SX126X_CS // FIXME: for some reason both are used in /src +#define LORA_DIO1 SX126X_DIO1 +#define SX126X_POWER_EN 48 + +// Battery +// #define BATTERY_PIN 2 +#define BATTERY_PIN 17 +// #define ADC_CHANNEL ADC1_GPIO2_CHANNEL +#define ADC_CHANNEL ADC2_GPIO17_CHANNEL +#define BATTERY_SENSE_RESOLUTION_BITS 12 +#define BATTERY_SENSE_RESOLUTION 4096.0 +#undef AREF_VOLTAGE +#define AREF_VOLTAGE 3.0 +#define VBAT_AR_INTERNAL AR_INTERNAL_3_0 +#define ADC_MULTIPLIER (1.548F) +#define BAT_MEASURE_ADC_UNIT 2 + +#define HAS_SCREEN 1 +#define USE_SH1106 1 + +// PCF8563 RTC Module +// #define PCF8563_RTC 0x51 +// #define PIN_RTC_INT 48 // Interrupt from the PCF8563 RTC +#define HAS_RTC 0 +#define HAS_GPS 0 + +#define BUTTON_PIN PIN_BUTTON1 +#define BUTTON_PIN_ALT PIN_BUTTON2 From c602bfecbd1a6f4c64857fcde6f457322c246ebc Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 28 Mar 2025 20:13:19 -0500 Subject: [PATCH 334/381] Update version.properties --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 9d6d2a464..56a8e4f3a 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 6 -build = 3 +build = 4 From 4a3991a8c6e1e9b16bc80241abbacb71df747728 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 28 Mar 2025 20:14:15 -0500 Subject: [PATCH 335/381] [create-pull-request] automated change (#6438) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protobufs b/protobufs index 14ec20586..f00e96f12 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 14ec205865592fcfa798065bb001a549fc77b438 +Subproject commit f00e96f12da48abfa9a992f8b5546fd75a370250 From 0491c890d72981c360ddbfebbf314060f031c43b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 29 Mar 2025 08:26:30 +0100 Subject: [PATCH 336/381] recognize M1 --- src/platform/nrf52/architecture.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platform/nrf52/architecture.h b/src/platform/nrf52/architecture.h index 1a06f173a..95ed8c617 100644 --- a/src/platform/nrf52/architecture.h +++ b/src/platform/nrf52/architecture.h @@ -54,7 +54,7 @@ #elif defined(TTGO_T_ECHO) #define HW_VENDOR meshtastic_HardwareModel_T_ECHO #elif defined(ELECROW_ThinkNode_M1) -#define HW_VENDOR meshtastic_HardwareModel_NRF52_UNKNOWN // HW_VENDOR meshtastic_HardwareModel_ThinkNode_M1 +#define HW_VENDOR meshtastic_HardwareModel_ThinkNode_M1 #elif defined(NANO_G2_ULTRA) #define HW_VENDOR meshtastic_HardwareModel_NANO_G2_ULTRA #elif defined(CANARYONE) @@ -133,4 +133,4 @@ #if !defined(PIN_SERIAL_RX) && !defined(NRF52840_XXAA) // No serial ports on this board - ONLY use segger in memory console #define USE_SEGGER -#endif \ No newline at end of file +#endif From ea9485657e845fdbcd116d4c584c560f6f955a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 29 Mar 2025 12:19:05 +0100 Subject: [PATCH 337/381] Speed up builds by referencing github zips for shallow checkouts (#6441) * Speed up builds by referencing github zips for shallow checkouts * sadly the zips don't include submodules OR submodule metadata --- arch/esp32/esp32.ini | 6 +++--- arch/esp32/esp32c6.ini | 4 ++-- arch/nrf52/nrf52.ini | 2 +- arch/nrf52/nrf52840.ini | 2 +- arch/portduino/portduino.ini | 4 ++-- arch/rp2xx0/rp2040.ini | 4 ++-- arch/rp2xx0/rp2350.ini | 4 ++-- arch/stm32/stm32.ini | 4 ++-- platformio.ini | 18 +++++++++--------- variants/CDEBYTE_E77-MBL/platformio.ini | 2 -- .../MakePython_nRF52840_eink/platformio.ini | 2 +- .../MakePython_nRF52840_oled/platformio.ini | 2 +- .../crowpanel-esp32s3-5-epaper/platformio.ini | 6 +++--- variants/heltec_mesh_node_t114/platformio.ini | 2 +- .../heltec_vision_master_e213/platformio.ini | 2 +- .../heltec_vision_master_e290/platformio.ini | 2 +- .../heltec_vision_master_t190/platformio.ini | 2 +- variants/heltec_wireless_paper/platformio.ini | 2 +- .../heltec_wireless_paper_v1/platformio.ini | 2 +- variants/meshlink/platformio.ini | 2 +- variants/meshlink_eink/platformio.ini | 2 +- variants/monteops_hw1/platformio.ini | 2 +- variants/radiomaster_900_bandit/platformio.ini | 2 +- variants/rak11310/platformio.ini | 2 +- variants/rak2560/platformio.ini | 2 +- variants/rak4631/platformio.ini | 6 +++--- variants/rak4631_eth_gw/platformio.ini | 6 +++--- variants/rak_wismeshtap/platformio.ini | 2 +- .../seeed-sensecap-indicator/platformio.ini | 6 +++--- variants/t-echo/platformio.ini | 2 +- variants/t-eth-elite/platformio.ini | 2 +- variants/tlora_t3s3_epaper/platformio.ini | 2 +- variants/tracker-t1000-e/platformio.ini | 2 +- 33 files changed, 55 insertions(+), 57 deletions(-) diff --git a/arch/esp32/esp32.ini b/arch/esp32/esp32.ini index 256781ba1..df3778002 100644 --- a/arch/esp32/esp32.ini +++ b/arch/esp32/esp32.ini @@ -45,11 +45,11 @@ lib_deps = ${networking_base.lib_deps} ${environmental_base.lib_deps} ${radiolib_base.lib_deps} - https://github.com/meshtastic/esp32_https_server.git#23665b3adc080a311dcbb586ed5941b5f94d6ea2 + https://github.com/meshtastic/esp32_https_server/archive/23665b3adc080a311dcbb586ed5941b5f94d6ea2.zip h2zero/NimBLE-Arduino@^1.4.3 - https://github.com/dbinfrago/libpax.git#3cdc0371c375676a97967547f4065607d4c53fd1 + https://github.com/dbinfrago/libpax/archive/3cdc0371c375676a97967547f4065607d4c53fd1.zip lewisxhe/XPowersLib@^0.2.7 - https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f + https://github.com/meshtastic/ESP32_Codec2/archive/633326c78ac251c059ab3a8c430fcdf25b41672f.zip rweather/Crypto@^0.4.0 lib_ignore = diff --git a/arch/esp32/esp32c6.ini b/arch/esp32/esp32c6.ini index d0425812f..dba3bac08 100644 --- a/arch/esp32/esp32c6.ini +++ b/arch/esp32/esp32c6.ini @@ -1,6 +1,6 @@ [esp32c6_base] extends = esp32_base -platform = https://github.com/Jason2866/platform-espressif32.git#22faa566df8c789000f8136cd8d0aca49617af55 +platform = https://github.com/Jason2866/platform-espressif32/archive/22faa566df8c789000f8136cd8d0aca49617af55.zip build_flags = ${arduino_base.build_flags} -Wall @@ -25,7 +25,7 @@ lib_deps = ${environmental_base.lib_deps} ${radiolib_base.lib_deps} lewisxhe/XPowersLib@^0.2.7 - https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f + https://github.com/meshtastic/ESP32_Codec2/archive/633326c78ac251c059ab3a8c430fcdf25b41672f.zip rweather/Crypto@^0.4.0 build_src_filter = diff --git a/arch/nrf52/nrf52.ini b/arch/nrf52/nrf52.ini index d4e88af1f..310967e49 100644 --- a/arch/nrf52/nrf52.ini +++ b/arch/nrf52/nrf52.ini @@ -4,7 +4,7 @@ platform = platformio/nordicnrf52@^10.7.0 extends = arduino_base platform_packages = ; our custom Git version until they merge our PR - platformio/framework-arduinoadafruitnrf52 @ https://github.com/meshtastic/Adafruit_nRF52_Arduino.git#e13f5820002a4fb2a5e6754b42ace185277e5adf + platformio/framework-arduinoadafruitnrf52 @ https://github.com/meshtastic/Adafruit_nRF52_Arduino#e13f5820002a4fb2a5e6754b42ace185277e5adf platformio/toolchain-gccarmnoneeabi@~1.90301.0 build_type = debug diff --git a/arch/nrf52/nrf52840.ini b/arch/nrf52/nrf52840.ini index a13a600f3..0dab5d9ba 100644 --- a/arch/nrf52/nrf52840.ini +++ b/arch/nrf52/nrf52840.ini @@ -6,7 +6,7 @@ build_flags = ${nrf52_base.build_flags} lib_deps = ${nrf52_base.lib_deps} ${environmental_base.lib_deps} - https://github.com/Kongduino/Adafruit_nRFCrypto.git#e31a8825ea3300b163a0a3c1ddd5de34e10e1371 + https://github.com/Kongduino/Adafruit_nRFCrypto/archive/e31a8825ea3300b163a0a3c1ddd5de34e10e1371.zip ; Common NRF52 debugging settings follow. See the Meshtastic developer docs for how to connect SWD debugging probes to your board. diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index 3b5ec1a9b..e0488aeff 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -1,6 +1,6 @@ ; The Portduino based 'native' environment. Currently supported on Linux targets with real LoRa hardware (or simulated). [portduino_base] -platform = https://github.com/meshtastic/platform-native.git#c5bd469ab9b5a6966321e09557b27d906961da63 +platform = https://github.com/meshtastic/platform-native/archive/c5bd469ab9b5a6966321e09557b27d906961da63.zip framework = arduino build_src_filter = @@ -26,7 +26,7 @@ lib_deps = ${radiolib_base.lib_deps} rweather/Crypto@^0.4.0 lovyan03/LovyanGFX@^1.2.0 - https://github.com/pine64/libch341-spi-userspace#a9b17e3452f7fb747000d9b4ad4409155b39f6ef + https://github.com/pine64/libch341-spi-userspace/archive/a9b17e3452f7fb747000d9b4ad4409155b39f6ef.zip build_flags = ${arduino_base.build_flags} diff --git a/arch/rp2xx0/rp2040.ini b/arch/rp2xx0/rp2040.ini index 1542dbee7..33fcfb211 100644 --- a/arch/rp2xx0/rp2040.ini +++ b/arch/rp2xx0/rp2040.ini @@ -1,8 +1,8 @@ ; Common settings for rp2040 Processor based targets [rp2040_base] -platform = https://github.com/maxgerhardt/platform-raspberrypi.git#76ecf3c7e9dd4503af0331154c4ca1cddc4b03e5 ; For arduino-pico >= 4.4.3 +platform = https://github.com/maxgerhardt/platform-raspberrypi#76ecf3c7e9dd4503af0331154c4ca1cddc4b03e5 ; For arduino-pico >= 4.4.3 extends = arduino_base -platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#4.4.3 +platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico#4.4.3 board_build.core = earlephilhower board_build.filesystem_size = 0.5m diff --git a/arch/rp2xx0/rp2350.ini b/arch/rp2xx0/rp2350.ini index 6f1e4400e..841035c80 100644 --- a/arch/rp2xx0/rp2350.ini +++ b/arch/rp2xx0/rp2350.ini @@ -1,8 +1,8 @@ ; Common settings for rp2040 Processor based targets [rp2350_base] -platform = https://github.com/maxgerhardt/platform-raspberrypi.git#76ecf3c7e9dd4503af0331154c4ca1cddc4b03e5 ; For arduino-pico >= 4.4.3 +platform = https://github.com/maxgerhardt/platform-raspberrypi#76ecf3c7e9dd4503af0331154c4ca1cddc4b03e5 ; For arduino-pico >= 4.4.3 extends = arduino_base -platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#4.4.3 +platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico#4.4.3 board_build.core = earlephilhower board_build.filesystem_size = 0.5m diff --git a/arch/stm32/stm32.ini b/arch/stm32/stm32.ini index d5e615f5f..c1b58bb82 100644 --- a/arch/stm32/stm32.ini +++ b/arch/stm32/stm32.ini @@ -1,7 +1,7 @@ [stm32_base] extends = arduino_base platform = ststm32 -platform_packages = platformio/framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32.git#2.9.0 +platform_packages = platformio/framework-arduinoststm32@https://github.com/stm32duino/Arduino_Core_STM32/archive/2.10.1.zip extra_scripts = ${env.extra_scripts} post:extra_scripts/extra_stm32.py @@ -35,7 +35,7 @@ debug_tool = stlink lib_deps = ${env.lib_deps} ${radiolib_base.lib_deps} - https://github.com/caveman99/Crypto.git#eae9c768054118a9399690f8af202853d1ae8516 + https://github.com/caveman99/Crypto/archive/eae9c768054118a9399690f8af202853d1ae8516.zip lib_ignore = mathertel/OneButton@2.6.1 diff --git a/platformio.ini b/platformio.ini index 542374637..3db4af88d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -56,11 +56,11 @@ build_flags = -Wno-missing-field-initializers monitor_speed = 115200 monitor_filters = direct lib_deps = - https://github.com/meshtastic/esp8266-oled-ssd1306.git#e16cee124fe26490cb14880c679321ad8ac89c95 + https://github.com/meshtastic/esp8266-oled-ssd1306/archive/e16cee124fe26490cb14880c679321ad8ac89c95.zip mathertel/OneButton@2.6.1 - https://github.com/meshtastic/arduino-fsm.git#7db3702bf0cfe97b783d6c72595e3f38e0b19159 - https://github.com/meshtastic/TinyGPSPlus.git#71a82db35f3b973440044c476d4bcdc673b104f4 - https://github.com/meshtastic/ArduinoThread.git#7c3ee9e1951551b949763b1f5280f8db1fa4068d + https://github.com/meshtastic/arduino-fsm/archive/7db3702bf0cfe97b783d6c72595e3f38e0b19159.zip + https://github.com/meshtastic/TinyGPSPlus/archive/71a82db35f3b973440044c476d4bcdc673b104f4.zip + https://github.com/meshtastic/ArduinoThread/archive/7c3ee9e1951551b949763b1f5280f8db1fa4068d.zip nanopb/Nanopb@0.4.91 erriez/ErriezCRC32@1.0.1 @@ -94,7 +94,7 @@ lib_deps = [device-ui_base] lib_deps = - https://github.com/meshtastic/device-ui.git#b1e862e8b2a604a8d911e9d7a27f6e80f1176c21 + https://github.com/meshtastic/device-ui/archive/b1e862e8b2a604a8d911e9d7a27f6e80f1176c21.zip ; Common libs for environmental measurements in telemetry module ; (not included in native / portduino) @@ -127,13 +127,13 @@ lib_deps = ClosedCube OPT3001@1.1.2 emotibit/EmotiBit MLX90632@1.0.8 adafruit/Adafruit MLX90614 Library@2.1.5 - https://github.com/boschsensortec/Bosch-BSEC2-Library#v1.7.2502 + https://github.com/boschsensortec/Bosch-BSEC2-Library/archive/v1.7.2502.zip boschsensortec/BME68x Sensor Library@1.1.40407 - https://github.com/KodinLanewave/INA3221@1.0.1 + https://github.com/KodinLanewave/INA3221/archive/1.0.1.zip mprograms/QMC5883LCompass@1.2.3 dfrobot/DFRobot_RTU@1.0.3 - https://github.com/meshtastic/DFRobot_LarkWeatherStation#4de3a9cadef0f6a5220a8a906cf9775b02b0040d - https://github.com/DFRobot/DFRobot_RainfallSensor#38fea5e02b40a5430be6dab39a99a6f6347d667e + https://github.com/meshtastic/DFRobot_LarkWeatherStation/archive/4de3a9cadef0f6a5220a8a906cf9775b02b0040d.zip + https://github.com/DFRobot/DFRobot_RainfallSensor/archive/38fea5e02b40a5430be6dab39a99a6f6347d667e.zip robtillaart/INA226@0.6.0 ; Health Sensor Libraries diff --git a/variants/CDEBYTE_E77-MBL/platformio.ini b/variants/CDEBYTE_E77-MBL/platformio.ini index 3252a56ea..8a8002086 100644 --- a/variants/CDEBYTE_E77-MBL/platformio.ini +++ b/variants/CDEBYTE_E77-MBL/platformio.ini @@ -1,7 +1,5 @@ [env:CDEBYTE_E77-MBL] extends = stm32_base -; `ebyte_e77_dev` was added in this commit. Remove when a new release is used in the base. -platform = https://github.com/platformio/platform-ststm32.git#3208828db447f4373cd303b7f7393c8fc0dae623 board = ebyte_e77_dev board_upload.maximum_size = 233472 ; reserve the last 28KB for filesystem board_level = extra diff --git a/variants/MakePython_nRF52840_eink/platformio.ini b/variants/MakePython_nRF52840_eink/platformio.ini index b7ce97dcb..9e2d5bbf7 100644 --- a/variants/MakePython_nRF52840_eink/platformio.ini +++ b/variants/MakePython_nRF52840_eink/platformio.ini @@ -11,7 +11,7 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/MakePython_nRF52840_eink - build_src_filter = ${nrf52_base.build_src_filter} +<../variants/MakePython_nRF52840_eink> lib_deps = ${nrf52840_base.lib_deps} - https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f + https://github.com/meshtastic/ESP32_Codec2/archive/633326c78ac251c059ab3a8c430fcdf25b41672f.zip zinggjm/GxEPD2@^1.6.2 debug_tool = jlink ;upload_port = /dev/ttyACM4 \ No newline at end of file diff --git a/variants/MakePython_nRF52840_oled/platformio.ini b/variants/MakePython_nRF52840_oled/platformio.ini index 0146385e0..25dd36c08 100644 --- a/variants/MakePython_nRF52840_oled/platformio.ini +++ b/variants/MakePython_nRF52840_oled/platformio.ini @@ -7,5 +7,5 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/MakePython_nRF52840_oled - build_src_filter = ${nrf52_base.build_src_filter} +<../variants/MakePython_nRF52840_oled> lib_deps = ${nrf52840_base.lib_deps} - https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f + https://github.com/meshtastic/ESP32_Codec2/archive/633326c78ac251c059ab3a8c430fcdf25b41672f.zip debug_tool = jlink diff --git a/variants/crowpanel-esp32s3-5-epaper/platformio.ini b/variants/crowpanel-esp32s3-5-epaper/platformio.ini index c9786690b..f1257a979 100644 --- a/variants/crowpanel-esp32s3-5-epaper/platformio.ini +++ b/variants/crowpanel-esp32s3-5-epaper/platformio.ini @@ -24,7 +24,7 @@ build_flags = ;-DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/GxEPD2 + https://github.com/meshtastic/GxEPD2/archive/33db3fa8ee6fc47d160bdb44f8f127c9a9203a10.zip [env:crowpanel-esp32s3-4-epaper] extends = esp32s3_base @@ -52,7 +52,7 @@ build_flags = ;-DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/GxEPD2 + https://github.com/meshtastic/GxEPD2/archive/33db3fa8ee6fc47d160bdb44f8f127c9a9203a10.zip [env:crowpanel-esp32s3-2-epaper] extends = esp32s3_base @@ -80,4 +80,4 @@ build_flags = ;-DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/GxEPD2 + https://github.com/meshtastic/GxEPD2/archive/33db3fa8ee6fc47d160bdb44f8f127c9a9203a10.zip diff --git a/variants/heltec_mesh_node_t114/platformio.ini b/variants/heltec_mesh_node_t114/platformio.ini index 1b06c7f5e..4f83d8516 100644 --- a/variants/heltec_mesh_node_t114/platformio.ini +++ b/variants/heltec_mesh_node_t114/platformio.ini @@ -14,4 +14,4 @@ build_src_filter = ${nrf52_base.build_src_filter} +<../variants/heltec_mesh_node lib_deps = ${nrf52840_base.lib_deps} lewisxhe/PCF8563_Library@^1.0.1 - https://github.com/meshtastic/st7789#bd33ea58ddfe4a5e4a66d53300ccbd38d66ac21f \ No newline at end of file + https://github.com/meshtastic/st7789/archive/bd33ea58ddfe4a5e4a66d53300ccbd38d66ac21f.zip \ No newline at end of file diff --git a/variants/heltec_vision_master_e213/platformio.ini b/variants/heltec_vision_master_e213/platformio.ini index 4bed30324..037d10168 100644 --- a/variants/heltec_vision_master_e213/platformio.ini +++ b/variants/heltec_vision_master_e213/platformio.ini @@ -16,7 +16,7 @@ build_flags = -DEINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting" lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/GxEPD2#b202ebfec6a4821e098cf7a625ba0f6f2400292d + https://github.com/meshtastic/GxEPD2/archive/b202ebfec6a4821e098cf7a625ba0f6f2400292d.zip lewisxhe/PCF8563_Library@^1.0.1 upload_speed = 115200 diff --git a/variants/heltec_vision_master_e290/platformio.ini b/variants/heltec_vision_master_e290/platformio.ini index d28c2015b..6952e9f9e 100644 --- a/variants/heltec_vision_master_e290/platformio.ini +++ b/variants/heltec_vision_master_e290/platformio.ini @@ -20,7 +20,7 @@ build_flags = lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/GxEPD2#448c8538129fde3d02a7cb5e6fc81971ad92547f + https://github.com/meshtastic/GxEPD2/archive/448c8538129fde3d02a7cb5e6fc81971ad92547f.zip lewisxhe/PCF8563_Library@^1.0.1 upload_speed = 115200 diff --git a/variants/heltec_vision_master_t190/platformio.ini b/variants/heltec_vision_master_t190/platformio.ini index 53b56f57d..7f55a1be7 100644 --- a/variants/heltec_vision_master_t190/platformio.ini +++ b/variants/heltec_vision_master_t190/platformio.ini @@ -9,5 +9,5 @@ build_flags = lib_deps = ${esp32s3_base.lib_deps} lewisxhe/PCF8563_Library@^1.0.1 - https://github.com/meshtastic/st7789#bd33ea58ddfe4a5e4a66d53300ccbd38d66ac21f + https://github.com/meshtastic/st7789/archive/bd33ea58ddfe4a5e4a66d53300ccbd38d66ac21f.zip upload_speed = 921600 \ No newline at end of file diff --git a/variants/heltec_wireless_paper/platformio.ini b/variants/heltec_wireless_paper/platformio.ini index bd25a932a..51430ebff 100644 --- a/variants/heltec_wireless_paper/platformio.ini +++ b/variants/heltec_wireless_paper/platformio.ini @@ -17,7 +17,7 @@ build_flags = -D EINK_HASQUIRK_GHOSTING ; Display model is identified as "prone to ghosting" lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/GxEPD2#b202ebfec6a4821e098cf7a625ba0f6f2400292d + https://github.com/meshtastic/GxEPD2/archive/b202ebfec6a4821e098cf7a625ba0f6f2400292d.zip lewisxhe/PCF8563_Library@^1.0.1 upload_speed = 115200 diff --git a/variants/heltec_wireless_paper_v1/platformio.ini b/variants/heltec_wireless_paper_v1/platformio.ini index ec5fe2408..44b0606af 100644 --- a/variants/heltec_wireless_paper_v1/platformio.ini +++ b/variants/heltec_wireless_paper_v1/platformio.ini @@ -15,6 +15,6 @@ build_flags = -D EINK_LIMIT_GHOSTING_PX=2000 ; (Optional) How much image ghosting is tolerated lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/GxEPD2#55f618961db45a23eff0233546430f1e5a80f63a + https://github.com/meshtastic/GxEPD2/archive/55f618961db45a23eff0233546430f1e5a80f63a.zip lewisxhe/PCF8563_Library@^1.0.1 upload_speed = 115200 \ No newline at end of file diff --git a/variants/meshlink/platformio.ini b/variants/meshlink/platformio.ini index 180dddd49..ec3506b0e 100644 --- a/variants/meshlink/platformio.ini +++ b/variants/meshlink/platformio.ini @@ -23,7 +23,7 @@ build_flags = ${nrf52840_base.build_flags} -I variants/meshlink -D MESHLINK build_src_filter = ${nrf52_base.build_src_filter} +<../variants/meshlink> lib_deps = ${nrf52840_base.lib_deps} - https://github.com/meshtastic/GxEPD2#55f618961db45a23eff0233546430f1e5a80f63a + https://github.com/meshtastic/GxEPD2/archive/55f618961db45a23eff0233546430f1e5a80f63a.zip debug_tool = jlink ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) ; Note: as of 6/2013 the serial/bootloader based programming takes approximately 30 seconds diff --git a/variants/meshlink_eink/platformio.ini b/variants/meshlink_eink/platformio.ini index db3647e73..f8ee96fc3 100644 --- a/variants/meshlink_eink/platformio.ini +++ b/variants/meshlink_eink/platformio.ini @@ -23,7 +23,7 @@ build_flags = ${nrf52840_base.build_flags} -I variants/meshlink_eink -D MESHLINK build_src_filter = ${nrf52_base.build_src_filter} +<../variants/meshlink_eink> lib_deps = ${nrf52840_base.lib_deps} - https://github.com/meshtastic/GxEPD2#55f618961db45a23eff0233546430f1e5a80f63a + https://github.com/meshtastic/GxEPD2/archive/55f618961db45a23eff0233546430f1e5a80f63a.zip debug_tool = jlink ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) ; Note: as of 6/2013 the serial/bootloader based programming takes approximately 30 seconds diff --git a/variants/monteops_hw1/platformio.ini b/variants/monteops_hw1/platformio.ini index eaa246526..1464ca7e7 100644 --- a/variants/monteops_hw1/platformio.ini +++ b/variants/monteops_hw1/platformio.ini @@ -9,7 +9,7 @@ build_src_filter = ${nrf52_base.build_src_filter} +<../variants/monteops_hw1> +< lib_deps = ${nrf52840_base.lib_deps} ${networking_base.lib_deps} - https://github.com/RAKWireless/RAK13800-W5100S.git#1.0.2 + https://github.com/RAKWireless/RAK13800-W5100S/archive/1.0.2.zip debug_tool = jlink ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) ;upload_protocol = jlink diff --git a/variants/radiomaster_900_bandit/platformio.ini b/variants/radiomaster_900_bandit/platformio.ini index 010791d8a..f87025937 100644 --- a/variants/radiomaster_900_bandit/platformio.ini +++ b/variants/radiomaster_900_bandit/platformio.ini @@ -13,4 +13,4 @@ board_build.f_cpu = 240000000L upload_protocol = esptool lib_deps = ${esp32_base.lib_deps} - https://github.com/gjelsoe/STK8xxx-Accelerometer.git#v0.1.1 + https://github.com/gjelsoe/STK8xxx-Accelerometer/archive/v0.1.1.zip diff --git a/variants/rak11310/platformio.ini b/variants/rak11310/platformio.ini index 6e718a651..c87304e61 100644 --- a/variants/rak11310/platformio.ini +++ b/variants/rak11310/platformio.ini @@ -15,6 +15,6 @@ lib_deps = ${rp2040_base.lib_deps} ${networking_base.lib_deps} melopero/Melopero RV3028@^1.1.0 - https://github.com/RAKWireless/RAK13800-W5100S.git#1.0.2 + https://github.com/RAKWireless/RAK13800-W5100S/archive/1.0.2.zip debug_build_flags = ${rp2040_base.build_flags}, -g debug_tool = cmsis-dap ; for e.g. Picotool \ No newline at end of file diff --git a/variants/rak2560/platformio.ini b/variants/rak2560/platformio.ini index 956f573c5..faed231f1 100644 --- a/variants/rak2560/platformio.ini +++ b/variants/rak2560/platformio.ini @@ -15,7 +15,7 @@ lib_deps = ${nrf52840_base.lib_deps} ${networking_base.lib_deps} melopero/Melopero RV3028@^1.1.0 - https://github.com/beegee-tokyo/RAK-OneWireSerial.git#0.0.2 + https://github.com/beegee-tokyo/RAK-OneWireSerial/archive/0.0.2.zip debug_tool = jlink ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) ;upload_protocol = jlink diff --git a/variants/rak4631/platformio.ini b/variants/rak4631/platformio.ini index ced93df66..1c6bdabcf 100644 --- a/variants/rak4631/platformio.ini +++ b/variants/rak4631/platformio.ini @@ -17,9 +17,9 @@ lib_deps = ${nrf52840_base.lib_deps} ${networking_base.lib_deps} melopero/Melopero RV3028@^1.1.0 - https://github.com/RAKWireless/RAK13800-W5100S.git#1.0.2 + https://github.com/RAKWireless/RAK13800-W5100S/archive/1.0.2.zip rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2 - https://github.com/RAKWireless/RAK12034-BMX160.git#dcead07ffa267d3c906e9ca4a1330ab989e957e2 + https://github.com/RAKWireless/RAK12034-BMX160/archive/dcead07ffa267d3c906e9ca4a1330ab989e957e2.zip ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) ; Note: as of 6/2013 the serial/bootloader based programming takes approximately 30 seconds @@ -41,7 +41,7 @@ build_flags = lib_deps = ${env:rak4631.lib_deps} - https://github.com/geeksville/Armduino-Semihosting.git#35b538fdf208c3530c1434cd099a08e486672ee4 + https://github.com/geeksville/Armduino-Semihosting/archive/35b538fdf208c3530c1434cd099a08e486672ee4.zip ; NOTE: the pyocd support for semihosting is buggy. So I switched to using the builtin platformio support for the stlink adapter which worked much better. ; However the built in openocd version in platformio has buggy support for TCP to semihosting. diff --git a/variants/rak4631_eth_gw/platformio.ini b/variants/rak4631_eth_gw/platformio.ini index a624d0381..e3da21c55 100644 --- a/variants/rak4631_eth_gw/platformio.ini +++ b/variants/rak4631_eth_gw/platformio.ini @@ -27,9 +27,9 @@ lib_deps = ${nrf52840_base.lib_deps} ${networking_base.lib_deps} melopero/Melopero RV3028@^1.1.0 - https://github.com/RAKWireless/RAK13800-W5100S.git#1.0.2 + https://github.com/RAKWireless/RAK13800-W5100S/archive/1.0.2.zip rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2 - https://github.com/meshtastic/RAK12034-BMX160.git#4821355fb10390ba8557dc43ca29a023bcfbb9d9 + https://github.com/meshtastic/RAK12034-BMX160/archive/4821355fb10390ba8557dc43ca29a023bcfbb9d9.zip bblanchon/ArduinoJson @ 6.21.4 ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) ; Note: as of 6/2013 the serial/bootloader based programming takes approximately 30 seconds @@ -51,7 +51,7 @@ build_flags = lib_deps = ${env:rak4631_eth_gw.lib_deps} - https://github.com/geeksville/Armduino-Semihosting.git#35b538fdf208c3530c1434cd099a08e486672ee4 + https://github.com/geeksville/Armduino-Semihosting/archive/35b538fdf208c3530c1434cd099a08e486672ee4.zip ; NOTE: the pyocd support for semihosting is buggy. So I switched to using the builtin platformio support for the stlink adapter which worked much better. ; However the built in openocd version in platformio has buggy support for TCP to semihosting. diff --git a/variants/rak_wismeshtap/platformio.ini b/variants/rak_wismeshtap/platformio.ini index bcf46b90d..78472783e 100644 --- a/variants/rak_wismeshtap/platformio.ini +++ b/variants/rak_wismeshtap/platformio.ini @@ -18,7 +18,7 @@ lib_deps = ${nrf52840_base.lib_deps} ${networking_base.lib_deps} melopero/Melopero RV3028@^1.1.0 - https://github.com/RAKWireless/RAK13800-W5100S.git#1.0.2 + https://github.com/RAKWireless/RAK13800-W5100S/archive/1.0.2.zip rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2 bodmer/TFT_eSPI beegee-tokyo/RAKwireless RAK12034@^1.0.0 diff --git a/variants/seeed-sensecap-indicator/platformio.ini b/variants/seeed-sensecap-indicator/platformio.ini index ca1639e4d..fb51d77c3 100644 --- a/variants/seeed-sensecap-indicator/platformio.ini +++ b/variants/seeed-sensecap-indicator/platformio.ini @@ -2,7 +2,7 @@ [env:seeed-sensecap-indicator] extends = esp32s3_base platform_packages = - platformio/framework-arduinoespressif32 @ https://github.com/mverch67/arduino-esp32.git#aef7fef6de3329ed6f75512d46d63bba12b09bb5 ; add_tca9535 (based on 2.0.16) + platformio/framework-arduinoespressif32 @ https://github.com/mverch67/arduino-esp32/archive/aef7fef6de3329ed6f75512d46d63bba12b09bb5.zip ; add_tca9535 (based on 2.0.16) board = seeed-sensecap-indicator board_check = true @@ -24,7 +24,7 @@ build_flags = ${esp32_base.build_flags} -DUSE_ARDUINO_HAL_GPIO lib_deps = ${esp32s3_base.lib_deps} - https://github.com/mverch67/LovyanGFX#4c76238c1344162a234ae917b27651af146d6fb2 + https://github.com/mverch67/LovyanGFX/archive/4c76238c1344162a234ae917b27651af146d6fb2.zip earlephilhower/ESP8266Audio@^1.9.9 earlephilhower/ESP8266SAM@^1.0.1 @@ -70,4 +70,4 @@ build_flags = lib_deps = ${env:seeed-sensecap-indicator.lib_deps} ${device-ui_base.lib_deps} - https://github.com/mverch67/bb_captouch.git#8626412fe650d808a267791c0eae6e5860c85a5d ; alternative touch library supporting FT6x36 + https://github.com/mverch67/bb_captouch/archive/8626412fe650d808a267791c0eae6e5860c85a5d.zip ; alternative touch library supporting FT6x36 diff --git a/variants/t-echo/platformio.ini b/variants/t-echo/platformio.ini index e01befb45..59fd52ccd 100644 --- a/variants/t-echo/platformio.ini +++ b/variants/t-echo/platformio.ini @@ -20,7 +20,7 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/t-echo build_src_filter = ${nrf52_base.build_src_filter} +<../variants/t-echo> lib_deps = ${nrf52840_base.lib_deps} - https://github.com/meshtastic/GxEPD2#55f618961db45a23eff0233546430f1e5a80f63a + https://github.com/meshtastic/GxEPD2/archive/55f618961db45a23eff0233546430f1e5a80f63a.zip lewisxhe/PCF8563_Library@^1.0.1 ;upload_protocol = fs diff --git a/variants/t-eth-elite/platformio.ini b/variants/t-eth-elite/platformio.ini index ec6c82a5d..d6f415f3d 100644 --- a/variants/t-eth-elite/platformio.ini +++ b/variants/t-eth-elite/platformio.ini @@ -14,4 +14,4 @@ lib_ignore = lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/ETHClass2#v1.0.0 + https://github.com/meshtastic/ETHClass2/archive/v1.0.0.zip diff --git a/variants/tlora_t3s3_epaper/platformio.ini b/variants/tlora_t3s3_epaper/platformio.ini index 3f3b3fe50..87351e586 100644 --- a/variants/tlora_t3s3_epaper/platformio.ini +++ b/variants/tlora_t3s3_epaper/platformio.ini @@ -15,4 +15,4 @@ build_flags = lib_deps = ${esp32s3_base.lib_deps} - https://github.com/meshtastic/GxEPD2#b202ebfec6a4821e098cf7a625ba0f6f2400292d + https://github.com/meshtastic/GxEPD2/archive/b202ebfec6a4821e098cf7a625ba0f6f2400292d.zip diff --git a/variants/tracker-t1000-e/platformio.ini b/variants/tracker-t1000-e/platformio.ini index 0bce9fbb5..8c3c97e6c 100644 --- a/variants/tracker-t1000-e/platformio.ini +++ b/variants/tracker-t1000-e/platformio.ini @@ -9,7 +9,7 @@ board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld build_src_filter = ${nrf52_base.build_src_filter} +<../variants/tracker-t1000-e> lib_deps = ${nrf52840_base.lib_deps} - https://github.com/meshtastic/QMA6100P_Arduino_Library.git#14c900b8b2e4feaac5007a7e41e0c1b7f0841136 + https://github.com/meshtastic/QMA6100P_Arduino_Library/archive/14c900b8b2e4feaac5007a7e41e0c1b7f0841136.zip debug_tool = jlink ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) upload_protocol = nrfutil \ No newline at end of file From a902776e578bc2574c95eff8c13402e8cb5f5fbd Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 29 Mar 2025 07:18:03 -0500 Subject: [PATCH 338/381] Try-fix ESP32 wifi disconnects (#6363) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Thomas Göttgens --- src/mesh/wifi/WiFiAPClient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index 4d0b74f7c..e050c2057 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -163,7 +163,7 @@ static int32_t reconnectWiFi() delay(5000); if (!WiFi.isConnected()) { -#ifdef CONFIG_IDF_TARGET_ESP32C3 +#ifdef ARCH_ESP32 WiFi.mode(WIFI_MODE_NULL); WiFi.useStaticBuffers(true); WiFi.mode(WIFI_STA); From 7df327664eba3548ec8d8b2d7cbfe99d3c2352c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 29 Mar 2025 14:13:01 +0100 Subject: [PATCH 339/381] add missing C8H10N4O2 --- src/platform/nrf52/architecture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/nrf52/architecture.h b/src/platform/nrf52/architecture.h index 95ed8c617..4e8823063 100644 --- a/src/platform/nrf52/architecture.h +++ b/src/platform/nrf52/architecture.h @@ -54,7 +54,7 @@ #elif defined(TTGO_T_ECHO) #define HW_VENDOR meshtastic_HardwareModel_T_ECHO #elif defined(ELECROW_ThinkNode_M1) -#define HW_VENDOR meshtastic_HardwareModel_ThinkNode_M1 +#define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M1 #elif defined(NANO_G2_ULTRA) #define HW_VENDOR meshtastic_HardwareModel_NANO_G2_ULTRA #elif defined(CANARYONE) From 3148e7277d41cb1b102bb6376a4d0eb65f4a1a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 29 Mar 2025 14:14:24 +0100 Subject: [PATCH 340/381] Fix a couple of warnings (#6445) * Fix a couple of warnings * fix build error --------- Co-authored-by: Ben Meadors --- src/Power.cpp | 13 ++++++++----- src/gps/GPS.cpp | 11 ++++++----- src/mesh/NodeDB.cpp | 4 ++-- src/mesh/Router.cpp | 4 ++-- src/platform/stm32wl/STM32_LittleFS.h | 2 +- src/platform/stm32wl/STM32_LittleFS_File.cpp | 7 +++---- src/platform/stm32wl/STM32_LittleFS_File.h | 2 +- src/platform/stm32wl/littlefs/lfs.c | 6 +++--- 8 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/Power.cpp b/src/Power.cpp index ec3550869..0dec0fc21 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -533,6 +533,9 @@ Power::Power() : OSThread("Power") { statusHandler = {}; low_voltage_counter = 0; +#if defined(ELECROW_ThinkNode_M1) || defined(POWER_CFG) + low_voltage_counter_led3 = 0; +#endif #ifdef DEBUG_HEAP lastheap = memGet.getFreeHeap(); #endif @@ -668,12 +671,12 @@ void Power::readPowerStatus() int8_t batteryChargePercent = -1; OptionalBool usbPowered = OptUnknown; OptionalBool hasBattery = OptUnknown; // These must be static because NRF_APM code doesn't run every time - OptionalBool isCharging = OptUnknown; + OptionalBool isChargingNow = OptUnknown; if (batteryLevel) { hasBattery = batteryLevel->isBatteryConnect() ? OptTrue : OptFalse; usbPowered = batteryLevel->isVbusIn() ? OptTrue : OptFalse; - isCharging = batteryLevel->isCharging() ? OptTrue : OptFalse; + isChargingNow = batteryLevel->isCharging() ? OptTrue : OptFalse; if (hasBattery) { batteryVoltageMv = batteryLevel->getBattVoltage(); // If the AXP192 returns a valid battery percentage, use it @@ -702,15 +705,15 @@ void Power::readPowerStatus() // If changed to DISCONNECTED if (nrf_usb_state == NRFX_POWER_USB_STATE_DISCONNECTED) - isCharging = usbPowered = OptFalse; + isChargingNow = usbPowered = OptFalse; // If changed to CONNECTED / READY else - isCharging = usbPowered = OptTrue; + isChargingNow = usbPowered = OptTrue; #endif // Notify any status instances that are observing us - const PowerStatus powerStatus2 = PowerStatus(hasBattery, usbPowered, isCharging, batteryVoltageMv, batteryChargePercent); + const PowerStatus powerStatus2 = PowerStatus(hasBattery, usbPowered, isChargingNow, batteryVoltageMv, batteryChargePercent); LOG_DEBUG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d", powerStatus2.getHasUSB(), powerStatus2.getIsCharging(), powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent()); #if defined(ELECROW_ThinkNode_M1) || defined(POWER_CFG) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index c33cb2975..41a2ff980 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -981,15 +981,16 @@ void GPS::down() setPowerState(GPS_IDLE); else { - // Check whether the GPS hardware is capable of GPS_SOFTSLEEP - // If not, fallback to GPS_HARDSLEEP instead +// Check whether the GPS hardware is capable of GPS_SOFTSLEEP +// If not, fallback to GPS_HARDSLEEP instead +#ifdef PIN_GPS_STANDBY // L76B, L76K and clones have a standby pin + bool softsleepSupported = true; +#else bool softsleepSupported = false; +#endif // U-blox is supported via PMREQ if (IS_ONE_OF(gnssModel, GNSS_MODEL_UBLOX6, GNSS_MODEL_UBLOX7, GNSS_MODEL_UBLOX8, GNSS_MODEL_UBLOX9, GNSS_MODEL_UBLOX10)) softsleepSupported = true; -#ifdef PIN_GPS_STANDBY // L76B, L76K and clones have a standby pin - softsleepSupported = true; -#endif if (softsleepSupported) { // How long does gps_update_interval need to be, for GPS_HARDSLEEP to become more efficient than diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index df0fbcedd..3f79d18e6 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -1061,8 +1061,8 @@ void NodeDB::loadFromDisk() // if (state != LoadFileResult::LOAD_SUCCESS) { // installDefaultDeviceState(); // Our in RAM copy might now be corrupt //} else { - if (devicestate.version < DEVICESTATE_MIN_VER) { - LOG_WARN("Devicestate %d is old, discard", devicestate.version); + if ((state != LoadFileResult::LOAD_SUCCESS) || (devicestate.version < DEVICESTATE_MIN_VER)) { + LOG_WARN("Devicestate %d is old or invalid, discard", devicestate.version); installDefaultDeviceState(); } else { LOG_INFO("Loaded saved devicestate version %d", devicestate.version); diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index 992f38ff4..b8b7ee610 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -188,7 +188,7 @@ ErrorCode Router::sendLocal(meshtastic_MeshPacket *p, RxSource src) // don't override if a channel was requested and no need to set it when PKI is enforced if (!p->channel && !p->pki_encrypted && !isBroadcast(p->to)) { - meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(p->to); + meshtastic_NodeInfoLite const *node = nodeDB->getMeshNode(p->to); if (node) { p->channel = node->channel; LOG_DEBUG("localSend to channel %d", p->channel); @@ -688,7 +688,7 @@ void Router::perhapsHandleReceived(meshtastic_MeshPacket *p) return; } - meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(p->from); + meshtastic_NodeInfoLite const *node = nodeDB->getMeshNode(p->from); if (node != NULL && node->is_ignored) { LOG_DEBUG("Ignore msg, 0x%x is ignored", p->from); packetPool.release(p); diff --git a/src/platform/stm32wl/STM32_LittleFS.h b/src/platform/stm32wl/STM32_LittleFS.h index 2ab531ee5..9460ffa81 100644 --- a/src/platform/stm32wl/STM32_LittleFS.h +++ b/src/platform/stm32wl/STM32_LittleFS.h @@ -37,7 +37,7 @@ class STM32_LittleFS { public: STM32_LittleFS(void); - STM32_LittleFS(struct lfs_config *cfg); + explicit STM32_LittleFS(struct lfs_config *cfg); virtual ~STM32_LittleFS(); bool begin(struct lfs_config *cfg = NULL); diff --git a/src/platform/stm32wl/STM32_LittleFS_File.cpp b/src/platform/stm32wl/STM32_LittleFS_File.cpp index 5e2d4c86c..349187a02 100644 --- a/src/platform/stm32wl/STM32_LittleFS_File.cpp +++ b/src/platform/stm32wl/STM32_LittleFS_File.cpp @@ -217,9 +217,9 @@ int File::available(void) _fs->_lockFS(); if (!this->_is_dir) { - uint32_t size = lfs_file_size(_fs->_getFS(), _file); + uint32_t file_size = lfs_file_size(_fs->_getFS(), _file); uint32_t pos = lfs_file_tell(_fs->_getFS(), _file); - ret = size - pos; + ret = file_size - pos; } _fs->_unlockFS(); @@ -279,10 +279,9 @@ bool File::truncate(uint32_t pos) bool File::truncate(void) { int32_t ret = LFS_ERR_ISDIR; - uint32_t pos; _fs->_lockFS(); if (!this->_is_dir) { - pos = lfs_file_tell(_fs->_getFS(), _file); + uint32_t pos = lfs_file_tell(_fs->_getFS(), _file); ret = lfs_file_truncate(_fs->_getFS(), _file, pos); } _fs->_unlockFS(); diff --git a/src/platform/stm32wl/STM32_LittleFS_File.h b/src/platform/stm32wl/STM32_LittleFS_File.h index 0a021dc54..2b48b02e0 100644 --- a/src/platform/stm32wl/STM32_LittleFS_File.h +++ b/src/platform/stm32wl/STM32_LittleFS_File.h @@ -42,7 +42,7 @@ enum { class File : public Stream { public: - File(STM32_LittleFS &fs); + explicit File(STM32_LittleFS &fs); File(char const *filename, uint8_t mode, STM32_LittleFS &fs); public: diff --git a/src/platform/stm32wl/littlefs/lfs.c b/src/platform/stm32wl/littlefs/lfs.c index 522614486..99c8b155e 100644 --- a/src/platform/stm32wl/littlefs/lfs.c +++ b/src/platform/stm32wl/littlefs/lfs.c @@ -863,7 +863,7 @@ static int lfs_dir_find(lfs_t *lfs, lfs_dir_t *dir, lfs_entry_t *entry, const ch // check that entry has not been moved if (entry->d.type & 0x80) { int moved = lfs_moved(lfs, &entry->d.u); - if (moved < 0 || moved) { + if (moved) { return (moved < 0) ? moved : LFS_ERR_NOENT; } @@ -1057,7 +1057,7 @@ int lfs_dir_seek(lfs_t *lfs, lfs_dir_t *dir, lfs_off_t off) return 0; } -lfs_soff_t lfs_dir_tell(lfs_t *lfs, lfs_dir_t *dir) +lfs_soff_t lfs_dir_tell(lfs_t *lfs, lfs_dir_t const *dir) { (void)lfs; return dir->pos; @@ -1755,7 +1755,7 @@ int lfs_file_truncate(lfs_t *lfs, lfs_file_t *file, lfs_off_t size) return 0; } -lfs_soff_t lfs_file_tell(lfs_t *lfs, lfs_file_t *file) +lfs_soff_t lfs_file_tell(lfs_t *lfs, lfs_file_t const *file) { (void)lfs; return file->pos; From d663d4464744e10e89e01eff7c62db1d94315414 Mon Sep 17 00:00:00 2001 From: Jason P Date: Sat, 29 Mar 2025 08:21:57 -0500 Subject: [PATCH 341/381] Fix Bold and Inverted Displays to actually show Uptime (#6413) Co-authored-by: Ben Meadors --- src/graphics/Screen.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 635cd5164..e27495f54 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -2669,14 +2669,19 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat // minutes %= 60; // hours %= 24; + // Show uptime as days, hours, minutes OR seconds + std::string uptime = screen->drawTimeDelta(days, hours, minutes, seconds); + + // Line 1 (Still) + display->drawString(x + SCREEN_WIDTH - display->getStringWidth(uptime.c_str()), y, uptime.c_str()); + if (config.display.heading_bold) + display->drawString(x - 1 + SCREEN_WIDTH - display->getStringWidth(uptime.c_str()), y, uptime.c_str()); + display->setColor(WHITE); // Setup string to assemble analogClock string std::string analogClock = ""; - // Show uptime as days, hours, minutes OR seconds - std::string uptime = screen->drawTimeDelta(days, hours, minutes, seconds); - uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice, true); // Display local timezone if (rtc_sec > 0) { long hms = rtc_sec % SEC_PER_DAY; @@ -2709,9 +2714,6 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat analogClock += timebuf; } - // Line 1 - display->drawString(x + SCREEN_WIDTH - display->getStringWidth(uptime.c_str()), y, uptime.c_str()); - // Line 2 display->drawString(x, y + FONT_HEIGHT_SMALL * 1, analogClock.c_str()); @@ -2733,7 +2735,7 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat drawGPSpowerstat(display, x, y + FONT_HEIGHT_SMALL * 2, gpsStatus); } #endif - /* Display a heartbeat pixel that blinks every time the frame is redrawn */ +/* Display a heartbeat pixel that blinks every time the frame is redrawn */ #ifdef SHOW_REDRAWS if (heartbeat) display->setPixel(0, 0); From cbcdc3ed00a3573784a43dae9d4909e4e11fb8fb Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 29 Mar 2025 14:30:59 -0500 Subject: [PATCH 342/381] fix STM32 build (#6455) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Thomas Göttgens --- src/platform/stm32wl/littlefs/lfs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platform/stm32wl/littlefs/lfs.h b/src/platform/stm32wl/littlefs/lfs.h index f243c404b..398f3b0f3 100644 --- a/src/platform/stm32wl/littlefs/lfs.h +++ b/src/platform/stm32wl/littlefs/lfs.h @@ -389,7 +389,7 @@ int lfs_file_truncate(lfs_t *lfs, lfs_file_t *file, lfs_off_t size); // // Equivalent to lfs_file_seek(lfs, file, 0, LFS_SEEK_CUR) // Returns the position of the file, or a negative error code on failure. -lfs_soff_t lfs_file_tell(lfs_t *lfs, lfs_file_t *file); +lfs_soff_t lfs_file_tell(lfs_t *lfs, const lfs_file_t *file); // Change the position of the file to the beginning of the file // @@ -442,7 +442,7 @@ int lfs_dir_seek(lfs_t *lfs, lfs_dir_t *dir, lfs_off_t off); // sense, but does indicate the current position in the directory iteration. // // Returns the position of the directory, or a negative error code on failure. -lfs_soff_t lfs_dir_tell(lfs_t *lfs, lfs_dir_t *dir); +lfs_soff_t lfs_dir_tell(lfs_t *lfs, lfs_dir_t const *dir); // Change the position of the directory to the beginning of the directory // From 8a4a0cc932d39226f975e697bd9b4d4e86368183 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 29 Mar 2025 14:32:56 -0500 Subject: [PATCH 343/381] Remove unused lfs_dir_tell function --- src/platform/stm32wl/littlefs/lfs.c | 6 ------ src/platform/stm32wl/littlefs/lfs.h | 8 -------- 2 files changed, 14 deletions(-) diff --git a/src/platform/stm32wl/littlefs/lfs.c b/src/platform/stm32wl/littlefs/lfs.c index 99c8b155e..5dc4c7669 100644 --- a/src/platform/stm32wl/littlefs/lfs.c +++ b/src/platform/stm32wl/littlefs/lfs.c @@ -1057,12 +1057,6 @@ int lfs_dir_seek(lfs_t *lfs, lfs_dir_t *dir, lfs_off_t off) return 0; } -lfs_soff_t lfs_dir_tell(lfs_t *lfs, lfs_dir_t const *dir) -{ - (void)lfs; - return dir->pos; -} - int lfs_dir_rewind(lfs_t *lfs, lfs_dir_t *dir) { // reload the head dir diff --git a/src/platform/stm32wl/littlefs/lfs.h b/src/platform/stm32wl/littlefs/lfs.h index 398f3b0f3..c6ed1d622 100644 --- a/src/platform/stm32wl/littlefs/lfs.h +++ b/src/platform/stm32wl/littlefs/lfs.h @@ -436,14 +436,6 @@ int lfs_dir_read(lfs_t *lfs, lfs_dir_t *dir, struct lfs_info *info); // Returns a negative error code on failure. int lfs_dir_seek(lfs_t *lfs, lfs_dir_t *dir, lfs_off_t off); -// Return the position of the directory -// -// The returned offset is only meant to be consumed by seek and may not make -// sense, but does indicate the current position in the directory iteration. -// -// Returns the position of the directory, or a negative error code on failure. -lfs_soff_t lfs_dir_tell(lfs_t *lfs, lfs_dir_t const *dir); - // Change the position of the directory to the beginning of the directory // // Returns a negative error code on failure. From b89355ffa60b3893417004b07e7b96f04b17022c Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Sat, 29 Mar 2025 21:44:13 +0100 Subject: [PATCH 344/381] MUI: node list <-> map navigation (#6456) device-ui lib update: - node list <-> map navigation - customizable boot logo / screen --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 3db4af88d..52532410d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -94,7 +94,7 @@ lib_deps = [device-ui_base] lib_deps = - https://github.com/meshtastic/device-ui/archive/b1e862e8b2a604a8d911e9d7a27f6e80f1176c21.zip + https://github.com/meshtastic/device-ui/archive/99171e87a70452395b56cce713a951c1c2964370.zip ; Common libs for environmental measurements in telemetry module ; (not included in native / portduino) From 38c8c20a2bf108dcef242074c1835ae522cf2c4c Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 30 Mar 2025 08:12:56 -0500 Subject: [PATCH 345/381] Update version.properties --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 56a8e4f3a..0b46aeec6 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 6 -build = 4 +build = 5 From a93d779ec0a0eb44262015f6b2e6bbfee82621af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sun, 30 Mar 2025 15:13:18 +0200 Subject: [PATCH 346/381] Update library deps and nrf Toolchain (#6450) --- arch/nrf52/nrf52.ini | 2 +- platformio.ini | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/nrf52/nrf52.ini b/arch/nrf52/nrf52.ini index 310967e49..ca12be6b1 100644 --- a/arch/nrf52/nrf52.ini +++ b/arch/nrf52/nrf52.ini @@ -1,6 +1,6 @@ [nrf52_base] ; Instead of the standard nordicnrf52 platform, we use our fork which has our added variant files -platform = platformio/nordicnrf52@^10.7.0 +platform = platformio/nordicnrf52@^10.8.0 extends = arduino_base platform_packages = ; our custom Git version until they merge our PR diff --git a/platformio.ini b/platformio.ini index 52532410d..010aea90f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -100,12 +100,12 @@ lib_deps = ; (not included in native / portduino) [environmental_base] lib_deps = - adafruit/Adafruit BusIO@1.16.2 - adafruit/Adafruit Unified Sensor@1.1.14 + adafruit/Adafruit BusIO@1.17.0 + adafruit/Adafruit Unified Sensor@1.1.15 adafruit/Adafruit BMP280 Library@2.6.8 adafruit/Adafruit BMP085 Library@1.2.4 adafruit/Adafruit BME280 Library@2.2.4 - adafruit/Adafruit BMP3XX Library@2.1.5 + adafruit/Adafruit BMP3XX Library@2.1.6 adafruit/Adafruit DPS310@1.1.5 adafruit/Adafruit MCP9808 Library@2.0.2 adafruit/Adafruit INA260 Library@1.5.2 @@ -114,16 +114,16 @@ lib_deps = adafruit/Adafruit SHTC3 Library@1.0.1 adafruit/Adafruit LPS2X@2.0.6 adafruit/Adafruit SHT31 Library@2.2.2 - adafruit/Adafruit PM25 AQI Sensor@1.1.1 + adafruit/Adafruit PM25 AQI Sensor@1.2.0 adafruit/Adafruit MPU6050@2.2.6 adafruit/Adafruit LIS3DH@1.3.0 adafruit/Adafruit AHTX0@2.0.5 - adafruit/Adafruit LSM6DS@4.7.3 + adafruit/Adafruit LSM6DS@4.7.4 adafruit/Adafruit VEML7700 Library@2.1.6 adafruit/Adafruit SHT4x Library@1.0.5 adafruit/Adafruit TSL2591 Library@1.4.5 sparkfun/SparkFun Qwiic Scale NAU7802 Arduino Library@1.0.6 - sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@1.2.13 + sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@1.3.0 ClosedCube OPT3001@1.1.2 emotibit/EmotiBit MLX90632@1.0.8 adafruit/Adafruit MLX90614 Library@2.1.5 @@ -134,7 +134,7 @@ lib_deps = dfrobot/DFRobot_RTU@1.0.3 https://github.com/meshtastic/DFRobot_LarkWeatherStation/archive/4de3a9cadef0f6a5220a8a906cf9775b02b0040d.zip https://github.com/DFRobot/DFRobot_RainfallSensor/archive/38fea5e02b40a5430be6dab39a99a6f6347d667e.zip - robtillaart/INA226@0.6.0 + robtillaart/INA226@0.6.4 ; Health Sensor Libraries sparkfun/SparkFun MAX3010x Pulse and Proximity Sensor Library@1.1.2 From 32d91ed85944523d358b190c81f5599e70fb2760 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 30 Mar 2025 14:35:51 -0500 Subject: [PATCH 347/381] [create-pull-request] automated change (#6464) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/mesh.pb.h | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/protobufs b/protobufs index f00e96f12..5e032099b 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit f00e96f12da48abfa9a992f8b5546fd75a370250 +Subproject commit 5e032099be353f1bebdda021bf66e2c90943f4dd diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index daee04f90..2f47d5503 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -326,7 +326,9 @@ typedef enum _meshtastic_ExcludedModules { /* Detection Sensor module */ meshtastic_ExcludedModules_DETECTIONSENSOR_CONFIG = 2048, /* Paxcounter module */ - meshtastic_ExcludedModules_PAXCOUNTER_CONFIG = 4096 + meshtastic_ExcludedModules_PAXCOUNTER_CONFIG = 4096, + /* Bluetooth module */ + meshtastic_ExcludedModules_BLUETOOTH_CONFIG = 8192 } meshtastic_ExcludedModules; /* How the location was acquired: manual, onboard GPS, external (EUD) GPS */ @@ -1122,8 +1124,8 @@ extern "C" { #define _meshtastic_CriticalErrorCode_ARRAYSIZE ((meshtastic_CriticalErrorCode)(meshtastic_CriticalErrorCode_FLASH_CORRUPTION_UNRECOVERABLE+1)) #define _meshtastic_ExcludedModules_MIN meshtastic_ExcludedModules_EXCLUDED_NONE -#define _meshtastic_ExcludedModules_MAX meshtastic_ExcludedModules_PAXCOUNTER_CONFIG -#define _meshtastic_ExcludedModules_ARRAYSIZE ((meshtastic_ExcludedModules)(meshtastic_ExcludedModules_PAXCOUNTER_CONFIG+1)) +#define _meshtastic_ExcludedModules_MAX meshtastic_ExcludedModules_BLUETOOTH_CONFIG +#define _meshtastic_ExcludedModules_ARRAYSIZE ((meshtastic_ExcludedModules)(meshtastic_ExcludedModules_BLUETOOTH_CONFIG+1)) #define _meshtastic_Position_LocSource_MIN meshtastic_Position_LocSource_LOC_UNSET #define _meshtastic_Position_LocSource_MAX meshtastic_Position_LocSource_LOC_EXTERNAL From 95523a9659efe2a4e711d7e42f84e1b99f8a4b54 Mon Sep 17 00:00:00 2001 From: Andrew Yong Date: Mon, 31 Mar 2025 08:21:47 +0800 Subject: [PATCH 348/381] Fix: Update xiao_ble E22-900M30S regulatory gain to 7 dB (#6466) Allow 3 dBm increase in power from previous value of 10 dB gain, based on actual measurements from https://github.com/S5NC/EBYTE_ESP32-S3/blob/main/E22-900M30S%20power%20output%20testing.txt Signed-off-by: Andrew Yong --- variants/xiao_ble/variant.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/variants/xiao_ble/variant.h b/variants/xiao_ble/variant.h index a86ddfde2..d00f8be89 100644 --- a/variants/xiao_ble/variant.h +++ b/variants/xiao_ble/variant.h @@ -143,9 +143,10 @@ static const uint8_t SCK = PIN_SPI_SCK; #define SX126X_DIO2_AS_RF_SWITCH #define SX126X_DIO3_TCXO_VOLTAGE 1.8 #ifdef EBYTE_E22_900M30S -// 10dB PA gain and 30dB rated output; based on PA output table from Ebyte Robin -#define REGULATORY_GAIN_LORA 10 -#define SX126X_MAX_POWER 20 +// 10dB PA gain and 30dB rated output; based on measurements from +// https://github.com/S5NC/EBYTE_ESP32-S3/blob/main/E22-900M30S%20power%20output%20testing.txt +#define REGULATORY_GAIN_LORA 7 +#define SX126X_MAX_POWER 22 #endif #ifdef EBYTE_E22_900M33S // 25dB PA gain and 33dB rated output; based on TX Power Curve from E22-900M33S_UserManual_EN_v1.0.pdf From e79d4492e8c56458b75d47d8cb3388a76b85bc39 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 30 Mar 2025 20:33:22 -0500 Subject: [PATCH 349/381] [create-pull-request] automated change (#6468) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/mesh.pb.h | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/protobufs b/protobufs index 5e032099b..484d002a5 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 5e032099be353f1bebdda021bf66e2c90943f4dd +Subproject commit 484d002a52bc20fa9f91ebf1b216d585c5f93a1b diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 2f47d5503..defaaad28 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -327,8 +327,10 @@ typedef enum _meshtastic_ExcludedModules { meshtastic_ExcludedModules_DETECTIONSENSOR_CONFIG = 2048, /* Paxcounter module */ meshtastic_ExcludedModules_PAXCOUNTER_CONFIG = 4096, - /* Bluetooth module */ - meshtastic_ExcludedModules_BLUETOOTH_CONFIG = 8192 + /* Bluetooth config (not technically a module, but used to indicate bluetooth capabilities) */ + meshtastic_ExcludedModules_BLUETOOTH_CONFIG = 8192, + /* Network config (not technically a module, but used to indicate network capabilities) */ + meshtastic_ExcludedModules_NETWORK_CONFIG = 16384 } meshtastic_ExcludedModules; /* How the location was acquired: manual, onboard GPS, external (EUD) GPS */ @@ -1124,8 +1126,8 @@ extern "C" { #define _meshtastic_CriticalErrorCode_ARRAYSIZE ((meshtastic_CriticalErrorCode)(meshtastic_CriticalErrorCode_FLASH_CORRUPTION_UNRECOVERABLE+1)) #define _meshtastic_ExcludedModules_MIN meshtastic_ExcludedModules_EXCLUDED_NONE -#define _meshtastic_ExcludedModules_MAX meshtastic_ExcludedModules_BLUETOOTH_CONFIG -#define _meshtastic_ExcludedModules_ARRAYSIZE ((meshtastic_ExcludedModules)(meshtastic_ExcludedModules_BLUETOOTH_CONFIG+1)) +#define _meshtastic_ExcludedModules_MAX meshtastic_ExcludedModules_NETWORK_CONFIG +#define _meshtastic_ExcludedModules_ARRAYSIZE ((meshtastic_ExcludedModules)(meshtastic_ExcludedModules_NETWORK_CONFIG+1)) #define _meshtastic_Position_LocSource_MIN meshtastic_Position_LocSource_LOC_UNSET #define _meshtastic_Position_LocSource_MAX meshtastic_Position_LocSource_LOC_EXTERNAL From b52c355f2f560078ff27d2516a8b0ae639c3e1b0 Mon Sep 17 00:00:00 2001 From: Mark Trevor Birss Date: Mon, 31 Mar 2025 03:37:08 +0200 Subject: [PATCH 350/381] Update ScreenFonts.h (#6412) --- src/graphics/ScreenFonts.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/graphics/ScreenFonts.h b/src/graphics/ScreenFonts.h index 910d1b0b9..079a3e282 100644 --- a/src/graphics/ScreenFonts.h +++ b/src/graphics/ScreenFonts.h @@ -16,6 +16,10 @@ #include "graphics/fonts/OLEDDisplayFontsCS.h" #endif +#ifdef CROWPANEL_ESP32S3_5_EPAPER +#include "graphics/fonts/EinkDisplayFonts.h" +#endif + #ifdef OLED_PL #define FONT_SMALL_LOCAL ArialMT_Plain_10_PL #else @@ -74,13 +78,12 @@ #endif #if defined(CROWPANEL_ESP32S3_5_EPAPER) -#include "graphics/fonts/EinkDisplayFonts.h" #undef FONT_SMALL #undef FONT_MEDIUM #undef FONT_LARGE -#define FONT_SMALL FONT_LARGE_LOCAL // Height: 30 -#define FONT_MEDIUM FONT_LARGE_LOCAL // Height: 30 -#define FONT_LARGE FONT_LARGE_LOCAL // Height: 30 +#define FONT_SMALL Monospaced_plain_30 +#define FONT_MEDIUM Monospaced_plain_30 +#define FONT_LARGE Monospaced_plain_30 #endif #define _fontHeight(font) ((font)[1] + 1) // height is position 1 From e08177ba986d915894d7f95a6a2b498b6c8fee2e Mon Sep 17 00:00:00 2001 From: Tavis Date: Sun, 30 Mar 2025 15:38:24 -1000 Subject: [PATCH 351/381] update to handle ws80 as well (#6440) Small change to make the string parsing of Name = value less brittle. Adds a function to parse a line without knowing how many spaces are after the = sign. This allows it to also work with the ws80 serial output. --- src/modules/SerialModule.cpp | 127 ++++++++++++++++++++--------------- 1 file changed, 72 insertions(+), 55 deletions(-) diff --git a/src/modules/SerialModule.cpp b/src/modules/SerialModule.cpp index f3f23b080..e088b4612 100644 --- a/src/modules/SerialModule.cpp +++ b/src/modules/SerialModule.cpp @@ -408,6 +408,49 @@ uint32_t SerialModule::getBaudRate() return BAUD; } +// Add this structure to help with parsing WindGust = 24.4 serial lines. +struct ParsedLine { + String name; + String value; +}; + +/** + * Parse a line of format "Name = Value" into name/value pair + * @param line Input line to parse + * @return ParsedLine containing name and value, or empty strings if parse failed + */ +ParsedLine parseLine(const char *line) +{ + ParsedLine result = {"", ""}; + + // Find equals sign + const char *equals = strchr(line, '='); + if (!equals) { + return result; + } + + // Extract name by copying substring + char nameBuf[64]; // Temporary buffer + size_t nameLen = equals - line; + if (nameLen >= sizeof(nameBuf)) { + nameLen = sizeof(nameBuf) - 1; + } + strncpy(nameBuf, line, nameLen); + nameBuf[nameLen] = '\0'; + + // Create trimmed name string + String name = String(nameBuf); + name.trim(); + + // Extract value after equals sign + String value = String(equals + 1); + value.trim(); + + result.name = name; + result.value = value; + return result; +} + /** * Process the received weather station serial data, extract wind, voltage, and temperature information, * calculate averages and send telemetry data over the mesh network. @@ -453,6 +496,7 @@ void SerialModule::processWXSerial() // WindSpeed = 0.5 // WindGust = 0.6 // GXTS04Temp = 24.4 + // Temperature = 23.4 // WS80 // RainIntSum = 0 // Rain = 0.0 @@ -471,75 +515,48 @@ void SerialModule::processWXSerial() memset(line, '\0', sizeof(line)); if (lineEnd - lineStart < sizeof(line) - 1) { memcpy(line, &serialBytes[lineStart], lineEnd - lineStart); - if (strstr(line, "Wind") != NULL) // we have a wind line - { - gotwind = true; - // Find the positions of "=" signs in the line - char *windDirPos = strstr(line, "WindDir = "); - char *windSpeedPos = strstr(line, "WindSpeed = "); - char *windGustPos = strstr(line, "WindGust = "); - if (windDirPos != NULL) { - // Extract data after "=" for WindDir - strlcpy(windDir, windDirPos + 15, sizeof(windDir)); // Add 15 to skip "WindDir = " + ParsedLine parsed = parseLine(line); + if (parsed.name.length() > 0) { + if (parsed.name == "WindDir") { + strlcpy(windDir, parsed.value.c_str(), sizeof(windDir)); double radians = GeoCoord::toRadians(strtof(windDir, nullptr)); dir_sum_sin += sin(radians); dir_sum_cos += cos(radians); dirCount++; - } else if (windSpeedPos != NULL) { - // Extract data after "=" for WindSpeed - strlcpy(windVel, windSpeedPos + 15, sizeof(windVel)); // Add 15 to skip "WindSpeed = " + gotwind = true; + } else if (parsed.name == "WindSpeed") { + strlcpy(windVel, parsed.value.c_str(), sizeof(windVel)); float newv = strtof(windVel, nullptr); velSum += newv; velCount++; - if (newv < lull || lull == -1) + if (newv < lull || lull == -1) { lull = newv; - - } else if (windGustPos != NULL) { - strlcpy(windGust, windGustPos + 15, sizeof(windGust)); // Add 15 to skip "WindSpeed = " + } + gotwind = true; + } else if (parsed.name == "WindGust") { + strlcpy(windGust, parsed.value.c_str(), sizeof(windGust)); float newg = strtof(windGust, nullptr); - if (newg > gust) + if (newg > gust) { gust = newg; - } - - // these are also voltage data we care about possibly - } else if (strstr(line, "BatVoltage") != NULL) { // we have a battVoltage line - char *batVoltagePos = strstr(line, "BatVoltage = "); - if (batVoltagePos != NULL) { - strlcpy(batVoltage, batVoltagePos + 17, sizeof(batVoltage)); // 18 for ws 80, 17 for ws85 + } + gotwind = true; + } else if (parsed.name == "BatVoltage") { + strlcpy(batVoltage, parsed.value.c_str(), sizeof(batVoltage)); batVoltageF = strtof(batVoltage, nullptr); break; // last possible data we want so break - } - } else if (strstr(line, "CapVoltage") != NULL) { // we have a cappVoltage line - char *capVoltagePos = strstr(line, "CapVoltage = "); - if (capVoltagePos != NULL) { - strlcpy(capVoltage, capVoltagePos + 17, sizeof(capVoltage)); // 18 for ws 80, 17 for ws85 + } else if (parsed.name == "CapVoltage") { + strlcpy(capVoltage, parsed.value.c_str(), sizeof(capVoltage)); capVoltageF = strtof(capVoltage, nullptr); - } - // GXTS04Temp = 24.4 - } else if (strstr(line, "GXTS04Temp") != NULL) { // we have a temperature line - char *tempPos = strstr(line, "GXTS04Temp = "); - if (tempPos != NULL) { - strlcpy(temperature, tempPos + 15, sizeof(temperature)); // 15 spaces for ws85 + } else if (parsed.name == "GXTS04Temp" || parsed.name == "Temperature") { + strlcpy(temperature, parsed.value.c_str(), sizeof(temperature)); temperatureF = strtof(temperature, nullptr); - } - - } else if (strstr(line, "RainIntSum") != NULL) { // we have a rainsum line - // LOG_INFO(line); - char *pos = strstr(line, "RainIntSum = "); - if (pos != NULL) { - strlcpy(rainStr, pos + 17, sizeof(rainStr)); // 17 spaces for ws85 + } else if (parsed.name == "RainIntSum") { + strlcpy(rainStr, parsed.value.c_str(), sizeof(rainStr)); rainSum = int(strtof(rainStr, nullptr)); - } - - } else if (strstr(line, "Rain") != NULL) { // we have a rain line - if (strstr(line, "WaveRain") == NULL) { // skip WaveRain lines though. - // LOG_INFO(line); - char *pos = strstr(line, "Rain = "); - if (pos != NULL) { - strlcpy(rainStr, pos + 17, sizeof(rainStr)); // 17 spaces for ws85 - rain = strtof(rainStr, nullptr); - } + } else if (parsed.name == "Rain") { + strlcpy(rainStr, parsed.value.c_str(), sizeof(rainStr)); + rain = strtof(rainStr, nullptr); } } @@ -557,7 +574,7 @@ void SerialModule::processWXSerial() } if (gotwind) { - LOG_INFO("WS85 : %i %.1fg%.1f %.1fv %.1fv %.1fC rain: %.1f, %i sum", atoi(windDir), strtof(windVel, nullptr), + LOG_INFO("WS8X : %i %.1fg%.1f %.1fv %.1fv %.1fC rain: %.1f, %i sum", atoi(windDir), strtof(windVel, nullptr), strtof(windGust, nullptr), batVoltageF, capVoltageF, temperatureF, rain, rainSum); } if (gotwind && !Throttle::isWithinTimespanMs(lastAveraged, averageIntervalMillis)) { @@ -607,7 +624,7 @@ void SerialModule::processWXSerial() m.variant.environment_metrics.wind_lull = lull; m.variant.environment_metrics.has_wind_lull = true; - LOG_INFO("WS85 Transmit speed=%fm/s, direction=%d , lull=%f, gust=%f, voltage=%f temperature=%f", + LOG_INFO("WS8X Transmit speed=%fm/s, direction=%d , lull=%f, gust=%f, voltage=%f temperature=%f", m.variant.environment_metrics.wind_speed, m.variant.environment_metrics.wind_direction, m.variant.environment_metrics.wind_lull, m.variant.environment_metrics.wind_gust, m.variant.environment_metrics.voltage, m.variant.environment_metrics.temperature); From 850d21dcb9b7ab82016a464d6c05e5950da6fb9f Mon Sep 17 00:00:00 2001 From: "Jason B. Cox" Date: Sun, 30 Mar 2025 18:39:01 -0700 Subject: [PATCH 352/381] Add a static_assert to verify assumption about NodeInfoLite size (#6428) Co-authored-by: Ben Meadors --- src/mesh/mesh-pb-constants.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mesh/mesh-pb-constants.h b/src/mesh/mesh-pb-constants.h index 1c86653dc..f748d295e 100644 --- a/src/mesh/mesh-pb-constants.h +++ b/src/mesh/mesh-pb-constants.h @@ -18,6 +18,10 @@ #define MAX_RX_TOPHONE 32 #endif +/// Verify baseline assumption of node size. If it increases, we need to reevaluate +/// the impact of its memory footprint, notably on MAX_NUM_NODES. +static_assert(sizeof(meshtastic_NodeInfoLite) <= 192, "NodeInfoLite size increased. Reconsider impact on MAX_NUM_NODES."); + /// max number of nodes allowed in the nodeDB #ifndef MAX_NUM_NODES #if defined(ARCH_STM32WL) From f18f60cd0b38cb333a6ca2ebcf28669391b50b85 Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 30 Mar 2025 21:47:15 -0400 Subject: [PATCH 353/381] meshtasticd: CH341 / HAT+ Auto Configuration (#6446) --- bin/config-dist.yaml | 6 ++ ...dafruit-RFM9x => lora-Adafruit-RFM9x.yaml} | 0 src/platform/portduino/PortduinoGlue.cpp | 71 +++++++++++++++++-- src/platform/portduino/PortduinoGlue.h | 11 +++ 4 files changed, 84 insertions(+), 4 deletions(-) rename bin/config.d/{lora-Adafruit-RFM9x => lora-Adafruit-RFM9x.yaml} (100%) diff --git a/bin/config-dist.yaml b/bin/config-dist.yaml index da4c192c7..722f80fae 100644 --- a/bin/config-dist.yaml +++ b/bin/config-dist.yaml @@ -6,6 +6,12 @@ ### Including the "Module:" line! --- Lora: + # Default to auto-detecting the module type + # This will be overridden by configs from config.d + Module: auto + +# # Uncomment to enable Simulation mode, or use --sim +# Module: sim # Module: sx1262 # Waveshare SX1302 LISTEN ONLY AT THIS TIME! # CS: 7 diff --git a/bin/config.d/lora-Adafruit-RFM9x b/bin/config.d/lora-Adafruit-RFM9x.yaml similarity index 100% rename from bin/config.d/lora-Adafruit-RFM9x rename to bin/config.d/lora-Adafruit-RFM9x.yaml diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index 7b13971b4..a4050e702 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -33,6 +33,7 @@ std::ofstream traceFile; Ch341Hal *ch341Hal = nullptr; char *configPath = nullptr; char *optionMac = nullptr; +bool forceSimulated = false; // FIXME - move setBluetoothEnable into a HALPlatform class void setBluetoothEnable(bool enable) @@ -61,6 +62,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) case 'c': configPath = arg; break; + case 's': + forceSimulated = true; + break; case 'h': optionMac = arg; break; @@ -78,6 +82,7 @@ void portduinoCustomInit() static struct argp_option options[] = {{"port", 'p', "PORT", 0, "The TCP port to use."}, {"config", 'c', "CONFIG_PATH", 0, "Full path of the .yaml config file to use."}, {"hwid", 'h', "HWID", 0, "The mac address to assign to this virtual machine"}, + {"sim", 's', 0, 0, "Run in Simulated radio mode"}, {0}}; static void *childArguments; static char doc[] = "Meshtastic native build."; @@ -157,7 +162,9 @@ void portduinoSetup() YAML::Node yamlConfig; - if (configPath != nullptr) { + if (forceSimulated == true) { + settingsMap[use_simradio] = true; + } else if (configPath != nullptr) { if (loadConfig(configPath)) { std::cout << "Using " << configPath << " as config file" << std::endl; } else { @@ -179,7 +186,12 @@ void portduinoSetup() exit(EXIT_FAILURE); } } else { - std::cout << "No 'config.yaml' found, running simulated." << std::endl; + std::cout << "No 'config.yaml' found..." << std::endl; + settingsMap[use_simradio] = true; + } + + if (settingsMap[use_simradio] == true) { + std::cout << "Running in simulated mode." << std::endl; settingsMap[maxnodes] = 200; // Default to 200 nodes settingsMap[logoutputlevel] = level_debug; // Default to debug // Set the random seed equal to TCPPort to have a different seed per instance @@ -197,6 +209,56 @@ void portduinoSetup() } } } + + // If LoRa `Module: auto` (default in config.yaml), + // attempt to auto config based on Product Strings + if (settingsMap[use_autoconf] == true) { + char autoconf_product[96] = {0}; + // Try CH341 + try { + std::cout << "autoconf: Looking for CH341 device..." << std::endl; + ch341Hal = + new Ch341Hal(0, settingsStrings[lora_usb_serial_num], settingsMap[lora_usb_vid], settingsMap[lora_usb_pid]); + ch341Hal->getProductString(autoconf_product, 95); + delete ch341Hal; + std::cout << "autoconf: Found CH341 device " << autoconf_product << std::endl; + } catch (...) { + std::cout << "autoconf: Could not locate CH341 device" << std::endl; + } + // Try Pi HAT+ + std::cout << "autoconf: Looking for Pi HAT+..." << std::endl; + if (access("/proc/device-tree/hat/product", R_OK) == 0) { + std::ifstream hatProductFile("/proc/device-tree/hat/product"); + if (hatProductFile.is_open()) { + hatProductFile.read(autoconf_product, 95); + hatProductFile.close(); + } + std::cout << "autoconf: Found Pi HAT+ " << autoconf_product << " at /proc/device-tree/hat/product" << std::endl; + } else { + std::cout << "autoconf: Could not locate Pi HAT+ at /proc/device-tree/hat/product" << std::endl; + } + // Load the config file based on the product string + if (strlen(autoconf_product) > 0) { + // From configProducts map in PortduinoGlue.h + std::string product_config = ""; + try { + product_config = configProducts.at(autoconf_product); + } catch (std::out_of_range &e) { + std::cerr << "autoconf: Unable to find config for " << autoconf_product << std::endl; + exit(EXIT_FAILURE); + } + if (loadConfig(("/etc/meshtasticd/available.d/" + product_config).c_str())) { + std::cout << "autoconf: Using " << product_config << " as config file for " << autoconf_product << std::endl; + } else { + std::cerr << "autoconf: Unable to use " << product_config << " as config file for " << autoconf_product + << std::endl; + exit(EXIT_FAILURE); + } + } else { + std::cerr << "autoconf: Could not locate any devices" << std::endl; + } + } + // if we're using a usermode driver, we need to initialize it here, to get a serial number back for mac address uint8_t dmac[6] = {0}; if (settingsStrings[spidev] == "ch341") { @@ -358,8 +420,9 @@ bool loadConfig(const char *configPath) const struct { configNames cfgName; std::string strName; - } loraModules[] = {{use_rf95, "RF95"}, {use_sx1262, "sx1262"}, {use_sx1268, "sx1268"}, {use_sx1280, "sx1280"}, - {use_lr1110, "lr1110"}, {use_lr1120, "lr1120"}, {use_lr1121, "lr1121"}, {use_llcc68, "LLCC68"}}; + } loraModules[] = {{use_simradio, "sim"}, {use_autoconf, "auto"}, {use_rf95, "RF95"}, {use_sx1262, "sx1262"}, + {use_sx1268, "sx1268"}, {use_sx1280, "sx1280"}, {use_lr1110, "lr1110"}, {use_lr1120, "lr1120"}, + {use_lr1121, "lr1121"}, {use_llcc68, "LLCC68"}}; for (auto &loraModule : loraModules) { settingsMap[loraModule.cfgName] = false; } diff --git a/src/platform/portduino/PortduinoGlue.h b/src/platform/portduino/PortduinoGlue.h index a52ca88f8..a7aea1c3e 100644 --- a/src/platform/portduino/PortduinoGlue.h +++ b/src/platform/portduino/PortduinoGlue.h @@ -1,9 +1,18 @@ #pragma once #include #include +#include #include "platform/portduino/USBHal.h" +// Product strings for auto-configuration +// {"PRODUCT_STRING", "CONFIG.YAML"} +// YAML paths are relative to `meshtastic/available.d` +inline const std::unordered_map configProducts = {{"MESHTOAD", "lora-usb-meshtoad-e22.yaml"}, + {"MESHSTICK", "lora-meshstick-1262.yaml"}, + {"MESHADV-PI", "lora-MeshAdv-900M30S.yaml"}, + {"POWERPI", "lora-MeshAdv-900M30S.yaml"}}; + enum configNames { default_gpiochip, cs_pin, @@ -34,6 +43,8 @@ enum configNames { rf95_max_power, dio2_as_rf_switch, dio3_tcxo_voltage, + use_simradio, + use_autoconf, use_rf95, use_sx1262, use_sx1268, From f626f02005bfafd0553ebebe8d1db251fae7c8e5 Mon Sep 17 00:00:00 2001 From: Plant Daddy <5402293+PlantDaddy@users.noreply.github.com> Date: Mon, 31 Mar 2025 02:14:48 -0500 Subject: [PATCH 354/381] Add 'bluetooth' option to the LilyGo T-Watch-S3 definition. --- boards/t-watch-s3.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/t-watch-s3.json b/boards/t-watch-s3.json index e6e363305..5d4afd322 100644 --- a/boards/t-watch-s3.json +++ b/boards/t-watch-s3.json @@ -23,7 +23,7 @@ "mcu": "esp32s3", "variant": "t-watch-s3" }, - "connectivity": ["wifi"], + "connectivity": ["wifi", "bluetooth"], "debug": { "openocd_target": "esp32s3.cfg" }, From da26ff5b95d6723cd415d0b328d0eaac32e7e87d Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Mon, 31 Mar 2025 20:15:54 +1300 Subject: [PATCH 355/381] feat: more toggles for InkHUD menu (#6469) GPS on/off Wifi off -> Bluetooth on 12 / 24 hour clock --- src/graphics/niche/InkHUD/Applet.cpp | 7 ++- .../InkHUD/Applets/System/Menu/MenuAction.h | 6 +- .../InkHUD/Applets/System/Menu/MenuApplet.cpp | 63 +++++++++++-------- 3 files changed, 47 insertions(+), 29 deletions(-) diff --git a/src/graphics/niche/InkHUD/Applet.cpp b/src/graphics/niche/InkHUD/Applet.cpp index 9fda9a87e..459f30213 100644 --- a/src/graphics/niche/InkHUD/Applet.cpp +++ b/src/graphics/niche/InkHUD/Applet.cpp @@ -582,9 +582,12 @@ std::string InkHUD::Applet::getTimeString(uint32_t epochSeconds) uint32_t hour = hms / SEC_PER_HOUR; uint32_t min = (hms % SEC_PER_HOUR) / SEC_PER_MIN; - // Format the clock string + // Format the clock string, either 12 hour or 24 hour char clockStr[11]; - sprintf(clockStr, "%u:%02u %s", (hour % 12 == 0 ? 12 : hour % 12), min, hour > 11 ? "PM" : "AM"); + if (config.display.use_12h_clock) + sprintf(clockStr, "%u:%02u %s", (hour % 12 == 0 ? 12 : hour % 12), min, hour > 11 ? "PM" : "AM"); + else + sprintf(clockStr, "%02u:%02u", hour, min); return clockStr; } diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h index 6950bb110..4f8205647 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h @@ -22,15 +22,17 @@ enum MenuAction { SEND_POSITION, SHUTDOWN, NEXT_TILE, + TOGGLE_BACKLIGHT, + TOGGLE_GPS, + ENABLE_BLUETOOTH, TOGGLE_APPLET, - ACTIVATE_APPLETS, // Todo: remove? Possible redundant, handled by TOGGLE_APPLET? TOGGLE_AUTOSHOW_APPLET, SET_RECENTS, ROTATE, LAYOUT, TOGGLE_BATTERY_ICON, TOGGLE_NOTIFICATIONS, - TOGGLE_BACKLIGHT, + TOGGLE_12H_CLOCK, }; } // namespace NicheGraphics::InkHUD diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp index 7397f7e9f..4c411bb85 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp @@ -5,8 +5,13 @@ #include "RTC.h" #include "airtime.h" +#include "main.h" #include "power.h" +#if !MESHTASTIC_EXCLUDE_GPS +#include "GPS.h" +#endif + using namespace NicheGraphics; static constexpr uint8_t MENU_TIMEOUT_SEC = 60; // How many seconds before menu auto-closes @@ -161,12 +166,6 @@ void InkHUD::MenuApplet::execute(MenuItem item) case TOGGLE_APPLET: settings->userApplets.active[cursor] = !settings->userApplets.active[cursor]; inkhud->updateAppletSelection(); - // requestUpdate(Drivers::EInk::UpdateTypes::FULL); // Select FULL, seeing how this action doesn't auto exit - break; - - case ACTIVATE_APPLETS: - // Todo: remove this action? Already handled by TOGGLE_APPLET? - inkhud->updateAppletSelection(); break; case TOGGLE_AUTOSHOW_APPLET: @@ -205,6 +204,25 @@ void InkHUD::MenuApplet::execute(MenuItem item) backlight->latch(); break; + case TOGGLE_12H_CLOCK: + config.display.use_12h_clock = !config.display.use_12h_clock; + nodeDB->saveToDisk(SEGMENT_CONFIG); + break; + + case TOGGLE_GPS: + gps->toggleGpsMode(); + nodeDB->saveToDisk(SEGMENT_CONFIG); + break; + + case ENABLE_BLUETOOTH: + // This helps users recover from a bad wifi config + LOG_INFO("Enabling Bluetooth"); + config.network.wifi_enabled = false; + config.bluetooth.enabled = true; + nodeDB->saveToDisk(); + rebootAtMsec = millis() + 2000; + break; + default: LOG_WARN("Action not implemented"); } @@ -242,13 +260,21 @@ void InkHUD::MenuApplet::showPage(MenuPage page) case OPTIONS: // Optional: backlight - if (settings->optionalMenuItems.backlight) { - assert(backlight); + if (settings->optionalMenuItems.backlight) items.push_back(MenuItem(backlight->isLatched() ? "Backlight Off" : "Keep Backlight On", // Label MenuAction::TOGGLE_BACKLIGHT, // Action MenuPage::EXIT // Exit once complete )); - } + + // Optional: GPS + if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_DISABLED) + items.push_back(MenuItem("Enable GPS", MenuAction::TOGGLE_GPS, MenuPage::EXIT)); + if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED) + items.push_back(MenuItem("Disable GPS", MenuAction::TOGGLE_GPS, MenuPage::EXIT)); + + // Optional: Enable Bluetooth, in case of lost wifi connection + if (!config.bluetooth.enabled || config.network.wifi_enabled) + items.push_back(MenuItem("Enable Bluetooth", MenuAction::ENABLE_BLUETOOTH, MenuPage::EXIT)); items.push_back(MenuItem("Applets", MenuPage::APPLETS)); items.push_back(MenuItem("Auto-show", MenuPage::AUTOSHOW)); @@ -260,26 +286,14 @@ void InkHUD::MenuApplet::showPage(MenuPage page) &settings->optionalFeatures.notifications)); items.push_back(MenuItem("Battery Icon", MenuAction::TOGGLE_BATTERY_ICON, MenuPage::OPTIONS, &settings->optionalFeatures.batteryIcon)); - - // TODO - GPS and Wifi switches - /* - // Optional: has GPS - if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_DISABLED) - items.push_back(MenuItem("Enable GPS", MenuPage::EXIT)); // TODO - if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED) - items.push_back(MenuItem("Disable GPS", MenuPage::EXIT)); // TODO - - // Optional: using wifi - if (!config.bluetooth.enabled) - items.push_back(MenuItem("Enable Bluetooth", MenuPage::EXIT)); // TODO: escape hatch if wifi configured wrong - */ - + items.push_back( + MenuItem("12-Hour Clock", MenuAction::TOGGLE_12H_CLOCK, MenuPage::OPTIONS, &config.display.use_12h_clock)); items.push_back(MenuItem("Exit", MenuPage::EXIT)); break; case APPLETS: populateAppletPage(); - items.push_back(MenuItem("Exit", MenuAction::ACTIVATE_APPLETS)); + items.push_back(MenuItem("Exit", MenuPage::EXIT)); break; case AUTOSHOW: @@ -293,7 +307,6 @@ void InkHUD::MenuApplet::showPage(MenuPage page) case EXIT: sendToBackground(); // Menu applet dismissed, allow normal behavior to resume - // requestUpdate(Drivers::EInk::UpdateTypes::FULL); break; default: From bd2d2981c963bcd86fedf727ae15ebb028e68ff3 Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Mon, 31 Mar 2025 20:17:24 +1300 Subject: [PATCH 356/381] Add InkHUD driver for WeAct Studio 4.2" display module (#6384) * chore: todo.txt * chore: InkHUD documentation Word salad for maintainers * refactor: don't init system applets using onActivate System applets cannot be deactivated, so we will avoid using onActivate / onDeactivate methods entirely. * chore: update the example applets * fix: SSD16XX reset pulse Allow time for controller IC to wake. Aligns with manufacturer's suggestions. T-Echo button timing adjusted to prevent bouncing as a result(?) of slightly faster refreshes. * fix: allow timeout if display update fails Result is not graceful, but avoids total display lockup requiring power cycle. Typical cause of failure is poor wiring / power supply. * fix: improve display health on shutdown Two extra full refreshes, masquerading as a "shutting down" screen. One is drawn white-on-black, to really shake the pixels up. * feat: driver for display HINK_E042A87 As of Feb. 2025, these panels are used for "WeActStudio 4.2in B&W" display modules. * fix: inkhud rotation should default to 0 * Revert "chore: todo.txt" This reverts commit bea7df44a7cbf2f92e8c67c965e53d26a7885b11. * fix: more generous timeout for display updates Previously this was tied to the expected duration of the update, but this didn't account for any delay if our polling thread got held up by an unrelated firmware task. * fix: don't use the full shutdown screen during reboot * fix: cooldown period during the display shutdown display sequence Observed to prevent border pixels from being locked in place with some residual charge? --- src/graphics/niche/Drivers/EInk/EInk.cpp | 22 +- src/graphics/niche/Drivers/EInk/EInk.h | 5 +- .../niche/Drivers/EInk/HINK_E042A87.cpp | 58 ++ .../niche/Drivers/EInk/HINK_E042A87.h | 43 ++ src/graphics/niche/Drivers/EInk/README.md | 49 +- src/graphics/niche/Drivers/EInk/SSD16XX.cpp | 34 +- src/graphics/niche/Drivers/EInk/SSD16XX.h | 2 +- src/graphics/niche/InkHUD/Applet.cpp | 16 +- src/graphics/niche/InkHUD/Applet.h | 3 +- .../BasicExample/BasicExampleApplet.cpp | 2 +- .../NewMsgExample/NewMsgExampleApplet.cpp | 5 +- .../InkHUD/Applets/System/Logo/LogoApplet.cpp | 44 +- .../InkHUD/Applets/System/Logo/LogoApplet.h | 2 + .../InkHUD/Applets/System/Menu/MenuApplet.cpp | 2 - .../InkHUD/Applets/System/Menu/MenuApplet.h | 1 - .../InkHUD/Applets/System/Tips/TipsApplet.cpp | 2 - .../InkHUD/Applets/System/Tips/TipsApplet.h | 1 - src/graphics/niche/InkHUD/Events.cpp | 16 +- src/graphics/niche/InkHUD/Persistence.h | 2 +- src/graphics/niche/InkHUD/README.md | 12 - src/graphics/niche/InkHUD/SystemApplet.h | 2 + src/graphics/niche/InkHUD/docs/README.md | 640 ++++++++++++++++++ src/graphics/niche/InkHUD/docs/appletfont.png | Bin 0 -> 7797 bytes src/graphics/niche/InkHUD/docs/disclaimer.jpg | Bin 0 -> 17942 bytes src/graphics/niche/InkHUD/docs/rendering.gif | Bin 0 -> 78402 bytes .../niche/InkHUD/docs/tile_translation.png | Bin 0 -> 5832 bytes .../heltec_vision_master_e213/nicheGraphics.h | 19 +- .../heltec_vision_master_e290/nicheGraphics.h | 26 +- .../heltec_wireless_paper/nicheGraphics.h | 21 +- variants/t-echo/nicheGraphics.h | 4 +- 30 files changed, 945 insertions(+), 88 deletions(-) create mode 100644 src/graphics/niche/Drivers/EInk/HINK_E042A87.cpp create mode 100644 src/graphics/niche/Drivers/EInk/HINK_E042A87.h delete mode 100644 src/graphics/niche/InkHUD/README.md create mode 100644 src/graphics/niche/InkHUD/docs/README.md create mode 100644 src/graphics/niche/InkHUD/docs/appletfont.png create mode 100644 src/graphics/niche/InkHUD/docs/disclaimer.jpg create mode 100644 src/graphics/niche/InkHUD/docs/rendering.gif create mode 100644 src/graphics/niche/InkHUD/docs/tile_translation.png diff --git a/src/graphics/niche/Drivers/EInk/EInk.cpp b/src/graphics/niche/Drivers/EInk/EInk.cpp index 043788b13..cd2e9dc98 100644 --- a/src/graphics/niche/Drivers/EInk/EInk.cpp +++ b/src/graphics/niche/Drivers/EInk/EInk.cpp @@ -6,7 +6,7 @@ using namespace NicheGraphics::Drivers; // Separate from EInk::begin method, as derived class constructors can probably supply these parameters as constants EInk::EInk(uint16_t width, uint16_t height, UpdateTypes supported) - : concurrency::OSThread("E-Ink Driver"), width(width), height(height), supportedUpdateTypes(supported) + : concurrency::OSThread("EInkDriver"), width(width), height(height), supportedUpdateTypes(supported) { OSThread::disable(); } @@ -31,8 +31,8 @@ bool EInk::supports(UpdateTypes type) void EInk::beginPolling(uint32_t interval, uint32_t expectedDuration) { updateRunning = true; - updateBegunAt = millis(); pollingInterval = interval; + pollingBegunAt = millis(); // To minimize load, we can choose to delay polling for a few seconds, if we know roughly how long the update will take // By default, expectedDuration is 0, and we'll start polling immediately @@ -45,10 +45,26 @@ void EInk::beginPolling(uint32_t interval, uint32_t expectedDuration) // This is what allows us to update the display asynchronously int32_t EInk::runOnce() { + // Check for polling timeout + // Manually set at 10 seconds, in case some big task holds up the firmware's cooperative multitasking + if (millis() - pollingBegunAt > 10000) + failed = true; + + // Handle failure + // - polling timeout + // - other error (derived classes) + if (failed) { + LOG_WARN("Display update failed. Check wiring & power supply."); + updateRunning = false; + failed = false; + return disable(); + } + + // If update not yet done if (!isUpdateDone()) return pollingInterval; // Poll again in a few ms - // If update done: + // If update done finalizeUpdate(); // Any post-update code: power down panel hardware, hibernate, etc updateRunning = false; // Change what we report via EInk::busy() return disable(); // Stop polling diff --git a/src/graphics/niche/Drivers/EInk/EInk.h b/src/graphics/niche/Drivers/EInk/EInk.h index facb8ce72..3c51d4f1d 100644 --- a/src/graphics/niche/Drivers/EInk/EInk.h +++ b/src/graphics/niche/Drivers/EInk/EInk.h @@ -24,7 +24,7 @@ class EInk : private concurrency::OSThread enum UpdateTypes : uint8_t { UNSPECIFIED = 0, FULL = 1 << 0, - FAST = 1 << 1, + FAST = 1 << 1, // "Partial Refresh" }; EInk(uint16_t width, uint16_t height, UpdateTypes supported); @@ -41,14 +41,15 @@ class EInk : private concurrency::OSThread void beginPolling(uint32_t interval, uint32_t expectedDuration); // Begin checking repeatedly if update finished virtual bool isUpdateDone() = 0; // Check once if update finished virtual void finalizeUpdate() {} // Run any post-update code + bool failed = false; // If an error occurred during update private: int32_t runOnce() override; // Repeated checking if update finished const UpdateTypes supportedUpdateTypes; // Capabilities of a derived display class bool updateRunning = false; // see EInk::busy() - uint32_t updateBegunAt = 0; // For initial pause before polling for update completion uint32_t pollingInterval = 0; // How often to check if update complete (ms) + uint32_t pollingBegunAt = 0; // To timeout during polling }; } // namespace NicheGraphics::Drivers diff --git a/src/graphics/niche/Drivers/EInk/HINK_E042A87.cpp b/src/graphics/niche/Drivers/EInk/HINK_E042A87.cpp new file mode 100644 index 000000000..1b72bc4a9 --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/HINK_E042A87.cpp @@ -0,0 +1,58 @@ +#include "./HINK_E042A87.h" + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +using namespace NicheGraphics::Drivers; + +// Load settings about how the pixels are moved from old state to new state during a refresh +// - manually specified, +// - or with stored values from displays OTP memory +void HINK_E042A87::configWaveform() +{ + sendCommand(0x3C); // Border waveform: + sendData(0x01); // Follow LUT for VSH1 + + sendCommand(0x18); // Temperature sensor: + sendData(0x80); // Use internal temperature sensor to select an appropriate refresh waveform +} + +// Describes the sequence of events performed by the displays controller IC during a refresh +// Includes "power up", "load settings from memory", "update the pixels", etc +void HINK_E042A87::configUpdateSequence() +{ + switch (updateType) { + case FAST: + sendCommand(0x21); // Use both "old" and "new" image memory (differential) + sendData(0x00); + sendData(0x00); + + sendCommand(0x22); // Set "update sequence" + sendData(0xFF); // Differential, load waveform from OTP + break; + + case FULL: + default: + sendCommand(0x21); // Bypass "old" image memory (non-differential) + sendData(0x40); + sendData(0x00); + + sendCommand(0x22); // Set "update sequence": + sendData(0xF7); // Non-differential, load waveform from OTP + break; + } +} + +// Once the refresh operation has been started, +// begin periodically polling the display to check for completion, using the normal Meshtastic threading code +// Only used when refresh is "async" +void HINK_E042A87::detachFromUpdate() +{ + switch (updateType) { + case FAST: + return beginPolling(50, 1000); // At least 1 second, then check every 50ms + case FULL: + default: + return beginPolling(100, 3500); // At least 3.5 seconds, then check every 100ms + } +} +#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/HINK_E042A87.h b/src/graphics/niche/Drivers/EInk/HINK_E042A87.h new file mode 100644 index 000000000..ac03b65ef --- /dev/null +++ b/src/graphics/niche/Drivers/EInk/HINK_E042A87.h @@ -0,0 +1,43 @@ +/* + +E-Ink display driver + - HINK-E042A87 + - Manufacturer: Holitech + - Size: 4.2 inch + - Resolution: 400px x 300px + - Flex connector marking: HINK-E042A07-FPC-A1 + - Silver sticker with QR code, marked: HE042A87 + + Note: as of Feb. 2025, these panels are used for "WeActStudio 4.2in B&W" display modules + +*/ + +#pragma once + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +#include "configuration.h" + +#include "./SSD16XX.h" + +namespace NicheGraphics::Drivers +{ +class HINK_E042A87 : public SSD16XX +{ + // Display properties + private: + static constexpr uint32_t width = 400; + static constexpr uint32_t height = 300; + static constexpr UpdateTypes supported = (UpdateTypes)(FULL | FAST); + + public: + HINK_E042A87() : SSD16XX(width, height, supported) {} + + protected: + void configWaveform() override; + void configUpdateSequence() override; + void detachFromUpdate() override; +}; + +} // namespace NicheGraphics::Drivers +#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS \ No newline at end of file diff --git a/src/graphics/niche/Drivers/EInk/README.md b/src/graphics/niche/Drivers/EInk/README.md index 04a23a31f..eca91c6a8 100644 --- a/src/graphics/niche/Drivers/EInk/README.md +++ b/src/graphics/niche/Drivers/EInk/README.md @@ -28,6 +28,17 @@ void setupNicheGraphics() } ``` +- [Methods](#methods) + - [`update(uint8_t *imageData, UpdateTypes type)`](#updateuint8_t-imagedata-updatetypes-type) + - [`await()`](#await) + - [`supports(UpdateTypes type)`](#supportsupdatetypes-type) + - [`busy()`](#busy) + - [`width()`](#width) + - [`height()`](#height) +- [Supporting New Displays](#supporting-new-displays) + - [Controller IC](#controller-ic) + - [Finding Information](#finding-information) + ## Methods ### `update(uint8_t *imageData, UpdateTypes type)` @@ -37,7 +48,7 @@ Update the image on the display - _`imageData`_ to draw to the display. - _`type`_ which type of update to perform. - `FULL` - - `FAST` + - `FAST` (partial refresh) - (Other custom types may be possible) The imageData is a 1-bit image. X-Pixels are 8-per byte, with the MSB being the leftmost pixel. This was not an InkHUD design decision; it is the raw format accepted by the E-Ink display controllers ICs. @@ -83,3 +94,39 @@ Width of the display, in pixels. Note: most displays are portrait. Your UI will ### `height()` Height of the display, in pixels. Note: most displays are portrait. Your UI will need to implement rotation in software. + +## Supporting New Displays + +_This topic is not covered in depth, but these notes may be helpful._ + +The `InkHUD::Drivers::EInk` class contains only the mechanism for implementing an E-Ink driver on-top of Meshtastic's `OSThread`. A driver for a specific display needs to extend this class. + +### Controller IC + +If your display uses a controller IC from Solomon Systech, you can probably extend the existing `Drivers::SSD16XX` class, making only minor modifications. + +At this stage, displays using controller ICS from other manufacturers (UltraChip, Fitipower, etc) need to manually implemented. See `Drivers::LCMEN2R13EFC1` for an example. + +Generic base classes for manufacturers other than Solomon Systech might be added here in future. + +### Finding Information + +#### Flex-Connector Labels + +The orange flex-connector attached to E-Ink displays is often printed with an identifying label. This is not a _totally_ unique identifier, but does give a very strong clue as to the true model of the display, which can be used to search out further information. + +#### Datasheets + +The manufacturer of a DIY display module may publish a datasheet. These are often incomplete, but might reveal the true model of the display, or the controller IC. + +If you can determine the true model name of the display, you can likely find a more complete datasheet on the display manufacturer's website. This will often provide a "typical operating sequence"; a general overview of the code used to drive the display + +#### Example Code + +The manufacturer of a DIY module may publish example code. You may have more luck finding example code published by the display manufacturer themselves, if you can determine the true model of the panel. These examples are a very valuable reference. + +#### Other E-Ink drivers + +Libraries like ZinggJM's GxEPD2 can be valuable sources of information, although your panel may not be _specifically_ supported, and only _compatible_ with a driver there, so some caution is advised. + +The display selection file in GxEPD2's Hello World example is also a useful resource for matching "flex connector labels" with display models, but the flex connector label is _not_ a unique identifier, so this is only another clue. diff --git a/src/graphics/niche/Drivers/EInk/SSD16XX.cpp b/src/graphics/niche/Drivers/EInk/SSD16XX.cpp index 07d02a2ae..5a5397dbd 100644 --- a/src/graphics/niche/Drivers/EInk/SSD16XX.cpp +++ b/src/graphics/niche/Drivers/EInk/SSD16XX.cpp @@ -37,11 +37,26 @@ void SSD16XX::begin(SPIClass *spi, uint8_t pin_dc, uint8_t pin_cs, uint8_t pin_b reset(); } -void SSD16XX::wait() +// Poll the displays busy pin until an operation is complete +// Timeout and set fail flag if something went wrong and the display got stuck +void SSD16XX::wait(uint32_t timeout) { + // Don't bother waiting if part of the update sequence failed + // In that situation, we're now just failing-through the process, until we can try again with next update. + if (failed) + return; + + uint32_t startMs = millis(); + // Busy when HIGH - while (digitalRead(pin_busy) == HIGH) + while (digitalRead(pin_busy) == HIGH) { + // Check for timeout + if (millis() - startMs > timeout) { + failed = true; + break; + } yield(); + } } void SSD16XX::reset() @@ -50,8 +65,9 @@ void SSD16XX::reset() if (pin_rst != 0xFF) { pinMode(pin_rst, OUTPUT); digitalWrite(pin_rst, LOW); - delay(50); - pinMode(pin_rst, INPUT_PULLUP); + delay(10); + digitalWrite(pin_rst, HIGH); + delay(10); wait(); } @@ -61,6 +77,11 @@ void SSD16XX::reset() void SSD16XX::sendCommand(const uint8_t command) { + // Abort if part of the update sequence failed + // This will unlock again once we have failed-through the entire process + if (failed) + return; + spi->beginTransaction(spiSettings); digitalWrite(pin_dc, LOW); // DC pin low indicates command digitalWrite(pin_cs, LOW); @@ -77,6 +98,11 @@ void SSD16XX::sendData(uint8_t data) void SSD16XX::sendData(const uint8_t *data, uint32_t size) { + // Abort if part of the update sequence failed + // This will unlock again once we have failed-through the entire process + if (failed) + return; + spi->beginTransaction(spiSettings); digitalWrite(pin_dc, HIGH); // DC pin HIGH indicates data, instead of command digitalWrite(pin_cs, LOW); diff --git a/src/graphics/niche/Drivers/EInk/SSD16XX.h b/src/graphics/niche/Drivers/EInk/SSD16XX.h index 88fe4dc25..799a378c0 100644 --- a/src/graphics/niche/Drivers/EInk/SSD16XX.h +++ b/src/graphics/niche/Drivers/EInk/SSD16XX.h @@ -27,7 +27,7 @@ class SSD16XX : public EInk virtual void update(uint8_t *imageData, UpdateTypes type) override; protected: - virtual void wait(); + virtual void wait(uint32_t timeout = 1000); virtual void reset(); virtual void sendCommand(const uint8_t command); virtual void sendData(const uint8_t data); diff --git a/src/graphics/niche/InkHUD/Applet.cpp b/src/graphics/niche/InkHUD/Applet.cpp index 459f30213..6c6245ec3 100644 --- a/src/graphics/niche/InkHUD/Applet.cpp +++ b/src/graphics/niche/InkHUD/Applet.cpp @@ -802,7 +802,7 @@ uint16_t InkHUD::Applet::getLogoHeight(uint16_t limitWidth, uint16_t limitHeight // // \\ */ -void InkHUD::Applet::drawLogo(int16_t centerX, int16_t centerY, uint16_t width, uint16_t height) +void InkHUD::Applet::drawLogo(int16_t centerX, int16_t centerY, uint16_t width, uint16_t height, Color color) { struct Point { int x; @@ -908,24 +908,24 @@ void InkHUD::Applet::drawLogo(int16_t centerX, int16_t centerY, uint16_t width, Point aq2{a2.x - fromPath.x, a2.y - fromPath.y}; Point aq3{a2.x + fromPath.x, a2.y + fromPath.y}; Point aq4{a1.x + fromPath.x, a1.y + fromPath.y}; - fillTriangle(aq1.x, aq1.y, aq2.x, aq2.y, aq3.x, aq3.y, BLACK); - fillTriangle(aq1.x, aq1.y, aq3.x, aq3.y, aq4.x, aq4.y, BLACK); + fillTriangle(aq1.x, aq1.y, aq2.x, aq2.y, aq3.x, aq3.y, color); + fillTriangle(aq1.x, aq1.y, aq3.x, aq3.y, aq4.x, aq4.y, color); // Make the path thick: path b becomes quad b Point bq1{b1.x - fromPath.x, b1.y - fromPath.y}; Point bq2{b2.x - fromPath.x, b2.y - fromPath.y}; Point bq3{b2.x + fromPath.x, b2.y + fromPath.y}; Point bq4{b1.x + fromPath.x, b1.y + fromPath.y}; - fillTriangle(bq1.x, bq1.y, bq2.x, bq2.y, bq3.x, bq3.y, BLACK); - fillTriangle(bq1.x, bq1.y, bq3.x, bq3.y, bq4.x, bq4.y, BLACK); + fillTriangle(bq1.x, bq1.y, bq2.x, bq2.y, bq3.x, bq3.y, color); + fillTriangle(bq1.x, bq1.y, bq3.x, bq3.y, bq4.x, bq4.y, color); // Make the path thick: path c becomes quad c Point cq1{c1.x - fromPath.x, c1.y + fromPath.y}; Point cq2{c2.x - fromPath.x, c2.y + fromPath.y}; Point cq3{c2.x + fromPath.x, c2.y - fromPath.y}; Point cq4{c1.x + fromPath.x, c1.y - fromPath.y}; - fillTriangle(cq1.x, cq1.y, cq2.x, cq2.y, cq3.x, cq3.y, BLACK); - fillTriangle(cq1.x, cq1.y, cq3.x, cq3.y, cq4.x, cq4.y, BLACK); + fillTriangle(cq1.x, cq1.y, cq2.x, cq2.y, cq3.x, cq3.y, color); + fillTriangle(cq1.x, cq1.y, cq3.x, cq3.y, cq4.x, cq4.y, color); // Radius the intersection of quad b and quad c /* @@ -944,7 +944,7 @@ void InkHUD::Applet::drawLogo(int16_t centerX, int16_t centerY, uint16_t width, // The radius for the cap *should* be the same as logoTh, but it's not, due to accumulated rounding // We get better results just re-deriving it int16_t capRad = sqrt(pow(fromPath.x, 2) + pow(fromPath.y, 2)); - fillCircle(b2.x, b2.y, capRad, BLACK); + fillCircle(b2.x, b2.y, capRad, color); } } diff --git a/src/graphics/niche/InkHUD/Applet.h b/src/graphics/niche/InkHUD/Applet.h index 028b24f9c..8f4466647 100644 --- a/src/graphics/niche/InkHUD/Applet.h +++ b/src/graphics/niche/InkHUD/Applet.h @@ -130,7 +130,8 @@ class Applet : public GFX static constexpr float LOGO_ASPECT_RATIO = 1.9; // Width:Height for drawing the Meshtastic logo uint16_t getLogoWidth(uint16_t limitWidth, uint16_t limitHeight); // Size Meshtastic logo to fit within region uint16_t getLogoHeight(uint16_t limitWidth, uint16_t limitHeight); // Size Meshtastic logo to fit within region - void drawLogo(int16_t centerX, int16_t centerY, uint16_t width, uint16_t height); // Draw the meshtastic logo + void drawLogo(int16_t centerX, int16_t centerY, uint16_t width, uint16_t height, + Color color = BLACK); // Draw the Meshtastic logo std::string hexifyNodeNum(NodeNum num); // Style as !0123abdc SignalStrength getSignalStrength(float snr, float rssi); // Interpret SNR and RSSI, as an easy to understand value diff --git a/src/graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.cpp b/src/graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.cpp index 17458ab96..b12ea4809 100644 --- a/src/graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.cpp @@ -8,7 +8,7 @@ using namespace NicheGraphics; // Our basic example doesn't do anything useful. It just passively prints some text. void InkHUD::BasicExampleApplet::onRender() { - print("Hello, World!"); + printAt(0, 0, "Hello, World!"); } #endif \ No newline at end of file diff --git a/src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.cpp b/src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.cpp index e31f534ac..6b02f4c92 100644 --- a/src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.cpp @@ -4,11 +4,12 @@ using namespace NicheGraphics; -// We configured MeshModule API to call this method when we receive a new text message +// We configured the Module API to call this method when we receive a new text message ProcessMessage InkHUD::NewMsgExampleApplet::handleReceived(const meshtastic_MeshPacket &mp) { // Abort if applet fully deactivated + // Don't waste time: we wouldn't be rendered anyway if (!isActive()) return ProcessMessage::CONTINUE; @@ -25,7 +26,7 @@ ProcessMessage InkHUD::NewMsgExampleApplet::handleReceived(const meshtastic_Mesh requestUpdate(); } - // Tell MeshModule API to continue informing other firmware components about this message + // Tell Module API to continue informing other firmware components about this message // We're not the only component which is interested in new text messages return ProcessMessage::CONTINUE; } diff --git a/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp index 24c2d88a4..520b3ef65 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.cpp @@ -34,7 +34,15 @@ void InkHUD::LogoApplet::onRender() int16_t logoCX = X(0.5); int16_t logoCY = Y(0.5 - 0.05); - drawLogo(logoCX, logoCY, logoW, logoH); + // Invert colors if black-on-white + // Used during shutdown, to resport display health + // Todo: handle this in InkHUD::Renderer instead + if (inverted) { + fillScreen(BLACK); + setTextColor(WHITE); + } + + drawLogo(logoCX, logoCY, logoW, logoH, inverted ? WHITE : BLACK); if (!textLeft.empty()) { setFont(fontSmall); @@ -74,13 +82,45 @@ void InkHUD::LogoApplet::onBackground() // Begin displaying the screen which is shown at shutdown void InkHUD::LogoApplet::onShutdown() { + bringToForeground(); + + textLeft = ""; + textRight = ""; + textTitle = "Shutting Down..."; + fontTitle = fontSmall; + + // Draw a shutting down screen, twice. + // Once white on black, once black on white. + // Intention is to restore display health. + + inverted = true; + inkhud->forceUpdate(Drivers::EInk::FULL, false); + delay(1000); // Cooldown. Back to back updates aren't great for health. + inverted = false; + inkhud->forceUpdate(Drivers::EInk::FULL, false); + delay(1000); // Cooldown + + // Prepare for the powered-off screen now + // We can change these values because the initial "shutting down" screen has already rendered at this point textLeft = ""; textRight = ""; textTitle = owner.short_name; fontTitle = fontLarge; + // This is then drawn by InkHUD::Events::onShutdown, with a blocking FULL update, after InkHUD's flash write is complete +} + +void InkHUD::LogoApplet::onReboot() +{ bringToForeground(); - // This is then drawn by InkHUD::Events::onShutdown, with a blocking FULL update + + textLeft = ""; + textRight = ""; + textTitle = "Rebooting..."; + fontTitle = fontSmall; + + inkhud->forceUpdate(Drivers::EInk::FULL, false); + // Perform the update right now, waiting here until complete } int32_t InkHUD::LogoApplet::runOnce() diff --git a/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.h b/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.h index b55d4a2d9..3f604baed 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.h +++ b/src/graphics/niche/InkHUD/Applets/System/Logo/LogoApplet.h @@ -25,6 +25,7 @@ class LogoApplet : public SystemApplet, public concurrency::OSThread void onForeground() override; void onBackground() override; void onShutdown() override; + void onReboot() override; protected: int32_t runOnce() override; @@ -33,6 +34,7 @@ class LogoApplet : public SystemApplet, public concurrency::OSThread std::string textRight; std::string textTitle; AppletFont fontTitle; + bool inverted = false; // Invert colors. Used during shutdown, to restore display health. }; } // namespace NicheGraphics::InkHUD diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp index 4c411bb85..f59579230 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp @@ -32,8 +32,6 @@ InkHUD::MenuApplet::MenuApplet() : concurrency::OSThread("MenuApplet") } } -void InkHUD::MenuApplet::onActivate() {} - void InkHUD::MenuApplet::onForeground() { // We do need this before we render, but we can optimize by just calculating it once now diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.h b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.h index fe72d826b..d9297c8ed 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.h +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.h @@ -21,7 +21,6 @@ class MenuApplet : public SystemApplet, public concurrency::OSThread { public: MenuApplet(); - void onActivate() override; void onForeground() override; void onBackground() override; void onButtonShortPress() override; diff --git a/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.cpp index 1abf3ccfa..82a196cb1 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.cpp @@ -207,8 +207,6 @@ void InkHUD::TipsApplet::onBackground() inkhud->forceUpdate(EInk::UpdateTypes::FULL); } -void InkHUD::TipsApplet::onActivate() {} - // While our SystemApplet::handleInput flag is true void InkHUD::TipsApplet::onButtonShortPress() { diff --git a/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.h b/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.h index e7bb7bedc..db88585e9 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.h +++ b/src/graphics/niche/InkHUD/Applets/System/Tips/TipsApplet.h @@ -33,7 +33,6 @@ class TipsApplet : public SystemApplet TipsApplet(); void onRender() override; - void onActivate() override; void onForeground() override; void onBackground() override; void onButtonShortPress() override; diff --git a/src/graphics/niche/InkHUD/Events.cpp b/src/graphics/niche/InkHUD/Events.cpp index 10072b302..ddd01b7e1 100644 --- a/src/graphics/niche/InkHUD/Events.cpp +++ b/src/graphics/niche/InkHUD/Events.cpp @@ -70,6 +70,9 @@ void InkHUD::Events::onButtonLong() // Returns 0 to signal that we agree to sleep now int InkHUD::Events::beforeDeepSleep(void *unused) { + // If a previous display update is in progress, wait for it to complete. + inkhud->awaitUpdate(); + // Notify all applets that we're shutting down for (Applet *ua : inkhud->userApplets) { ua->onDeactivate(); @@ -87,9 +90,12 @@ int InkHUD::Events::beforeDeepSleep(void *unused) inkhud->persistence->saveSettings(); inkhud->persistence->saveLatestMessage(); - // LogoApplet::onShutdown will have requested an update, to draw the shutdown screen - // Draw that now, and wait here until the update is complete + // LogoApplet::onShutdown attempted to heal the display by drawing a "shutting down" screen twice, + // then prepared a final powered-off screen for us, which shows device shortname. + // We're updating to show that one now. + inkhud->forceUpdate(Drivers::EInk::UpdateTypes::FULL, false); + delay(1000); // Cooldown, before potentially yanking display power return 0; // We agree: deep sleep now } @@ -106,16 +112,16 @@ int InkHUD::Events::beforeReboot(void *unused) a->onDeactivate(); a->onShutdown(); } - for (Applet *sa : inkhud->systemApplets) { + for (SystemApplet *sa : inkhud->systemApplets) { // Note: no onDeactivate. System applets are always active. - sa->onShutdown(); + sa->onReboot(); } inkhud->persistence->saveSettings(); inkhud->persistence->saveLatestMessage(); // Note: no forceUpdate call here - // Because OSThread will not be given another chance to run before reboot, this means that no display update will occur + // We don't have any final screen to draw, although LogoApplet::onReboot did already display a "rebooting" screen return 0; // No special status to report. Ignored anyway by this Observable } diff --git a/src/graphics/niche/InkHUD/Persistence.h b/src/graphics/niche/InkHUD/Persistence.h index 28841d4d9..40f1dd521 100644 --- a/src/graphics/niche/InkHUD/Persistence.h +++ b/src/graphics/niche/InkHUD/Persistence.h @@ -99,7 +99,7 @@ class Persistence // Rotation of the display // Multiples of 90 degrees clockwise // Most commonly: rotation is 0 when flex connector is oriented below display - uint8_t rotation = 1; + uint8_t rotation = 0; // How long do we consider another node to be "active"? // Used when applets want to filter for "active nodes" only diff --git a/src/graphics/niche/InkHUD/README.md b/src/graphics/niche/InkHUD/README.md deleted file mode 100644 index 8d788ffa8..000000000 --- a/src/graphics/niche/InkHUD/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# InkHUD - -A heads-up-display for E-Ink devices, intended to supplement a connected phone / client. Implemented as a "NicheGraphics" UI. - -Supported devices (as of 1st Feb. 2025): - -- Heltec Vision Master E213 -- Heltec Vision Master E290 -- Heltec Wireless Paper V1.1 -- LILYGO T-Echo - -More to follow diff --git a/src/graphics/niche/InkHUD/SystemApplet.h b/src/graphics/niche/InkHUD/SystemApplet.h index 0f8ceedc7..7ee47eeb9 100644 --- a/src/graphics/niche/InkHUD/SystemApplet.h +++ b/src/graphics/niche/InkHUD/SystemApplet.h @@ -26,6 +26,8 @@ class SystemApplet : public Applet bool lockRendering = false; // - prevent other applets from being rendered during an update bool lockRequests = false; // - prevent other applets from triggering display updates + virtual void onReboot() { onShutdown(); } // - handle reboot specially + // Other system applets may take precedence over our own system applet though // The order an applet is passed to WindowManager::addSystemApplet determines this hierarchy (added earlier = higher rank) diff --git a/src/graphics/niche/InkHUD/docs/README.md b/src/graphics/niche/InkHUD/docs/README.md new file mode 100644 index 000000000..07fe6c942 --- /dev/null +++ b/src/graphics/niche/InkHUD/docs/README.md @@ -0,0 +1,640 @@ +# InkHUD + +This document is intended as a reference for maintainers. A haphazard collection of notes which _might_ be helpful. + +self deprecating meme + +--- + +- [Purpose](#purpose) +- [Design Principles](#design-principles) + - [Self-Contained](#self-contained) + - [Static](#static) + - [Non-interactive](#non-interactive) + - [Customizable](#customizable) + - [Event-Driven Rendering](#event-driven-rendering) + - [No `#ifdef` spaghetti](#no-ifdef-spaghetti) +- [The Implementation](#the-implementation) +- [The Rendering Process](#the-rendering-process) +- [Concepts](#concepts) + - [NicheGraphics Framework](#nichegraphics-framework) + - [NicheGraphics E-Ink Drivers](#nichegraphics-e-ink-drivers) + - [InkHUD Applets](#inkhud-applets) +- [Adding a Variant](#adding-a-variant) + - [platformio.ini](#platformioini) + - [nicheGraphics.h](#nichegraphicsh) +- [Class Notes](#class-notes) + - [`InkHUD::InkHUD`](#inkhudinkhud) + - [`InkHUD::Persistence`](#inkhudpersistence) + - [`InkHUD::Persistence::Settings`](#inkhudpersistencesettings) + - [`InkHUD::Persistence::LatestMessage`](#inkhudpersistencelatestmessage) + - [`InkHUD::WindowManager`](#inkhudwindowmanager) + - [`InkHUD::Renderer`](#inkhudrenderer) + - [`InkHUD::Renderer::DisplayHealth`](#inkhudrendererdisplayhealth) + - [`InkHUD::Events`](#inkhudevents) + - [`InkHUD::Applet`](#inkhudapplet) + - [`InkHUD::SystemApplet`](#inkhudsystemapplet) + - [`InkHUD::Tile`](#inkhudtile) + - [`InkHUD::AppletFont`](#inkhudappletfont) + +## Purpose + +InkHUD is a minimal UI for E-Ink devices. It displays the user's choice of info, as statically as possible, to minimize the amount of display refreshing. + +It is intended to supplement a connected client app. + +## Design Principles + +### Self-Contained + +- Keep InkHUD code within `/src/graphics/niche/InkHUD`. +- Place reusable components within `/src/graphics/niche`, for other UIs to take advantage of. +- Interact with the firmware code using the **Module API**, **Observables**, and other similarly non-intrusive hooks. + +### Static + +Information should be displayed as statically as possible. Unnecessary updates should be avoided. + +As as example, fixed timestamps are used instead of `X seconds ago` labels, as these need to be constantly updated to remain current. + +### Non-interactive + +InkHUD aims to be a "heads up display". The intention is for the user to glance at the display. The intention is _not_ for the user to frequently interact with the display. + +Some interactivity is tolerated as a means to an end: the display _should_ be customizable, but this should be minimized as much as possible. + +_Edit: there's significant demand for keyboard support, so some sort of free-text feature will need to be added eventually, although it does go against the original design principles._ + +### Customizable + +The user should be given the choice to decide which information they would like to receive, and how they would like to receive it. + +### Event-Driven Rendering + +The display image does not update "automatically". Individual applets are responsible for deciding when they have new information to show, and then requesting a display update. + +### No `#ifdef` spaghetti + +**Don't** use preprocessor macros for device-specific configuration. This should be achieved with config methods, in [`nicheGraphics.h`](#nichegraphicsh). + +**Do** use preprocessor macros to guard all files + +- `#ifdef MESHTASTIC_INCLUDE_INKHUD` for InkHUD files +- `#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS` for reusable components (drivers, etc) + +## The Implementation + +- Variant's platformio.ini file extends `inkhud` (defined in InkHUD/PlatformioConfig.ini) + - original screen class suppressed: `MESHTASTIC_EXCLUDE_SCREEN` + - ButtonThread suppressed: `HAS_BUTTON=0` + - NicheGraphics components included: `MESHTASTIC_INCLUDE_NICHE_GRAPHICS` + - InkHUD components included: `MESHTASTIC_INCLUDE_INKHUD` +- `main.cpp` + - includes `nicheGraphics.h` (from variant folder) + - calls `setupNicheGraphics`, (from nicheGraphics.h) +- `nicheGraphics.h` + - includes InkHUD components + - includes shared NicheGraphics components + - `setupNicheGraphics` + - configures and connects components + - `inkhud->begin` + +## The Rendering Process + +(animated diagram) + +animated process diagram of InkHUD rendering + +An overview: + +- A component calls `requestUpdate` (applets only) or `InkHUD::forceUpdate` +- `Renderer` schedules a render cycle for the next loop(), using `Renderer::runOnce` +- `Renderer` determines whether the update request is valid +- `Renderer` asks relevant applets to render +- Applet dimensions are updated (by Applet's `Tile`) +- Applets generate pixel output, and pass this to their `Tile` +- Tiles shift these "relative" pixels to their true region, for multiplexing +- Tiles pass the pixels to `Renderer` +- `Renderer` applies any global display rotation to the pixels +- `Renderer` combines the pixels into the finished image +- The finished image is passed to the display driver, starting the physical update process + +## Concepts + +### NicheGraphics Framework + +InkHUD is implemented as a _NicheGraphics_ UI. + +Intended as a pattern / philosophy for implementing self-contained UIs, to suit various niche devices, which are best served by their own custom user interface. + +Hypothetical examples: E-Ink, 1602 LCDs, tiny OLEDs, smart watches, etc + +A NicheGraphics UI: + +- Is self-contained +- Makes use of the loose collection of resources (drivers, input methods, etc) gathered in the `/src/graphics/niche` folder. +- Implements a `setupNicheGraphics()` method. + +### NicheGraphics E-Ink Drivers + +InkHUD uses a set of custom E-Ink drivers. These are not based on GxEPD2, or any other code base. They are written directly on-top of the Meshtastic firmware, to make use of the OSThread class for asynchronous display updates. + +Interacting with the drivers is straightforward. InkHUD generates a frame of 1-bit image data. This image data is passed to the driver, along with the type of refresh to use (FULL or FAST). + +`driver->update(uint8_t* buffer, EInk::UpdateTypes::FULL)` + +For more information, see the documentation in `src/graphics/niche/Drivers/EInk` + +### InkHUD Applets + +An InkHUD applet is a class which generates a screen of info for the display. + +Consider: `DMApplet.h` (displays most recent direct message) and `RecentsList.h` (displays a list of recently heard nodes) + +- Applets are modular: they are easy to write, and easy to implement. Users select which applets they want, using the menu. +- Applets use responsive design. They should scale for different screens / layouts / fonts. +- Applets decide when to update. They use the Module API, Observers, etc, to retrieve information, and request a display update when they have something interesting to show. + +See `src/graphics/niche/InkHUD/Applets/Examples` for example code. + +#### Writing an Applet + +Your new applet class will inherit `InkHUD::Applet`. + +```cpp +class BasicExampleApplet : public Applet +{ + public: + // You must have an onRender() method + // All drawing happens here + + void onRender() override; +}; +``` + +The `onRender` method is called when the display image is redrawn. This can happen at any time, so be ready! + +```cpp +// All drawing happens here +// Our basic example doesn't do anything useful. It just passively prints some text. +void InkHUD::BasicExampleApplet::onRender() +{ + printAt(0, 0, "Hello, world!"); +} +``` + +Your applet will need to scale automatically, to suit a variety of screens / layouts / fonts. Make sure you draw relative to applet's size. + +| edge | coordinate | shorthand | +| ------ | ---------- | --------- | +| left | 0 | `X(0.0)` | +| top | 0 | `Y(0.0)` | +| right | `width()` | `X(1.0)` | +| bottom | `height()` | `Y(1.0)` | + +The same principles apply for drawing text. Methods like `AppletFont::lineHeight` and `getTextWidth` are useful here. + +```cpp +std::string line1 = "Line 1"; +printAt(0, Y(0.5), line1); +drawRect(0, Y(0.5), getTextWidth(line1), fontSmall.lineHeight(), BLACK); +``` + +Your applet will only be redrawn when _something_ requests a display update. Your applet is welcome to request a display update, when it determines that it has new info to display, by calling `requestUpdate`. + +Exactly how you determine this, depends on what your applet actually does. Here's a code snippet from one of the example applets. The applet is requesting an update when a new message is received. + +```cpp +// We configured the Module API to call this method when we receive a new text message +ProcessMessage InkHUD::NewMsgExampleApplet::handleReceived(const meshtastic_MeshPacket &mp) +{ + + // Abort if applet fully deactivated + // Don't waste time: we wouldn't be rendered anyway + if (!isActive()) + return ProcessMessage::CONTINUE; + + // Check that this is an incoming message + // Outgoing messages (sent by us) will also call handleReceived + + if (!isFromUs(&mp)) { + // Store the sender's nodenum + // We need to keep this information, so we can re-use it anytime render() is called + haveMessage = true; + fromWho = mp.from; + + // Tell InkHUD that we have something new to show on the screen + requestUpdate(); + } + + // Tell Module API to continue informing other firmware components about this message + // We're not the only component which is interested in new text messages + return ProcessMessage::CONTINUE; +} +``` + +#### Implementing an Applet + +Incorporating your new applet into InkHUD is easy. + +In a variant's `nicheGraphics.h`: + +- `#include` your applet +- `inkhud->addApplet("My Applet", new InkHUD::MyApplet);` + +You will need to add these lines to any variants which will use your applet. + +#### Applet Bases + +If you need to create several similar applets, it might make sense to create a reusable base class. Several of these already exist in `src/graphics/niche/InkHUD/Applets/Bases`, but use these with caution, as they may be modified in future. + +#### System Applets + +So far, we have been talking about "user applets". We also recognize a separate category of "system applets". These handle things like the menu, and the boot screen. These often need special handling, and need to be implemented manually. + +## Adding a Variant + +In `/variants//`: + +### platformio.ini + +Extend `inkhud`, then combine with any other platformio config your hardware variant requires. + +_(Example shows only config required by InkHUD. This is not a complete `env` definition.)_ + +```ini +[env:YOUR_VARIANT-inkhud] +extends = esp32s3_base, inkhud ; or nrf52840_base, etc + +build_src_filter = +${esp32_base.build_src_filter} +${inkhud.build_src_filter} + +build_flags = +${esp32s3_base.build_flags} +${inkhud.build_flags} + +lib_deps = +${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX +${esp32s3_base.lib_deps} +``` + +### nicheGraphics.h + +âš  Wrap this file in `#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS` + +`nicheGraphics.h` should be placed in the same folder as your variant's `platformio.ini`. If this is not possible, modify `build_src_filter`. + +`nicheGraphics.h` should contain a `setupNicheGraphics` method, which creates and configures the various components for InkHUD. + +- Display + - Start SPI + - Create display driver +- InkHUD + - Create InkHUD instance + - Set E-Ink fast refresh limit (`setDisplayResilience`) + - Set fonts + - Set default user-settings + - Select applets to build (`addApplet`) + - Start InkHUD +- Buttons + - Setup `TwoButton` driver (user button, optional "auxiliary" button) + - Connect to InkHUD handlers (use lambdas) + +For well commented examples, see: + +- `variants/heltec_vision_master_e290/nicheGraphics.h` (ESP32) +- `variants/t-echo/nicheGraphics.h` (NRF52) + +## Class Notes + +### `InkHUD::InkHUD` + +_`src/graphics/niche/InkHUD/InkHUD.h`_ + +- singleton +- mediator between other InkHUD components + +#### `getInstance()` + +Gets access to the class. +First `getInstance` call instantiates the class, and the subclasses: + +- `InkHUD::Persistence` +- `InkHUD::WindowManager` +- `InkHUD::Renderer` +- `InkHUD::Events` + +For convenience, many InkHUD components call this on `begin`, and store it as `InkHUD* inkhud`. + +--- + +### `InkHUD::Persistence` + +_`src/graphics/niche/InkHUD/Persistence.h`_ + +Stores InkHUD data in flash + +- settings +- most recent text message received (both for broadcast and DM) + +In rare cases, applets may store their own specific data separately (e.g. `ThreadedMessageApplet`) + +Data saved only on shutdown / reboot. Not saved if power is removed unexpectedly. + +--- + +### `InkHUD::Persistence::Settings` + +_`src/graphics/niche/InkHUD/Persistence.h`_ + +Settings which relate to InkHUD. Mostly user's customization, but some values record the UI's state (e.g. `tips.safeShutdownSeen`) + +- stored using `FlashData.h` (a shared Niche Graphics tool) +- not encoded as protobufs +- serialized directly as bytes of struct + +#### Defaults + +Global default values are set when the struct is defined (Persistence.h). +Per-variant defaults are set by modifying the values of the settings instance during `setupNicheGraphics()`, before `inkhud->begin` is called. + +```cpp +inkhud->persistence->settings.userTiles.count = 2; +inkhud->persistence->settings.userTiles.maxCount = 4; +inkhud->persistence->settings.rotation = 3; +``` + +By modifying the values at this point, they will be used if we fail to load previous settings from flash (not yet saved, old version, etc) + +--- + +### `InkHUD::Persistence::LatestMessage` + +_`src/graphics/niche/InkHUD/Persistence.h`_ + +Most recently received text message + +- most recent DM +- most recent broadcast + +Collected here, so various user applets don't all have to store their own copy of this info. + +We are unable to use `devicestate.rx_text_message` for this purpose, because: + +- it is cleared by an outgoing text message +- we want to store both a recent broadcast and a recent DM + +#### Saving / Loading + +_A bit of a hack.._ +Stored to flash using `InkHUD::MessageStore`, which is really intended for storing a thread of messages (see `ThreadedMessageApplet`). Used because it stores strings more efficiently than `FlashData.h`. + +The hack is: + +- If most recent message was a DM, we only store the DM. +- If most recent message was a broadcast, we store both a DM and a broadcast. The DM may be 0-length string. + +--- + +### `InkHUD::WindowManager` + +_`src/graphics/niche/InkHUD/WindowManager.h`_ + +Manages which applets are shown, and their size / position (by manipulating the "tiles") + +- owns the `Tile` instances +- creates and destroys tiles; sets size and position: + - at startup + - at runtime, when config changes (layout, rotation, etc) +- activates (or deactivates) applets +- cycling through applets (e.g. on button press) + +The window manager doesn't process pixels; that is handled by the `InkHUD::Tile` objects. + +Note: Some of the methods (incl. `changeLayout`, `changeActivatedApplets`) don't trigger changes themselves. They should be called _after_ the relevant values in `inkhud->persistence->settings` have been modified. + +--- + +### `InkHUD::Renderer` + +_`src/graphics/niche/InkHUD/Renderer.h`_ + +Get pixel output from applets (via a tile), combine, and pass to the driver. + +- triggered by `requestUpdate` or `forceUpdate` +- not run immediately: allows multiple applets to share one render cycle +- calls `Applet::onRender` for relevant applets +- applies global rotation +- passes finalized image to driver + +`requestUpdate` is for applets (user or system). Renderer will honor the request if the applet is visible. `forceUpdate` can be used anywhere, but not from user applets, please. + +#### Asynchronous updates + +`requestUpdate` and `forceUpdate` do not block code execution. They schedule rendering for "ASAP", using `Renderer::runOnce`. Renderer then gets pixel output from relevant applets, and hands the assembled image to the driver. Driver's update process is also asynchronous. If the driver is busy when `requestUpdate` or `forceUpdate` is called, another rendering will run as soon as possible. This is handled by `Renderer::runOnce` + +#### Blocking updates + +If needed, call `forceUpdate` with the optional argument `async=false` to wait while an update runs (> 1 second). Additionally, the `awaitUpdate` method can be used to block until any previous update has completed. An example usage of this is waiting to draw the shutdown screen. + +#### Global rotation + +The exact size / position / rotation of InkHUD applets is configurable by the user. To achieve this, applets draw pixels between 0,0 and `Applet::width()`, `Applet::height()` + +- **Scaling**: Applet's `width()` and `height()` are set by `Tile` before rendering starts +- **Translation**: `Tile` shifts applet pixels up/down/left/right +- **Rotation**: `Renderer` rotates all pixels it receives, before placing them into the final image buffer + +--- + +### `InkHUD::Renderer::DisplayHealth` + +_`src/graphics/niche/InkHUD/DisplayHealth.h`_ + +Responsible for maintaining display health, by optimizing the ratio of FAST vs FULL refreshes + +- count number of FAST vs FULL refreshes (debt) +- suggest either FAST or FULL type +- periodically FULL refresh the display unprovoked, if needed + +#### Background Info + +When the image on an E-Ink display is updated, different procedures can be used to move the pixels to their new states. We have defined two procedures: `FAST` and `FULL`. + +A `FAST` update moves pixels directly from their old position, to their new position. This is aesthetically pleasing, and quick, _but_ it is challenging for the display hardware. If used excessively, pixels can build up residual charge, which negatively impacts the display's lifespan and image quality. + +A `FULL` update first moves all pixels between black and white, before letting them eventually settle at their final position. This causes an unpleasant flashing of the display image, but is best for the display health and image quality. + +Most displays readily tolerate `FAST` updates, so long as a `FULL` update is occasionally performed. How often this `FULL` update is required depends on the display model. + +#### Debt + +`InkHUD::DisplayHealth` records how many `FAST` refreshes have occurred since the previous `FULL` refresh. + +This is referred to as the "full refresh debt". + +If an update of a specific type (`FULL` / `FAST`) is requested / forced, this will be granted. + +If an update is requested / forced _without_ a specified type (`UpdateTypes::UNSPECIFIED`), `DisplayHealth` will select either `FAST` or `FULL`, in an attempt to maintain a target ratio of fast to full updates. + +This target is set by `InkHUD::setDisplayResilience`, when setting up in `nichegraphics.h` + +If an _excessive_ amount of `FAST` refreshes are performed back-to-back, `DisplayHealth` will begin artificially inflating the full refresh debt. This will cause the next few `UNSPECIFIED` updates to _all_ be performed as `FULL`, while the debt is paid down. + +This system of "full refresh debt" allows us to increase perceived responsiveness by tolerating additional strain on the display during periods of user interaction, and attempting to "repair the damage" later, once user interaction ceases. + +#### Maintenance + +The system of "full refresh debt" assumes that the display will perform many updates of `UNSPECIFIED` type between periods of user interaction. Depending on the amount of mesh traffic / applet selection, this may not be the case. + +If debt is particularly high, and no updates are taking place organically, `DisplayHealth` will begin infrequently performing `FULL` updates, purely to pay down the full refresh debt. + +--- + +### `InkHUD::Events` + +Handles events which impact the InkHUD system generally (e.g. shutdown, button press). + +Applets themselves do also listen separately for various events, but for the purpose of gathering information which they would like to display. + +#### Buttons + +Button input is sometimes handled by a system applet. `InkHUD::Events` determines whether the button should be handled by a specific system applet, or should instead trigger a default behavior + +--- + +### `InkHUD::Applet` + +A base class for applets. An applet is one "program", which may show info on the display. + +To oversimplify, all of the InkHUD code "under the hood" only exists to support applets. Applets are what actually shows useful information to the user. This base class exposes the functionality needed to write an applet. + +#### Drawing Methods + +`Applet` implements most AdafruitGFX drawing methods. Exception is the text handling. `printAt`, `printWrapped`, and `printThick` should be used instead. These are intended to be more convenient, but they also implement the character substitution system which powers the foreign alphabet support. + +`Applet` also adds methods for drawing several design elements which are re-used commonly though-out InkHUD. + +#### InkHUD Events + +Applets undergo a number of state changes: activated / deactivated by user, brought to foreground / hidden to background by user button press, etc. The `Applet` class provides a set of virtual methods, which an applet can override to appropriately handle these events. + +The `onRender` virtual method is one example. This is called when an applet is rendered, and should execute all drawing code. An applet _must_ implement this method. + +#### Responsive Design + +An applet's size will vary depending on the screen size, and the user's layout (multiplexing). Immediately before `onRender` is called, an applet's dimensions are updated, so that `width()` and `height()` will give the required size. The applet should draw its graphical elements relative to these values. The methods `X(float)` and `Y(float)` are also provided for convenience. + +| edge | coordinate | shorthand | +| ------ | ---------- | --------- | +| left | 0 | `X(0.0)` | +| top | 0 | `Y(0.0)` | +| right | `width()` | `X(1.0)` | +| bottom | `height()` | `Y(1.0)` | + +The same principles apply for drawing text. Methods like `AppletFont::lineHeight` and `getTextWidth` are useful here. + +Applets should always draw relative to their top left corner, at _x=0, y=0._ The applet's pixels are automatically moved to the correct position on-screen by an InkHUD::Tile. + +#### User Applets + +User applets are the "normal" applets, each one displaying a specific set of information to the user. They can be activated / deactivated at run-time using the on-screen menu. Examples include `DMApplet.h` and `PositionsApplet.h`. User applets are not expected to interact with lower layers of the InkHUD code. + +Users applets are instantiated in a variant's `setupNicheGraphics` method, and passed to `InkHUD::addApplet`. Their class should not be mentioned elsewhere, so that its code can be stripped away during compilation if a variant does not implement the specific applet. Internal processing of user applets treats them all as the generic `Applet` type only. + +#### Activated / Deactivated + +User applets can be activated or deactivated. This changes at run-time: the user selects which applets should be active using the on-screen menu. An applet should not process data while it is deactivated. It can unobserve any observables, ignore `handleReceived` calls, etc. + +An applet can implement the virtual `onActivate` and `onDeactivate` methods to handle this change in state. It can check this state internally by calling `isActive`. + +System applets cannot be deactivated. + +#### Foreground / Background + +An activated applet can either be _foreground_ or _background_. A foreground applet is one which will be rendered to a tile when the screen updates. A background applet will not be drawn. The applet cycling which takes place when the user button is pressed is implemented using foreground / background. + +Regardless of whether it is foreground or background, an activated applet should continue to collect / process data, and request update when it has new info to display. This is because of the _autoshow_ mechanic, which might bring a background applet to foreground in order to display its data. If an applet remains background, its update requests will be safely ignored. + +#### Autoshow + +Autoshow is a feature which allows the user to select which applets (if any) they would like to be shown automatically. If autoshow is enabled for an applet, it will be brought to foreground when it has new information to display. The user grants this privilege on a per-applet basis, using the on-screen menu. If an event causes an applet to be autoshown, NotificationApplet should not be shown for the same event. + +An applet needs to decide when it has information worthy of autoshowing. It signals this by calling `requestAutoshow`, in addition to the usual `requestUpdate` call. + +--- + +### `InkHUD::SystemApplet` + +_System applets_ are applets with special roles, which require special handling. Examples include `BatteryIconApplet.h` and `LogoApplet.h`. These are manually implemented, one-by-one, in `WindowManager.h`. + +This class is a slight extension of `Applet`. It adds extra flags for some special features which are restricted to system applets: exclusive use of the display, and the handling of user input. Having a separate system applet class also allows us to make it clear within the code when system applets are being handled, rather than user applets + +We store reference to these as a `vector`. This parallels how we treat user applets, and makes rendering convenient. +Because system applets do have unique roles, there are times when we will need to interact with a specific applet. Rather than keeping an extra set of references, we access them from the `vector`. Use `InkHUD::getSystemApplet` to access the applet by its `Applet::name` value, and then typecast. + +--- + +### `InkHUD::Tile` + +A tile represents a region of the display. A tile controls the size and position of an applet. + +For an applet to render, it must be assigned to a tile. When an applet is assigned to a tile, the two become linked. The applet is aware of the tile; the tile is aware of the applet. Applets cannot share a tile; assigning a different applet will remove any existing link. + +Before an applet renders, its width and height are set to the dimensions of the tile. During `onRender`, an applet's drawing methods generate pixels between _x=0, y=0_ and _x=Applet::width(), y=Applet::height()_. These pixels are passed to its tile's `Tile::handleAppletPixel` method. The tile then applies x and y offset, "translating" these pixels to the tile's region of the display. These translated pixels are then passed on to the `InkHUD::Renderer`. + +![depiction of a tile translating applet pixels](./tile_translation.png) + +#### User Tiles + +_User applets_ are the "normal" applets. They can be activated / deactivated at run-time using the on-screen menu. User applets are rendered to one of the **user tiles**. + +The user can customize the "layout", using the on-screen menu. Depending on their selected layout, a certain number of _user tiles_ are created. These tiles are automatically positioned and sized so that they fill the entire screen. + +Often, a user will have enabled more applets than they have tiles. Pressing the user-button will cycle through these applets. The old applet is sent to _background_, the new applet is brought to _foreground_. When a user applet is brought to foreground, it becomes assigned to a user tile (the focused tile). When it renders, its size will be set by this tile, and its pixels will be translated to this tile's region. The user applet which was sent to background loses its assignment; it no longer has an assigned tile. + +#### Focused Tile + +The focused tile is one of the user tiles. This is tile whose applet will change when the user button is pressed. This also the tile where the menu will appear on longpress. The focused tile is identified by its index in `vector userTiles`. + +#### Highlighting + +In addition to the user button, some devices have a second "auxiliary button". The function of this button can vary from device to device, but it is sometimes used to focus a different tile. When this happens, the newly focused tile is temporarily "highlighted", by drawing it with a border. This border is automatically removed after several seconds. As drawing code may only be executed by applets, this highlighting is a collaborative effort between a `Tile` and an `Applet`: performed in `Applet::render`, after the virtual `onRender` method has already run. + +Highlighting is only used when `nextTile` is fired by an aux button. It does not occur if performed via the on-screen menu. + +#### System Tiles + +_System applets_ are applets with special roles, which require special handling. Examples include `BatteryIconApplet.h` and `LogoApplet.h`. _Mostly_, these applets do not render to user tiles. Instead, they are given their own unique tile, which is positioned / dimensioned manually. The only reference we keep to these special tiles is stored within the linked system applet. They can be accessed with `Applet::getTile`. + +--- + +### `InkHUD::AppletFont` + +Wrapper which extends the functionality of an AdafruitGFX font. + +#### Dimension Info + +The AppletFont class pre-calculates some info about a font's dimensions, which is useful for design (`AppletFont::lineHeight`), and is used to power InkHUD's custom text handling. + +The default AdafruitGFX text handling places characters "upon a line", as if hand-written on a sheet of ruled paper. `InkHUD::AppletFont` measures the character set of the font, so that we instead draw fixed-height lines of text, positioned by the bounding box, with optional horizontal and vertical alignment. + +![text origins in InkHUD vs AdafruitGFX](./appletfont.png) + +The height of this box is `AppletFont::lineHeight`, which is the height of the tallest character in the font. This gives us a fixed-height for text, which is much tighter than with AdafruitGFX's default line spacing. + +#### UTF-8 Substitutions + +To enable non-English text, the `AppletFont` class includes a mechanism to detect specific UTF-8 characters, and replace them with alternative glyphs from the AdafruitGFX font. This can be used to remap characters for a custom font, or to offer a suitable ASCII replacement. + +```cpp +// With a custom font +// Ñ— is ASCII 0xBF, in Windows-1251 encoding +addSubstitution("Ñ—", "\xBF"); + +// Substitution (with a default font) +addSubstitution("ö", "oe"); +``` + +These substitutions should be performed in a variant's `setupNicheGraphics` method. For convenience, some common ASCII encodings have ready-to-go sets of substitutions you can apply, for example `AppletFont::addSubstitutionsWin1251` diff --git a/src/graphics/niche/InkHUD/docs/appletfont.png b/src/graphics/niche/InkHUD/docs/appletfont.png new file mode 100644 index 0000000000000000000000000000000000000000..f0b11d3236bde64a4ab3385c33bc0d2bac6f03ef GIT binary patch literal 7797 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 OG<9Vir5Xk6kpBTCAtn9* literal 0 HcmV?d00001 diff --git a/src/graphics/niche/InkHUD/docs/disclaimer.jpg b/src/graphics/niche/InkHUD/docs/disclaimer.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d4c2c890e56705770336672cfa426fe449950a1c GIT binary patch literal 17942 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 literal 0 HcmV?d00001 diff --git a/src/graphics/niche/InkHUD/docs/rendering.gif b/src/graphics/niche/InkHUD/docs/rendering.gif new file mode 100644 index 0000000000000000000000000000000000000000..cb712381b91c13f5ce3bf7ebe81f998057c57722 GIT binary patch literal 78402 zcmc$_WmsIxzV6#Va0wv^5F{ax;O-8=-QC^Y-QC??8+UiN#@*fBJ$=ZWYp%WSv(G*s z?sKI-!04jnUt`oLs_OT?g2DpKEZT99agaIh0Lj0T0RR9P3%c6(R#fiu6#Oh>jWv*|hjpt-;W?{?f#DTA^XQ`vl z`gZ*%nF=58uPk<^9QeQf`~mMzo4l4b`gn|#)D*hZ)UwIqi4V>!zb{sw%)#R;2YW5S+P=4IXXI0I?_>E+89#N zu&}UDQPWb<(o($Tps;neu+w&;u&^cgrv^TKTU{GtD?4LL3%oxyYU^0q+i~E(Mf!Ia z%&q=it%WV+U)`b9wKS)4(zc?ap``xPrGGMti~paqnw$SSx2>Iw{(r^$zpdC-&e=+z zN=Dz-(%wc_|1CSgpQfx>d2RHy?JRBNEG^Ccxr(RR|6|!dW5L|&tz|xa8)FB3Jpmg_bG*O$%xe5U z$HMYI*7vWndjE4Qzy8OvRByph{duzg@udGrdK*4}F8@7l-@g2N)7% z#K*@}C@U!{$jiyfNJ~jdh>MAe2nz`c@bmHV{Nm=~XJqj`sA_6=dEDZEJD9E?j;rrt| z=vK&g0P;W6$Dg?c00m}lUinQuEL_sYd_39$)*_D3GtMw7E-%<we*OW0LBS!RVc`*xQPDB6aq$U>Ny#axY3Ui6S=l+cdHDr}z@p-k(z5c3 z%Bt#`+PeCN#-`?$*0%PJ&aUpB-oE~U!J*+1(CFCs#N^cU%kCRu^I{WkIxCzx)FR|yfQ~qKjSsWp`jLzXCm8m zKf$5`rPFvEIS-v{58Ly~gXZi+7@+0y#gY_ORkldUiqv{SE(BfeflEuPh!7Pk-|Zd|6gKAL*1CKV!O&=!ml}O}C~O``R@QSlu^$y9ezIJv z4kkF$-=(3~0>|IH=+v`* z=C$2}@cZ^%W98sdd`MUdT)D#I_-Q`BWkF-r@Ih>G0733DoyYa#etxVX_@(!`g=|Yx z8ik9|aQmP@jRpNvl97N069 zd|{o*POJ4Jo+;Dn3aX28iJOl|8>5F051THVo2WW&zq(Piyx&eCuGbuOJqQw8JSZvG zL1?w|`b4DW+ech%N}RWaC05pw2(xUd@uR|}s`1^d({?HHv|9P#l80NDC-jKO#ZbwU zn%Q7I7R9e%B^l@Zc+`0(>yeAAm6WL)fvC$oR#&Xrc{xRnA9JJ`nAZ_hsvKVzRZ`O} zN9`g)YF5;lMiv+OzXmmMcB|Ao)>iP~8fB1*QW!4arMk*lcuJNsqJ%@OFm83`n=9>r z1*t|EWfD}wAIC{NBJieuhh*ID#NM_g9io{^G|3hVURgT3IgZgCBW09-Ii$9fU~`XL z_iEW|Mnq@(Q3Gzby`V>`Xgv<$>S#R0XQO(ZnbZVNU+ODYxCbtJdVaiDa;9pR+sp)i zx`j`r;(QGMQQ;8#O?Pg33K-R^#!x51CsE}i$*Bx z4!to5hLzeAHB1XY71Y*Z9_70+vVr)+i35SO+XpW%5l--->r+Um7iHc$0yH}9Rx-HlR6Hb4AL;?IO&zGPyDPX-4V{Ii(fVEs0dhXq@!K}zdj}nmd)

XvxR6aNm@T)%IDb8YXzrivZDo*@ z!8|4bImW(^B+bh2OiN=AN}I#+XTNr&OM@>99RV47-zAspF3BX%zAHrOBLwpV;2)Wj zq!w6z3dtZ&fX%pAD5Mt+{+Xg}>-F_!k1wB@H`1V*9;dID`xo4lW20R>HS&S6#ZziZ zvu~lcO{nBEwJZusJT5nMx|D8nW?uUq@Yw1|HrXUNM+3F^DC!8$9t)v_6}9AWg4DP( z1hxV_s&pT<#Bjm{wgw@pY*)(EU_%79;V!a#JIeG3xJ1;34^y#qajf|$0^hRrzH$@w z-5d^x0%I;6%^{swN9V)mN`~DU>eO(P@(&#Lu8hHuNA1ZlmLPwJs%#VTCpN7n9|@7pfIE8O-)*PoW|+aE?N zJnl!+{1v8+JvMFm2BT z%Htq94OL8HYcxLH#+B~z$oAe6KeWXRCi>4&$tQZ zl^PQ~^Y?;^fs;m+cGlGD$l~{LQ-K$?7R=(v($fJm`qZ~_$7uxemhvO}pLH^IPx+Ll zQ*u!4Zk2wG@(H`f%zmG`RdEjI*L3}`0R1+P2dfL}W}+=_N#AK?m%$se!OTuo-f0!B zO3(NtFE>oy>DVvl`$f%+8$mIdB8^1ZN-oba8sE?NQ}8%Y^{&nv-2FrzqP2^)o}1pD zYZ+Q4@ZMKl&HiFr*Luq3Lnjy;Lvm0BVUbR65SQxaz+8rBQS_ZNbqjv?A>l_mwmVbo zI)24|-@5UYBk{_X%i%-CCa#S&T6hXJf1|!ehD{)iTVO1B)oA?JuH~0G>|I99M~=e6 z>u&s4B~@(2q14|P8APjtaQdvH*erJbVs8Elfltd9GXrJYHOKtp`sJA(6Xr|M%eru` z%kdJ1QMRu~D*i2)J8R{sRBc;wiHPf(hu5|9D%((4F8Ll~Q@M06QD3*020ldM^dRUOqQ8;Gp(Zj9er~yD?T|+!9l8+hMQ>oIc?nZKK-=*eW3NFZXwm}RwNbDQX9kLPo zCr|<&C|bZIN!RVYk?14FM2Ze{8@PuJn3EuU@FDQ>?yK}=0!rgPc>ToiW)AeEC${5r z@|kq>AU%-c7<6SB1Nka|Kh~0@C2(Z};$yM+- z-S*Y&3voOMW?}Lvgp+R`w988J?tpV@W%g<(4lN7_^=A%)hYocK2rChQ0V#=hIYGY? z1-dzfMB#@|G|JB!LC?dv_Q81#7=;?GIVs){hpjf6Ucm9)VOl;YMIGLS%V$OED|$uCM=S-gmMugE`bWBUMgjUFKPb~8 z2t#8wg`y1U!+weCQTX_=DVp0bgqTFRNGLj8Kc-12W`r>+J0J>-9z@Gxj>`i5t;qiS zqandzOg?n%NKz~;Q^YZBG#LvaQB#~9*eC9wFirvo2DLi^9i+(97Uu*+w^<9*Msuuwqj8yR5%$Ni&(errd z)2ZC(N@mkiIrwyA!KpRTlzorB;KsCdytHV1rWttYRg(1b?DVqW^bNd>??O%=6w^op zX`8aft@M*;WKCOG7p<5b$0BV9@D3kQ(uymMoCZ6ofw7sX@bvJk86S(0KR@A0V^H8UXA~=^r$1(|qUQKcqf1U_ z#Xn>P4N{{O=ZtpdoCs$H8Id$NXSUyFFq$AUhmd;!Gh*JQw+y8)VC4-{=RpxT|3nb` z8fZ@gl_$oEERiCO-fRc4lrNi-qv(Qc#X=*BRnSjeFfLPIAcACsfNRoR&^=MGe^p?G zfMoOZ-A<*j-KsD*w$No5(QWCc$5UZ5Do{iO_z59Nml+u3f*4?u{&fjBbOF>NEgIo2 z((eH#up&Br%wo#+NF!0K=^9E1ieJ!eI_Jo;wB zQ?VKocq&(M>XQD90Ng1~wZbfu;LX#Dt;lz-v`(oU3og}?F2y#g!cwh_Cav-psnT)E zV5O@(k&}d$FM~O*YV<1lP*S~sRctg@MQMsiZkk0GT1ky)Nb6dYRt&7mFJebTU^wRE z#;(nvu6;7DZSty>1hDU~27U}vj~B5JxOYcJQZ zh`LIs*2huTKgQOZkina!vREP_RtW1`ur)+VHOM+NI4#4uAnLmE5|ns+pJkJEJwMuT{Z2Uu3HMGAi5DKWv8(x_rX=)x-LD2_zI9rI3R%B5nsAaEA0? znX`37rNL0nVVJ{+AN%t~2ki_q4S4Ka-012NDAG!Yd_hBBOz6syXn14kDpshg$VXDu zhDUfpez2D6%(Hg0_qV@{ROl8zHV6x^XLn&fZv}lqYCmPqMB4`u-h!UP(!gfp1ScKB zr4Gj{P|)T~u&+??ui}WK6XIsWdCL>sHxr!PlcmO!7`T)7pf*h8BCPNU9FB>n=gH2G zQ?qPS#OYJ~Y9VCmP=xA?ROwJO=5}<*)1>axj8fCp1=Gx{Qz8e`cd64n95dV;-u$nS z>|l2%;kFLG)fvjl8D!X5>DL)4irL1w86}E3xw09BvRTda8C7w2bqauP`j8^-9KZYA zn%bOM_%DmHIiAp~RnVhqP(ocdyd`(jf1VoKX$+UjD)>tYt}QVz#bp88UO`w}pHskm*abakoxb*XZ+ zCXhnU`?V$-S3gb(!~N*_&cTUwlQ~d_^vNMXGE?d~`+lbcG*zm4{-L zQ+$=xe3dDDm9A`+YIK$Cbd?x+?K{O9miQXF`P%#NHN>(t*wMA)leKlE^%?T@A@B-w zT2VhM%Zj{SW)neF=WEX$g`i%4-E!MHplp6qWd)|ZU&^*35obbSw|uc}BRSb+BCG^! zy5GHcJ)n?@5MgxkQRIqv6MAjaA~prjV~ilA1KidF5s~~GM6(Yne-+wV72j+a8qaJ^ zY1G|b58tlC**?`7!BpKQQC;QM7<@U|KwH=r^jH<9+m zVQq`)W$PCw=!Si_H!TY1H+g#N4lsM9cV~Okd?USecdcnaz+;yyVk0tO-@1H1@owki z*?!63{Vj|>ClJ#&|d7&(CknZXTY_TKPqIq0i42Myf#b= zl)K5^Eas81_B)_rAGa1dD)azVtkq{r?BQF`nZs_OD*9+H@qfW*=2+ORS@Zi6nt{Pj zFCKGTheJQidGg`9ARi^2cyY&XE?eB7gZGQw}p zLK1ho!ae#79740JSL!PxL2`Y%d{Vl4Cc3+lQF0>rJ@m&qX=RSf3c>vueR=-tyDa`6 z<0HTGsKR6e(Q1FtrXp4r=;=zhHX}^PcEAaVD zZz@A>U>a}a-iL`t##m__`1}rm1$QNB^l4fy2YB2NcHGt^o$qtpNo(F=Aszf&yEDpM zGa0{;v5dEf+_hT2#cW+(%fJ5sx?kPBM@D*B`uPCUx`2eb9MbU+w*C+Seu(<^7{m1# zr}>!R`IwaXn9}i>w*Hs_e$4vzl*9Fur}yU!0w*0${#IE)zW{TAZ#2Pop5TW}@KeW8 zvJc?n_tW>evb;;7HFF`S?|FDXTj&NC91Yi>Ar4%L&EJI!j^Nu<#`iq>U}k}Y#7GlC z1=sN5BG4^>LmIvBg)1|6x2GWkJJpY2_3|7_8f0mVJ#}-9uMy+N_jL>{(a?nVA_is%djxn={~c$^%2%FNWi5yR}G|w*zQmc7wSQd z^-9Jic}{lXEM5}s6zcB({_JD5$p!N*0k8rs_`7#n85j%GRI5jL0;&JVk$RfUCM`vO z$cY-2B-(-&hEFIov)B7prP+-HX0a~g`~`9JevM~7pd4fVVqIm z^`$#QalECa(+e~^{^$6x63!s2lCiIx=+Ner zB-|a)>$f)~pMgecYcn6jX6GixKBRJfBUEQ;yx5FL-t@;ds~8@`sHLqaVXZaNE=bN* z0Lfi2n&rZeSP0=h*h|;l=WAfCv0mPu46$;_v4U-`&K!O*Q*All9dL0{`bzaJ$*vg- zMsru}-YI#M-4H_h7GF5T>m1ezYWv4@IS8vfKNfs2G@-acuzMN}{N^deps(!VNdk;i zSX(WO^}xA_kCW2qE1dH~KN}?AIH)367WQg_M%O<7KDfz&t&c7zr|^>*(N0M0-3J4S zcFZktP3>+BLJ=3`KzZh|Thv7IyC8#aydjo=~`=O^4-TO)AnIf$cV*;O%fCl*qXp{4~OJxennTwc%(QM0Y1c}z!j305M zq7QCK(yZ!(^@=j1n~mek98AJZ>oS~;E835Sxe2tIPB6lffi}LYm9FjnDDfF2%P3j< zgZPFPn*el0_w{Vs)TA_#?ikjwvOCkJy^K%`eY=7Yiv-iujvLGhYebt6!Lta?zmkgR*rB*m=z&^5!X`>`xR)&pNXk!%L>BgJfn z2s6WMhDj?xHY1cBNVXu_aWUIb#`Q4UG1l|a-gb5{lAV5IjDX#wz_)O_DG{nsyJ-n7 zWcwKzNpbsG1WnWXBboadF30hxJuu z$iMK<0n}gk=LY~EQtJ=?5&8@Nz!d+3e|%*B!arum|H3~bz(4q>@gMvnb8E_)DK%yD z7ycn<96oh%Uiu6FB(B%Gn6v!BKP#Z}<;?3p_^08_%bURC5B{<62?@mt`h$OX!s5bW z{@@?f_;l~oH~izDk#C>-hJW-6%8X0i@Q;uqi)lUnyTY0`{6pn{1kr%t+iceHhJW67 zA@vS??;8Zo&b5vKrYn|ZTIM%4bL=7d8qL!Vn!7RgQ7}eVwytlYTY8ozk5C>S4?j2J zZIIoIiMRQ}2}|?NzsIBW89;anH4w%B<@B`kb7k-nj9h1gL1R$5fXprAiGrPD_fVEQ zlBmKNk|unOBO3UDt{gOvRxq9^JeSrh{E=YNVcI5+d;TMEx{xXBb-5_wNIL&xl84`L z9T`#)*zBsd8Leat>1T(N`ba`>tHAOn;Ey6Yi>Vr+)cVyCCi72C*Z|f1(9Iv4hyj;2 zha*Xs%bku5KkG%CAiF%!ULA}PE>C{fxQlD+8-56v-nRlCcINzB#rce}{b3Q&;s1QHrUTGdY*+_K$)$Py8$4sspbru& zarQUVcBV~#S2^I<0G#1$Z5P~tq`|=LU?co5KN6g_LX`6ka6_q8-fln5T#x`!0mFQ% zHRGLAuLWe0uBv0fgV7Eu_nPC9;|}hjo*eU>y&{W{bblJYqyYW z!Xad$v$L>t(o&d0Ub0oQe6XftGT$V%>=ovI24R-*jFKj#-A6v}_M!c3S!ElAbdxo` zWIkzpQj)xowZ!RMbJpf<{8$GUeF_%MNcZA}?7|2Jj)KT%r{G!4f7hv&ukP1pk zO&z{zG2KxUS!UbQlWAJl6C-(L-;oP>6?h1%*(`aK_1P?8Qi6%1ZdSnMGD4g{tF~^_nUS0+Ib91p3(C zDiGeXt}+NY_wJ(ilcL#WAEsgHWj~JN$>jiEAozW)t6}nnldBQx0rG1Q z{k+-rDD!^l^%(p8$@MrlEXBCLp1AjR#BoTB;dtde2b?VOt9 z>FvB$AjRE+UZVNkqETVl-I7_u>D{u`0LA@^-Msnzs?&bi{hHhTpN9)e`LN-KVezmT zL{$E;6~=V-upK2x`M49OXz{oUPBJWi+)Hyjd)&_oqi2fC~I_Gj9ogeb}!6|9-hYe^av{WdUG? zIw7$xyx_#LATb6zVOTG`QNyy{5eao6s9gA9g0f(k2D?yPE`0Hjvf%`Uy3tZD{D{S} z5flfz(VH*)sl&374262ImM#LALD?vdgFRoLE&{oca!><>dhxL?gM`F#&=LoG30W_L zrNVMP6$>PN3Yc_k#nRPnVHiNO^d$!h<|mS5ZM?dH5JZg95Bq(NSS}KZt~fL{zR~l0bQc zOhZEwE?2QxNcqHq!oxBtS8+hGd{V`sVTIPbfHrXmWWaizJP}qvUno3kqH>+G04iW?7#g*3xlY|cDr6oI9mi9l-wL?_(j`(3Sz z7^Y0oblwyYzJ3#T#DYnTk;}vPFOqN+nI?aj$>WAL5r&=M%DMW4NF`n@Cpyeki1xXd zE8avV@rf%<#vVyUycp2-Bv0cfUkdm^COl*{7yI-c_|fb5^Kf%<-Pw4tWF3#(xQOD* zW*tzG*+i*HWwv8(2Iz`>BpUcMpHa+ENNZlI+%_x+p;DL6X@3m3Mwl9NxvR-Srr5D! z1;kV0)u3LGK#3g#W)ZsbNimBcl|rEwDK`oW!$~bPH>P^p=gM;`&5`|{^V<=68iTk` zq0~lHH^3=c4Gb5>mhmI+o2L>WX4)Xkq$^jCQRbT_@{h{!j(ygu?ckP?`CSYv*MJD` zngR#Utkai$ZW92_bV-zE8#Xe0R@ful#}k>tzCU*r23 z{7FpZS!Mb(oa^-{%hkV`DXt{c)oK=-iI9!R&sofuk@O^D4KiO%!+f##l`^cSg2|S(2Wq!#IIe4diCNQ&woN_-Fpt4ASZ+u>&8jk0yDK9{mnWvT z9@;n7!{6F7__9vo72G>Dg~?Tvq_^5|Jr8`x)@Z?a1l5+gcxw8aCll1IQY13>U~|h) zYrHI!$U9H4N$4a5;8Y8uyi`q}o(zFmK)#t(+cfX(hQMyCT%NR*j_J1WYE0vi4Gg=w z5yxpu?87zR9Fh)S^h#nK5AO4;!={(-QZ3V)L@H=2i(2Q{=vMA-`c4-f#|~B{xbDM< zURV0cPus>hpIyc|&p9Ma6hr$Lq`$dkYSyg}NqW=;?mAs?jmxA$Io+O1wu6m{N+0j$ zJMLHIWseoKcVG>Y6Fl1o9HwVoK3up!E;uI)*zDPB)Yt0(?>#@%t78Nj^d@=`O1Z(n ze1M+Qec<;RV$u=Yb^Eelut%g-17o>8V608#DOPtRuz^PB)9bpt)CoSzcVj*r+M=%^ilAuk}P&@SK|AZREY2yDr9s8B)ZMPy00s$k6;9?5_$CBE4dM)nkxB`&pT=I_)8_(?1L5crJP*%U|b#* zO?Z=>-|u;}_xmd)81B_s^fP(GHU?V^cue(sZ4hC|-Fs~dgyl`MjT33<6rx0Bwd8!#xD8isXPc;w;6ieF$CxUZKLLm%p7#FVZuxf zJV}Ux;|}zF;{6?%WwD8^D{uYDvy{FX_^KqD(CGUx0Nv>xyw{w9W)kJ&i6aV}e2V0Q zmW^WL;2gGrvB?L%)TpxG1*1+CA_-x&E**y3Il{N{*Ie{xOxij$}oFUllCI z6T=Z45~&It^#dYU27Sbf;!X#He!@rc?OPWz#BmSV==+7r{83?aS*FN6#K!^G*Q@2 zh{;?JKHh6SzHr~ipU?)f-lkSLBYepEdN8t6FodAM2^GBHEX|yp_r*5*&^Zy-fHOWI zI@yW+-cxkm?bb1wJ<+s)*zjjVsyI*u=}z+}V~nz6_R_ttyL0-Cd^%Q0s$f6@h$t8< z#BmkQ5dl4&axr`QF~>PDy`(?UATW_xKNEvEnh#c~D$pq5F83EOHyhSb;K-mkn~7;{pHCH2j+lsrX}^o8fuRDc`sXK2zdNHPXIW@qzM)`J z++NO=gCnG1gz1w7|g61o27qP4@4fC-;@782bQ zEEe>y6Qr>!Tk6wG=-$RfzpcyGl7I3GX1Pu};1Pe@KqwceHf*{KTF1&eYA*MJ#u;ly zfd5;PcmwgaCq)8K1JEJm{%cSACP_ru_)kgVNkJV5@gGTI$8h_<_N01Hz`rGlq}sGp zou+)Ee@PNCdvX6r5}TFw66XI%5-r<~-z16aExa$D@@{`5i4H%oyaNA762Ew3hD5zd z5+g$2E5A!gdXpsTX3*rkNfHC|iryrNW-+N1Z<55y`Zq};ds@r?eM#cOu>Pi zl0>a=d6>T?iM(!b-$anmt^Y_8=}i8TBo0L4-O8zJ(nacuXG@f7Ojd{MO6DuHdO~nT z>q{4FjHZj#N9xO#8?3g6(?uJ~S6iH}k5)$-D%Lx^pb)=`HCAr+1brma05w)^4@41& zW{5Ra?~WwVnXZAFYWByoctgL6H`g9c17%AzMw{!7=PPwbGQ?ZzPnR2QkJm<98qU`{ zeG$J&v^HLD55|&dj(qK3*U1==h^=haukZdWUYb;SEO!-0(qSJlOC>6(HX9`=nsB>5pju z+zh~RIM@ut3n1PK`jKF?6--9PTD+1(56|=_MHNB^wnK?WLI2 zAMT}E^^@$U+07a6r#tNx?Ps{%9qwm(!H^zg`JtN}WCsxzALN8F9v$RH36LJ<#VME^ z<|i2x9~PuJ932*B1&|&A^Ab#sihu>hN5!S}M@J=<{iMgGwR0xNWsQ5q$K|beN5>VN zFk~l{z38SVRfB{jC)HpO&=|$dE3KY$$9(B-SK$`0G9ls^BsoSMHd`V=|wjZ)5%2-sv!C0 z|1*118c6z6yJ>Y!iaLN45;ZqK30BMAU)FK8cUCzNx6@DEHQjH)$P`(7QJ(;UaZW*% z;%#>->E64nGJxwi2gR<`u*m0EcE6!4n&hx4fyC+LA4pK{x8*{&_V6)E5Jh_hjHYGb zxBcF#ePdnbTbJXm<^3w&fn+Er>rRGeMDwx_*_fkWMNd2Hny#pl<5qajXx(buHw)H8 zn;wprslWH6sn%{#?Nq2wP(_MT90&?*uYiRa+iyPiGqMyMvrRR)K6lhvnXofNl@*=0 zD4mi0H_(*cSk3q+Xuyj8YD55_tf>&wV}svf+^6c;D%ic_8m_qo@*h ze_WgJ!v<_Unqb0ySJCpNjN8PFJLtwk`vA$!xB2|k&$D4a;io{JH3vpn;QqXJ;i_4x z`QDtFk>KlPFd?-r<_t48#IRJb&fpf}q*Fgl{bU4c6#l30K(EENsE~d{0^}lr_U$q& zGbpL`@6JMis-M+m-u5byMEA zb_C?Yk0LHhALAR4_Si!YC0+K=Jnq>KxFDFN9ML`{ZK)Dp|J8 zr4f^i1i%*HKk5UpQ%n#1NnZGu`OBRwvlcE4UNO}8Go)|5Pwj7r(-F^k2>Z$I zoif6L^*K#YUr#1JWae1DB7tV6@Hwb?f((DUNS>cmwq{r^+vIbJEOH5js}X`Xfha3MOwhT#I!{(qX zIrA@Vc|u=;g@R0OtFiR-wM|(Rgec{U6x;9(B1vX}Ir3$1{t%oJ4- zRjq6kN`c6yMoieMiUL<#E_EiTK+>9d$wL>5fI=!toqW_enZ^J*3@wQd2c zM!Geks_Xpd1xLLEoc69z(FK*p;L?an*1|5UiQ)&w!?TYvlQwJMZ8XNmhx99SRRIntk2OFYeWrGC4xQ-Go@+zMU*|kVWL>XMjF!K>U~>)@^=Ni-qu`|W zx-3z+I#L)^=iOY!Oq+%gWbF2-HM%7YW3FWpZ)9*c2sFkSD)exy*to&PpH|~XpO-5j z^)OCSb=xL7qw7yMKaVnJSH-zc8hc@=<~C(p8)b|KkF(U9gx|Ao|9GEN8`!Vwa(u7z zb6z}z!`$@CsVHYNDRYxbfkmNpiYm8<4e0fBD|sEX*I55lU?Q65xE;32o|-WABCdl> z^s4KB*EG-FZ;newtT~OwI^|K2n`3CUr}_2KlZnu(`X`018ur7a!(IkB*Fds84{ z-VS=nu_o{r#;lOMeZ2B0?|E6%s^%vPGsCuNI0d%$fid!$W3zqNb(OHb`V0^M@N@5k zozgd`I0%)c624_&uv}kl1bx!g=xaVBJdul zXReNY4Ud8(?f6vPT;gG)bFVX&#r3pm7=8Q^+C1Rw8gJ} zJRUh}n+=QVf1vxF(YV-pGv{Fj`&N5M9A#BZ(|L!RVuheASZyeT<;2aesee0TD;+EG z1WTM$T2N@#Ad}tCrGc5m9cjyJe7@9Ql58^atJ9a**~=V;lC3t8M}zkoM}>VaTgh%W zrxK&xs|mIPY^3{x?X!iO*!ED=q>Te5mKIF!Z4()cP0CE)-w~Nr%w=uIVs$m~A%E)`X!p=GYM}!e_bxY1WACRJOrlFufYx)Jh=77I zPk?**y+@_I9om5<3yk!rqtk~VFUWc`g?&?oN?z1^OA1tus4jsbfDa;(4>`9_;4h6X zFCWqe4eCyx0B@%rfUh^YFDbV#gOL)vOF4e>< zri&3q^i5<}tu7JKQr&mPtv{Zy3>>CJBipH-955TUgEvV$nO)q?zkAaJeh3co4Gn{` zLn609H1mu9jvN=2>Jy%9pXI5Qq@NUHk{>~lndOmF&J+D6W2&qxY|0MzFL$a*OYW?# zZqDy_Zp}_{=;0V^=tHq6p)B(UwO36|bXVr}w)k!pO@XSH?PgT>Du#zPyvK7VH$#>) z&L8EDUk;{k736hq4`wl-y!6GY1n7;p5lv-D=%%v9%lS7R80jx=B)it~b$C$F%IX1JMj9vHcUED{}i7a0ELwH-cZSf%C+z2ny zy5g`*g_@_dqB>K?a*ZAtEr zGI?LzsGkMA;CGU7W9>figUu8ijA{(GYdm*(lm2sBuRb+2*+c89-JjvS>n;Hz=Z6eQ zZSY0CW%OF51+U=+xaD~gE77|1Ur*6Uj^^F$WT#igw9$90xanFKKnxcn_+%cX_t+=8 z?-31;kL;FPHpV8#J(()nEuZcd7JFcyJUBCt@5Hyqzj=~)-h-cC9W&h^yV140cY3|? z+)3U|#C%39-~R>p#0e+kH{i~_8Gv5yx9NprMywOKnKC5c6H{#MG4;6Z89juz{O(<6IZh~}ezrZvuw6_oh15N&4m zir3OP)JoJ#7(z@k3K7mpep`s<1R3?ib4OUrEf%EM3=0>gyIBMqX1H)J?q^B=hBwMm zMk^+!vigc;7!oQld=L|%0$-GuM7m&<&!mxZSg08^beM+kV`2hKg*-YeDn<)kL(?D3?QJTHm3Zb5;} zynaTfiLha$|AC@$lQ8-}UYizxB|r!u^XIjBV~V8RLx1*fJfN1sl)Lb}&jI?y8HI1a z<#|jVXPQ}enWg=_ZSg&(8nScWRCLk{d9wJh7OOi?E^Eo>ny45 zWsByME!gWIy36OhGT7i}1{E(tNnZ@n08HLs9K|qiib&iyQ<+0Nb<%&gl*vFq0ihtO zEAroLWqEI|vg|ikSw=em&|aJN<|}LIPkQr}HGm@Dd}W}X>6WFXzTn06o=vYe zTiJ;F!Qs%c?VGJ^((=t#HZOhuaCEEna?!>1k$Sb00lE&icE3!M(_$ZMi;jsHkDvFR zG9*?>9G8GG;`fbk&R!K-bjrKuD;n)h!C``1LX0muUI0XX08m@D!B z-h}sW3j2RB;VB(+e}OZLTs=#~M2Ym>y;@9!0eYKzErTdW&d=3fC?)q{T;1IDnYt=K(IhS0^aO| zP>`6>|5cp&Eg2v1w!ty0Z~{!H1A~wsF!>it2!v)MyQb%{ zC8wPl$Uf~npxm)?d>?aQckR{se#Z^iwLA2F~W z*Zhi7c5v^;>}=`fYOd<6LfY!GTE79ksj86FY;CDAL{LMe?4FV!sjd#-Z&r@y27 z>x2UXKmZ_vRQtc2aQxeJ$(Z(Ly8PGkR^#j``!CaFcvJ2_rb`oHnSYrs+2$(#HeCuc z|7E&#GNSlnx_n6}|I2jw&CTbJ>C(|J_|FN4VrbMK({r&ewhcFT_77YSk5A0^PA@L`&aZCoSa0s1p0!?ngMVE?;0Q^1cly9R;))Gcu5|~X zE^>qkMX&URV791(2BX1C{SkPH?nuHh3xhGl&go)9)pNrM)aq?v!q+pP6lRW9(9reN zSO)j^S0oYo$%z~xXk78(+VQCZsZ;iF5qtUBlHvlLRS^NQ`3m(`AKXxW^2HiyP>%Wt zAH{M*!^W^YYeV_B28Zi}&XR@->JG2f3uLi}?v3uCpEwer#;&dYsBgRmTEE91e`974?>uqh-&e=WBAFP=Taw|F55L z$bH(+2w2v7fC}{TYRm|7bUuIzmPlTJ3UR4)$_RDpRLTgGDH?FTvG(XctZ~;sc?*u7`AiongT3 z&m@iV$9WE89*ja(i+1Djw6V=({|wOO7vXdV)^`VZ<|xhHnP0G$-lv7wcpZF-#K$mJ z3ID2MlrOIqLINGjGkIv0$@;;>GPk~t1SX#{n$*1H>twNMMZdjCLD-neuhQ!Umy&{J zR=`av7lyoO9K z)wh32F{!0ZZ8^*N%`jCZB`rTDN|Iaam&knD(>K}3I=o{Lsk1N8s4HP%BlpgW;Mr6v zyAUmxD)XTwOTGJw_`^v0ft;W!?XRY4hXb|UqF3dgLst%l(gM^O<&R-e?MYo2XZ!JTk}w({V|jr#sp8X8;7!hRg3i)SU&w>wiPtzaP}W|3lrCx{&{(?we3- z#D7tD^dH~Nhmx4uz#r%s%!i$KPk@2G(X-Q^!HgBU*Hqb0)e z{G`1M{$hv!sgU>=iOgjPaxMNFbr0gEu(=G?c-cblA?_!OsS1;2C&0=C_A^jcgGARU9tM7OS4IWseaHV8%)=nl8Tk&7izoXq$So3M zimB!W`9({Zl2rx*5eY!7&pb>cVdImsqDO*!;Pus~I$nKehZGS`RE5(k9tn<{99ybS z_Kr5D_?-a+zq6>SKxcd(4&ghiAyEKMY;sy}HdQ`}n9)&8GN{#nE?s$8&c-%=P0fq3 z%~(v2=h`PT&5Px|keIGUP1-u27TczAr?Y@;@@(x-#z_`&1c8n8XL=%*ZDA=zm`|xt zxWr5Y$&w}(6tNp}2LvBk!6Ly3wmCJWc|5Pd!XA6q8U5^p{NBdWMwGUB<0}Vn&rMSS zK6VN4I3yg_!qemip9)(1j08y*Cw!jh3z(qy*pXRfvphZ(9`79TaujpxXnZR8jBFx) zyeJNgu}k1xEfm2`8iNjqO)H8c;W&Ss0yfj{#c^KLR(*D??$e7NxV38R#lzgzav2x+RJZ~ z;G6VnhQvXpl3ra`%l(7GQM7F>0$ zX}b0T5+Hbh1a|@i4{iwrlHd|ZaEAcFCAho0ySw|s-8B&0-Q6XuGa-AQ+Eul?PgQqU ze|^4jegR{xv6$~YpZ9vMdyQJ@s#kunEULPHjo$vMPaUN^rb}#{DgLToPog|-qJN#O z?rOj^s61gqY=dj&YS3n|Jn5o;RKi;*(u+KTuAo{@O2kz_dAwd-x zl;T?=O4lPXgB4i>M#b+a_Ak$z^4DY>)iYB#7Wx?hj4 z*_0H{yw8r(po4nIV830Wkb&5sHU2bWkmLL@V(7R0Az}oF;r|{nL@KHBfAcyd)BNUj z`1}wtI3#HwB1X)wi1FfA#Blx*@{SYxE{}M5{?juI$ zeZ;7_j~Kc45hMOSVg%kt48Mh?<)GP>^$p#%&7EDPZ6IP)AD^D79h_fXx8D4`6TQ59 zf-giu40s)$VT*MiE&vhZ1c(@~=7EUu9f%mOAhSTkCegF}J6NnfUBS6IHd7+}XOEsG9n!ul!CrCY(Z&{!@w|yTm^ni#_=Ut$X zsynKPo?lgnS!KM!=1Nmt^t9IM1hyr=+JvFWr5u(J$(v!R4Ihb2)#2@{l`dgo(fwtc zvM>KN#7-_(X(&lYB!`Vv_tseD$FDX_K(X$e5$#$Vl0PqSHyZ zy(ZF$d7ZGxi3P0WGKd6?qqRTNH%@AVlhMX{M@)XS^^P3Zc!?cBqW97}del_`J6fex zhyq@-F_hw)LDlyx3zNL3lol3VmO9uv^HXmVw>E2Zlbn`8dMVh4U%gVhNpKNU-QM)* zrMkaSl*$PEu&$RGuIiVY`RJucLbkfgc6?5#Vcgg3EGPc2c}O85IQdV(y`BYS-}5{R z3zqymi?WVHJd0DHZk`vQ!Q*+BMw4)(mO@adc09`C3q@!v#H4m&D@qjoJ*rYQ`lzd| zU(FO$=ej9*)Oe(Fd(^s?)UkIQqZ?lz8bmj7gJ`3h$wulxE$-L_ zAr0}QyBRGgg1L-3NLsk1@L0)_ui`LF0kYM~7p521%shXilPL(BFZ5ke{ss zWWlkQzkz*{PSYdR4`3hfn~pUa?R&7V`0hr}KN$iGfPK=aF1i>gP*~l3S0uxR2!;UI zXT!UxK;ec7fPMKF&1D*UF74qkUeJJBj;>1!$s13ch=(_{v`56c-axEZD&mMB zLM?oh{)EIH)wByV~!=mPdhw&STy5-t9#fM*kTj79p=*}$x z%Os1qK;s-l`xzYH`1d2CvSHjpMW%hZiDeReBlC}~I37y(&d^oj`VLy>?sn0T& z-@U&A(P}a$4%X|wrt579e#4USgJqpoCa+DMpCai-JBx$FuU}e%B}$l&P~>~fpu71& zqLhEO1YDd<99Klf^Y_D*o z3Q;1HNnX7C?A-e)plq~2%W_LABX8LM!)XEQ008gR%BJ@o7dbp8`jq%VE~B%e$fi>N z8LGW})b+E{kZ1Ylurn2{Y*E>4@3*u%0G5$LHt998;fIqAS&yiwoZ;I7{iZ9aNH&Z7 zIR_){4nc)1lCtne1$!gL{xgbhtiEA;MkLNR?TZL1*C6+^bv7q%*73n>{@rs{bHRY%ka+P&|m`x${%g z{y>TM^0|29ZD79567J&9t7ttCJtK3ef6ODA%R(5ZLugbU7C2EGzl;}$o^#P^O#9Yt zl6$7OyhxgEOqYz$qZmCYqn6={y>odgQd&Njo|4&8?$gqz@ zMH<$hMhy0WEeZSU(G--*96|AI>G&@jZQ|o9W5Hs;cUNJ!AWunMIUp zaF_VLdHl`nrbKn^#K68)-Ob!#P<8!=_<`Nb%-i-p>&8^R223d#t7{Z+Ogtk93#7aV z4F`|Z?ZD+hhX3TTpzGPEMJ{jdS@@^CZ_mk%dHgAFmC+{%5!5fBDQ`bny`a35*MftI zEKaaQ@Z{^CuyiB;kzh&a%<+_;-aK%HXX6^uh&WWrew+-`VDrA4gN<|EEJa{;VJ!V} zC#dmJX1U8!&I!0j$>nTp>-Nddahr()@$<6ypSyaJbzjUGL4`Mq>yL@JVM9<{9eIJD zN^{-g%_P>Uje0drur2)QKB$$U`4E@S;Sr`JYt=&H5wVXwD-oAXBi8(}cbCI5Ym?0& zyJ})I5t#9k_!5;*^(bVaZi9&7y3yS!>ZQ$Vs9Lcr_kqTkAUVFHN698V&aY42PWp9MUhN7? zkavElsbW^Jey`mgvNy^J@!oG-7m|a9Ty&I}1mZ31+f_T|d)q4?Eo_czol=4o?)=t?I zo=>p7)HmJmIlN$FJVh+L*s;Dz$_wAId)~@<^2B)KFgjQY0e{Fw2+kKS##AWBM+U}c zEZZGQ%6)+8H3yZWkGy>p*fw;l+cPM~N9oc%O3wGajd${dKm?^Lx4dgdhQn~Q>v@;^ zTW?1j4!;5)hvpa$+ZexAYzOU0f6-0JXYn@NPeg7&}S}@$c3)F`pfux;RQv`6ON1e}nhvrVQTQuu|;y(Vh$(ys#75 zaE0qu+-$c3v)d!&fF>vHFDD$XE?osL?U%ZO&Gr1BD)8J;d1u?OO|$#yVKbz`KVJ9Y z#QSQKneFunEi9TjEQZn+SZN`?a*It53zD~cf%BN^D<_iztw?hi<&$um@V`Q+SU_0N zQh!MQDmnjq!1&i|JvI`m7|z$VzYr=RB$^5Ugx{YQ7 z1I7ygp<+8l`k5wrw--)Gd6<~GiDa-7OX8gYZp}N?;i~}D62vs)Ad|b`(KaNoG2A_;w?A#+%kg{7yF4X42 zKY~z&x%@RkB~7XB&**og2_RJ9!2q_uL#VXHIS99c!+gneQ^UpL&|jdx5TAmMkk$P9 z0#VWUzZRilLv98Tsw#F6=*)F>Qvv5jAbOCJZQPKwzLXX+x<)G;80M5G$>Du10IziEH0y)-~mXbX-Xq z%wyC;kuGZ33k&S=wbIjYL)ARGN+=8d2^_WS@5qCSdz+Ipkn9Z5uqtzT&<@2VPKNaLS*Am|)ylu13ksSFK4| z(A%vh^&u0^d2{b`K6Vyp%js#E@$QgO}q zO^cx0v$mT#_Vc9^Wp0QW^UUUHbWQ8tp6%lV!rS(Vrq6T1E`9zf!$BLY=Szde2&-5y zYOk9lxo9KVFY)arWi7(*;4Y@~j{(lNnmMrlg0-Ht@9&~r zwn!;vw@}*1DQv=o$#tktV%>AY(ovxPY^|qlsUMT|k=R-UdMY2uzzbXA#1&dZp6}#n z>!(^tLoK>IqThxb|Jk)3V&q&QL6MQLX+98@_)C#YMi;0@iQBh5W4Qv|xu2>LMp2|p!Mvd!a&@kimXTh;YdE^n?va*C9DE+9r|cF+vDl7&jf5UbDvgh zkJmx7mAqty{`6hsa~ACLCsKj>+PofrSY$14y--s|g%i%gHiomb>E zNNJjsNJAH#3ntY90d06Xy6Sn=Be0>ET#4e$e3f9SWAjH_0~s0R#cCdeedtel%CL}4 z%gkiUeWRW0>D6_sn*PsxW+aR*emF1YI5Y5#$d`T${!!WS+Cz2# z(WA&tu2J2SK^F^cYA(#DVO_k~cCJq?WBRn=5n7&$k%-Dg+-J}hU5T@|f7;|YYxRlB z*5lfp;1zzGwi(ZtA`A9P3Hs5^1nX}-XaY2DWk0tS8G(Fx@wJ`=Pqq;xx%gr@XgmiD zaId}0{9Ei+aJe}^RIDX7_J*^?gbMFl#A!V}cUMXMv9g7OwoGDqRx^)nvbTKAjUvUg zR$Ht4XFAG25eX|uyOUkh1k7QDwDZg-*o}|94gzKZT-lT1n@`7>+#m0`z(BAKI=sfq zJS2A)-aF&;P6VD9_}8h!r`vSCe5UWf?x0Nws>!1{FZYeJ*Acy#EP2y>>O)p2k&(GQi{I=7SoASZm)L=VEOp+L+D>}5QbfA>FWE1ry6EXEEF%7Z z0H}djKx`>^4u*yoY&mccoWnVEpSY>~5{62jItg;2QVF1E? zt(jGIk8q>dj^0~kwRD-U?OomMT-<>RP8?5Pwt%2uwfpI#N?0VYRvZ=oUtyJ{k6wDP z%1*9W3V+zyT00OuJ_Pc|GU}-S=glR6aNiwLmJs_mX+B3|xwp!Cqa{-X{Ibga1>qL( z1FW+Dqw)tuscD7hNEU!_?}1ni9E<-kgu83Y&gyInK)B`XUt3-5{ksUa^KH>zA>72) za1=RE&IoLq>S#!B{ubd*#l!z_sR2iNC#&f|3C;1;>tz~;CL&$qKY?&ZBBSvI>?`0j zM-u4QyokoNyLu6W<;O`8i|Ge!7iem7CdC<)ac0FYw%}wZsEx!XCR#7oWG0OqO=TzR zp;G}IH}v!@z;Wwu#ssoWXSoD?s9n#1eAfS(U~!!daNO&;3)v~E(_fu3-0ZeoT8#kuy zn0?%49oP^h(@y+0d$TTL>l?FfaxHH29x6$D^IqB=gUA-Tu7bl(rU|6IUN(2YBY=O< z&)oS2B4#$sFCg~qI}%YKOREUOYtvB)I3&v-KPAK~+ga4+O2-su@=w1?)3_W@sLRn= z^=K!*J|WV{POz#(zU*V0R`BPkt}t6E92#)mEwrAs=2e1QK&YSqFL;v~o6pUz7aq@H zpc%JKyHl!OtwMC9_QBNwCUrHd2JZV3%O3s`wQD)vs&?B}Sg_?AUoO&Xm$DZQFSheX z>2LbM)e@6Cj|83S<|~u$YW6yal5US|iHL3wR*Z}4*3fs29TvMUG#bul+V<^ET_v5T zHwLtLFD{o>hJT*8Lk-nT7wDo|Uu!Zuvz@nHNEDtN2uL#AjkG1-^};pn9+}ue|46>L z#iHN%KIjBrPjrh9*RnTN?DV95eC8ak21V12tp*iQn`P0%sJr*+jQi?9lqE~@dhNOfi z@Exy?%~TCOfQ8>!F$E`A zXi;r&h;T6N{Fkp4qtP!hnZ><-x8@K;F!FT}T*AzAV3^HAP)3SBW&9^=#VzgO9Q!Gf zT&RlK6qrE-gz9>42S`4DzusNpI?ka|V&VEetzD7+d;W+!&7cy`6_M*5iK;!#WDLv| z(-j$wn?B9r7yx#OdqA-p5ex#Uy50@0KG( zv$}-cK4jABciVMLSIib&Y#{k}b#3q08&XW{o_~7nYdxm~{#n~Mb8cw)2!!D5;_B^- z01b@-6W}Ko5JDRs7|IhBz!n!BLzNg1oSKZ6njMw-ET*xFcK^lmJ$&&e_vR22;ETs+-Jz@n#PP=36iIsWMPl2v zyVrwyVj~=S3!IJ74O5cO3y^)^&xJxs7Yk*I}C1&f<9nG zhS-~ji^N7HFu2C0_#}!lWw@n2O3usA%4QWSF3BpYw010`uK+l&#-;%IdfL`Dsj%)I zP++Gz)j(*$@VJCw-NcN-;PmVw36Ov&7uGhPZ*1+Nm+l=B$Q+$QJ^jN+?FS`*_CX@R zM}+{iAk%Lj6~LtD(H^Nk44Vo#!VG~5fjJ+k?Z%QlNVB?jH1nR#>s0d|7E=G@l~+>* zipA`!@V%kXAfW=A`h;UJ&H+|GS=~a}irn<;;t36~6VdYA)>kWQ8zToVZwzyHm*@KK z9t=KVVSd2@zD~ixlHrM_k#W%|DRI^bNjY*Esk-R-nITHKg}8r z)g7N89&K!$L(&g>PC5@_cwOMJD)3f|i3{AHkkQ{lf7f78c*>0O^fKfe|FQoyi(mgS zKkhqNV#y$}$$+>=-qdnss~mJXFivb=NR`*h+-efItoOI4gb+JZg#5pd+O;4xWH4od zGMh2;gqWd{RJrxXwlNDynymu2%?hTlIR^ie`+9whB7fM|`&f#j^02RGG+shB|FEw& zQiJgZkMD2x^|%@QzkyF5_VtPq?WA^Q@AvhRYOE6%`+$8tz#$yFHPe^O0BHz&^cV6o z7UTdDgA%y^DF|WqA2Rk%#nk@Q+%ZUiwZVi{*$8IgQ|11z-2d5PF^Gx(6(a{1R8Q(d zn?&Xs##9Vl{ER%7D9|RM7e#~Q?=%&vX9u)NxGLH>h=p&hS>Lxw;Mh7lV4G;Tcmi`r zZSMeIFDJ>sPylS?373fVdj^#fnFxT5#L4WbQ3gg?dF2&(1)NCCB%&FbHI>aRIn`)I z`1N41*1rCb_D+IsRJDPzao6M@ROz7UiG@WS@A;YZvZc)}e#O<7>%H4Y$2JFtJn6M3 z*EcWg&tGp`KEcOEj;nKcghBm73TCO*8*PH~AI$yXX)bXb>`x|R%XL!|`5dhf{Lphg zrp5)#v*eyqNehZc2L)`O<`U;gztt?%uN)jNAZRk*^ZP(6AE?t6_9Fazx1&mbLe_O> zoI)kdyl}Sg#+9(cvHclY47@$|8G1zJXoeM9WL zLnFQh0h%ez$ON76#1z>$pk)L-HAgNvx4d#CzP%&3 zwHwsZQ_wj$B+}p7HK(ar z{iCAQGtkD?6@}z%oI_gY8BIBwkboBynNHtm5plhlKAOnY2Q-Kv*pZz>7RmSfiVz58 zRaki|U|HBlf>8fEwx@cVj1g%J%N6m4C=;#w^K!D0WwclYJ$~Pb@47ufl&Nnb716(Z z7UeJRB)vY$YK13K@Gj`Dk^)^+-9ec_0VdfcYDt`y6g`*b>(dl z^RgGkew+*r>{_GeB+`a@c32x3&CF5fx5mcU72FgW*>c(I+>gOH>JPpwDe zL~)%MYqu|qn98_qtH2$7lifpfNR%(#{m7J7a`Wo;Y{RdrtNPF9oENPb$2xu$-pJW@PW86*O~Zx^%o`iho(P@?Wrg@K~K zQ04Tvmr>LldaDsw$pMkRCM<;}uSO^@z6-oh-?JZjG!A9b5I)dH(r7r_XX1E`dwHM( zReB0w#&>S^v)E1C(_QG1M^e5zWxcEPI-BGmxDCc((vAKK}K z)aI@MC^g8vcZ=sbLdZ^IdD#p~SSQZhqtj;5X$@;%ygW{4=Z9!vkaUL6rNvI=KipiD zjEueN)f}WR63ZiCF?n_No$585HmUp#t>xHaD1jQO26u+J`?u;_i|OpI1Lu=bI5d?5 zr!{*DT{h`iXKqFZov95LWT7J zQKzjHsW48T&2)Bp_2mjVbnE&OUaQO9w^^60lXzHh_9}IvIzwwsFhupCZMtK*JzMn2 zh9`=zi)~LwDBm?mjUy($u9&fKMm;@nDt5f2i8V>PW=$PJzxg=3UvzWO=A8X=d6?np zokVwW(cR6;0@|%NJ?O(b7npY`PDnzik6~S1RyB$F@Zlf9dx^T8r7WV-PSPQjG?(8sQ_>#G(2x>9Go|>^fATO5yC$dORoqj5b%#!z362h?vZH{npH}deHaj`3 zUIh)8q+_q-2(m1{3U;htCV~;};Pna(F=8PnMUF*&hu{*508dVi_p(PAoi8{lBZGh$ zr-$8KI^6J9n{tb)*TAMMBASJa`fW|u=b*5FA|7oTtymG>k&y`1`nBheb43-7%c3jA z$QjM9Iy4$bVhS9{nYe4jq}WbkKYpV4@6=5F@qKVW2P7RA7+Ln~eK2x;Bo;kAi|yZk zA3V#I3e5YIEi#s;c$OzWkSAN+J62?OmamSSFW)6H?y^`>K*&L(IMF*^ReM$_Dn+AA zLp)J44ODsnNa;oIMC0{Yu?up6I-KZaEADxTk9dJ5R^MbN*Li73V1YKJ=u|I#c~R6r zfez56^Gh>Ts3#~oJrV>e&l0CY`j|gGUdxtK;8^eheO?6~C^WY2o0-2puWo*A zXy}gTzl1LLvGcVtTv-0BG=#CbW=MX^BDK$FOPU>Hyunzi3}_j#yQo`4F1G0soj;Dd zsNWR-|EOi;ci{CTrtU)&ZJ1g8DjqxMJ@6`@O#5F0yw3c`X%yDC$)aBrv?|BZo6npS z@(q+EZQC2pD@&?hs$kc#Ot$?!jgtRl>hLv9RZE=_ux!~pN>>E~zA-Y0FQ3IyH81Je zQ~VaMRJrT)8;x=^e>qs)crkF`baS%+LIpR&NgTT2-7dmQf?Kf$552f=m(YU2?UWKn ze!yiC_7J#}eefvA{&t0Uh}Cz_X!y~uyz`*dL;yBNIsd5D{G0WoYmol$T1^{?61(48 z)kbVOf3>Pf!885Vs#g7=FqvfjO<|&XuhmQ#O}bz30YA{U?;Kq3wVD*}KKHF^NPfXU ztD1G_{rp=!Iv!|M6H83Z$kc!_Pd9MS$ssGsDlMbRvneSDn^mgSSydx9A@VfTbbM?< zEF|yt4eak6_81awSE?KRK4mvF$vI}$OEbMJNHownIyE))4$sGJ1k zmAf-UdZX_&@T|Yg@fMYB?!_~i61DsHJ<5IBZRXocl3sh7;9s~oY4m9*l!tp_-}1!e z!Wgaj5^cteM_jUT#Oj<)xy@Me>h{qk>+UF#H{|XP0!hmlRYv;>1+Pwi{aGr-73oc> zx;q;6k-7)wpzM-ofSAvc7pd7M2{En{)v_X4l%AjuMb>7tA8nqiraz-!bO9*g)DM?)j}l|-WN_?Cu~=KGdGLYe%1%Y*qveJcW`X?!dFHFtcf ze9ilOs=eL(eZZb!20k_JX*7YkEID{SbuO(p-t|r+@fdZ?lXb|AOq(?G&+l-ljGOV% z0f-A+7=z4URiBQ@VIuEYvO0N(d!j>b(y#Ycy$|v8G7{?q|tiyel0`t z>eFrA_3ZyLg2dQG0Hbpf!!7D*f%w|stQ_I3+Q-vqLAlUx(V|4m-w?zFo>oT5aDQZt zl4B07j8sxOV=>`!cI2OU@B8!Pqz;3-)ih~HAo@&k0rCZ$G1kZGaBF*3Yk1rADt36s ziF5Wj^BeJ(B`R?A8Otrm`%o+0obynt!@~PgOOU!}1{Wn!YV%lY+-`#^8@N72gj+Z< zPVU<*Wl2Qa^cpDkkBX|f>mFBb*xNs@xv0D0DT5TDt2HF!)*m8ZLKu%Lh=S{n8Ti!F zPWhNoq0ZhZK|tqH2Fc$y=G$PLE_*l_crMh#lk2Z{qi6qKt9cOY1OWkVIcR{soi}!Y z{Wr9li%Tpy$dAm2t%wZ8;meoaB1>p{H1U%>`Ft6LUiROr)vTx)c6ByXC&uCEe*9e8 z)mu!R6dBwN%@*bojHFHu#nE&3Im|iwRE?;is;Ao0+#;ErpW=+Y_cjvUIlEqsdat_o zx-!hEI6;kejlJ)34Be^PL5+T_?iIl}3K-ksUfl zs%@i`-$9k3Gqv%z?))VIEa(zHutd1>mq_l@{L)zUlI;FiYBvV|ZMg zs=PU?8Cp9VO@{O<@IB@l-hK81*y>Q@@2ZmWWcy@xIe(?&^XtER}`e*hiWoznM@bDv6N&v-9u&L*6NiJ1fu=&;ONoDrrCpTS^xZ_%&JEnihfC zD$Z3C_1CPi&~|w=*Vhw&mUom8S~a(^qTXW`GVL(BC6tgRWEwhxal^`7qWn^y(Y>e4 z2J#MY=m!32-a#%h^%k97#=QV{ix-(k_sy_j~b5_X2 zphe_nhwJXSV}um7CGldL9s|{rM!tqa6%)dlnfaj13)bR~2M$|GYB`=*O`tn^8<~8H zyK}6^7s!lGZFOCjOg0(_od*;INb^qbZR(M;OhLpB8qnEDZ3s|iPY98q&?mk(!?CqE zbKfp-r-AFKg-kuf#k#O8qVjmm)ObQRUkw z1AklaQJ`Uo((_aqA)p!^=!Q|{k8v#1+Mm_z*YbL5t?|kQk3p*sd9#RrF<=GR0O$Ev zHvXg)3pJ)01t>i>bN|@{9_%JJ$RJ_}Gb7pn-Uk?o;o!+~JA7n4p?tkM=;w@3@B{3E zG+cxc@pYT=7;~Lsv_7vI2&!48mh1WfC*#{+SKN<>!tTuhQ%@ z#WOqBy>0V!yS8sS7M>~%YtIoE`;n*^sPTD>UohOXpo|MQe=#zC(H1=ohkD*jlXxhC zSGQE63a%?{cx~7fy@VMIZeecRJmtDwfsC_yRpf8^R4WXQ8DC_nHGB;#W>}7)KecVc zJBhlPT)(h#>5Beo>Pb_-Q3rvwh=W1ikdK~S<%O^hGm9Vc2FGsk$k~mi51KwfQknkh z#RbkpIraL(}gPNIHmEFkgB?q~Gc8I7Og#3}YT- zAxEXSN3C$v(^qW{mTa8Ma&AaCa@y};u3Z%zI^{aQRna0MT#7a6*kfHVnDLLs(a_=9 zq&zT6>JvB|IJi81#b8@}adQzoK(#GNc%D$2jgx}6B~aYY=6%fpG2^W zOqW|boPQM9>jzfAd9;7vr4ypOTk<7Qk*@bjw5^q#acZ<5-G=cLwqI_HljNj|eYM3t zg-JQQuDzVi{JAL@-XYN@NK()@6wCHNPg@Z#c;CiHrORG{JvcT*I?h;sTR8(e!Q{M#Sy*h=$ zDxv~*bG%@E9nlqZFiF*ut6qC`>F8QJz}19U$yo$d>lEl(Ab1-Rz=h*ZSikcP<){hL z&9PzR40|gct1DLH3pZ&LX%jF%9#MPgBUfVrvW*-|{r-5?hM}9ANw|`uc6Cc}BE@m$B+^gbn8XMD;a@83YT>{HGID?dK7| zM0JC+*5LQvX2Sm8dzdHEVh zIR%*|W#!hzb`hFY6?OG4ShXoN4Q=h|9i`n}y?v~P{qa3RBcn{s39Ub-rsbw4XBHN5 z#{t4-WMzG8yMA-$FTKtG#`W7hVe`j(PxulDL09mh;v?)QW#n&zDP+6^Y=tuWzEUYP zCQJ!Zh=;rSP1P%y>k=gMxc5R+pHh6(dLJGqZ}lm6RESjgO=9i0&oX&{B=M((W&T96 z+CMExjM=Iy3j8HW3=JiR(wncxDgV^hz=OIdR$K8El%{};=2%;RQnn1y69Q|S zql5-$IY(8nmBj3K7^$W=b~oeAeeub3ypCtrkngJ# zc6O36U&Wql1=ELZeh5iG7GCw7+2l|)7hUg|w*M${r3t$J+%w^?pkK3Qp$hv!HO9?S z_#cxb9*-{EOA__c!s-4ZNfc2`kNQoL`1Nay({GYQoz$cUNur->UeUcIF|SqRUXsX_ zTUdK9N$fg803?afG=_jAk!Gh9(#y6(o7;a+_(nYtzSR0gfFu#GKzrVcrpRU{$e^ei zAbj^L0m8Sae6P{J;4z5GC9k2QvyQ6aa(t$^e&9&7xdCPaaX%Xx1Bo&H@n}_ZJzV_t z!BN#57OOm8+;EUY&acDKyD}*dnQO=S@<-%m$gyV zfbL-Ou}q2Kq9s<^>JW#@X>(C=_7M|^$XTQDO@sB4qpph0@Yndg z?Zs*OB$h>A8Cu&ph;tVLXPcdMVCl+1S|RgVT>0y~%?vF%_HCgPp31GXvi-6h-@Z58 zn?@_*r)#+jK{jhs#wfRkb*&P&N9cILx5w}_L$@b!2&g|#7q%sSp2dm;|2!908v1$h znH%-)63Sol?g}M7`0jd+z4Pv-^(!jm_;@JTV#RM|UjJtT-kXba?RbSnhYsF%k4x+q zxKkjfaBK&qBCds^i?bdS9A_lE&K2=Vb5ufnh{nCfXSj=J#N92b&q{dFKH*;o<*>l+ z54zf(EI>Z^@II|&v}K%4gx7^{K(0EpwzgP+Asc1^jSqYA(W;Mx^6v@Hhy59t$DgNfbP!AzyNU9w++^i^$SN%jWV9#4rvnHZ=z<_C zq&e)9$+p+Wp|&=+D>cwByUm`Kg)9MtOb`%$M3pT!lFmbz!02~e*I$8keH zV5h~5>lRG+?NmRH)*aP59n=@^IVs+Yi`iUNU3?V00Id&&zr0^qcnEOIi4pk~DZw`` zH7zC*CD|rDH_yW#Ejuc|w9LdQzBsYGrdIviv+BC$7Dqj-?AESsUU?X`j?A9n@9eTd zmbhUfQ`4_Lkt6gI_{^-VGS1^G!a((xtnDA*Z$lwM?GW~z?F<~={=_&w1FZsQ{0txT z?xRbk?h>eG5Qr3o$9qtz;qfA_{^neF4eAaMSJbkFZk4*=P}`v5*A?@ zJdsF_w?Wu37CHmTUB=713dL)@NdlJ8DqIH3!`ULi>-N;&DM$0u6QsrUS^2vPq3bjW zZiHy$)5wV&UgJd;%)HeZN@Kl7&YdlJzpy=raZ%J;1;2OwxW1Y(rqKyvr4o;AqSzLa z%xKJ0z5l6~=H$ctt~QfSV$w^Db+I_X&6YQk{?CMw2ke({kOaP6(*FQlTKk;5M0(c`10;zKMp(~*AzvW~5Qb*#>CY?&Y6~T5r9tzz;ljkw?2Wp#+#kLu8 zZMuLM$`#mPJW;l%wq5)ZvOKjFQNvj><(~&|KkZD2NwuBR+E=Yl zSJABu(%G_`v^P4VqR`(m94%W1lO^XnaL%p|{v$5*Y(yV56&J_rk-eR+CgmoGJLKlb z+ROP7?57kLO|%?!UW7sKMJ!}`JxLFgH!+Vr(QDl`JfF*!YItoqbZdA^`oL>)Py`7r zqrXh*7Wbzvl7AFHuPC4uzyxci6*#!-qZRb}vRmsF{~i1)@_Upk(XbDMoG{@c$IxHG zB^nvOM1YlrzeK*&^Ub7DHSSq^qA@Qh7ONSgz#sE2EjBBTOs@th&UBn{joEPgt8N&Z zYA$6MzorEsM4z8T4)<7B&tZR0(JSB|^q+O1d%wL%DQze9DR6=GQT(4==+ZDO_J89- zH?iBA@AIz(tls~q3ta+4_&5Dr`3UBHjJl`hKtET(RzKUHn8Ns$1HNI2Ff@paO2mUK zf5?f6pWzTIIkI9Xn!J8Lp?U#j^)Kt^8tk1+FQ>2FNo_-^-Ax|duh~mn8LZilKPjp? zh=mERIgG|IsX2-yldL%oXJ)852^B!CISrOM0G|bF4S~=7EsDVxzV5-`OYd+K@Ret} zB>39BoB@2}+J*|geK*Wo{L@h&n0MqxcbK;mg2)dVVr{N_Hf#)6palJ_q&a|9${003 z>CqBfOZDerBP>HD*r}?PN=qptA~7ZS?`*B*k;8_Rv`Pp)RjnnJ!v+kqib%z50(oPM z`t08nQKG8^?s5mAUh^oT1+ulLJqy(n#8*W3tZGkTeX1vUtAOdq){*o%R99|R;W@;z zs)OiX)z1|)am- z%=c{~ZBmW|ze&lEWZrtaiY4u28t$5;{}n#NyZl8fYUUPSlGsyU8QD;D!`Gkrr6A@4 zC&-^O{U>wLUs!&s#H@rBe=qVWG%hFij^-EF{cz$a11HV~6yLvb;#f83{_dun%dq+t zVu|U6XmJ5lPnuQv0o9w{-0O3@2 z_4M)e6ZF1c9cK!>A1o1t-@7SMV%ZZ@(|nWDv$B(HGQ|+`bBaqCib^XgwY|%$YU=`+ zYwDX@>{{E?zBM&;0F98{w1fTMM`(se$0uUOo=s2AbOrU*(%k^cs4pTe_!}@HjH*n%uxFG!GsL;br{tymq_I=9j z$&#Ssf5FI__ePmFPjSxgEg+7&T1B$05$TWl zD0Q`G$`d6$9bS%hR{o%>f1rKC2Ua~hgJ8%7G*``VO{h9}0b1;!;Yyz8xxQE%gJ=Z5 zX~exgTtjSCgCIMCAP1G%YJ`x-dJEW4u%Ko)SQH;YH$>vDr!h=Qw<45C?+K;}9N%t@P*b zU~P#pVQV)t!Wju|--k=e+NOqzwd$@#eH6iY9I5nXY7HHz;GhUp<@%Tv`<~vm9jM@l z)rmUm__`MJ;Z}DeQEyPeBgsB#N(H-S!QPQuV)Sgbc+BF8I*Yn`Zd`8X^COG(s}`!;O&I_{KrM z={J5$?GB*F&@g{|h9Y9S57Z60zPK01|Aspwz^cx<3KSfm8AI^!O@2K?nbu*ZJ^J)A zw;XiLM+&Tf;k@OK?TzcP!FE19+k5$*7}|BV7wV7&*Ay_Ehp5@uvRb;(!kD|;Vas~~ z&(P2pJ~)2qrUu-Flv(6Bfk+G89fj2K}3l@{^o8*+7jfF8&8{uE&o3Xz6E!V&QESPF&e z4n=vC0_Zn9djp^!sXuv3yxteZVZr9ZDdQ?0!1hH4-cBa_d*oZrr-?$J^hVPJ(^U=q zHgnsu<+ViSt{G{@Jygrh3Ah<|C(3k&!c^+$3l;5+JIWIC>GqXutky>63}_GL%$?4T z33zA@7izswF;wwimM-fAJ!VeYr8-_|jAD?P@24o&QA>JZLD)cXx}lsE9i}=*VJT%^ zlvrhUmsFE2iCGF0iGJL*VokEpDyZ3|Nrj>quLHuzdva( zA~)N985Zy`oJYab|2G

;j7D5_@T^8}IUjOIqK&Gc4s;Go>wqT+{X$z8!qSEnhM6 zuWm5HC#fW@<1_E^PAO>bq0VkL?~4ayNqtP=d=>)*i(>5qTr$lTL$#oWwjq9AzHi^_ zNPo6|7g-ps=#i{${x&K@qry5Ohm}}4tOPS>Ii$9O&o-zvpL}XOKV3)@u@t zU)^ott;|kj?HpI#rF1Y*yg&t_FI@cTB5Kp=t(9=u;g7dxy7EjwqI4BQhQ4$S@>C0@ zbRE^=&gREUclvTx~5ADyE!X}HtdqN0u$u!eru+@ZY2peJ0cP1+s1#i>Kbm)URfHeB|% z!OH`|$q8(%AVUL^{$G2gf0*S`1LtclMGEk2>@ZjI~aikBk$~5-lx|4?aq00#g^rg$#j@ULRg*Z%v*h z^|R`Cp|&+548s#DM+Ui&zlCOaFZQk^#nThMV^hfO6-2zv;@vLmB}a)CFYzKw_SKfEcU|^t+&p&b6bRR9=;Jm(p?7V%t$Z~Q-`GFb6I8q%0@mw0f zI9*y59$ku$tA9c(id>SWShSw@X;~a#1-rp=NPx9!2Ln0sGYg)<(KnGzTcmA z$w!WGW(}6upDPND+})XHW5o{!`DI3!NC^4L*G7^ac;6hJ9JP0n{9ly=KOuboA}#j8 zawbe){>nYj&LP(~R?aF%HnungM?6Mp1P9*Ja65fH)@ph<8*6j5rZ4FYTCY!vz?;}F zq<3oFg+zsn-F$&=2YDpVKFE_S(g&GE?Tl~g&seBzqm zLTiVdtEgl4>8(GX7qviOvVllQX|>K=jGWt5`k~ zNo@?875!YkeD{K`b&aZEqVh4jL+3Me?&#tO;d6fiiGy|Ap*DQUubtSz1AXt6NN+y& zk(*3|Ua>M4ZyyD;XPF6fj%u8sk;iArOAe5L@s5RwS8Dre7ueKUh`mfI zhADsHliw}qB#`B%7_n7cXk*CL*nvjK#)FGs^F*Q%pKMV!53HKCKvlVzT3a4)Pxw+S ze2Qjv)1WU<#h+JADY;-%y(AD5x3a80J;%NZAv4@IUbGsM=U6|QZntX2Mn#F(2zGbk z06+5fEZdT=LrS}hf^Hk;!E=%X-=FM+_%yVXG=;!FRy0#kMU1hwRw-ucLf8~uN{ijnqmU_ ziV03{+@I%*X&^p}$^2D}?$Zn^gL@a@0!6pD(Tot)MT8-Sbv_=Iuq%J)o~H%%5__{n z=*wS<(UbT=e^!jn=%t&Y-mC+~Pj)-(CBwOl?BCr^MD^77)@B(!Ug$l(&{MyC@G>SO z|9_G9oc<*iX-`0s^Z9+-gr{i+bV3xXlg;RoW+h{grFpi#8B8`8h#bF7b! zGj+mheaYndU z{MzsM)HVEtyE1rh;+koho-wE>tCBJyTEp0T{fjjz6(r!AVQ(;9aG~p_sT@UXa#C_L zMWKf@X>#0!iZLY(`&n;NC1Q#(Y;w9=Tr(9$#KoGqaY~_kGc|f!4|SrTQ(5-24Hh5E zK2}p2FRSWPqx+dT%S+9oEJ%_MPAmOym6<+|+AUH*W@q}3lAjUAtte=6emFJowsjd+TE z!P|_>x4u8`lK)iYM$WrFFDKT0SCk(pw6t)0D!Qj@Spf9<`}>wyIwafdKE{#e(OEKG zLA7Z$;auv*wCaysKK7qc@0ZpYYrR4I6?`8*Ig+w|_wJW{DG(Kc#03qUc!z{Um9{WaDFcr^5AZh13Fl&qyKVieO?&8o$uT?IsK6W9WQz7nAYR(d@L^ z#AU~?yb)q!LsM>WYNZ`H2Q+4|;l~l=#ojg-5B&t;!&;)zC0mJHx-a({>Qd+*SiN|` zFnK@j1kSZ=r{qRIRii6h%#mcGtzZ4G!2Zp&BlC6e6gWG)TXR$*Ca(^WKq+j z`u4Joi;dCJjEqO4@shJz(8Bx?b6t9hkdrrMOaF1jbA(;`wtv4we~@`q$EK>YNy@}j zkmflU+;+&Ib&bTdi-CEZKgE=aZ8D$p^}l4s*1cQ5PCW4GdfmQ|P`d==PC*Yp<3EOf z6y4%!Y;sYlI8N;MZ-FqcM?3rC#$2~puFj|szDM7p90;B8wK|CSomgY zoj0@HekW^GUe0wLoK_13e7BC^ogH0qFD(4MC&l5JUOl@X7nQy^XXfd%Npa}l)_lO! z(bBvf>#|?*U~emKHX_g$FDSBcy3^n9Nx^RrAz+5vNeZu@XEUfC$MyBzD+@zn6#t^Iet8;h@)*GgR`Cg4}S z^yTpJ)#;RUYm7tX`PB0ubX8^G{*%m)6O}8MiZ6suf`dM;Bs2}y71kWy`eA!SlzF8+ zE3@nr6hJV{av9fuj#-pky!`$49DUPoAj$5Hi*~ux2hdM@5`X|A)c~?00GYDq;r(DE z{UBOSGaNbqm3MF*Yk)~(Fq4?a9lDSvT?GmdfEnh&svL6H8^Am8di^|v&o)rdAcWOD z`nDcSeW1pl*c5ChbnGD=!eakPeU_k7~$;BhM=`V4TX2ZNMM7jYdA<1eV<9~bj;*pait<2}0L`>W#l z>GhteunMUph+M=!2PcT{(n$^`NEb7{AW3}LBqBd3_R20%sfk^sI8hDEr-AX|)FMfG zZAUENlb~yupf8?aNS|Q58*e%o{|+Ai-Y5QpO1u?Uyv;?N-F%!wahwx8?jtzvlTVzR zU7UwuoR>iG-op{WHVo8vohqcN#r~> z%3=4-;Y8$cH|Ov!e+H;mJ>{!NZy`B$ng`sC01Tn8zix4J0F7&hZDb;c|mBCR$4l4F=2P-F49 zHrBq_RNXNs5D;Y?LWTFq9S|9v^cqAN8-#F8OwLrZqfT?pbIHgmmXC!(%CQxll3L}m z0@6n3Caa>lcF~5WYX26?wvP7$H25RESdJ&Hoo6Pfqlwy-)E2x?}byN~~4H5E#ZxPWc0c<$HdAWja z17#Hkr-Z}4Q6JNAn)E8#S5kzcrJ8Mr)4=I+mpVio^e!(^HFvw&Ylq-+>bi%KNg}1V z{G^TU9jNpy_Nf^JW%E{k)f~YJH_e@XE)zEhep4_#r5>wz?|Y_{QPl%u+?uYTXO%uU zzaJi3^5i|+Z+?QFtH(mfZ+b0^+y*)b3<_gwQcb^;=DeSlk$&a)9YssHHdfC#Pr|?V{Sl(++GX2h_i(Q zGpC=g^OI~4uF@%boLYd`3H3hMaT?|1;0uELHaORo4VYr8N09(1{aM6Ip!mJuSs9U2 zI@xD@gd`hr>-1dRUK|4RU#YbC?+yzgaSMWMR35ze=aPYt>|ED;&C9D32oM7DRAWtAzO z8-$}aLzDDmck(4Io7uso>-UP8c0l)_G8}fH8nVwvhc*kO64)F zibFh(Brj`YAGEFa9OA_&V>J2pB*$AF^H93I zU>rF93!`>y=dA;?_CJJB+QO-#@j^*9X3%EsjYPF2`PMOZZYd*MkZNKV?%a1 z`W_^YkGA$@Wuey!_b=m?71kqPoP(6Li7VFYW2fiUEn-Q}>P+@^GtEAcbFcH?qAl{* zvLQ^1{w;~X%GvE?q`Rzx`d8Fggs+JNl{Hb+pW517&SZ%l-tw zMJXdW?-xYqa(^5`Lp6$LW1DnE}2BuGT8v{p)sgoG&=tdw@T z(AX6bFo}^Vz{NyfI8;MD<%P|tLX{H6inMhY)!C?0hzTW4WFzv6i0)$6e>Do3La5)Q zZQL7e6dK=md|^JlK?g^}ex*~#$mwh{l!`?>@20-zn)cy-dmPEFdg|!+1U=-Z#38an zF*e~#AJ}r`lwWzWbG>@p$JQh;pyj)6a5{6nySi^J*kl;x66u!ml?*68-ZZ*aoshok-Yv0O-0wZ)mT|(A zEBzC$$T4zh}l)M#!JY;`}|Oj(r&_}06&u?$xNP+8xsmtoDRAJ+))?yef`By z2hQ@NNI||tIzDpRqo6fJMJw`45?*L7udeMQbA~BIAfQ0BoI}%X=up&KW%ERY z=1C6Y?;T~W=E;n zxtrL5H4C}y22iZ0mb5h?Czb4TeJ_lvuu?E)(Mq!P#Repf<$0^|r%hH~2=%=PE6=C(`D zd}KditgfP|PJrGMg9M=8qi4@G?*fQH#P~=+kW~PgN1*B*KNAt*m~8S}mP(2WFCQSu zZ71aEb6G*|0CJdTolS_+Hv{j9kc3;Ilw!eL2EKx59bRR?Gi8n4Np_o8fGJn<*u$p} zHiAgLklxvR#DosQ4ZY3LMOf8EKQ^bMlW)MT4AetE7Zx+X-T?=uLdb4~>%;s_&_F{2 z>>nBo-g?*Da-K6`Wu3tgkVGF_@M{bzg8Z$X*%O&Tj$jEi z5Ty?)LPb)327zIrOcsDi4shu}B;gpFnksS`ho(@c!ygmd!iIVWOEI0A4WS`L|ocL_78;I&yC(4hz=Zx zBm#m32Y?$KfU}~|4X+p^ar7cG<~JvlmRNm3hkw0`a9jChE9}{KZyAOnXl_x|C;c=2XK#VfviVnJB8?o4@vH}SeCcW;6Rj@AY=(mz6^`v z-HD^)y1(ib^Oz)xTqRzXD^bA*N&=79@`$ZGr1&)JE#tu{%0=Q&7V70{pm^jRDQpK3 zpHJejOI#C6B!?%wH;l)>fS8jcN}=Pi_gi^lnjV~#AWLCY+h{+O0GcDxs5oj8l@Ngf zR-sZJsHj_@V?xCZS_~3j7$(~pL`{FCKyeZiRTHXldOe=H&*0|Ch79_J3cO1nb-m;N zfh+bch{dugBz!lHUo8HHBG1nWYCoJr?c_&9ZQiSW-WDbvgR&XF1F24)NqDNSZ z11#y`pOvESq9Z;VKFxt94{*J?Z)ej#X!G#GrfS!Q)Yj%d7KkPPsX$!w@*m_iw93C# z5vq8`+?`g@R6o@YusgwUrN8Q2f={rUgq&}rs^xn5e>{Lsj5^HCQ)u~9b2saJM-?+x z58wOIRQ7CRN!*oHSL4_^*E@eKi9{_lQYSbn_9Y0LW4(nW%fzH0gcGqO?ts)BTc6wl z=B(lpU|~5UyrNp7w65O123ecmRMF7hVbEG#)t%GXKVbH`us1q;EG=wsYMOg^#P_|l zK7r8q*v$F{hn_%PqEMtpNBOMfW!n_vYuo>l+bAL8=*f&TVBGUV2;$H896RWTFyPxKcE)vo8UO zmT_ae9Ke-|wAfrWSvZp`@!ZLLDuL6~G3`TKp=9QZY>DY_b>qr;DvxG+-#%s6K@d$f zhYgWTP3zCG>PI|54NdDbj;o&eQhSUA=wJCniZeGDpP@jSMTF z{U11peuq`Q@A$AycOBj2WRagbm_$)7C;M<{-F+z8DN$fy5ka~AsyUg>&?P{hM%-05M)JGN*sN|5nZ55d-KGlYo_|i~Rr&P{?mrJ!%Ak8g z&N&urObh!gLyD(s5|m!7`#vP+mF~kJYb(OFw=wxUsjdlN19Fhj4vP8J)%*@TlK#f# zD<#)^xfO8#?lfpAKlmIezp)Oe^8JOrDQJt8g}N<3DrkhJu$O(dBXl) zlesV13Sxr8MHG~WOUUAkQ_~mD>g*}59-&Lac^ASyvP<}WRvPs<493N2rDNGgZ3{!T zW)(4j@TTkt+|oH7V5!l^Uthk<-r36kaI-~JTIQT%mnP{<`cn7HE9+80fDF4Wk4j(d z*KowhWoK{;KeP-VGdy{;TTQyQP*yY5o;46&ZAMe3+)hKnn>})g=B;;O@U^X*iEZhr zU-oqv3;4!s;fOrR$>PVKDRBMR=K5_Buf>|iVX)y>J1KwdH9MlRBXfTd(1R8LaKIk5-@*OXGY64hl8ouy8 zs(7{Taj4$pgNeYDe;NLLzz5$rD>1DdOu4P*y^HHg!L4La^)cM+hbpz;*$)P8-e$qO zCEwngGy<4Dx_?Rb>&3pbK*(NHR?UW2=Ph5QU<-%%mKqTxVRHFL!^^aavjVYmuqN>N z)Y`3wNKVS53i2S(WC=k-P4hB2aC`Gzw)4!h!A=)|cdB`!Bk1w+@}_h`d|a77OyQxc z0R7dQY+npiO#X>#q_fk;I;|E54L`g@vG@W(a;4bA<{if`mo`sg!`Z37<%0y=4 z_)a4kk=Cd0rYEyK-OpNIhnY*=CW%?^^SCU4*9SuH^P?^iZE2fJ_3Tvm)rr ztr{kmM7u3qV(@(K1#j$#_;$11GvvaX%D}q>2!>MZ4&e(T_LNv?W{0+aXR01)fbvFZWq-?9A}9qahT(!o31$TUi44u%Uvj=Yz)UGD}G{BR$Z) z3V55NoxTHTDo3=g!m8ZyZK=_Mgl7ZtcdBrD%{Z+zqWFsR#gI|mB zSBykT&QQJPC#;NakNIJ<7sA=GeAtxPJOw$j?CjOg6Z(^1zj5m~pU<3H_(>p5^?_BT zf6JDc67an4c=RL5Ug_%1<#`7VMHPTZeGQKh-RVXQ2)RG9MktByqKd5w<4|8GHAZ*S z=?VDW{bG*ejqbrQcj2c}-;j7^(DuahWyDJ|3+h7j=h6o_q0+pYw{q$FI1Qdf89RPp zx33H@1SU?`7q%id;jW7zi3@S zipGziSE(c8EADj(razo(v*uODJYiO&P9IZKN#<7Ea>SR{+*K#B$m9kRDCgO!-kPuBQDe`^(wayU6ov?N*TEx&)bKw6fzHP4$De;;^{x2&9xVRh`ke*!35*NC*x-HbPfAg$Jo`{U?7$(vtL zNb6S)t&1V!n(=w}i!r~O<1EUy9VM;H$<&*ZBCWPP{qf7$mYdTmNZY=R*44t| z%^C7kUQ>dO)lFC}sS5OA>Q20ck%e)cU<=jJZUOx1TkR|32`; zT&+=dp!>CMj#4q#J6au=bK^H>EtubjkdEtZEzIR2HYCH!z;4ci&Mrez_HQ^$ub%@5 z3;=}Q0Ad(`6bT?h0VvP_D!O1Av0z$*;CtS|bg*CsWH1vdm>C_+N*BT=7V_92gxx!Y z6Bfda4BLWK=NMZH7CV4)JoP$^WX3_4VnE=*1g`w|tV=pCjE3sXgg zsiVR)(P7$jz&Bz*9Rr}AH_!kEG(rMRP(U*@(3~#ZLM+_U087FMw}pk66}wC+Qd_>G>oXz>|!cl1%24%r26gv|Y``lPwLCt$mVh;mP(*$&T~M&KJop z^eJ8($*#qI?uIG*UMUV)DYXMBVLK_@eYXJMl*;F@G%J`r2o^T)A6ZNq;}ZhmdKY&A zOi+PG%>$B(LH~RYvB8qTi*Y&rkio^Ux`01@I+}k+2LH#bIDGi1aX3I7ZkBe1iQKSV@qB^ukOOTrEr;n-P8 zx;sABNXUkdo0VHsoR3>jT#->)R$f_`g6&1uH$xk7kcBN>k!?8bHJ#mqp-9}%V;w_Z ztOj^T#^xp_7tG40xv;v1{>86`^W0cp!}7NuZ%3LqcK5#jIyhH3+&@B|+-#%qXsQXd zd!>TbNl8rx9;M4s5>c}=^;hM@hEhIPNEG`-m-!hY=q&QKpR89g_Q8)}6S&;t?)V3P zcM2@s!opohu|skxJhFe4PsLiQ5d0f1+nq1a(M>tGfp)Z|@%%9K!a;$NtKv zrf0BcG{3O8w7jzVcd11>-uB-2H~#xS4;4TDIysg4gq63mx?SC1?(X3*DQkD7hY+8B zQyGBDHhcIn+;g{arep-;Y$w$!Q)6_79v`W?L3gys%aG6B_sBA-F^^#7 z?JdwCla=UslI?L9p(`8>hN|t!qTR@?xMq>Lp^6Vr&D!J}oJy)bE*6*?H-5xv3ToUc zmq#9~^{L$%kMlp@-Kt301TZs-pN>vyn6TXVOYZJJY0YimUwP(D^R2^6E9l~y_$+g< zCum=$*MI-}ZzG%v*^ii2%;~%m%dKnbwaj3gt+~0t+f1A$09Mw%wIFhKRIlY-y`=R| zRK9@qAcl~Ebzr=c7-LAg$Ig2&TLwBS1YcD*8%$0hkP*q`588Mu)L^g~^B6H_5lq3n z18@~{&dQCZ4WYx0e<^Cs7N?_U_asooy2?^VItRI)m^|3H1~t7$G6Q{YUHl|U@}41k zic27|! z#UN*JY`0Hw92J#Bp?PvMm_0F7bFDBd(+tj#@0Fzb1XfglD7L6+H(V|X`WCs9`DxGg zdpY=Gfx9Y45$uqT=@0bbPVEU_;HuG;U@WUrE3+?2=`ElyuaoO5E+yFGGUlxfX20ZZ zSQX6rQ6?jb^Z3sB;QT?{X-%p^`{l~;)4KT^o^NevQvZr3!gJNCRuZ)VhaNY+5rN)3 z8TC)LG*iBxdhdNK)5AI(qn~xN_1`*beiF3wY3M_`Ki@ES0$Hsc>-b3Zh-kt$*D?0W z5jSHIOzXWeIpcb_FTzt%!bVC@%WKC;ull)%2CaEZrd?u-PV%6d8X|Kq-C{&ajfi+f zgFfW)8Bd{Oq<<}Ff1j&guyecbxrm*u@r>ci$eyoy8aq|4+6IxI&HiqGaI{Y2VC1s= z<+Iby(rkBt7XkytXBJa8eosNA4?JnCjU-0>!8&i|F z&y7G>lF?hWPJ!>^A(c0m2H8Jv1`j)CWzaw8SlG5NLyZD4`f)5bJ4Bs0E0um1Jgld& zg|b>CmBAF2tOUQ6sz@@3Ki$jA>JUVB?tIcV#aw0KP%C#*hCuz;)maIYc7*SWLV;>- z*?8|k!u0o`;jd~R;(X#1esBhfcyXM40~io`I12%Z3$b0B^!2h!`~qv&-PJBo{>*Lk z>G64U&OJ=yz$>`IuPAe}T)KYcK0(BA{}XFB0|mkdVT6VI_C+xNqgy*A=TQ1Kt+O z&Tx3@-qU+kjK{5tS7Y?BjQ@(8cf?oM`36v~Bl~@D8UZTz#HpB1EG0fP(iPfEqB>l{ zeW!AvPepc*6liK-f%|$$c`^w<;ufAs?ImDf(mg(rwZNK7E%@^pP6bIlkEHZ>t+(+F zl<~q_A4FV?9#qw5mOgNBh!a@U0nbt~eJdldcL2xn#7Og~df7nh)wk>G5js8tQd zrP&`9ym7Qvzw>I_nq_T;<)l&m#41Fc1Lxgslz!E==|?xpCbM;hyH(uehr~Cx4NFy% z3Ktv&9zK@hrMNBJou=WOp|E6pd%Lk_@h(63`M38A+;`e*`CKSazU#SfU_^Y@zalFU zYHM$V`Xm+e!4Iem$i5u>Ybi2vR<7!q9Q)X@`&dsJdOXyz+!r`avlBx{`zD>0t?YRjAY zcd$qlZBIJClhBK0&kun893Vb{=3tppZ;t$Bl9MbJkBb(@v>PPSYP#kBJ7>~z(ywQyo=mK z3tTI>LTi8|7BFLp_mbOGU@wPU*dLMAF-bkG3=??00>Ed{oxe+U@$}*cGvcYm)*wcT zXM9l79d;!*^Qynj_!rzgR)1<+^94_Bqp5wbsPwkB4e4h$DmO~j^u00W-I;2$(Q3ct z{j&5+om1X5H$jnTQ=*qk^_Qph5vExZN}jVRg6FmUZ_R1pzDo}oJXezDc7AAio#v~sb-uFx@yOr$?m+DA@bUHvk??-?Zp;-oN$>2|`T{s4KwRdwX z_awB3s3~Os3KuO3mpM&+YHfyCC5+M`D02u3{Pk4sG%)d1O}R+`?P|vEFUo!l`_IfE zV|Y8}6G0G;*#B=YZMJl#b=dOZtK$Fh<-`BtOB;qhM)G}}dzSXLrGLTBEB$YH^PoFQ z<|?yAM27R$`$U0>#K}JO{)0A2nLBsnw3Ci{9p;Gf)mRA^>G0PQ1LrwYyuc~bXy3C4 zOP40IV6GVJc~gsvWISZ@?N4uQ2YoHY!6rV*5%ArCN7?bPH-5uDoD=TI@7+WI8*8*QqZ zqK_cEMt3nucmF%3ErbtV>RPgHouP73xLeBw)sMTzezVkf3rs_cy;m=A2T62#=`B0J zADBe3^aPUaL0BZaO6y?SB%GoiZY1EqU!U#By7ir+5IXSttez6E9(JkMIU!^5@5-5bpQb&?%kmBk@TU7?V= z-%GUZqsCR8dJvBHYd7_mr$r^)e*8Jj&#-j;WC}-C73XcLRrXxH*__s<*UFb^65Oz2 z_SB~mFwA-0(W$OQvg;l&KY7lf#mgR~lTjm*j4dLLC+F9^DlmyG5Sa_GW5}{lOivTe zBRed3P*UJNl)qIMWT_fN^gM42?waRQV6U3*a*5FDD=<+lqO8giM&!j@QsH+J1@z%? zQRitq$$eGwmdL&!4ngsQws?HL7=^h=YYop%zD$q5OwZbLE*nbA@hPxb_z-Lu_=w?k z@ChPOxX_5JC|Rl0Ts5C3tF&@2t)06JBvD{?SvWvi*fLaVt@@E~q9Bc1waKV#l^ro; zUzT8BK4xF=qp!T(H#3?6$Dl5UDl(^+Ht!((6>V2;oI7=gc!`3j9&#v?GTWX{)w=GY z;$*OL(>Faou_T9~a+A9x!QPU{uj)rr`J+oM5;a{*iDGKW(p95$BDE4b`=Sv0OtZ@m zv@ON-j3r=S+a}#=)0rxY#cJ=!kL--rd^|;cMvquhYibsB*hy=77)y~1HPj`wGO2}< zYQ?{O(`^|cTrv)->JBhaEtSP0k^Xlt9qK%-spd#aUJMl-4ie_?72hE6G!}~p zB#N z-^Q{dE3F&qNi?>18?+;lj^97#oxcehM!Fa_G4M2Y@6}c{<7nN^McP&10qhs7sIKfQ zDZA=WyLE*_sa(}n#|rf?M6*qXE6ES*6c(K7c}l{Ks?sHVg=Ua%7|LGy)w3-Y@(ydc zz|(xr8gHML+Lt!?EjA$>TCMEg2B(+-9NOT+t@jC$mm*D5#;puIZK)nj}n*6fwJ9Or@ zv>M*c=yqs|j0!lAY^PW-X}`!GEk*99HXROY;ieXX0(&mh3S8o};bSjF!yv&uUhQ%G+ef{BcrBuunDmq~(yiI-jAS zWxjJMtYvQ4XsERDnO{%OLc>~Ae!x{b^L`dsa_&h)+W)a`9QrZ!>@PlqT?);qbVx$dU2rCxaM@RfKN3YzqO@cxHQhM z#Hp|7c3K6cdL0d>Gf?hHSBh~L^_lMXrvAZ;2Fd-JaK?5U^?@)_Z-2&|g=W)_``sQ) zjc#S1FD=_cqq|y{`Yoc{=eW%PyfvL8J^r_Q2f_v@{X1Uxx5P?yv?Z%;ard7rw9kR< zA3Xe=zBih@FnETjKk`j2G;Uy#>I+M3JHFMoI&Gbo_GaPxkk?WVr++*7QbyI4z8-J? zO4Kk9Q)7ewIGAC=JG!Y)y)V(Y?{Ui*f$2C2dCI}%$kjq`Bw3YDLG$r#>@RdQU3c)y zh^F46gYHP>#`WN9$0`Uz=?S>GN8O2Hblj()YF(xI(7y=7)#S)C{LBPdE!Ea-H^ue6 z`vrOb%y7Rorfig2qiaXE@5*GT#-xYWB>${+f{v$5-?UZi$CNGE5P|QP)zV9UgQ!VbCo62(t=Onz;iM^df2^K&M#Q*Q-4yAqRuVGWRKU@u zFgp4opgN(i|BhNCbJQ^Ex`uLe+9tJzEvW&JUaMqU`S~h{Y;l6NY(6`n5tKguh_PX4 zx;Z;_ZhEN#$8o^*cTvWrx3klrm;R)oU*3h2YSx>J-BU}KC6Mw%<^86agg=%8e9P7@XBJ488~6I3N;M8KRJfX~gq7v| zO6@htXvrH47|0z;H>m46z1>R~J@vw*nsBM*#4oG$%JKD*P0rqz`~J8`Of!;vJ=@ar z1cb|D5-X4vO?^_Vw7ro1_MoS4*<;Dt2C_PN(?+(8)`t|!nbPY6Lo272?OwjaRi#t5 z3mf-jvuC5pZk31nNfAg;4E0ZJKC?}K!B6m#`D=&lSAl_fCd5}d2{Ltx(5Djw+JR$l zG;_$sHpQWT1GW97Lw$yQvb&4->R+%QIb#?9X)i2b_rDEy|MAK04c?!g#b2PdKku8> z)QG>{H@Qpy-@kAEmp$2S?_i%b_kaASdCUV?< zSshum-UGVBV>W`U-t33|jmP|L7$)SfGSXDLJ)R{W#jMd>w>wpYHJ*)8gA8DKuMDka|2mp`d^mD@R2yo_76N|31sY!02 zHYphn3|PSG*T~Q~&WBv9v=pRVS@BY`KB0+^U(bgoi3_Xb5*)u5|CTJ{Y6DDpmqBbD zsFeXGfU{Oz#39s>;vvcO?j#(sJS!v#X^#)#Sz*3{<~Fo}uG&S45e@X5)Ef2zJDgw( z+G3)Fg>74eEWc_|fs`u)X(7aHxA;zOiB2(_GzFZCCBMLZ4^hrfY+uIMDv_^MH~A@- zqIk=wuu=&}GQLU&+UNl9;1}bl#>k^2sB7QQwJ>Maa!Y=w@fBl?YZ&FGDj}b7M&>7! zC2xaDHcchgkqB3ZUBI@S1ABu=&36Fe=$@_fqlkDOe#AKqj&-{%Rcl}VQXyps9&ljkR`OyAerO95v)kg}U=q4sgVoz?zg_e;{;xD|=Q z7dQ)ffIFp`zYlF>;;MtwKO4Dazsw=Dl|UpQsjz-S>wyZFFqxE5XX2jh5FKEET0(_>AlyGckz2 zR1DO9t?!mNe|j)bMD#i2#Vq$^FriAi#9k<*OAvDFt-^q!?>6wh>sMBlGnNJ`6=~=F zoX5`xReqHXxyR5Fu-%cDJo!2fU6Zr2Of*P;(O#WYL-&N&=3ju?3IrllMl2YPVFT&~ zf+>R|))L3?iRgm=M#J5+FOfzkIdr2%iqD6>#QL86AB^YtgE4=M=d_)V{zzb>{le0=kF<*?q4aHm^SZU!zB1$ z-mqXP|Byc^888g|Cnd9tg8oU#6ypED*V6C9u_;+@QdS-|_z5g1!3ICJWmVYV=WR^` zHu!OC#Rfkz$S!Q~L)L?(`Zo`bj8Bw|eVLv~o0^?ph(#@~tOAzTHov-VeB0Ue+uQ%) zwSDmGNc-^k>>P%^ywW|r#^8J+U{V$Ub%YS#;TOZg*JQEqwS!R3>J2F@e66Mj3txLA zj)ku|<8#$K7Qw>T_~naho;<_C*N#H4@HIY!s9SS)aqTu&hD@k09(Uc&lN`kaIk}QL zJGKJNT+$HkdV7`9^nAPP3)_YjU9+|aj9p^1S_h-?Y; z161K?=R=(Gf|zBzdb_t}f_4GYGEpZIZJA`yFkp~u;_GddVvePM!YnHet>Cuz^tBO= zq!$XQE+s13X-*j`Hpw4Wz}u<5$#9!Yodpuk#2|`=ysU6`L)#o>wjs{AC>e&l-1r+h zyL`nXFjuy*^HA}fjKD~Pq6quu4>Y$;skigFb4og+E4x+fO79lgJEW&uV>$7~8>A&U z)y)$;sbzg)ytn&v#7nC&T@BE(%%*!6j-*rJO}x>A1-|=MCikM8YO83dDpF?zeaaKo zju;#X{1Aj?$gi=C75G0y-#a%iR4h6+K@}IDwodmge6PCJwBPHnCM^@_C-u zscOaj;KLs^uj%j5Ll%WtXd&rI{n)Q+;9u4C7$WtQK-V|Qd5GaB!_J_rHSbaP{uo(x z9nI>#+t_Qf)|}C!d;8DcQ%0E7^_&XExwr1cFO_$2@;s=o5jI{po)l1f@N0}%zFctn zrA>M14F1pIleydw-iCHE#`4q3ce&)}`0Sykr;9jh(8e}rqJ5zz*E#k2bcLYf_np1K!Zv=NrQZjtM*S(>*YV;kK zshe*|*>OD(fsM70S7IpG4!U#A{C?@tK(52-2f$-TZ@4L?$?3?b0LLsES~))#+)NyB z);>^bo{On!wZm3JSpto=DWCckSNV2$PVtt0>_9)N_jl{=MP%AtN2yI!>=Oa5#J~9l zPO;#$&2^kF-v-$CFtiX81Mo^HgSwEc6GIKM&MHukLmoKsecN(k)Ki?h>e;wauHCO- zWuXI9S(wD$3SznMxE$))6#6>}cPb!eN>S^jTj$S5lkD+ATCi%uqMir#RU9(@7Gw}m zW8~mOFm-6w0*0q^yejDu>Uc`wCoB~MgSr-PqAPU1J+<-4 zHDZf`T=rOWEGUav?vW+8pIGtm91VSc^)@cUyCi;MV+=v&4z{|tSt*3q}xgwmb6`(y2L)yCDG33(s7~j@Vz5t&tX-g1Dh2t>?Y-U zmCGP=cc_M4_s6bowXeEW{9RhKRJLY!q{g90eSj8l1t%9aTJNe;&i%^PBqc?r^)e5^ zNn2{X>f7GN_LL;>?$Cn{Rf8ydk0Q_m$2SA8!B+m0YR%sYrb%*h5}Lot9`@`SZqvMy z19(ELpE#JtllD&S(UMe<^ORC2=>L!2u>Y?N zll;a8ExDi052^OK#@9z%^0UkjD-ycJeO9*=q?{j-Q*?vQkXd5asG~CBZjf&yA0&RF z#w7aOVo#$#$gHBqMG4(wZfSgw8%JR#1Qp$*?~;E|>_C0t4|k7xGHRh(iJIi@bB`2> zvCzy!O|cVtfM01?yn&#m*%UoMy5tsmL8uw#aE}P9(f39lQL_wv9^oD_@6Fz!=I#-C z0)ZOuEwoT58b!~rB=YyxFHrLo;hv%SqvrNcQ46Gfo+0%y=FTjrMM6Ta;LjT7u9T=H zJVh_S47s@{W^VZg=oR#B^qud|xs}V$UV*24-~Q8{)c>Yo(tmwhPj~F+=)Z33$;;vV z)z+iDy4Aaa-`LTHXaAF6`5oY#Z9w|)`Pvl~?YrCUFWP_I!U5dL_h=z+V96F8NfMe1OO)hhR{G7R1l3a9xghFbSH=kMQ~p^ zfWbEKfj2%28UQ{F*2(h!z743mA4Gr(-~$D;cm?nd1otb2UN!=-&ApnGP-zs7m{=$i z9qv`jk76Q3ix?=i6DFz*ls5pXi2)Tkfd+Iyy&a(O0ML9Ozybt( zBo;n)Kg=2wu&*C(T?Dj2hT0QH+@yqJ`+k;U0o=sce;t0w5oQVsb@YySBL-5p1(_nT zvbRtV6lfy?)OhLeZBY?=1L4BN zk=Z*DA>NVEMUnB!k$z%e0aV1-{)o@|Q7Yb`R#4PibX3w#l&Eb4Ju7&?8`y^BP;f?e ziA8trL{B24hYWy|DDb#g%pzT2vq22RJEFrj8loK2R}@2qj_C)5t)QZ(2Vw@iW9N|3 zvjcw5=|WVMAxUB}`2+svuqd2)$SExL3>I#~iHjKs`&b11ZV<45jQwQ`#c2W&Ttrhg zK|a&PY`~xsMUWpb2(j%@&-oa>l`ovd;iGszTKp$B2AXpO_VOAUvH<)Ba0xN?>i|>X4#gd(O zqqD(La5V6qc?!ZXE{s0H$Sx(oE*ZQFvQ$Y*AB?FLi{PP8byA6IX@co;!7tD-pNpgf z5_pYasM0_x!YBE92lVqC{!uLH5(cuI51r;p0)k;3gNSx;LdAS)s$l}$4*qmLy~!s* zv?)cOD=i-eQ)!A?7mx3S2lee{Tw!c7{IU2+h#hS7B8|~IOF{)SIS(Tv zMcfRg1dAtqq)&F_$}~4j-zUlZ0nQpGNu{>WWcG#L@=c>*$Qf%&!l*Mk3X$nK z^iYDxJPx09Zlhei=16|k#7H}Y^aU1LlKZ|Sp@1aG92PTw5yMFuS8tf_ERkp}ks1om ze`TM$2P=5$Q=nlKvxhEFy^M7ng!?aKlBq@!8Ng}a89Rgd?uH2cL12XeZsSG%1~Gi5 zI7|Kln2Lhrs^nXjguehA6ep3F%N!X_4**=^O@z znW2UphVB`=5xL0^?p5{k4IP> zSJu>2R>Kx5QV%f|baYh;knHG(-ZD%+3i9&{PKsq~-e^wFQ`)V~HDOEhR~YA&s4Y43oxb@uf7b@vSpIS&kv zjhp^PgKK}Anw?XbnO|Ib`F(k9oplu*OQhRE#}di*f1La{KE2pJzr0zx{)tiklSq+& zrWJq>d!X8TIEj`~xJra8I!~Zw6z|b83g_FeXc>hlT1HVZj+Rk8K+7nOM$s|~Otg&R z*$7%ju{Jl@cl>rFJI0iirvMxl$AQ7FryWfW>?83p7O_qW2rGMjIvp9-}ZKD0pY zk-Ha7lbVkdbVa)t>kB)sB*0W^-_19^nOTk~M2mKs{l8(6+PU)^mxtc^zkB^TCM{-S)@`7a{wY8poY~K#V6`VZY1}055-)H7<^C(c-NVMJWlTKs8m`TYf zzYyJkhDJ&u@u1w3o9WvLlcNPZA8PweBT8EPzwKamIAH9S`&Mrcl-~}Tyyqzi6YJQmdWXAX zTQ#U!$op=HqR@_SCUoFyO|6lSYTYJtyaRSuMKW>2AqDP1;b%C{;O8H|fKQqTtMm`} zuh)~`w%%Md2DXusJ$6zhB;uE9`QAK!*#21U#)*o&QQ&D8o4xPTcAD>vKN>hAZk)S| z!v~)#aHrcH@Nq+Dod?KTic|)_F1tR(6KNDj^@X9oJ2A6@_v#)xVvt^Uk+7B==JZpJt z`V@M2&zo8K=c{HssY`_K_;&EZsxI!NVPO#7bGTRx)1NzEz73CM04&j^>>NWC{XcI~7)bWI%fvN?Bfp78hr*UquAMwl4M}8fApQ3z zyF&Gp_|9~;M9bvKZ2&fA4P5oAP?Bs;xks8Bbi<8*Vu@XR|2eEJbziUi-?6qzead=A zG4Ow2Z8L~-ITe)pH4#T~NYz|!?Y{p1sB?~4U0dEFW-Q4Rm`9UKD{liBLwxMaqpqHo zb8s0;*2l@e-{mFeqB)kL@hYG4Tm38dhhwQSz>R{{X<2jSzBKLjjii$#Y;Vo}bQqRZ z7LE-k;HodfM}{+%s-HbHuP@UAfJ|g^JYZQ_2%KWa|OAHF{Tmr=3`=U2Li7iWnJ|ke@b%)#5Fw1 z+wMVK266l6ct0wb=_xpEql%JofMp9IqSsGqwTZyQq0Ms|2%nF)YlJ2#4#3j;{_4Yv@)C>g#$&L@3PfU}# z%*+$nEG(HUt@fW-j&TZEo$1#=PQRPeO&K|xD z*LWyxelI%CutJ~0VS>;#+mJ{^T&pO3UU0q1&J@*I=NtJ%NYjnq+sD`3|6ZUUn=Vi^ zNLX7T3Ilx$4qbZFe?+}J`!6lkXRfUz<)xb)b&p33A ztv>CYZQ?ymef=%{O&tn)>2iY0*Y(i|tV&2#ms_R8z;8eP z__X2<|+&Iu3swV=8*_dV&%f2r%&QA_AaM2roWf9$#YMyKsEr-KU5U# z4`oK*<;OjZ0VX{}H(q=!+%h0pkJ58v^ZAl9QfWgAN{e_(ehYf5w2N~Z3!CU0S`*7y zYa5~HtNiNTmZ3HqI=}HqqnfeFymp$2xd7eAi%Z@M-)Fm~dDkYRAME$9JUMDTOxvzI z;Xf-djz2M8q3%epv}7QjVB(ZD7ItGIuBcohTO{zIbW{|-(@yX~o?-AlbLU^bLsDVN zqyNYB=)aC2=Rbe8cZPm{w*R6=_`A3GpM++Acmyte#O!~2Nd7R~h|vpov45u{!%F+t zRmsBtrX!Q{FFP`O8vkP*ng1^@+#9NQelOh9)Ea*;-2dXKDXqx=vnt_8NBvoq{2=~M zu1bdU(DMhBsh*^jJ9`p01eQLjwMS}~G|lX7BIZI)MK??0Yqji=M$ zGLO^I>H{Zy(BjW!Lwjm4V-jerEpV)~veprItCYYgP83r4tR5wo>ug?#`VBVI2~=x3 zTTvJm$Uuvq1wV*T&w>=(ePK$(B+iY*N+2BDAWafOSdmBklCnxoy+dAbH`&B%`)+Pl zgAKg&jGwzOQH+e|E^6J0C%$nznuoMF^s zR7T%&1{3IU2Arvi*@9@dnnY1$KXTE8bDv~KKyL?Yk3FUYIIPva8+)qh;uv!&=~==8ZJq;MUnW%4A`=T-) zXZA;w6_xc}wX5a~Km)^>hVJ(lWe-Ij4rYvmV@Q+_!#b~@jz!aa$QZp35oi2zpHU4s zjw7Si2GPWmKK-I=8~7>Z15J5#pq7Gaac#4hTFp#|vbW4Mad;CshTEk5`Ml>w@%e)9 z`QG{WK)he)EH3(Jl$i)Y$;EQG@czXLu(J4+KteffY~}WkY%%!U&WkbR&zU&bpE-opfkiFAorCl&d}8Z(OYRsqm3&p?36LU>o=)y4NG@=zG-g zWTf%<>p5xD;W*{TpJ$~XzxN$dIX{uyQS$iUdbSi*D!H-7lYVh^XqqN?rQJHDadROo z*|NJ1jk~>Vg)-bO;I(2M6`Nvz24hkqg>kk^0+@_5aP}si;y-NncTHZz;kh7433?Sw ze_|N>_=22Fxy*|7F%VD1svS40ESPIok?2F+%hyGtEYAdu#x}J>===FW7;!jvQHved zm_Gt!!ZR5|X<#hOu;5f9=2t23m*QMc$uxcO@7?~el%roagZ}7vdq17OJ2a5o-{i)S zmbP7l@IoC^nktK~#Zydpfi&{9+ah~wqGT5@hF3t6o@UGWo413RaVDxppd)iU}BR|Qqii2%ZY1cX3FTp zYjugM`Mkz*oC4^nR4)m>-JO1TLa4ncnw3I z`vS>0YSy9$eFG6OUsG9ra}z}`-bYO0K|RCw%Nj=Ti7vd7ieaQ3e`bK%^o@rWhQWc(8T`H2bCt#J|RM|`9pi# zSrx7=v)XT!d+~xqa~r4k%UgIIj@M5HSZ)P{nfgEM2d5DgtjgDV4nE++EWPgDve6Ej z`}x7$Pi5{u&7HFzpOgEfaXnpg_O{rNO{itPfG3_+jA zAGGb2)V}QeSb`JghZq)9Fpnu!7idQ?Ft{42dd@q6rHUUuYPR+~7keJKyTN+(RAus3 zY3)6i$2tIW_NCyO&0WB!-CwQs*!N>62%TQ-oQV7Mk_)+4kG<`r=hfGkm5eI>z{nH( zJozOm&fUQ@cLkO-@v0f1+eiRhADy>Zz&6QRJqvNfB++o7+VKedRowZJ;N~T$>QOK0 z{-eWUD+1z!yCr*_z_4SyNw9lh*Ln6zgsu3>WsrXKf{(+`Foc{Or&q6TG7Gej;iZA0 zbKO9Pd6dWL2a3g|fjvRjqs^Q87q_J&Q=}w01b3M>PhiQw#N7AHCkEm<4mw)ko0G#) zooPj+m}g1zqU}e6)Q`b{$#YZNq9E}N%hC}NHoK7WWbsOo+W41WN*Ie}XZPo%8vrYY ze4kqo2hQ1zUoZn)>#!I0V(*LllBMG$e*yha9KH5o48ZAY>^XSQD()`Wg4sU+I@ZGp76E#R z!}eQ}A0F>)UKJ+m0c){p&E93Lv=k0LQw%;U|L9hv5b$a?k?P!jb?@N+05%x8{dIkN zi-vDw{daX_iW%`v-&(W^GrGOOT~V+*_P`62XFB3|@TL{$5bL{;iT9e!9-rOxU?W6* z(bu>)gyf`{0E?0-U5G;=e%nOhP0Xp|oer^+=;emvGvQaMyS?+4gW2 zjEMI~;Z2I+7L|m}QyvpYo>pXpdUQl3zV!HoO;<(4fIReTFSv3dg5M-^v6pKX|H(S1 z&@s|#Q%CI-AM>&oz5R%!u8JC?>Y}iRKqChmho0Cd6CRau@@gkaT+AVxD+TsrM0XT+yIi^H0 z=6O=Ao_S1tU2F+WEG{jxZx~laSgcTAG{=?-mRH>T?NQ8^JMm~Iuzc_lD%nQCyxJR@M&wvPQE3ZwN(6ivNOqQhBdYDl= z2+um!tsa(p3D50=-cq>3E+O_?h&Zm$G%f@W0W?u34wRJq6^Y34N{Ts4vH&9zQBhxM z5arg1gHwoTuM}10q?kTXGk)YFF8L=?2~k;~G}=_cEkrsXRj@u)k2!*c06|8}CP$D0 z6ir(9O6@#Ly*)}Dpk+=&r5Pk8S)pLYxAhpMO}|u1zwOJs>SL?lO!!5UAv?o`&z;yw1LtYTxfNoZOL;myayfT{v zs14%d6(=JiT~OIRDW(vmRHSvqrFB($(@;#fgE)g^E%g_d6qHi=&lra)FDCUs(00HQrR>8iXoH8QLaonZ)7gGx?QQL zR;l1hlr{M>NuCH{MxXaXw}w|Vs)!)AY`Vt!vWB>!=9O4xw{Fg`SB<<6qFJ{@S}f(b zzE~fc_{2KT+Xrc#lwdwv#tfBEBS_ZJ&0Xlvc}G|7#g#S>s4r+pn7^t`N-j_V$8&L| zrbFSG&`P!BT3xPB-;!!oHRF>8s=R5_^P$mN6?K7^C4RJUM!g!Oetbo8gMvVmYjS+U z0I)$13GjmTR77w0hsi6=@S&=+ml|_*RHwmJ8m0o{0_NhBaIl z>J)wkdN=CIsvt8|wBILJY7(~mB+A9djKCn~j+i3B^`XL=3**ykopWlHhqXdL$s>AX zqy|)EHxaZ~WcO65sKeWIY02q76aN#a(JC8Xl9^&P>JhOQKH$}|Q4W(LyO(Kfl++e$w5CwSY8>@D>)Zq#m)13A zZFi-WMA8_pJX~XnnDwN)MOzBd+(_rQ z;M|CO8cJrB7=?b`Nnz@`)_Ae&PS!EWHDRyvUs@=mkgu5$m?-6}nQRo08`Gw+C~K>r zfaNnJvpC;hxe#7gJr?DM4jnsBzXnPi-(vjw}E z2)7N3?gpoQRlqK!{aktu*mnoRLVVsDxuY`kjc3;5j zkyU@;g|xL>Y}01LRfE^0_3N|%zN$^v*oU=S9zMff zk;ut;@2{m%wcfDu0f)Zb`KA5bjrWtJtOx1Z%P$r?Ht;|1ryWJ!pt?Yl;&~$h)PB$} z8-@~@lL}NA;scgR5-Ql6WWR7`W5*>B-}T@9y0h}JteK!F<;kY@UdyAPpDz}lKyRoH zTVTJg-b!85khR{Sa>B%82)W&lYYt@{#l&8f#+m1U;I8j_#+Dgf+3 z3%(463*KEIbACu{$eM=#fLr;8r>Yx*^0pHG{4pRJ`lTElwiJ2w#A zlLH-7OcbrbLHa$LQ&k?p5(9;!2Zj*6bSV}`}c zCB@*M3J6 zNYmOV$Qj23?tNcE2^dw*>iu#`m@u*VC8b{%V*9Qq z7P8TGlD)T{pf3KDGaG0{fiL>4%tkQQRbbmt!fT>co*~X4!q%@%ED+DeT{?b92~Y7F z;PCuYjx28wFRQ+ma(HW*^Uw8650Q5a2e=jl98#j%QW z2{xJ=K1*xhh;SgS^C>v=XN8u`cQOvsEwYK!{b(N|XP33ccte5F3C48_f0@zeEoM~u zRNWj$WBM!Q%qKFn1sg4>;`lv*Plww><`(9k<2V$I3Sns1#2(!W<}H0~&pdZ4$1_SL z$r{%&Y(^%i>RH`wCq#x8!;R3w!46!W?Gh+w!*O?EL#MWJzTU7ZP(pN$vg&4g5ATp)@#pCQ zTsUUv)%l(Ta`onntLS>8Tj-<-lbqpEL9zW!7q*{9e%|F(DDO|?q=9Vg-A6G+&E9)a z*B2z*m#ayVS357#x0_p{Pw*TM4p@4Zr)&MMUi040rZ23=I=;C*sW*GPMxFXy&+=1` zhojY`%UerF<$OX14;)u&hmSFzaLjxUJ+N`9JjpkmL$uNPeE;{RK?R^7zDeN_;XuVI z2^s}Iq_$)iyFauCBPj6`7NgZ;1vde!Ah@>Y6P>`W`@vYf!TlV8=kl()AOP>wi|Sg3 z$i#q_4HpS*;L8pGAHFC?E%4o>q|Bt0`zwzi96_liOTgDWE;O8RF+a$p z&PxFwP@eCdZt9578pKlP$Bp!t6!Fohll(!=Z%X5HSH{m$2e3NHDuXZQwC*oW6QC&q zsOt_B=w(*s^oif_SHlVz#0m^n4D_A?)AxXh^GP{3UA=Cp#W|fkZYE5>z4I8}a0Cj3 zwc`0Yi+s}HaNnVX9_M+I_68>@xG3r{NrZ{$>VR`apfi)M`JDD88$LlCcl;GY!gM4d zVc-&WAIX@I9v!w=E3n^`TlJarFKw?Bk;sx7`!^o`F=c^XZ#=lPA%2$L4=!+nYi-ys zG|FfI6}@4fYrJo!{1)?}$Zn{SkuS^&^xZ0)59#R(2aO^j1rq?w&G2Nr2s+LPDaD9- zMIc#V#K$_$GzGBW1+-xkv_vT_uIarq;cPbQcRCu0?dEbHKlq@>dpa+q+9k@t%5@DM z)~6HV=iyz<8D537!<~-e2?Ju~1awV-pu+A$xAwAZ0A*P-4`xsW`h{%knATN)X5e zX_svk7uW~X7nZW52@t&iZL)`T={Pxr*nO^ZyQdqbyA>vDZO=@=@<gb-KQ;n{RVG5G>VkNKepbjX9^cIg}%;&k?V#m*SX;7dAOY;eoiJAU8E4z zJ12&^zuic)A-LOIE3?$ARIuL%#u&+nnOP(dA1e`XBIj46)AV97W13g z0E)gE6%Wc4XKPw_a9gV`7wi6YK~9VT!u*N(^LKpUAK{PR3-S(*e`7)ZnWDWV?QiTy zozZGlvGh@-n~lwtrj|lNKe_^FG$Qoxf-(h7byxv`e+Ol1OGW+*Q09N@{5g!@8qE|K zib&-Ja{K z%pXaY3MPD@{CDj)qcx5MW zInnmVvIJh5(wnF+nk3PAUScA6X!_P+S`;XD0!Iix2hArjr}b2Z!+Pnom)+AW@zQ)` zxf!7aidGP`ZweVln1a8Rt#7hrl^t$kvyzc)Gh-I5Xt>Rlld0#m8J*<9&6SlR?`@qQ zrLKn_Ko`7_dBy0jFGa#y1(pRN2oz^{LjwdEj-sQtE4(dt_ufX9EfnmQ4e-s{RgDjG zo7c=R+wxYaB>_q}OXp`^STy}N2QOCdsz>lq|X<79%{Q)p#0*&r$NQ+ z?c8obz7NhLjOh&3U*$c9s@r96RX$ByG^V&u7&_Vu!nIx(3yqleq#Whwbqojxa|^H_MykrZOg=iy2YgHl(Rv5A4AbR86Lxi zl}twm(UG(Xz0HNdgPZM^af)9jlbjsM2i2|H3zysQgA%dnQ_W$w`Lf0muTpQzL60#& ztwHHl0Jgfs8bamC^-f~#@O54v{de(`?;DcdyM}nz`@2VkgQDBd3tvl4uLMhM{&>gn zUHs}wa(DaS>dV6xyZ6t^Y2UaR^T4{MdPFk_R2-HoQ|G>(N?`~P`p^JpaDDNfU7S8~ zQ@fs@D-dq)F5UwiUq3npnzs?yL}5AcWZ=__h=Z$(fD?^Nm_Z&b_XyPh_i`qWf1Nx^B-1bX?PXiW|Za_ur|AZ6`Sz*{F77k3iiUuYOXM60fl`h!+LG& zx2lD{3Pg3$``d@T5~Az;$=;o82W0gFLWZuXOF2}fSGa@jq#9bYzIl8*)-5h-BZe)$ zx!YJeIU2*U!8sk&A|uGpQV_}veltdr`L9f>-CLM%c3L^#2+~E$$%kYw*5$sFq8s;! z_?orV%kk`=h{1mnb-$ze5B{BK{@7ol`DMbba6c9cX1r}yEyLgyEtz9yEy*gcX7OU zZDVt3YiIZE^4{SO#)G5Nv->CKSJ%XsH@9aum<&_ujBUXi#LNa4YD^uV2?m*z3svSW zX!m22xha)fmY%2@aR9@mGHYKfN;S)XK$&eI5n<4tqNKz=lpJBVJVy)3ABlb$+&<1# zg?xZ6jyFpeRB_Rvi{p_&+|}IF=;F8`x;V~5g)WZwQ>ff0o2sx1N>Lkd@0qD_QurL9 zGO0P=XuiHYuP^=NdkfhO*2B+I{7Y@2cW>2-JfEy|dpwfOra?A84h=UW?7N; z5=6q=z_T^3`#QU%!28qJiIQY=aokO4FRR88Z>V^d<6zTRS(Gz6l2fKoZ1^t(b1zZxiLGt zwHpXTNy9?3id17oze*{?(Xjr0**OH^*z)nF@ktp5k;y@8)BW(M)*Y8Z{_+D!)u2u& zQxQ)Wh0!j&tJcPMuZ={1$GLVZl9;dKhy38vVs=@5muCK+$H#+$lXk~LA{#}=!{X<= z=s-Rm@5$&ZYWtHhMULW=aaG~HlP_-+cu&8+)3!hTrej%rI$_|kcRFbV;ys%(OSC_m zw#qL)o3X3iJDYVvXYuF$FKH;gi$x%{!^Kh<$KTUX(F%N*t8v;6mur7ZL#24^Uv6Z8 z_^!}tD2J;pWPZujc2TY5Gm^3%zU$qp$%Tr-nvIg{{m+#~ZU?P+PsB-D?mFK5=%J3f zIU3w3@jV_@c+zn^uI(s6`1NC{-^sM&fyB{#z!U$&r6|Yd{k8PcU%OkS2fv8-TAs8J z{TOi!AUyqE8u06Cb|m2T==u@HJVz^LL22L}!ADq>oXxlbqdug*8E4F#(mNVufbmAg zJDK@yBm$+u4{<(@$#}jbi*fQ~7iYSZ=WGN!I~o2mHQv1%7ysB9ZM9p;^o#IVnr7HB zNc^2NnVgOcZM#F*)R!fK*6LRu`JaNfDNN`P7oA)(<&VBRWBzd)hu_7c2P1sv%gox| z+d&ZxgPwe0z8MXZ;|?9e`S{hCY*r^k7+?&NEMj4R(O@$+I7NAVWqB~rEB}ZY7OlLR z%`i5l@Z4f7{6lB6hAuDsPXLqdgSctEk8Hc53zpBMx zd>|_uV?3KOe_q9%$alF^FE6olv|OSRR84uY>s4Nt9EF85Ec2SuDzWw+CC1q09ngRW zOkG@X?Qz(iJ(*UPwK+=604@oHh*mLBxF!czWj^6ZQZp~8L@$V0p8F&X*r>b0C}#2` znMCFNhASY)tofsZ(*QR*L4=tb`@?y!VNu4o*tK^{*P5KS8Ved#S(}9%@*K#q2)(lG zheM2tvR5*;F>%@K5?cyy3p8OBRk>^toT{ZBV@Z;lc|xDK)LrSm1RcH0m;7n{I+*?4 zenb_rv5-sCqy9^7)*({8I8`(I>UEapH_x}ZHd@&Y@AKV1p+3sl=s?A^G80boE!V8| zTpP5KYd+pl!(N$K|WLo49byLJ2nx?5oJLeW3^q74?S|NUYp8s`nmKR27%KHYANbdr7ku@y ze@pZ7-)gkHcp!!KFS5@p7-9boCgxvfpMT+a|3#*t*{A*>Im9jtvK)%?FYC&F*Cm~GxvRYWoT)2 zW3zdEYj>}F2aSoz{*8%AIK8;OY594JA-qMTSZ0(Gbcd3gA=oLi1EftSlcMMhMi=p( z-Kj@oVzLz|AIU<1LKQhmj0~>}43f|@B8>NA|1OPdo*Lx2+6_78 zB^SkQp6G`9;;fdgj4NEttzM|}Kz^wI-t=5 z%r$sEogW(T7++`(r2R>vS~t4b9`=(#eehy zze<0IXgKBWE4>{q@e@AZU+jQBdfoi_@_6%0;m48Ru(89Hf%Mlc%|EX%j(5I~w6xr! zGf#Io7XxwbTP+6R|8Hi*B@koiA54tZGMMu>CgyR?=5I_4=SsLB;v&^YSUrx#=Y{0g zZ10yxuS}x}$-UBGcbIh3Vx&mGw6QDF1krIz8q-nn^Tzd236suVQHfuJz;UthVA|BA z9~oOIh`qAFeW2wbO#0A@+n}dB&`LjPB50MD#!f<6mkAVJ{mHoyQtKQvn^e;m zqXMt9&s2dlSeNra8qM2m6YGb@iQu1&muA7uAAayeH;rKpCbsC3`-0oFm<+(}Z=dca zwtkZdPwaTDaTC_1VoaReIq#yH*sT!sIjmO}<{Q@cGSd#;vs6Kx*#DwUJZw;S>;^RS zY-tWO{N%@H(8%K@LYC3U`jnC}J9596@lX68V!k|=|DQPR_pf&T>9lva-mCj_+Mn-V z|32++4m+vQr+qI+Df+Y*KDhaP+W$QHs_ppmbjq^y=h>Xc!O!zW(34*m2-%#tHOTk5aZVqcctT#tW5Kbp&>iNCIo)1z*0u^HJG6GgF1h6592GuEhdMDJ)02gL?w ztg_OG63Pq%qB=5G1gAtu1%`v6*qO_(;35>v!$6R1=F&SIk^2#ecl!{;u_J5twrWa< zuVM&li=92w2^SK`8Va|R&7S_MBP0|v6k!^iJ+(?BBnB9Y{MeB_c{24}(q$-0A3J9P zC+WG2$xyVmY|b|--RJUzhp_1I99E8hRm6*VfJN5IaZc9%CUTrK_wgFnMs)wXl5vt^ zyEUFkvH_i83XfW65#qVR*hGhSZ4n%yHVqV7}ye z--!R!aXJRc=F41;Q2^aZ2EH0nhM-_HRO}>^?36>6MfnyD8>`BoZ2AKm3wJ@o#y%kx zWR=Hbu-tOk)lkZN;PLo|svKTFlL(#5CC zNfc-vBz?^lt4686=YE%M^A)A}9;ww-@Vc_#eX2`!q0mom9dq=ux1p-Y;yst%7n||w z{kK@J*f8|BwzT{-jWS$PZ9g2NFq+Rkl{kkyRNF&Gh}KZO=;ST7S1azHTAaL9P(Gupu;AzrJVb7Qr*sdH=k6*__X5V_;#w=6w@YF<-y| zk=}$&ZS8sdp09@f$8QvMO$VP!?GI*gmTElO7=M;nvt)e7m!+vpKP`2m4>urk$nX#57Mi9B(->=gKs`kQ+nmmNgheZ7MX>U z*7wy(I9Rten%&1ftsr%`4|qQ(PG&jL;T*9UhoaZ()0-X`&K7_d5|1rdTnsMxr6GPM z&)>VN(?#CQ7gYVi80T8|bAIu0dLyyLvyQ~uT64n^EAs*D8A*{YH~AA+YWq#BM|vgL z?9MJE^Hy@ywc|gktB^kiHb}LvMjy*n7i>W+WK?v%CI52E`YC43(;+?Nw-yxQI<)-u z*t-_te^S&UzWtU`yRA~v&fjvt7?b0=+;Z5eXx{eDIY6uvcR|3-Tw+_)$Gc@L;V3PU zWZ?~Z8#y>(nO|Exw_TDvJ(94~D95|!jD0?j-o!zq=cdOH^z+jns!Pou*xBjN44QYl zwZfVXMAB;-$K+}fO82ZoC=G@U++EY_4IFwy>86ql4?A{r?Sr&yR%t&zOp+tCysYu< zq`7-I@S%A$>6ys7NlpF7PwKYx^hs;aZ#OQ%up2YZ+4BwgCj!Hp-+K>N-b0rqshA4Xjw#=hlCAXS+E ziQM96mLJ%@EKa}9)4$&wf=j*F4u7Q%Iey0Fe)5xKv*I68x0lv@p1(-37=H;wzr?P; zmA@n>X6FW-Blo>t8AyOohZEhGU5%vDWZ_QTg64JcD29V7{0F6oPbQd*iskJQycY5IG}tAdN2jr0R`xa_)Jg1R)l@t zh(wS%MO^hlNl>u8-Y6=i7%s0Uc2NkIC&1VQ+IkVqyA>Xe4-2A+y0?Wvy%j1x6(|4? zamNqM=fsr0<&3$xh)ptreV>8|!UKhp@EXrUBv1q|M59(jLKT%_-&&*Z=Ay-v62ve4 z8!log2oj9EVq-l3^j=|`NHD}Ife|03JsqJU8vj{4-dh(M0 zI=UL~A)#)hpJ)haeHbG_O*U{VBehEq{Kv?;H^Q2^R-8m>sAdRWU=Tpn!orHG}>5Z~Z?!ENHn~t7NikGSYVCp6{UqEE)lS9K&?h)WEq7u4v66I-A zC~mzF>0arooaygrBPZce>q@ZRi`0{?q%<1vAu?i?ApYS6yE&(?cwh9uCiK2{Dh_wJ zkzz#A6v7{kuJHshY{MQDAgBuBSj1u*bzsZWsT$LnGf9!ymnp`&LA6R*#qcZ&NX#0X z4Mv+F#T~)O4U{g(O1wx^tp~f;XU%efJascy5(BoU5y>=h3fmB0c#Z)B#-*cY(dd}y5p1n<5 zx3xKT8UQ!~*=vZKy#d5KoZw@>kYP5i5dfer|7USTmzZ7!0C9rtF|)JLqw|d2m(r2M z_A9%2xg?IiPZ{~m;-0<|u@d>P*<;v4yO4);uavY7!lhZ=cWbaS%bUqLHAi72D35L` zbHZE|PUux>e;jucm2Pw(cbQkejXMFe^@?mQ3|;>cu~=Z@z1C7FpBvH7_@2`KbaCfe z-;t;ov66b`Av+kOjPoIkQStA=iIe3dkaF;^Ofd7CFuA~Ddfl(TUKq;XLXGx$nal23 zsuYGQ>cFZQdFDtrFh{VYG%kc(V5oqeQIoF{Lytr+g(3(7o)%r{rPycscu8KShqetT zLH$SuHtNBxF1~Bzg=%j5Dr{8lt%rVO8Hb!Gm>M{H@4|UH55Csb`#`@vXG8bCXvNgW zpz|RyXhB<3)$Xnm$PjDOkF_8#s3+dAbm~klp+7yX_Yg~HfHne7{|M$(lgbeXX_DNR zI&=ZRR6T>l5BPW7E^O5L2`_aq2AuR&r7S)G4u}VbL@g0CtDJVEX(mU?TS4QI>JxBj zjwcCBl41N)-as)OC#>OiglX*{_VsqTjlSv!Y&&qs#@44b+eGEW5t|(uq-Fg>Yl!W=l;&tj%5E2D2q~# zmAm=e^KkAHM=_~)MqmQ9*}*gG?ymg!mrWH8Iw-8+MZ62Pqsi~amOmj zkZ4IyR}Mp2nz@dE` z^_^pP0B+Z7Wp44QXV;|&iFOcwrBGOf>r~RvJDGHB;%tuc{*WDkU|gfZ z2fGurm6;UG84O5-G_v|$-+=b+Jr*!YVA&P$?RiN3>ACQE-uBAf^ef4cTD?WeN2xxs>)RrY zGSbzJVxGk!rU%60iHn`{4Kpq!1OaIbNnfF8#%u=0ZFnDBtKMV7&sQ0)#&7=qiilO$ zG#19dSl=nGK+7F0Czhi1iM?b_f>lg)i{Fn53AqEmo^`DQ2L6xtWoOtS8iL(&qh2C? z;4az1a);_@RW-Vrx|-ouwQ5P_)H^(*ju*3$d_NDtovo}ti%eaSqn*s|I(P=*k7)2O zzuI}TNZw}^F4*G1=Po|gmxtG4^B0qBt_oJJOlVbje5pSnoU_oSf};&$2HhyQ36EeG zx%UG|d9f^>qi3w$SvMr;D5w&5Dn}C!_}eI|XH^_(M;Lc&?)F(LgN$Nh0R@x=*=v=v zp%AHyXmI|&gIfr!F$BiY2&_L9WzZR);%`hAhtT!}Hu_)xQh&Xhg6*FUt+)Hb7zAMt zSSC>L&GDit=!uON{S={`c#MJ*Bucai3rrcpOd_D&QRFy(e^&87rK>=X$-lKWKUTZA zR{>4!6oW>dVXAy@|5369z>O_s40lLDO3I1Sc)g~@yx(rm0oK)_(T>b!>DS!+!9k#Sh1UN~n z07FRTJMh9ERnw|J2;J7fd?e|6yqxD_e3Th|wx{c1Fb=we8>p0xkZOS~KPjA)n1penHoy=;w{qT$f>>YhQN!b3Qo3mZo3+F`qX3K+A&j^;VxnNA<5Lg1VB9FA%b10Z_CfHkn~& zZ6;(Gme_WEFA`s-gE^P1V37nf$>mR*3+^)`` zc4~5;kSlDSmB48C9QPj_(9-od{$6>c8qeG7SPl}xralx)Tj)em@7_i;j?h*CC2{CT zy1?Gc671tPj1{`SM>2Xhl(WH77Fep;k*eWs+hP}M^bZ9CT$R|`nQoN5 zUeRJ!n(t>B!8+fs(I=dwy9=>rD6#kc1=D$h$qKh%V>d2*2S&M>PhSe0c$Y@P-+q7S z)BF9R(1`eqa>|-sr|1ETVuimoKpnMHw%Hb!Gv7LU-|lIVl;D?mZ*k0O3DIDw?=KK6 zoK-w|VOJjACi&Nm1ALW3Bc|+rzAWK32;L+g_^G0uyeKCQ^-<1bEACw*V*~KrLul!o z3rROlkj_#**Q~t-op3Z>HtRlTznaP~&xum!e;jTlB>|TQbx7*Dp;a#ilMg;7JKX0e z>pI}crm#Ci;9WSTV8P{>tjjHmx4|6pFI58>7qU9~94WDPvCq!J?8yt~{#QUG|JKcI zD!`g1SRWB}Qv&y5YPn+jdGYH+-nI$XFEh*Q2*PPx6i0OX2>MGCQ<7ZpkRbP17W}=cNk8dm1D7{$p#N+7 zvr7Kvt$Ir{RB16RHD2Wr?@<59$|C@rOmPk0=-f|N3XTorD!BPrnR(C7AR#VLqvh4( zy}9EpkrY&vm65Qm;uPmqvf@{o4WS~l&R6kzNa2H*<*LNEDgK# z8i>9+7{JkMc;>Z7bwX823=j02KK9(Sf?U_~rbdMntUn=@kr6fF?aHJ}M~B_CvYwje z(4@NrU;=fJqdfwn`~7a8TL_?NyxTd>9V|w9zq0$=pAL2oL&_DDltN~J9_C-UE|3Qb zRW;DH0OE*dFG(-xV9f@Sh!vD}G7~htnA)mt=^m&kX^Hus490TxL-MMz6KU;7hE09f zzYPtjlj_`RH?eKLfviC{K>}3G(-8B*^-GCEY@oKjnb7@PB#7Qnx0DcGX4BU zh0Ml#P;3vv@{VMK(B6&g46CA{T^}F*e>+dC5nsJLt+L$4=f5klZ z8FE#?F6d-PzQ_}iH`CE}f&%5A$f|}=3 zbP$f$u3h}5lyCmM#O6sH6`!$g-YnU^P4JbM+CE^kX$ZaDCuI|(7-MkZlpz+u|p*Me9g1Nm- z7ZY*mD~8FWj>+kLSZRv*Vbv2co!z}o~8MyNy3XJ&WtyV{kkxy*a5cs`Z=yWUVIZuqJpp_PGQ2Al>n@RYw`G zV^TRsuvwYe!yHYthrJvW^BhpV(8*5cCq4tTzB(x*&PX8QT=1f(-8?vBYk^_Vr0WbV zrLj6MlX%K3&=2?=5rUEHR_KK=V4;er0%JfC`Obl zY0G&bPWrG*TR{kh({AZR;_Ila&rlm<4osOS*R zn@3!(?8;nv3T#n)AQvQa0m*!7cQ*SwIC}o~-!VQux;{37!su5hNPOh(5t=17JL8Ng zg`6t!8oZRhBag#3CR5MtkoF`OmvuxyNx~=Yu@NW2mA1)WBY*ykCyr_eL+6_Yd*ts4r?b4fx*;SwYt6h z#+v^n2ka_6^T#QJ6@}P!HF7C-{m}mdo`_w4C!zofK@SjfW3AxT5UGF89Yg}zv5hb# z5}3`N8?c|_qkfb^*0L+Pz;(KSbx>)&$LP!Un~UU-51YG2-A|r*hOgQ>%q{bV8RkpV zUSY>PjtYe<%w7rCqU6F^KNsifQ~XUEMdMjg4s&nb*6nVVT+a~AkzqlV8$#VJNd_jb z^r)Gt8oJfnp!IK=Mcjil_}sn*Tey~Oh#*u{_>Rk!xx%qMhyev#Kw&)JeITrJ*kV=o ztUgwvp0ro1TNwy31oHO))j{1(_E7%<_sWbh$o=Paf`><|`gn|B}IF^ToE?0{wv-G^7~bZWd5XNw#hv zJ&Hen->6iK#`R|NyoQq5MJX*O$G4{(y10)ciF#Guds*2I)?BKyC*C=n;XX*}8%$V6 zGtzy4RoP+=zF@865~{+?acE=1F94r-TT)hxX045IR6p%;Cmk!5XcqWv!;G(P^($I! z2fg$9*S@)%Ayfv7h4=`@@dxXz;6Gxe5I)?amiGc&e&_$xuEYp9)JgnayR`Fd34)k@ zkkd)!y$`QI$$C{3B0#>WWKpq)Fybs-_Im}c(JO_4?aRJHc|<*J{@E{BB=c6riwkJ$ zb}q$R8O~k>)9F_`M~9>mt9UL$cEcy?B=(S~YEH_`TrR?BBz_$frie(UTQp*^ZYb_Y zI+6$E&l&!BqEEkdpHF>}&q;uARHvZ_O?J>r_0ZR8=*pG>6w*(LX43>-Fkg7{pn4z;xpRI9MM|8Qq?xJtBOu8dP}ix2GQj-wxhzd@|bQZ z*jl0q;Tk^A)F|AFmz{?D$K_QqFI$fkg>L=w?tt#AFyRIhsh>kz=Ve2;p2nxbzdHgS{rnvP5M(*yitS51ssE2Rh^}aozHH#*W zf9LH#x;6Kq%&UbU#HzYIZ~%v&<^D79l~llFY$0uMScwJ{7e) zOM6=Ur#-vA<)>PF|A~*Jo?Hy2Xw1q;a{T0ID3IU7t)Juoa z|B*ZAH|R^E_#B?sPq4~w4F?C)YZl*qwU?1zmLi)P{xUn~v#9y2Ss4IP&-O{|LDkymdW z;kIVwaeIx@Vzn5QlONm+d{-Cq)=7JHS{r>ruOw5B76L0EG! yQrDKeAVwSG)Ia&>z6xV3{`*<(e|#l4?3gl^khhjD8z1{KqPDekI96rulkg9-YVGg< literal 0 HcmV?d00001 diff --git a/variants/heltec_vision_master_e213/nicheGraphics.h b/variants/heltec_vision_master_e213/nicheGraphics.h index b14c72896..75e4423be 100644 --- a/variants/heltec_vision_master_e213/nicheGraphics.h +++ b/variants/heltec_vision_master_e213/nicheGraphics.h @@ -67,25 +67,20 @@ void setupNicheGraphics() InkHUD::Applet::fontSmall.addSubstitutionsWin1251(); */ - // Init settings, and customize defaults + // Customize default settings inkhud->persistence->settings.userTiles.maxCount = 2; // How many tiles can the display handle? inkhud->persistence->settings.rotation = 3; // 270 degrees clockwise inkhud->persistence->settings.userTiles.count = 1; // One tile only by default, keep things simple for new users inkhud->persistence->settings.optionalMenuItems.nextTile = false; // Behavior handled by aux button instead // Pick applets - // Note: order of applets determines priority of "auto-show" feature - // Optional arguments for defaults: - // - is activated? - // - is autoshown? - // - is foreground on a specific tile (index)? inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown - inkhud->addApplet("DMs", new InkHUD::DMApplet); - inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); - inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); - inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated - inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); - inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0 + inkhud->addApplet("DMs", new InkHUD::DMApplet); // Inactive + inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // Inactive + inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // Inactive + inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated + inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // Inactive + inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0 // inkhud->addApplet("Basic", new InkHUD::BasicExampleApplet); // inkhud->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet); diff --git a/variants/heltec_vision_master_e290/nicheGraphics.h b/variants/heltec_vision_master_e290/nicheGraphics.h index c14ee76ec..2674436b8 100644 --- a/variants/heltec_vision_master_e290/nicheGraphics.h +++ b/variants/heltec_vision_master_e290/nicheGraphics.h @@ -80,25 +80,27 @@ void setupNicheGraphics() InkHUD::Applet::fontSmall.addSubstitutionsWin1251(); */ - // Init settings, and customize defaults + // Customize default settings inkhud->persistence->settings.userTiles.maxCount = 2; // How many tiles can the display handle? inkhud->persistence->settings.rotation = 1; // 90 degrees clockwise inkhud->persistence->settings.userTiles.count = 1; // One tile only by default, keep things simple for new users inkhud->persistence->settings.optionalMenuItems.nextTile = false; // Behavior handled by aux button instead // Pick applets - // Note: order of applets determines priority of "auto-show" feature - // Optional arguments for defaults: - // - is activated? - // - is autoshown? - // - is foreground on a specific tile (index)? + + // Order of applets determines priority of "auto-show" feature. + // Optional arguments for default state: + // - is activated? + // - is autoshown? + // - is foreground on a specific tile (index)? + inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown - inkhud->addApplet("DMs", new InkHUD::DMApplet); - inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); - inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); - inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated - inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); - inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0 + inkhud->addApplet("DMs", new InkHUD::DMApplet); // Inactive + inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // Inactive + inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // Inactive + inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated + inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // Inactive + inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0 // inkhud->addApplet("Basic", new InkHUD::BasicExampleApplet); // inkhud->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet); diff --git a/variants/heltec_wireless_paper/nicheGraphics.h b/variants/heltec_wireless_paper/nicheGraphics.h index 44405b8f6..ece4225d0 100644 --- a/variants/heltec_wireless_paper/nicheGraphics.h +++ b/variants/heltec_wireless_paper/nicheGraphics.h @@ -67,26 +67,21 @@ void setupNicheGraphics() InkHUD::Applet::fontSmall.addSubstitutionsWin1251(); */ - // Init settings, and customize defaults + // Customize default settings inkhud->persistence->settings.userTiles.maxCount = 2; // How many tiles can the display handle? inkhud->persistence->settings.rotation = 3; // 270 degrees clockwise inkhud->persistence->settings.userTiles.count = 1; // One tile only by default, keep things simple for new users // Pick applets - // Note: order of applets determines priority of "auto-show" feature - // Optional arguments for defaults: - // - is activated? - // - is autoshown? - // - is foreground on a specific tile (index)? inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown - inkhud->addApplet("DMs", new InkHUD::DMApplet); - inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); - inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); - inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated - inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); - inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0 + inkhud->addApplet("DMs", new InkHUD::DMApplet); // Inactive + inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // Inactive + inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // Inactive + inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated + inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // Inactive + inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0 // inkhud->addApplet("Basic", new InkHUD::BasicExampleApplet); - // inkhud->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet); + // inkhud->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet); // Start running InkHUD inkhud->begin(); diff --git a/variants/t-echo/nicheGraphics.h b/variants/t-echo/nicheGraphics.h index f0ffe4108..e8a9232f1 100644 --- a/variants/t-echo/nicheGraphics.h +++ b/variants/t-echo/nicheGraphics.h @@ -68,8 +68,7 @@ void setupNicheGraphics() InkHUD::Applet::fontSmall.addSubstitutionsWin1251(); */ - // Init settings, and customize defaults - // Values ignored individually if found saved to flash + // Customize default settings inkhud->persistence->settings.userTiles.maxCount = 2; // Two applets side-by-side inkhud->persistence->settings.rotation = 3; // 270 degrees clockwise inkhud->persistence->settings.optionalFeatures.batteryIcon = true; // Device definitely has a battery @@ -106,6 +105,7 @@ void setupNicheGraphics() // Setup the main user button buttons->setWiring(MAIN_BUTTON, BUTTON_PIN, LOW); + buttons->setTiming(MAIN_BUTTON, 75, 500); buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->shortpress(); }); buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->longpress(); }); From 72db671e007bcccc0cb67c6a44889aed0ad94e59 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 31 Mar 2025 02:54:27 -0500 Subject: [PATCH 357/381] Try-fix some import of configuration inconsistencies (#6364) --- src/modules/AdminModule.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index c04c26a5a..88109bc78 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -265,7 +265,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta disableBluetooth(); LOG_INFO("Commit transaction for edited settings"); hasOpenEditTransaction = false; - saveChanges(SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS); + saveChanges(SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS | SEGMENT_NODEDATABASE); break; } case meshtastic_AdminMessage_get_device_connection_status_request_tag: { @@ -334,7 +334,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta node->position = TypeConversions::ConvertToPositionLite(r->set_fixed_position); nodeDB->setLocalPosition(r->set_fixed_position); config.position.fixed_position = true; - saveChanges(SEGMENT_DEVICESTATE | SEGMENT_NODEDATABASE | SEGMENT_CONFIG, false); + saveChanges(SEGMENT_NODEDATABASE | SEGMENT_CONFIG, false); #if !MESHTASTIC_EXCLUDE_GPS if (gps != nullptr) gps->enable(); @@ -347,7 +347,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta LOG_INFO("Client received remove_fixed_position command"); nodeDB->clearLocalPosition(); config.position.fixed_position = false; - saveChanges(SEGMENT_DEVICESTATE | SEGMENT_NODEDATABASE | SEGMENT_CONFIG, false); + saveChanges(SEGMENT_NODEDATABASE | SEGMENT_CONFIG, false); break; } case meshtastic_AdminMessage_set_time_only_tag: { @@ -574,7 +574,6 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c) config.has_position = true; config.position = c.payload_variant.position; // Save nodedb as well in case we got a fixed position packet - saveChanges(SEGMENT_DEVICESTATE, false); break; case meshtastic_Config_power_tag: LOG_INFO("Set config: Power"); From 3314b00fcc9500a722ac3e0fc700871a88ce74dd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 31 Mar 2025 11:16:13 +0200 Subject: [PATCH 358/381] Upgrade trunk (#6471) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 8f938ce9e..4c570c856 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -9,12 +9,12 @@ plugins: lint: enabled: - prettier@3.5.3 - - trufflehog@3.88.18 + - trufflehog@3.88.20 - yamllint@1.37.0 - bandit@1.8.3 - checkov@3.2.394 - terrascan@1.19.9 - - trivy@0.60.0 + - trivy@0.61.0 - taplo@0.9.3 - ruff@0.11.2 - isort@6.0.1 From 39408fd3b1f39c6799caf9d214cc3dd613d4824c Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 31 Mar 2025 05:50:53 -0500 Subject: [PATCH 359/381] Disable network config for non-eth_gateway nrf52 and non-W RP2040 targets (#6462) * Disable network config for non-eth_gateway nrf52 and non-W RP2040 targets * Use HAS_ETHERNET logic --- src/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 59cd6d8e9..f8443f9e9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1274,6 +1274,12 @@ extern meshtastic_DeviceMetadata getDeviceMetadata() deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_AMBIENTLIGHTING_CONFIG; #endif +#if defined(ARCH_NRF52) && !HAS_ETHERNET // nrf52 doesn't have network unless it's a RAK ethernet gateway currently + deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_NETWORK_CONFIG; // No network on nRF52 +#elif defined(ARCH_RP2040) && !HAS_WIFI && !HAS_ETHERNET + deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_NETWORK_CONFIG; // No network on RP2040 +#endif + #if !(MESHTASTIC_EXCLUDE_PKI) deviceMetadata.hasPKC = true; #endif From 886bffe8f3b1e27b087c7f866129d7d763bc22de Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Tue, 1 Apr 2025 00:03:44 +1300 Subject: [PATCH 360/381] fix: honor user button customization (#6400) Co-authored-by: Ben Meadors --- src/graphics/niche/Inputs/TwoButton.cpp | 38 ++++++++++++++++++- src/graphics/niche/Inputs/TwoButton.h | 4 +- .../heltec_vision_master_e213/nicheGraphics.h | 2 +- .../heltec_vision_master_e290/nicheGraphics.h | 4 +- .../heltec_wireless_paper/nicheGraphics.h | 2 +- variants/t-echo/nicheGraphics.h | 2 +- 6 files changed, 44 insertions(+), 8 deletions(-) diff --git a/src/graphics/niche/Inputs/TwoButton.cpp b/src/graphics/niche/Inputs/TwoButton.cpp index 10d89ef41..b270d56cf 100644 --- a/src/graphics/niche/Inputs/TwoButton.cpp +++ b/src/graphics/niche/Inputs/TwoButton.cpp @@ -2,6 +2,7 @@ #include "./TwoButton.h" +#include "NodeDB.h" // For the helper function TwoButton::getUserButtonPin #include "PowerFSM.h" #include "sleep.h" @@ -57,14 +58,47 @@ void TwoButton::stop() detachInterrupt(buttons[1].pin); } +// Attempt to resolve a GPIO pin for the user button, honoring userPrefs.jsonc and device settings +// This helper method isn't used by the TweButton class itself, it could be moved elsewhere. +// Intention is to pass this value to TwoButton::setWiring in the setupNicheGraphics method. +uint8_t TwoButton::getUserButtonPin() +{ + uint8_t pin = 0xFF; // Unset + + // Use default pin for variant, if no better source +#ifdef BUTTON_PIN + pin = BUTTON_PIN; +#endif + + // From userPrefs.jsonc, if set +#ifdef USERPREFS_BUTTON_PIN + pin = USERPREFS_BUTTON_PIN; +#endif + + // From user's override in device settings, if set + if (config.device.button_gpio) + pin = config.device.button_gpio; + + return pin; +} + // Configures the wiring and logic of either button // Called when outlining your NicheGraphics implementation, in variant/nicheGraphics.cpp void TwoButton::setWiring(uint8_t whichButton, uint8_t pin, bool internalPullup) { + // Prevent the same GPIO being assigned to multiple buttons + // Allows an edge case when the user remaps hardware buttons using device settings, due to a broken user button + for (uint8_t i = 0; i < whichButton; i++) { + if (buttons[i].pin == pin) { + LOG_WARN("Attempted reuse of GPIO %d. Ignoring assignment whichButton=%d", pin, whichButton); + return; + } + } + assert(whichButton < 2); buttons[whichButton].pin = pin; - buttons[whichButton].activeLogic = LOW; - buttons[whichButton].mode = internalPullup ? INPUT_PULLUP : INPUT; // fix me + buttons[whichButton].activeLogic = LOW; // Unimplemented + buttons[whichButton].mode = internalPullup ? INPUT_PULLUP : INPUT; pinMode(buttons[whichButton].pin, buttons[whichButton].mode); } diff --git a/src/graphics/niche/Inputs/TwoButton.h b/src/graphics/niche/Inputs/TwoButton.h index 1e1576256..f1e18dd89 100644 --- a/src/graphics/niche/Inputs/TwoButton.h +++ b/src/graphics/niche/Inputs/TwoButton.h @@ -30,6 +30,8 @@ class TwoButton : protected concurrency::OSThread public: typedef std::function Callback; + static uint8_t getUserButtonPin(); // Resolve the GPIO, considering the various possible source of definition + static TwoButton *getInstance(); // Create or get the singleton instance void start(); // Start handling button input void stop(); // Stop handling button input (disconnect ISRs for sleep) @@ -62,7 +64,7 @@ class TwoButton : protected concurrency::OSThread public: // Per-button config uint8_t pin = 0xFF; // 0xFF: unset - bool activeLogic = LOW; // Active LOW by default. Todo: remove, unused + bool activeLogic = LOW; // Active LOW by default. Currently unimplemented. uint8_t mode = INPUT; // Whether to use internal pull up / pull down resistors uint32_t debounceLength = 50; // Minimum length for shortpress, in ms uint32_t longpressLength = 500; // How long after button down to fire longpress, in ms diff --git a/variants/heltec_vision_master_e213/nicheGraphics.h b/variants/heltec_vision_master_e213/nicheGraphics.h index 75e4423be..d6983bafe 100644 --- a/variants/heltec_vision_master_e213/nicheGraphics.h +++ b/variants/heltec_vision_master_e213/nicheGraphics.h @@ -95,7 +95,7 @@ void setupNicheGraphics() constexpr uint8_t AUX_BUTTON = 1; // Setup the main user button - buttons->setWiring(MAIN_BUTTON, BUTTON_PIN); + buttons->setWiring(MAIN_BUTTON, Inputs::TwoButton::getUserButtonPin()); buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->shortpress(); }); buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->longpress(); }); diff --git a/variants/heltec_vision_master_e290/nicheGraphics.h b/variants/heltec_vision_master_e290/nicheGraphics.h index 2674436b8..c2f26c7ff 100644 --- a/variants/heltec_vision_master_e290/nicheGraphics.h +++ b/variants/heltec_vision_master_e290/nicheGraphics.h @@ -19,7 +19,7 @@ Different NicheGraphics UIs and different hardware variants will each have their // InkHUD-specific components // --------------------------- -#include "graphics/niche/InkHUD/WindowManager.h" +#include "graphics/niche/InkHUD/InkHUD.h" // Applets #include "graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.h" @@ -113,7 +113,7 @@ void setupNicheGraphics() Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // A shared NicheGraphics component // Setup the main user button (0) - buttons->setWiring(0, BUTTON_PIN); + buttons->setWiring(0, Inputs::TwoButton::getUserButtonPin()); buttons->setHandlerShortPress(0, []() { InkHUD::InkHUD::getInstance()->shortpress(); }); buttons->setHandlerLongPress(0, []() { InkHUD::InkHUD::getInstance()->longpress(); }); diff --git a/variants/heltec_wireless_paper/nicheGraphics.h b/variants/heltec_wireless_paper/nicheGraphics.h index ece4225d0..5e938fa64 100644 --- a/variants/heltec_wireless_paper/nicheGraphics.h +++ b/variants/heltec_wireless_paper/nicheGraphics.h @@ -93,7 +93,7 @@ void setupNicheGraphics() constexpr uint8_t MAIN_BUTTON = 0; // Setup the main user button - buttons->setWiring(MAIN_BUTTON, BUTTON_PIN); + buttons->setWiring(MAIN_BUTTON, Inputs::TwoButton::getUserButtonPin()); buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->shortpress(); }); buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->longpress(); }); diff --git a/variants/t-echo/nicheGraphics.h b/variants/t-echo/nicheGraphics.h index e8a9232f1..f5dde6b19 100644 --- a/variants/t-echo/nicheGraphics.h +++ b/variants/t-echo/nicheGraphics.h @@ -104,7 +104,7 @@ void setupNicheGraphics() constexpr uint8_t TOUCH_BUTTON = 1; // Setup the main user button - buttons->setWiring(MAIN_BUTTON, BUTTON_PIN, LOW); + buttons->setWiring(MAIN_BUTTON, Inputs::TwoButton::getUserButtonPin()); buttons->setTiming(MAIN_BUTTON, 75, 500); buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->shortpress(); }); buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->longpress(); }); From a5efbfccd784f77784ec429794378b599476935e Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 31 Mar 2025 06:32:54 -0500 Subject: [PATCH 361/381] Disable bluetooth config on rp2040, portduino (for now), and stm32 (#6465) * Disable bluetooth config on rp2040, portduino (for now), and stm32 * Add comments and exclude C6 --- src/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index f8443f9e9..05eeef2ae 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1274,6 +1274,13 @@ extern meshtastic_DeviceMetadata getDeviceMetadata() deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_AMBIENTLIGHTING_CONFIG; #endif +// No bluetooth on these targets (yet): +// Pico W / 2W may get it at some point +// Portduino and ESP32-C6 are excluded because we don't have a working bluetooth stacks integrated yet. +#if defined(ARCH_RP2040) || defined(ARCH_PORTDUINO) || defined(ARCH_STM32WL) || defined(CONFIG_IDF_TARGET_ESP32C6) + deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_BLUETOOTH_CONFIG; +#endif + #if defined(ARCH_NRF52) && !HAS_ETHERNET // nrf52 doesn't have network unless it's a RAK ethernet gateway currently deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_NETWORK_CONFIG; // No network on nRF52 #elif defined(ARCH_RP2040) && !HAS_WIFI && !HAS_ETHERNET From 2c01fad798e17bcc5e6feb4644ba15c12e32fffa Mon Sep 17 00:00:00 2001 From: Austin Date: Mon, 31 Mar 2025 08:31:54 -0400 Subject: [PATCH 362/381] meshtasticd: Add FrequencyLabs MeshAdv-Mini Hat (#6458) --- bin/config.d/lora-MeshAdv-900M30S.yaml | 4 +++- bin/config.d/lora-MeshAdv-Mini-900M22S.yaml | 11 +++++++++++ src/platform/portduino/PortduinoGlue.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 bin/config.d/lora-MeshAdv-Mini-900M22S.yaml diff --git a/bin/config.d/lora-MeshAdv-900M30S.yaml b/bin/config.d/lora-MeshAdv-900M30S.yaml index 113901d5e..5c148bf68 100644 --- a/bin/config.d/lora-MeshAdv-900M30S.yaml +++ b/bin/config.d/lora-MeshAdv-900M30S.yaml @@ -1,3 +1,5 @@ +# MeshAdv-Pi E22-900M30S +# https://github.com/chrismyers2000/MeshAdv-Pi-Hat Lora: Module: sx1262 CS: 21 @@ -9,4 +11,4 @@ Lora: DIO3_TCXO_VOLTAGE: true # Only for E22-900M33S: # Limit the output power to 8 dBm - # SX126X_MAX_POWER: 8 \ No newline at end of file + # SX126X_MAX_POWER: 8 diff --git a/bin/config.d/lora-MeshAdv-Mini-900M22S.yaml b/bin/config.d/lora-MeshAdv-Mini-900M22S.yaml new file mode 100644 index 000000000..554116b57 --- /dev/null +++ b/bin/config.d/lora-MeshAdv-Mini-900M22S.yaml @@ -0,0 +1,11 @@ +# MeshAdv Mini E22-900M22S +# https://github.com/chrismyers2000/MeshAdv-Mini +Lora: + Module: sx1262 # Ebyte E22-900M22S + CS: 8 + IRQ: 16 + Busy: 20 + Reset: 24 + TXen: 13 + DIO2_AS_RF_SWITCH: true + DIO3_TCXO_VOLTAGE: true diff --git a/src/platform/portduino/PortduinoGlue.h b/src/platform/portduino/PortduinoGlue.h index a7aea1c3e..4e074be71 100644 --- a/src/platform/portduino/PortduinoGlue.h +++ b/src/platform/portduino/PortduinoGlue.h @@ -11,6 +11,7 @@ inline const std::unordered_map configProducts = {{"MESHTOAD", "lora-usb-meshtoad-e22.yaml"}, {"MESHSTICK", "lora-meshstick-1262.yaml"}, {"MESHADV-PI", "lora-MeshAdv-900M30S.yaml"}, + {"MESHADV-MINI", "lora-MeshAdv-Mini-900M22S.yaml"}, {"POWERPI", "lora-MeshAdv-900M30S.yaml"}}; enum configNames { From ae887590594de8e573ca2ce16334f5534ce34155 Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Tue, 1 Apr 2025 13:08:23 +1300 Subject: [PATCH 363/381] draft an InkHUD variant for Elecrow Thinknode M1 (#6473) Only an initial guess. No hardware here yet for testing. Button assignments are largely placeholder. Co-authored-by: Ben Meadors --- variants/ELECROW-ThinkNode-M1/nicheGraphics.h | 119 ++++++++++++++++++ variants/ELECROW-ThinkNode-M1/platformio.ini | 22 +++- variants/ELECROW-ThinkNode-M1/variant.h | 2 - 3 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 variants/ELECROW-ThinkNode-M1/nicheGraphics.h diff --git a/variants/ELECROW-ThinkNode-M1/nicheGraphics.h b/variants/ELECROW-ThinkNode-M1/nicheGraphics.h new file mode 100644 index 000000000..f68ac9edd --- /dev/null +++ b/variants/ELECROW-ThinkNode-M1/nicheGraphics.h @@ -0,0 +1,119 @@ +#pragma once + +#include "configuration.h" + +#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS + +// InkHUD-specific components +// --------------------------- +#include "graphics/niche/InkHUD/InkHUD.h" + +// Applets +#include "graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.h" +#include "graphics/niche/InkHUD/Applets/User/DM/DMApplet.h" +#include "graphics/niche/InkHUD/Applets/User/Heard/HeardApplet.h" +#include "graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.h" +#include "graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h" +#include "graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h" + +// Shared NicheGraphics components +// -------------------------------- +#include "graphics/niche/Drivers/Backlight/LatchingBacklight.h" +#include "graphics/niche/Drivers/EInk/GDEY0154D67.h" +#include "graphics/niche/Inputs/TwoButton.h" + +#include "graphics/niche/Fonts/FreeSans6pt7b.h" +#include "graphics/niche/Fonts/FreeSans6pt8bCyrillic.h" +#include + +void setupNicheGraphics() +{ + using namespace NicheGraphics; + + // SPI + // ----------------------------- + + // For NRF52 platforms, SPI pins are defined in variant.h, not passed to begin() + SPI1.begin(); + + // Driver + // ----------------------------- + + // Use E-Ink driver + Drivers::EInk *driver = new Drivers::GDEY0154D67; // Todo: confirm display model + driver->begin(&SPI1, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES); + + // InkHUD + // ---------------------------- + + InkHUD::InkHUD *inkhud = InkHUD::InkHUD::getInstance(); + + // Set the driver + inkhud->setDriver(driver); + + // Set how many FAST updates per FULL update + // Set how unhealthy additional FAST updates beyond this number are + // Todo: observe the display's performance in-person and adjust accordingly. + // Currently set to the values given by Elecrow for EInkDynamicDisplay. + inkhud->setDisplayResilience(10, 1.5); + + // Prepare fonts + InkHUD::Applet::fontLarge = InkHUD::AppletFont(FreeSans9pt7b); + InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt7b); + /* + // Font localization demo: Cyrillic + InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt8bCyrillic); + InkHUD::Applet::fontSmall.addSubstitutionsWin1251(); + */ + + // Customize default settings + inkhud->persistence->settings.userTiles.maxCount = 2; // Two applets side-by-side + inkhud->persistence->settings.rotation = 0; // To be confirmed? + inkhud->persistence->settings.optionalFeatures.batteryIcon = true; // Device definitely has a battery + + // Setup backlight + // Note: button mapping for this configured further down + Drivers::LatchingBacklight *backlight = Drivers::LatchingBacklight::getInstance(); + backlight->setPin(PIN_EINK_EN); + + // Pick applets + // Note: order of applets determines priority of "auto-show" feature + inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown + inkhud->addApplet("DMs", new InkHUD::DMApplet); // Inactive + inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // Inactive + inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // Inactive + inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated + inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // Inactive + inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, no autoshow, default on tile 0 + + // Start running InkHUD + inkhud->begin(); + + // Buttons + // -------------------------- + + Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // Shared NicheGraphics component + + // As labeled on Elecrow diagram: https://www.elecrow.com/download/product/CIL12901M/ThinkNode-M1_User_Manual.pdf + constexpr uint8_t PAGE_TURN_BUTTON = 0; + constexpr uint8_t FUNCTION_BUTTON = 1; + + // Setup the main user button + buttons->setWiring(PAGE_TURN_BUTTON, PIN_BUTTON2); + buttons->setTiming(PAGE_TURN_BUTTON, 50, 500); // Todo: confirm 50ms is adequate debounce + buttons->setHandlerShortPress(PAGE_TURN_BUTTON, []() { InkHUD::InkHUD::getInstance()->shortpress(); }); + buttons->setHandlerLongPress(PAGE_TURN_BUTTON, []() { InkHUD::InkHUD::getInstance()->longpress(); }); + + // Setup the aux button + // Initial testing only: mapped to the backlight + // Todo: additional features + buttons->setWiring(FUNCTION_BUTTON, PIN_BUTTON1); + buttons->setTiming(FUNCTION_BUTTON, 50, 500); // 500ms before latch + buttons->setHandlerDown(FUNCTION_BUTTON, [backlight]() { backlight->peek(); }); + buttons->setHandlerLongPress(FUNCTION_BUTTON, [backlight]() { backlight->latch(); }); + buttons->setHandlerShortPress(FUNCTION_BUTTON, [backlight]() { backlight->off(); }); + + buttons->start(); +} + +#endif \ No newline at end of file diff --git a/variants/ELECROW-ThinkNode-M1/platformio.ini b/variants/ELECROW-ThinkNode-M1/platformio.ini index f37f6d310..86fbde398 100644 --- a/variants/ELECROW-ThinkNode-M1/platformio.ini +++ b/variants/ELECROW-ThinkNode-M1/platformio.ini @@ -10,6 +10,7 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/ELECROW-ThinkNode-M1 -DELECROW_ThinkNode_M1 -DGPS_POWER_TOGGLE -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" + -DUSE_EINK -DEINK_DISPLAY_MODEL=GxEPD2_154_D67 -DEINK_WIDTH=200 -DEINK_HEIGHT=200 @@ -26,4 +27,23 @@ lib_deps = https://github.com/meshtastic/GxEPD2/archive/33db3fa8ee6fc47d160bdb44f8f127c9a9203a10.zip lewisxhe/PCF8563_Library@^1.0.1 khoih-prog/nRF52_PWM@^1.0.1 -;upload_protocol = fs \ No newline at end of file +;upload_protocol = fs + +[env:thinknode_m1-inkhud] +extends = nrf52840_base, inkhud +board = ThinkNode-M1 +board_check = true +debug_tool = jlink +build_flags = + ${nrf52840_base.build_flags} + ${inkhud.build_flags} + -I variants/ELECROW-ThinkNode-M1 + -D ELECROW_ThinkNode_M1 + -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" +build_src_filter = + ${nrf52_base.build_src_filter} + ${inkhud.build_src_filter} +lib_deps = + ${inkhud.lib_deps} ; InkHUD libs first, so we get GFXRoot instead of AdafruitGFX + ${nrf52840_base.lib_deps} + lewisxhe/PCF8563_Library@^1.0.1 \ No newline at end of file diff --git a/variants/ELECROW-ThinkNode-M1/variant.h b/variants/ELECROW-ThinkNode-M1/variant.h index 3bfa360f6..fc2fddbdf 100644 --- a/variants/ELECROW-ThinkNode-M1/variant.h +++ b/variants/ELECROW-ThinkNode-M1/variant.h @@ -140,8 +140,6 @@ External serial flash WP25R1635FZUIL0 // Controls power for all peripherals (eink + GPS + LoRa + Sensor) #define PIN_POWER_EN (0 + 12) -#define USE_EINK - #define PIN_SPI1_MISO (32 + 7) #define PIN_SPI1_MOSI PIN_EINK_MOSI #define PIN_SPI1_SCK PIN_EINK_SCLK From 128c347c645d64497b5f024364e44c5884079b12 Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Tue, 1 Apr 2025 23:26:46 +1300 Subject: [PATCH 364/381] fix: T-Echo frontlight on at boot when using OLED UI (#6474) --- src/graphics/EInkDisplay2.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index 96c6b44c1..27117641e 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -128,11 +128,7 @@ bool EInkDisplay::connect() #ifdef PIN_EINK_EN // backlight power, HIGH is backlight on, LOW is off pinMode(PIN_EINK_EN, OUTPUT); -#ifdef ELECROW_ThinkNode_M1 digitalWrite(PIN_EINK_EN, LOW); -#else - digitalWrite(PIN_EINK_EN, HIGH); -#endif #endif #if defined(TTGO_T_ECHO) || defined(ELECROW_ThinkNode_M1) From ea4ce8d827d45e82e7ce5b377d956e324f80733c Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Tue, 1 Apr 2025 15:53:15 +0200 Subject: [PATCH 365/381] MUI unPhone-tft: fix defaults (#6477) --- src/mesh/NodeDB.cpp | 2 +- variants/unphone/platformio.ini | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 3f79d18e6..9bb63652a 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -689,7 +689,7 @@ void NodeDB::initConfigIntervals() config.display.screen_on_secs = default_screen_on_secs; -#if defined(T_WATCH_S3) || defined(T_DECK) || defined(MESH_TAB) || defined(RAK14014) +#if defined(T_WATCH_S3) || defined(T_DECK) || defined(UNPHONE) || defined(MESH_TAB) || defined(RAK14014) config.power.is_power_saving = true; config.display.screen_on_secs = 30; config.power.wait_bluetooth_secs = 30; diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini index 18efbb157..399d65b03 100644 --- a/variants/unphone/platformio.ini +++ b/variants/unphone/platformio.ini @@ -35,19 +35,19 @@ lib_deps = ${esp32s3_base.lib_deps} extends = env:unphone build_flags = ${env:unphone.build_flags} + -D CONFIG_DISABLE_HAL_LOCKS=1 -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 - -D MESHTASTIC_EXCLUDE_BLUETOOTH=1 -D MESHTASTIC_EXCLUDE_WEBSERVER=1 -D MESHTASTIC_EXCLUDE_SERIAL=1 -D MESHTASTIC_EXCLUDE_SOCKETAPI=1 -D INPUTDRIVER_BUTTON_TYPE=21 - -D MAX_THREADS=40 -D HAS_SCREEN=0 -D HAS_TFT=1 -D HAS_SDCARD -D DISPLAY_SET_RESOLUTION - -D RAM_SIZE=3072 + -D RAM_SIZE=6144 + -D LV_CACHE_DEF_SIZE=2097152 -D LV_LVGL_H_INCLUDE_SIMPLE -D LV_CONF_INCLUDE_SIMPLE -D LV_COMP_CONF_INCLUDE_SIMPLE @@ -63,6 +63,7 @@ build_flags = -D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_UNPHONE.h\" -D VIEW_320x240 -D USE_PACKET_API + -D MAP_FULL_REDRAW lib_deps = ${env:unphone.lib_deps} From 644849126ca179ee52f31133cc62e72142dde8f7 Mon Sep 17 00:00:00 2001 From: Benjamin Faershtein <119711889+RCGV1@users.noreply.github.com> Date: Tue, 1 Apr 2025 10:50:10 -0700 Subject: [PATCH 366/381] Fixes #6315 (#6475) * Fixed Canned Messages send to non broadcast * Small fix * Fix formatting for singular canned message * Trunk fmt --------- Co-authored-by: Ben Meadors --- src/modules/CannedMessageModule.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index 2a5ec00ab..c16c0e4b3 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -483,7 +483,7 @@ int32_t CannedMessageModule::runOnce() #if defined(USE_VIRTUAL_KEYBOARD) sendText(this->dest, indexChannels[this->channel], this->messages[this->currentMessageIndex], true); #else - sendText(NODENUM_BROADCAST, channels.getPrimaryIndex(), this->messages[this->currentMessageIndex], true); + sendText(this->dest, indexChannels[this->channel], this->messages[this->currentMessageIndex], true); #endif } this->runState = CANNED_MESSAGE_RUN_STATE_SENDING_ACTIVE; @@ -1114,20 +1114,19 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st display->drawStringf(0 + x, 0 + y, buffer, "To: %s", cannedMessageModule->getNodeName(this->dest)); int lines = (display->getHeight() / FONT_HEIGHT_SMALL) - 1; if (lines == 3) { - // static (old) behavior for small displays - display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL, cannedMessageModule->getPrevMessage()); display->fillRect(0 + x, 0 + y + FONT_HEIGHT_SMALL * 2, x + display->getWidth(), y + FONT_HEIGHT_SMALL); display->setColor(BLACK); display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL * 2, cannedMessageModule->getCurrentMessage()); display->setColor(WHITE); - display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL * 3, cannedMessageModule->getNextMessage()); + if (this->messagesCount > 1) { + display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL, cannedMessageModule->getPrevMessage()); + display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL * 3, cannedMessageModule->getNextMessage()); + } } else { - // use entire display height for larger displays int topMsg = (messagesCount > lines && currentMessageIndex >= lines - 1) ? currentMessageIndex - lines + 2 : 0; for (int i = 0; i < std::min(messagesCount, lines); i++) { if (i == currentMessageIndex - topMsg) { #ifdef USE_EINK - // Avoid drawing solid black with fillRect: harder to clear for E-Ink display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL * (i + 1), ">"); display->drawString(12 + x, 0 + y + FONT_HEIGHT_SMALL * (i + 1), cannedMessageModule->getCurrentMessage()); @@ -1138,7 +1137,7 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL * (i + 1), cannedMessageModule->getCurrentMessage()); display->setColor(WHITE); #endif - } else { + } else if (messagesCount > 1) { // Only draw others if there are multiple messages display->drawString(0 + x, 0 + y + FONT_HEIGHT_SMALL * (i + 1), cannedMessageModule->getMessageByIndex(topMsg + i)); } From f6ed10f3298abf6896892ca7906d3231c8b3f567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hampa=C3=AF?= Date: Tue, 1 Apr 2025 22:39:40 +0200 Subject: [PATCH 367/381] Added initial support for Texas Instruments LP5562 (#6381) * Added initial support for Texas Instrument LP5562 * Added proper support for Ambient Lighting * Code merge for all RBG_LED enabled devices * Fixed forgotten log_info & added firstRGBLED() --- src/AmbientLightingThread.h | 43 +++++++++++++++++----- src/configuration.h | 6 +++ src/detect/ScanI2C.cpp | 6 +++ src/detect/ScanI2C.h | 3 ++ src/detect/ScanI2CTwoWire.cpp | 3 ++ src/graphics/NomadStarLED.h | 5 +++ src/main.cpp | 8 ++-- src/modules/ExternalNotificationModule.cpp | 29 +++++++++++++-- 8 files changed, 87 insertions(+), 16 deletions(-) create mode 100644 src/graphics/NomadStarLED.h diff --git a/src/AmbientLightingThread.h b/src/AmbientLightingThread.h index c487f9d53..bff8846d6 100644 --- a/src/AmbientLightingThread.h +++ b/src/AmbientLightingThread.h @@ -6,6 +6,11 @@ NCP5623 rgb; #endif +#ifdef HAS_LP5562 +#include +LP5562 rgbw; +#endif + #ifdef HAS_NEOPIXEL #include Adafruit_NeoPixel pixels(NEOPIXEL_COUNT, NEOPIXEL_DATA, NEOPIXEL_TYPE); @@ -26,7 +31,7 @@ class AmbientLightingThread : public concurrency::OSThread notifyDeepSleepObserver.observe(¬ifyDeepSleep); // Let us know when shutdown() is issued. // Enables Ambient Lighting by default if conditions are meet. -#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE) +#ifdef HAS_RGB_LED #ifdef ENABLE_AMBIENTLIGHTING moduleConfig.ambient_lighting.led_state = true; #endif @@ -39,7 +44,7 @@ class AmbientLightingThread : public concurrency::OSThread // moduleConfig.ambient_lighting.green = (myNodeInfo.my_node_num & 0x00FF00) >> 8; // moduleConfig.ambient_lighting.blue = myNodeInfo.my_node_num & 0x0000FF; -#ifdef HAS_NCP5623 +#if defined(HAS_NCP5623) || defined(HAS_LP5562) _type = type; if (_type == ScanI2C::DeviceType::NONE) { LOG_DEBUG("AmbientLighting Disable due to no RGB leds found on I2C bus"); @@ -47,17 +52,21 @@ class AmbientLightingThread : public concurrency::OSThread return; } #endif -#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE) +#ifdef HAS_RGB_LED if (!moduleConfig.ambient_lighting.led_state) { LOG_DEBUG("AmbientLighting Disable due to moduleConfig.ambient_lighting.led_state OFF"); disable(); return; } LOG_DEBUG("AmbientLighting init"); -#ifdef HAS_NCP5623 +#if defined(HAS_NCP5623) || defined(HAS_LP5562) if (_type == ScanI2C::NCP5623) { rgb.begin(); #endif +#ifdef HAS_LP5562 + } else if (_type == ScanI2C::LP5562) { + rgbw.begin(); +#endif #ifdef RGBLED_RED pinMode(RGBLED_RED, OUTPUT); pinMode(RGBLED_GREEN, OUTPUT); @@ -70,7 +79,7 @@ class AmbientLightingThread : public concurrency::OSThread #endif setLighting(); #endif -#ifdef HAS_NCP5623 +#if defined(HAS_NCP5623) || defined(HAS_LP5562) } #endif } @@ -78,13 +87,13 @@ class AmbientLightingThread : public concurrency::OSThread protected: int32_t runOnce() override { -#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE) -#ifdef HAS_NCP5623 - if (_type == ScanI2C::NCP5623 && moduleConfig.ambient_lighting.led_state) { +#ifdef HAS_RGB_LED +#if defined(HAS_NCP5623) || defined(HAS_LP5562) + if ((_type == ScanI2C::NCP5623 || _type == ScanI2C::LP5562) && moduleConfig.ambient_lighting.led_state) { #endif setLighting(); return 30000; // 30 seconds to reset from any animations that may have been running from Ext. Notification -#ifdef HAS_NCP5623 +#if defined(HAS_NCP5623) || defined(HAS_LP5562) } #endif #endif @@ -108,6 +117,14 @@ class AmbientLightingThread : public concurrency::OSThread rgb.setBlue(0); LOG_INFO("OFF: NCP5623 Ambient lighting"); #endif +#ifdef HAS_LP5562 + rgbw.setCurrent(0); + rgbw.setRed(0); + rgbw.setGreen(0); + rgbw.setBlue(0); + rgbw.setWhite(0); + LOG_INFO("OFF: LP5562 Ambient lighting"); +#endif #ifdef HAS_NEOPIXEL pixels.clear(); pixels.show(); @@ -141,6 +158,14 @@ class AmbientLightingThread : public concurrency::OSThread LOG_DEBUG("Init NCP5623 Ambient light w/ current=%d, red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.current, moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue); #endif +#ifdef HAS_LP5562 + rgbw.setCurrent(moduleConfig.ambient_lighting.current); + rgbw.setRed(moduleConfig.ambient_lighting.red); + rgbw.setGreen(moduleConfig.ambient_lighting.green); + rgbw.setBlue(moduleConfig.ambient_lighting.blue); + LOG_DEBUG("Init LP5562 Ambient light w/ current=%d, red=%d, green=%d, blue=%d", moduleConfig.ambient_lighting.current, + moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue); +#endif #ifdef HAS_NEOPIXEL pixels.fill(pixels.Color(moduleConfig.ambient_lighting.red, moduleConfig.ambient_lighting.green, moduleConfig.ambient_lighting.blue), diff --git a/src/configuration.h b/src/configuration.h index fd4a5b196..ba6066896 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -170,6 +170,7 @@ along with this program. If not, see . // LED // ----------------------------------------------------------------------------- #define NCP5623_ADDR 0x38 +#define LP5562_ADDR 0x30 // ----------------------------------------------------------------------------- // Security @@ -295,6 +296,11 @@ along with this program. If not, see . #error HW_VENDOR must be defined #endif +// Support multiple RGB LED configuration +#if defined(HAS_NCP5623) || defined(HAS_LP5562) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE) +#define HAS_RGB_LED +#endif + // ----------------------------------------------------------------------------- // Global switches to turn off features for a minimized build // ----------------------------------------------------------------------------- diff --git a/src/detect/ScanI2C.cpp b/src/detect/ScanI2C.cpp index 4caa0f730..b88843a78 100644 --- a/src/detect/ScanI2C.cpp +++ b/src/detect/ScanI2C.cpp @@ -41,6 +41,12 @@ ScanI2C::FoundDevice ScanI2C::firstAccelerometer() const return firstOfOrNONE(8, types); } +ScanI2C::FoundDevice ScanI2C::firstRGBLED() const +{ + ScanI2C::DeviceType types[] = {NCP5623, LP5562}; + return firstOfOrNONE(2, types); +} + ScanI2C::FoundDevice ScanI2C::find(ScanI2C::DeviceType) const { return DEVICE_NONE; diff --git a/src/detect/ScanI2C.h b/src/detect/ScanI2C.h index 5b6bbe629..cfa3ea9cd 100644 --- a/src/detect/ScanI2C.h +++ b/src/detect/ScanI2C.h @@ -49,6 +49,7 @@ class ScanI2C VEML7700, RCWL9620, NCP5623, + LP5562, TSL2591, OPT3001, MLX90632, @@ -121,6 +122,8 @@ class ScanI2C FoundDevice firstAccelerometer() const; + FoundDevice firstRGBLED() const; + virtual FoundDevice find(DeviceType) const; virtual bool exists(DeviceType) const; diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index 8b779277d..82fcda480 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -218,6 +218,9 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) #ifdef HAS_NCP5623 SCAN_SIMPLE_CASE(NCP5623_ADDR, NCP5623, "NCP5623", (uint8_t)addr.address); #endif +#ifdef HAS_LP5562 + SCAN_SIMPLE_CASE(LP5562_ADDR, LP5562, "LP5562", (uint8_t)addr.address); +#endif #ifdef HAS_PMU SCAN_SIMPLE_CASE(XPOWERS_AXP192_AXP2101_ADDRESS, PMU_AXP192_AXP2101, "AXP192/AXP2101", (uint8_t)addr.address) #endif diff --git a/src/graphics/NomadStarLED.h b/src/graphics/NomadStarLED.h new file mode 100644 index 000000000..0633a577e --- /dev/null +++ b/src/graphics/NomadStarLED.h @@ -0,0 +1,5 @@ +#ifdef HAS_LP5562 +#include +extern LP5562 rgbw; + +#endif \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 05eeef2ae..4b098b3f3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -602,9 +602,9 @@ void setup() * "found". */ -// Only one supported RGB LED currently -#ifdef HAS_NCP5623 - rgb_found = i2cScanner->find(ScanI2C::DeviceType::NCP5623); +// Two supported RGB LED currently +#ifdef HAS_RGB_LED + rgb_found = i2cScanner->firstRGBLED(); #endif #ifdef HAS_TPS65233 @@ -1270,7 +1270,7 @@ extern meshtastic_DeviceMetadata getDeviceMetadata() #ifndef ARCH_ESP32 deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_PAXCOUNTER_CONFIG; #endif -#if !defined(HAS_NCP5623) && !defined(RGBLED_RED) && !defined(HAS_NEOPIXEL) && !defined(UNPHONE) && !RAK_4631 +#if !defined(HAS_RGB_LED) && !RAK_4631 deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_AMBIENTLIGHTING_CONFIG; #endif diff --git a/src/modules/ExternalNotificationModule.cpp b/src/modules/ExternalNotificationModule.cpp index bbb3f90e0..dc17460f6 100644 --- a/src/modules/ExternalNotificationModule.cpp +++ b/src/modules/ExternalNotificationModule.cpp @@ -28,6 +28,10 @@ #include #endif +#ifdef HAS_LP5562 +#include +#endif + #ifdef HAS_NEOPIXEL #include #endif @@ -37,10 +41,11 @@ extern unPhone unphone; #endif -#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE) +#if defined(HAS_RGB_LED) uint8_t red = 0; uint8_t green = 0; uint8_t blue = 0; +uint8_t white = 0; uint8_t colorState = 1; uint8_t brightnessIndex = 0; uint8_t brightnessValues[] = {0, 10, 20, 30, 50, 90, 160, 170}; // blue gets multiplied by 1.5 @@ -128,15 +133,21 @@ int32_t ExternalNotificationModule::runOnce() millis()); setExternalState(2, !getExternal(2)); } -#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE) +#if defined(HAS_RGB_LED) red = (colorState & 4) ? brightnessValues[brightnessIndex] : 0; // Red enabled on colorState = 4,5,6,7 green = (colorState & 2) ? brightnessValues[brightnessIndex] : 0; // Green enabled on colorState = 2,3,6,7 blue = (colorState & 1) ? (brightnessValues[brightnessIndex] * 1.5) : 0; // Blue enabled on colorState = 1,3,5,7 + white = (colorState & 12) ? brightnessValues[brightnessIndex] : 0; #ifdef HAS_NCP5623 if (rgb_found.type == ScanI2C::NCP5623) { rgb.setColor(red, green, blue); } #endif +#ifdef HAS_LP5562 + if (rgb_found.type == ScanI2C::LP5562) { + rgbw.setColor(red, green, blue, white); + } +#endif #ifdef RGBLED_CA analogWrite(RGBLED_RED, 255 - red); // CA type needs reverse logic analogWrite(RGBLED_GREEN, 255 - green); @@ -233,11 +244,12 @@ void ExternalNotificationModule::setExternalState(uint8_t index, bool on) break; } -#if defined(HAS_NCP5623) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE) +#if defined(HAS_RGB_LED) if (!on) { red = 0; green = 0; blue = 0; + white = 0; } #endif @@ -246,6 +258,11 @@ void ExternalNotificationModule::setExternalState(uint8_t index, bool on) rgb.setColor(red, green, blue); } #endif +#ifdef HAS_LP5562 + if (rgb_found.type == ScanI2C::LP5562) { + rgbw.setColor(red, green, blue, white); + } +#endif #ifdef RGBLED_CA analogWrite(RGBLED_RED, 255 - red); // CA type needs reverse logic analogWrite(RGBLED_GREEN, 255 - green); @@ -365,6 +382,12 @@ ExternalNotificationModule::ExternalNotificationModule() rgb.setCurrent(10); } #endif +#ifdef HAS_LP5562 + if (rgb_found.type == ScanI2C::LP5562) { + rgbw.begin(); + rgbw.setCurrent(20); + } +#endif #ifdef RGBLED_RED pinMode(RGBLED_RED, OUTPUT); // set up the RGB led pins pinMode(RGBLED_GREEN, OUTPUT); From 67fddcc2142bed7e6748d0a5485d4848f32856fc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 2 Apr 2025 05:41:36 -0500 Subject: [PATCH 368/381] Upgrade trunk (#6480) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 4c570c856..b89f1f835 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -12,7 +12,7 @@ lint: - trufflehog@3.88.20 - yamllint@1.37.0 - bandit@1.8.3 - - checkov@3.2.394 + - checkov@3.2.395 - terrascan@1.19.9 - trivy@0.61.0 - taplo@0.9.3 @@ -22,7 +22,7 @@ lint: - oxipng@9.1.4 - svgo@3.3.2 - actionlint@1.7.7 - - flake8@7.1.2 + - flake8@7.2.0 - hadolint@2.12.1-beta - shfmt@3.6.0 - shellcheck@0.10.0 From ef18a9b5b5a2a756ad15009ce9cd7e0b7717d077 Mon Sep 17 00:00:00 2001 From: Austin Date: Wed, 2 Apr 2025 07:55:14 -0400 Subject: [PATCH 369/381] meshtasticd: Set available.d dir in yaml (#6481) --- bin/config-dist.yaml | 3 ++- src/platform/portduino/PortduinoGlue.cpp | 4 +++- src/platform/portduino/PortduinoGlue.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/config-dist.yaml b/bin/config-dist.yaml index 722f80fae..9238d0e56 100644 --- a/bin/config-dist.yaml +++ b/bin/config-dist.yaml @@ -197,5 +197,6 @@ General: MaxNodes: 200 MaxMessageQueue: 100 ConfigDirectory: /etc/meshtasticd/config.d/ + AvailableDirectory: /etc/meshtasticd/available.d/ # MACAddress: AA:BB:CC:DD:EE:FF -# MACAddressSource: eth0 \ No newline at end of file +# MACAddressSource: eth0 diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index a4050e702..6d0972dc3 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -247,7 +247,7 @@ void portduinoSetup() std::cerr << "autoconf: Unable to find config for " << autoconf_product << std::endl; exit(EXIT_FAILURE); } - if (loadConfig(("/etc/meshtasticd/available.d/" + product_config).c_str())) { + if (loadConfig((settingsStrings[available_directory] + product_config).c_str())) { std::cout << "autoconf: Using " << product_config << " as config file for " << autoconf_product << std::endl; } else { std::cerr << "autoconf: Unable to use " << product_config << " as config file for " << autoconf_product @@ -602,6 +602,8 @@ bool loadConfig(const char *configPath) settingsMap[maxnodes] = (yamlConfig["General"]["MaxNodes"]).as(200); settingsMap[maxtophone] = (yamlConfig["General"]["MaxMessageQueue"]).as(100); settingsStrings[config_directory] = (yamlConfig["General"]["ConfigDirectory"]).as(""); + settingsStrings[available_directory] = + (yamlConfig["General"]["AvailableDirectory"]).as("/etc/meshtasticd/available.d/"); if ((yamlConfig["General"]["MACAddress"]).as("") != "" && (yamlConfig["General"]["MACAddressSource"]).as("") != "") { std::cout << "Cannot set both MACAddress and MACAddressSource!" << std::endl; diff --git a/src/platform/portduino/PortduinoGlue.h b/src/platform/portduino/PortduinoGlue.h index 4e074be71..f7239cb73 100644 --- a/src/platform/portduino/PortduinoGlue.h +++ b/src/platform/portduino/PortduinoGlue.h @@ -99,6 +99,7 @@ enum configNames { maxnodes, ascii_logs, config_directory, + available_directory, mac_address }; enum { no_screen, x11, st7789, st7735, st7735s, st7796, ili9341, ili9342, ili9486, ili9488, hx8357d }; From 594cb0cc1e94b478aac755025f0912b452aa2845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 3 Apr 2025 02:15:12 +0200 Subject: [PATCH 370/381] reinstate M1 Backlight (#6484) --- src/graphics/EInkDisplay2.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index 27117641e..d2d373d24 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -128,8 +128,13 @@ bool EInkDisplay::connect() #ifdef PIN_EINK_EN // backlight power, HIGH is backlight on, LOW is off pinMode(PIN_EINK_EN, OUTPUT); +#ifdef ELECROW_ThinkNode_M1 + // ThinkNode M1 has a hardware dimmable backlight. Start enabled + digitalWrite(PIN_EINK_EN, HIGH); +#else digitalWrite(PIN_EINK_EN, LOW); #endif +#endif #if defined(TTGO_T_ECHO) || defined(ELECROW_ThinkNode_M1) { From 31130fd49e732bdd813492e8155e71605275595c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 3 Apr 2025 06:52:39 -0500 Subject: [PATCH 371/381] Upgrade trunk to 1.22.12 (#6487) Co-authored-by: sachaw <11172820+sachaw@users.noreply.github.com> --- .trunk/trunk.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index b89f1f835..aeb0a1b43 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -1,6 +1,6 @@ version: 0.1 cli: - version: 1.22.11 + version: 1.22.12 plugins: sources: - id: trunk @@ -12,7 +12,7 @@ lint: - trufflehog@3.88.20 - yamllint@1.37.0 - bandit@1.8.3 - - checkov@3.2.395 + - checkov@3.2.396 - terrascan@1.19.9 - trivy@0.61.0 - taplo@0.9.3 From 11bafae2872c244dd821ce0b6273e699f55cfae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 3 Apr 2025 16:02:46 +0200 Subject: [PATCH 372/381] update OLED library (#6489) --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 010aea90f..377635873 100644 --- a/platformio.ini +++ b/platformio.ini @@ -56,7 +56,7 @@ build_flags = -Wno-missing-field-initializers monitor_speed = 115200 monitor_filters = direct lib_deps = - https://github.com/meshtastic/esp8266-oled-ssd1306/archive/e16cee124fe26490cb14880c679321ad8ac89c95.zip + https://github.com/meshtastic/esp8266-oled-ssd1306/archive/0119501e9983bd894830b02f545c377ee08d66fe.zip mathertel/OneButton@2.6.1 https://github.com/meshtastic/arduino-fsm/archive/7db3702bf0cfe97b783d6c72595e3f38e0b19159.zip https://github.com/meshtastic/TinyGPSPlus/archive/71a82db35f3b973440044c476d4bcdc673b104f4.zip From 1017f6af355f6e531d76578118b59bb4c9bee41b Mon Sep 17 00:00:00 2001 From: rcarteraz Date: Thu, 3 Apr 2025 07:07:43 -0700 Subject: [PATCH 373/381] remove very long slow (#6486) --- src/DisplayFormatters.cpp | 3 --- src/mesh/RadioInterface.cpp | 5 ----- 2 files changed, 8 deletions(-) diff --git a/src/DisplayFormatters.cpp b/src/DisplayFormatters.cpp index 0718ffcbd..44bc0897b 100644 --- a/src/DisplayFormatters.cpp +++ b/src/DisplayFormatters.cpp @@ -27,9 +27,6 @@ const char *DisplayFormatters::getModemPresetDisplayName(meshtastic_Config_LoRaC case meshtastic_Config_LoRaConfig_ModemPreset_LONG_MODERATE: return useShortName ? "LongM" : "LongMod"; break; - case meshtastic_Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW: - return useShortName ? "VeryL" : "VLongSlow"; - break; default: return useShortName ? "Custom" : "Invalid"; break; diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index 2e50c0168..86903153b 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -488,11 +488,6 @@ void RadioInterface::applyModemConfig() cr = 8; sf = 12; break; - case meshtastic_Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW: - bw = (myRegion->wideLora) ? 203.125 : 62.5; - cr = 8; - sf = 12; - break; } } else { sf = loraConfig.spread_factor; From 06658028234b86dc9cb7055f6f57ce6fd5a417fd Mon Sep 17 00:00:00 2001 From: "Jason B. Cox" Date: Thu, 3 Apr 2025 12:17:36 -0700 Subject: [PATCH 374/381] Improve PKC unit test coverage (#6485) * Cleanup PKC unit test a bit * Add unit test coverage for encryptCurve25519 --------- Co-authored-by: Ben Meadors --- test/test_crypto/test_main.cpp | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/test/test_crypto/test_main.cpp b/test/test_crypto/test_main.cpp index ac507116c..36dc37b9d 100644 --- a/test/test_crypto/test_main.cpp +++ b/test/test_crypto/test_main.cpp @@ -110,7 +110,7 @@ void test_DH25519(void) TEST_ASSERT_EQUAL_MEMORY(expected_shared, crypto->shared_key, 32); } -void test_PKC_Decrypt(void) +void test_PKC(void) { uint8_t private_key[32]; meshtastic_UserLite_public_key_t public_key; @@ -120,7 +120,8 @@ void test_PKC_Decrypt(void) uint8_t decrypted[128] __attribute__((__aligned__)); uint8_t expected_nonce[16]; - uint32_t fromNode; + uint32_t fromNode = 0x0929; + uint64_t packetNum = 0x13b2d662; HexToBytes(public_key.bytes, "db18fc50eea47f00251cb784819a3cf5fc361882597f589f0d7ff820e8064457"); public_key.size = 32; HexToBytes(private_key, "a00330633e63522f8a4d81ec6d9d1e6617f6c8ffd3a4c698229537d44e522277"); @@ -128,14 +129,26 @@ void test_PKC_Decrypt(void) HexToBytes(expected_decrypted, "08011204746573744800"); HexToBytes(radioBytes, "8c646d7a2909000062d6b2136b00000040df24abfcc30a17a3d9046726099e796a1c036a792b"); HexToBytes(expected_nonce, "62d6b213036a792b2909000000"); - fromNode = 0x0929; crypto->setDHPrivateKey(private_key); - // TEST_ASSERT(crypto->setDHPublicKey(public_key)); - // crypto->hash(crypto->shared_key, 32); - crypto->decryptCurve25519(fromNode, public_key, 0x13b2d662, 22, radioBytes + 16, decrypted); + + TEST_ASSERT(crypto->decryptCurve25519(fromNode, public_key, packetNum, 22, radioBytes + 16, decrypted)); TEST_ASSERT_EQUAL_MEMORY(expected_shared, crypto->shared_key, 8); TEST_ASSERT_EQUAL_MEMORY(expected_nonce, crypto->nonce, 13); + TEST_ASSERT_EQUAL_MEMORY(expected_decrypted, decrypted, 10); + uint32_t toNode = 0; // Only impacts logging + uint8_t encrypted[128] __attribute__((__aligned__)); + TEST_ASSERT(crypto->encryptCurve25519(toNode, fromNode, public_key, packetNum, 10, decrypted, encrypted)); + TEST_ASSERT_EQUAL_MEMORY(expected_shared, crypto->shared_key, 8); + // The extraNonce is random, so skip checking the nonce and encrypted output here + + // Copy the nonce to check it after encryption + memcpy(expected_nonce, crypto->nonce, 16); + + // Decrypt the re-encrypted bytes and check they are the same as what we expect + TEST_ASSERT(crypto->decryptCurve25519(fromNode, public_key, packetNum, 22, encrypted, decrypted)); + TEST_ASSERT_EQUAL_MEMORY(expected_shared, crypto->shared_key, 8); + TEST_ASSERT_EQUAL_MEMORY(expected_nonce, crypto->nonce, 13); TEST_ASSERT_EQUAL_MEMORY(expected_decrypted, decrypted, 10); } @@ -178,7 +191,7 @@ void setup() RUN_TEST(test_ECB_AES256); RUN_TEST(test_DH25519); RUN_TEST(test_AES_CTR); - RUN_TEST(test_PKC_Decrypt); + RUN_TEST(test_PKC); exit(UNITY_END()); // stop unit testing } From 749410617007319e995f5014329bc5f2c31e8a9e Mon Sep 17 00:00:00 2001 From: Nasimovy Date: Thu, 3 Apr 2025 19:18:18 +0000 Subject: [PATCH 375/381] TCA8418 initial config + basic 3x4 keypad config (#6422) * TCA8418 with base config for 3x4 keypad * replaced k with uppercase K * change detection method * reflect changes #6381 --------- Co-authored-by: Ben Meadors --- src/configuration.h | 1 + src/detect/ScanI2C.cpp | 4 +- src/detect/ScanI2C.h | 3 +- src/detect/ScanI2CTwoWire.cpp | 20 +- src/input/TCA8418Keyboard.cpp | 561 ++++++++++++++++++++++++++++++++++ src/input/TCA8418Keyboard.h | 83 +++++ src/input/cardKbI2cImpl.cpp | 8 +- src/input/kbI2cBase.cpp | 68 +++++ src/input/kbI2cBase.h | 2 + src/main.cpp | 4 + 10 files changed, 742 insertions(+), 12 deletions(-) create mode 100644 src/input/TCA8418Keyboard.cpp create mode 100644 src/input/TCA8418Keyboard.h diff --git a/src/configuration.h b/src/configuration.h index ba6066896..d319ddb0a 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -152,6 +152,7 @@ along with this program. If not, see . #define MLX90614_ADDR_DEF 0x5A #define CGRADSENS_ADDR 0x66 #define LTR390UV_ADDR 0x53 +#define XPOWERS_AXP192_AXP2101_ADDRESS 0x34 // same adress as TCA8418 // ----------------------------------------------------------------------------- // ACCELEROMETER diff --git a/src/detect/ScanI2C.cpp b/src/detect/ScanI2C.cpp index b88843a78..5bd5c0d12 100644 --- a/src/detect/ScanI2C.cpp +++ b/src/detect/ScanI2C.cpp @@ -31,8 +31,8 @@ ScanI2C::FoundDevice ScanI2C::firstRTC() const ScanI2C::FoundDevice ScanI2C::firstKeyboard() const { - ScanI2C::DeviceType types[] = {CARDKB, TDECKKB, BBQ10KB, RAK14004, MPR121KB}; - return firstOfOrNONE(5, types); + ScanI2C::DeviceType types[] = {CARDKB, TDECKKB, BBQ10KB, RAK14004, MPR121KB, TCA8418KB}; + return firstOfOrNONE(6, types); } ScanI2C::FoundDevice ScanI2C::firstAccelerometer() const diff --git a/src/detect/ScanI2C.h b/src/detect/ScanI2C.h index cfa3ea9cd..c363db1b5 100644 --- a/src/detect/ScanI2C.h +++ b/src/detect/ScanI2C.h @@ -18,7 +18,7 @@ class ScanI2C TDECKKB, BBQ10KB, RAK14004, - PMU_AXP192_AXP2101, + PMU_AXP192_AXP2101, // has the same adress as the TCA8418KB BME_680, BME_280, BMP_280, @@ -70,6 +70,7 @@ class ScanI2C DFROBOT_RAIN, DPS310, LTR390UV, + TCA8418KB, } DeviceType; // typedef uint8_t DeviceAddress; diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index 82fcda480..230271b94 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -10,11 +10,6 @@ #include "meshUtils.h" // vformat #endif -// AXP192 and AXP2101 have the same device address, we just need to identify it in Power.cpp -#ifndef XPOWERS_AXP192_AXP2101_ADDRESS -#define XPOWERS_AXP192_AXP2101_ADDRESS 0x34 -#endif - bool in_array(uint8_t *array, int size, uint8_t lookfor) { int i; @@ -221,8 +216,19 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) #ifdef HAS_LP5562 SCAN_SIMPLE_CASE(LP5562_ADDR, LP5562, "LP5562", (uint8_t)addr.address); #endif -#ifdef HAS_PMU - SCAN_SIMPLE_CASE(XPOWERS_AXP192_AXP2101_ADDRESS, PMU_AXP192_AXP2101, "AXP192/AXP2101", (uint8_t)addr.address) + case XPOWERS_AXP192_AXP2101_ADDRESS: + // Do we have the axp2101/192 or the TCA8418 + registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x90), 1); + if (registerValue == 0x0) { + logFoundDevice("TCA8418", (uint8_t)addr.address); + type = TCA8418KB; + } else { + logFoundDevice("AXP192/AXP2101", (uint8_t)addr.address); + type = PMU_AXP192_AXP2101; + } + break; +#ifdef HAS_LP5562 + SCAN_SIMPLE_CASE(LP5562_ADDR, LP5562, "LP5562", (uint8_t)addr.address); #endif case BME_ADDR: case BME_ADDR_ALTERNATE: diff --git a/src/input/TCA8418Keyboard.cpp b/src/input/TCA8418Keyboard.cpp new file mode 100644 index 000000000..21cd7b2d5 --- /dev/null +++ b/src/input/TCA8418Keyboard.cpp @@ -0,0 +1,561 @@ +// Based on the MPR121 Keyboard and Adafruit TCA8418 library + +#include "TCA8418Keyboard.h" +#include "configuration.h" + +#include + +// REGISTERS +// #define _TCA8418_REG_RESERVED 0x00 +#define _TCA8418_REG_CFG 0x01 // Configuration register +#define _TCA8418_REG_INT_STAT 0x02 // Interrupt status +#define _TCA8418_REG_KEY_LCK_EC 0x03 // Key lock and event counter +#define _TCA8418_REG_KEY_EVENT_A 0x04 // Key event register A +#define _TCA8418_REG_KEY_EVENT_B 0x05 // Key event register B +#define _TCA8418_REG_KEY_EVENT_C 0x06 // Key event register C +#define _TCA8418_REG_KEY_EVENT_D 0x07 // Key event register D +#define _TCA8418_REG_KEY_EVENT_E 0x08 // Key event register E +#define _TCA8418_REG_KEY_EVENT_F 0x09 // Key event register F +#define _TCA8418_REG_KEY_EVENT_G 0x0A // Key event register G +#define _TCA8418_REG_KEY_EVENT_H 0x0B // Key event register H +#define _TCA8418_REG_KEY_EVENT_I 0x0C // Key event register I +#define _TCA8418_REG_KEY_EVENT_J 0x0D // Key event register J +#define _TCA8418_REG_KP_LCK_TIMER 0x0E // Keypad lock1 to lock2 timer +#define _TCA8418_REG_UNLOCK_1 0x0F // Unlock register 1 +#define _TCA8418_REG_UNLOCK_2 0x10 // Unlock register 2 +#define _TCA8418_REG_GPIO_INT_STAT_1 0x11 // GPIO interrupt status 1 +#define _TCA8418_REG_GPIO_INT_STAT_2 0x12 // GPIO interrupt status 2 +#define _TCA8418_REG_GPIO_INT_STAT_3 0x13 // GPIO interrupt status 3 +#define _TCA8418_REG_GPIO_DAT_STAT_1 0x14 // GPIO data status 1 +#define _TCA8418_REG_GPIO_DAT_STAT_2 0x15 // GPIO data status 2 +#define _TCA8418_REG_GPIO_DAT_STAT_3 0x16 // GPIO data status 3 +#define _TCA8418_REG_GPIO_DAT_OUT_1 0x17 // GPIO data out 1 +#define _TCA8418_REG_GPIO_DAT_OUT_2 0x18 // GPIO data out 2 +#define _TCA8418_REG_GPIO_DAT_OUT_3 0x19 // GPIO data out 3 +#define _TCA8418_REG_GPIO_INT_EN_1 0x1A // GPIO interrupt enable 1 +#define _TCA8418_REG_GPIO_INT_EN_2 0x1B // GPIO interrupt enable 2 +#define _TCA8418_REG_GPIO_INT_EN_3 0x1C // GPIO interrupt enable 3 +#define _TCA8418_REG_KP_GPIO_1 0x1D // Keypad/GPIO select 1 +#define _TCA8418_REG_KP_GPIO_2 0x1E // Keypad/GPIO select 2 +#define _TCA8418_REG_KP_GPIO_3 0x1F // Keypad/GPIO select 3 +#define _TCA8418_REG_GPI_EM_1 0x20 // GPI event mode 1 +#define _TCA8418_REG_GPI_EM_2 0x21 // GPI event mode 2 +#define _TCA8418_REG_GPI_EM_3 0x22 // GPI event mode 3 +#define _TCA8418_REG_GPIO_DIR_1 0x23 // GPIO data direction 1 +#define _TCA8418_REG_GPIO_DIR_2 0x24 // GPIO data direction 2 +#define _TCA8418_REG_GPIO_DIR_3 0x25 // GPIO data direction 3 +#define _TCA8418_REG_GPIO_INT_LVL_1 0x26 // GPIO edge/level detect 1 +#define _TCA8418_REG_GPIO_INT_LVL_2 0x27 // GPIO edge/level detect 2 +#define _TCA8418_REG_GPIO_INT_LVL_3 0x28 // GPIO edge/level detect 3 +#define _TCA8418_REG_DEBOUNCE_DIS_1 0x29 // Debounce disable 1 +#define _TCA8418_REG_DEBOUNCE_DIS_2 0x2A // Debounce disable 2 +#define _TCA8418_REG_DEBOUNCE_DIS_3 0x2B // Debounce disable 3 +#define _TCA8418_REG_GPIO_PULL_1 0x2C // GPIO pull-up disable 1 +#define _TCA8418_REG_GPIO_PULL_2 0x2D // GPIO pull-up disable 2 +#define _TCA8418_REG_GPIO_PULL_3 0x2E // GPIO pull-up disable 3 +// #define _TCA8418_REG_RESERVED 0x2F + +// FIELDS CONFIG REGISTER 1 +#define _TCA8418_REG_CFG_AI 0x80 // Auto-increment for read/write +#define _TCA8418_REG_CFG_GPI_E_CGF 0x40 // Event mode config +#define _TCA8418_REG_CFG_OVR_FLOW_M 0x20 // Overflow mode enable +#define _TCA8418_REG_CFG_INT_CFG 0x10 // Interrupt config +#define _TCA8418_REG_CFG_OVR_FLOW_IEN 0x08 // Overflow interrupt enable +#define _TCA8418_REG_CFG_K_LCK_IEN 0x04 // Keypad lock interrupt enable +#define _TCA8418_REG_CFG_GPI_IEN 0x02 // GPI interrupt enable +#define _TCA8418_REG_CFG_KE_IEN 0x01 // Key events interrupt enable + +// FIELDS INT_STAT REGISTER 2 +#define _TCA8418_REG_STAT_CAD_INT 0x10 // Ctrl-alt-del seq status +#define _TCA8418_REG_STAT_OVR_FLOW_INT 0x08 // Overflow interrupt status +#define _TCA8418_REG_STAT_K_LCK_INT 0x04 // Key lock interrupt status +#define _TCA8418_REG_STAT_GPI_INT 0x02 // GPI interrupt status +#define _TCA8418_REG_STAT_K_INT 0x01 // Key events interrupt status + +// FIELDS KEY_LCK_EC REGISTER 3 +#define _TCA8418_REG_LCK_EC_K_LCK_EN 0x40 // Key lock enable +#define _TCA8418_REG_LCK_EC_LCK_2 0x20 // Keypad lock status 2 +#define _TCA8418_REG_LCK_EC_LCK_1 0x10 // Keypad lock status 1 +#define _TCA8418_REG_LCK_EC_KLEC_3 0x08 // Key event count bit 3 +#define _TCA8418_REG_LCK_EC_KLEC_2 0x04 // Key event count bit 2 +#define _TCA8418_REG_LCK_EC_KLEC_1 0x02 // Key event count bit 1 +#define _TCA8418_REG_LCK_EC_KLEC_0 0x01 // Key event count bit 0 + +// Pin IDs for matrix rows/columns +enum { + _TCA8418_ROW0, // Pin ID for row 0 + _TCA8418_ROW1, // Pin ID for row 1 + _TCA8418_ROW2, // Pin ID for row 2 + _TCA8418_ROW3, // Pin ID for row 3 + _TCA8418_ROW4, // Pin ID for row 4 + _TCA8418_ROW5, // Pin ID for row 5 + _TCA8418_ROW6, // Pin ID for row 6 + _TCA8418_ROW7, // Pin ID for row 7 + _TCA8418_COL0, // Pin ID for column 0 + _TCA8418_COL1, // Pin ID for column 1 + _TCA8418_COL2, // Pin ID for column 2 + _TCA8418_COL3, // Pin ID for column 3 + _TCA8418_COL4, // Pin ID for column 4 + _TCA8418_COL5, // Pin ID for column 5 + _TCA8418_COL6, // Pin ID for column 6 + _TCA8418_COL7, // Pin ID for column 7 + _TCA8418_COL8, // Pin ID for column 8 + _TCA8418_COL9 // Pin ID for column 9 +}; + +#define _TCA8418_COLS 3 +#define _TCA8418_ROWS 4 +#define _TCA8418_NUM_KEYS 12 + +uint8_t TCA8418TapMod[_TCA8418_NUM_KEYS] = {13, 7, 7, 7, 7, 7, + 9, 7, 9, 2, 2, 2}; // Num chars per key, Modulus for rotating through characters + +unsigned char TCA8418TapMap[_TCA8418_NUM_KEYS][13] = { + {'1', '.', ',', '?', '!', ':', ';', '-', '_', '\\', '/', '(', ')'}, // 1 + {'2', 'a', 'b', 'c', 'A', 'B', 'C'}, // 2 + {'3', 'd', 'e', 'f', 'D', 'E', 'F'}, // 3 + {'4', 'g', 'h', 'i', 'G', 'H', 'I'}, // 4 + {'5', 'j', 'k', 'l', 'J', 'K', 'L'}, // 5 + {'6', 'm', 'n', 'o', 'M', 'N', 'O'}, // 6 + {'7', 'p', 'q', 'r', 's', 'P', 'Q', 'R', 'S'}, // 7 + {'8', 't', 'u', 'v', 'T', 'U', 'V'}, // 8 + {'9', 'w', 'x', 'y', 'z', 'W', 'X', 'Y', 'Z'}, // 9 + {'*', '+'}, // * + {'0', ' '}, // 0 + {'#', '@'}, // # +}; + +unsigned char TCA8418LongPressMap[_TCA8418_NUM_KEYS] = { + _TCA8418_ESC, // 1 + _TCA8418_UP, // 2 + _TCA8418_NONE, // 3 + _TCA8418_LEFT, // 4 + _TCA8418_NONE, // 5 + _TCA8418_RIGHT, // 6 + _TCA8418_NONE, // 7 + _TCA8418_DOWN, // 8 + _TCA8418_NONE, // 9 + _TCA8418_BSP, // * + _TCA8418_NONE, // 0 + _TCA8418_NONE, // # +}; + +#define _TCA8418_LONG_PRESS_THRESHOLD 2000 +#define _TCA8418_MULTI_TAP_THRESHOLD 750 + +TCA8418Keyboard::TCA8418Keyboard() : m_wire(nullptr), m_addr(0), readCallback(nullptr), writeCallback(nullptr) +{ + state = Init; + last_key = -1; + next_key = -1; + should_backspace = false; + last_tap = 0L; + char_idx = 0; + tap_interval = 0; + backlight_on = true; + queue = ""; +} + +void TCA8418Keyboard::begin(uint8_t addr, TwoWire *wire) +{ + m_addr = addr; + m_wire = wire; + + m_wire->begin(); + + reset(); +} + +void TCA8418Keyboard::begin(i2c_com_fptr_t r, i2c_com_fptr_t w, uint8_t addr) +{ + m_addr = addr; + m_wire = nullptr; + writeCallback = w; + readCallback = r; + reset(); +} + +void TCA8418Keyboard::reset() +{ + LOG_DEBUG("TCA8418 Reset"); + // GPIO + // set default all GIO pins to INPUT + writeRegister(_TCA8418_REG_GPIO_DIR_1, 0x00); + writeRegister(_TCA8418_REG_GPIO_DIR_2, 0x00); + // Set COL9 as GPIO output + writeRegister(_TCA8418_REG_GPIO_DIR_3, 0x02); + // Switch off keyboard backlight (COL9 = LOW) + writeRegister(_TCA8418_REG_GPIO_DAT_OUT_3, 0x00); + + // add all pins to key events + writeRegister(_TCA8418_REG_GPI_EM_1, 0xFF); + writeRegister(_TCA8418_REG_GPI_EM_2, 0xFF); + writeRegister(_TCA8418_REG_GPI_EM_3, 0xFF); + + // set all pins to FALLING interrupts + writeRegister(_TCA8418_REG_GPIO_INT_LVL_1, 0x00); + writeRegister(_TCA8418_REG_GPIO_INT_LVL_2, 0x00); + writeRegister(_TCA8418_REG_GPIO_INT_LVL_3, 0x00); + + // add all pins to interrupts + writeRegister(_TCA8418_REG_GPIO_INT_EN_1, 0xFF); + writeRegister(_TCA8418_REG_GPIO_INT_EN_2, 0xFF); + writeRegister(_TCA8418_REG_GPIO_INT_EN_3, 0xFF); + + // Set keyboard matrix size + matrix(_TCA8418_ROWS, _TCA8418_COLS); + enableDebounce(); + flush(); + state = Idle; +} + +bool TCA8418Keyboard::matrix(uint8_t rows, uint8_t columns) +{ + if ((rows > 8) || (columns > 10)) + return false; + + // Skip zero size matrix + if ((rows != 0) && (columns != 0)) { + // Setup the keypad matrix. + uint8_t mask = 0x00; + for (int r = 0; r < rows; r++) { + mask <<= 1; + mask |= 1; + } + writeRegister(_TCA8418_REG_KP_GPIO_1, mask); + + mask = 0x00; + for (int c = 0; c < columns && c < 8; c++) { + mask <<= 1; + mask |= 1; + } + writeRegister(_TCA8418_REG_KP_GPIO_2, mask); + + if (columns > 8) { + if (columns == 9) + mask = 0x01; + else + mask = 0x03; + writeRegister(_TCA8418_REG_KP_GPIO_3, mask); + } + } + + return true; +} + +uint8_t TCA8418Keyboard::keyCount() const +{ + uint8_t eventCount = readRegister(_TCA8418_REG_KEY_LCK_EC); + eventCount &= 0x0F; // lower 4 bits only + return eventCount; +} + +bool TCA8418Keyboard::hasEvent() +{ + return queue.length() > 0; +} + +void TCA8418Keyboard::queueEvent(char next) +{ + if (next == _TCA8418_NONE) { + return; + } + queue.concat(next); +} + +char TCA8418Keyboard::dequeueEvent() +{ + if (queue.length() < 1) { + return _TCA8418_NONE; + } + char next = queue.charAt(0); + queue.remove(0, 1); + return next; +} + +void TCA8418Keyboard::trigger() +{ + if (keyCount() == 0) { + return; + } + if (state != Init) { + // Read the key register + uint8_t k = readRegister(_TCA8418_REG_KEY_EVENT_A); + uint8_t key = k & 0x7F; + if (k & 0x80) { + if (state == Idle) + pressed(key); + return; + } else { + if (state == Held) { + released(); + } + state = Idle; + return; + } + } else { + reset(); + } +} + +void TCA8418Keyboard::pressed(uint8_t key) +{ + if (state == Init || state == Busy) { + return; + } + uint8_t next_key = 0; + int row = (key - 1) / 10; + int col = (key - 1) % 10; + + if (row >= _TCA8418_ROWS || col >= _TCA8418_COLS) { + return; // Invalid key + } + + // Compute key index based on dynamic row/column + next_key = row * _TCA8418_COLS + col; + + // LOG_DEBUG("TCA8418: Key %u -> Next Key %u", key, next_key); + + state = Held; + uint32_t now = millis(); + tap_interval = now - last_tap; + if (tap_interval < 0) { + // Long running, millis has overflowed. + last_tap = 0; + state = Busy; + return; + } + + // Check if the key is the same as the last one or if the time interval has passed + if (next_key != last_key || tap_interval > _TCA8418_MULTI_TAP_THRESHOLD) { + char_idx = 0; // Reset char index if new key or long press + should_backspace = false; // dont backspace on new key + } else { + char_idx += 1; // Cycle through characters if same key pressed + should_backspace = true; // allow backspace on same key + } + + // Store the current key as the last key + last_key = next_key; + last_tap = now; +} + +void TCA8418Keyboard::released() +{ + if (state != Held) { + return; + } + + if (last_key < 0 || last_key > _TCA8418_NUM_KEYS) { // reset to idle if last_key out of bounds + last_key = -1; + state = Idle; + return; + } + uint32_t now = millis(); + int32_t held_interval = now - last_tap; + last_tap = now; + if (tap_interval < _TCA8418_MULTI_TAP_THRESHOLD && should_backspace) { + queueEvent(_TCA8418_BSP); + } + if (held_interval > _TCA8418_LONG_PRESS_THRESHOLD) { + queueEvent(TCA8418LongPressMap[last_key]); + // LOG_DEBUG("Long Press Key: %i Map: %i", last_key, TCA8418LongPressMap[last_key]); + } else { + queueEvent(TCA8418TapMap[last_key][(char_idx % TCA8418TapMod[last_key])]); + // LOG_DEBUG("Key Press: %i Index:%i if %i Map: %c", last_key, char_idx, TCA8418TapMod[last_key], + // TCA8418TapMap[last_key][(char_idx % TCA8418TapMod[last_key])]); + } +} + +uint8_t TCA8418Keyboard::flush() +{ + // Flush key events + uint8_t count = 0; + while (readRegister(_TCA8418_REG_KEY_EVENT_A) != 0) + count++; + // Flush gpio events + readRegister(_TCA8418_REG_GPIO_INT_STAT_1); + readRegister(_TCA8418_REG_GPIO_INT_STAT_2); + readRegister(_TCA8418_REG_GPIO_INT_STAT_3); + // Clear INT_STAT register + writeRegister(_TCA8418_REG_INT_STAT, 3); + return count; +} + +uint8_t TCA8418Keyboard::digitalRead(uint8_t pinnum) const +{ + if (pinnum > _TCA8418_COL9) + return 0xFF; + + uint8_t reg = _TCA8418_REG_GPIO_DAT_STAT_1 + pinnum / 8; + uint8_t mask = (1 << (pinnum % 8)); + + // Level 0 = low other = high + uint8_t value = readRegister(reg); + if (value & mask) + return HIGH; + return LOW; +} + +bool TCA8418Keyboard::digitalWrite(uint8_t pinnum, uint8_t level) +{ + if (pinnum > _TCA8418_COL9) + return false; + + uint8_t reg = _TCA8418_REG_GPIO_DAT_OUT_1 + pinnum / 8; + uint8_t mask = (1 << (pinnum % 8)); + + // Level 0 = low other = high + uint8_t value = readRegister(reg); + if (level == LOW) + value &= ~mask; + else + value |= mask; + writeRegister(reg, value); + return true; +} + +bool TCA8418Keyboard::pinMode(uint8_t pinnum, uint8_t mode) +{ + if (pinnum > _TCA8418_COL9) + return false; + + uint8_t idx = pinnum / 8; + uint8_t reg = _TCA8418_REG_GPIO_DIR_1 + idx; + uint8_t mask = (1 << (pinnum % 8)); + + // Mode 0 = input 1 = output + uint8_t value = readRegister(reg); + if (mode == OUTPUT) + value |= mask; + else + value &= ~mask; + writeRegister(reg, value); + + // Pullup 0 = enabled 1 = disabled + reg = _TCA8418_REG_GPIO_PULL_1 + idx; + value = readRegister(reg); + if (mode == INPUT_PULLUP) + value &= ~mask; + else + value |= mask; + writeRegister(reg, value); + + return true; +} + +bool TCA8418Keyboard::pinIRQMode(uint8_t pinnum, uint8_t mode) +{ + if (pinnum > _TCA8418_COL9) + return false; + if ((mode != RISING) && (mode != FALLING)) + return false; + + // Mode 0 = falling 1 = rising + uint8_t idx = pinnum / 8; + uint8_t reg = _TCA8418_REG_GPIO_INT_LVL_1 + idx; + uint8_t mask = (1 << (pinnum % 8)); + + uint8_t value = readRegister(reg); + if (mode == RISING) + value |= mask; + else + value &= ~mask; + writeRegister(reg, value); + + // Enable interrupt + reg = _TCA8418_REG_GPIO_INT_EN_1 + idx; + value = readRegister(reg); + value |= mask; + writeRegister(reg, value); + + return true; +} + +void TCA8418Keyboard::enableInterrupts() +{ + uint8_t value = readRegister(_TCA8418_REG_CFG); + value |= (_TCA8418_REG_CFG_GPI_IEN | _TCA8418_REG_CFG_KE_IEN); + writeRegister(_TCA8418_REG_CFG, value); +}; + +void TCA8418Keyboard::disableInterrupts() +{ + uint8_t value = readRegister(_TCA8418_REG_CFG); + value &= ~(_TCA8418_REG_CFG_GPI_IEN | _TCA8418_REG_CFG_KE_IEN); + writeRegister(_TCA8418_REG_CFG, value); +}; + +void TCA8418Keyboard::enableMatrixOverflow() +{ + uint8_t value = readRegister(_TCA8418_REG_CFG); + value |= _TCA8418_REG_CFG_OVR_FLOW_M; + writeRegister(_TCA8418_REG_CFG, value); +}; + +void TCA8418Keyboard::disableMatrixOverflow() +{ + uint8_t value = readRegister(_TCA8418_REG_CFG); + value &= ~_TCA8418_REG_CFG_OVR_FLOW_M; + writeRegister(_TCA8418_REG_CFG, value); +}; + +void TCA8418Keyboard::enableDebounce() +{ + writeRegister(_TCA8418_REG_DEBOUNCE_DIS_1, 0x00); + writeRegister(_TCA8418_REG_DEBOUNCE_DIS_2, 0x00); + writeRegister(_TCA8418_REG_DEBOUNCE_DIS_3, 0x00); +} + +void TCA8418Keyboard::disableDebounce() +{ + writeRegister(_TCA8418_REG_DEBOUNCE_DIS_1, 0xFF); + writeRegister(_TCA8418_REG_DEBOUNCE_DIS_2, 0xFF); + writeRegister(_TCA8418_REG_DEBOUNCE_DIS_3, 0xFF); +} + +void TCA8418Keyboard::setBacklight(bool on) +{ + if (on) { + digitalWrite(_TCA8418_COL9, HIGH); + } else { + digitalWrite(_TCA8418_COL9, LOW); + } +} + +uint8_t TCA8418Keyboard::readRegister(uint8_t reg) const +{ + if (m_wire) { + m_wire->beginTransmission(m_addr); + m_wire->write(reg); + m_wire->endTransmission(); + + m_wire->requestFrom(m_addr, (uint8_t)1); + if (m_wire->available() < 1) + return 0; + + return m_wire->read(); + } + if (readCallback) { + uint8_t data; + readCallback(m_addr, reg, &data, 1); + return data; + } + return 0; +} + +void TCA8418Keyboard::writeRegister(uint8_t reg, uint8_t value) +{ + uint8_t data[2]; + data[0] = reg; + data[1] = value; + + if (m_wire) { + m_wire->beginTransmission(m_addr); + m_wire->write(data, sizeof(uint8_t) * 2); + m_wire->endTransmission(); + } + if (writeCallback) { + writeCallback(m_addr, data[0], &(data[1]), 1); + } +} \ No newline at end of file diff --git a/src/input/TCA8418Keyboard.h b/src/input/TCA8418Keyboard.h new file mode 100644 index 000000000..c7f3c1f28 --- /dev/null +++ b/src/input/TCA8418Keyboard.h @@ -0,0 +1,83 @@ +// Based on the MPR121 Keyboard and Adafruit TCA8418 library +#include "configuration.h" +#include + +#define _TCA8418_NONE 0x00 +#define _TCA8418_REBOOT 0x90 +#define _TCA8418_LEFT 0xb4 +#define _TCA8418_UP 0xb5 +#define _TCA8418_DOWN 0xb6 +#define _TCA8418_RIGHT 0xb7 +#define _TCA8418_ESC 0x1b +#define _TCA8418_BSP 0x08 +#define _TCA8418_SELECT 0x0d + +class TCA8418Keyboard +{ + public: + typedef uint8_t (*i2c_com_fptr_t)(uint8_t dev_addr, uint8_t reg_addr, uint8_t *data, uint8_t len); + + enum KeyState { Init = 0, Idle, Held, Busy }; + + KeyState state; + int8_t last_key; + int8_t next_key; + bool should_backspace; + uint32_t last_tap; + uint8_t char_idx; + int32_t tap_interval; + bool backlight_on; + + String queue; + + TCA8418Keyboard(); + + void begin(uint8_t addr = XPOWERS_AXP192_AXP2101_ADDRESS, TwoWire *wire = &Wire); + void begin(i2c_com_fptr_t r, i2c_com_fptr_t w, uint8_t addr = XPOWERS_AXP192_AXP2101_ADDRESS); + + void reset(void); + // Configure the size of the keypad. + // All other rows and columns are set as inputs. + bool matrix(uint8_t rows, uint8_t columns); + + // Flush all events in the FIFO buffer + GPIO events. + uint8_t flush(void); + + // Key events available in the internal FIFO buffer. + uint8_t keyCount(void) const; + + void trigger(void); + void pressed(uint8_t key); + void released(void); + bool hasEvent(void); + char dequeueEvent(void); + void queueEvent(char); + + uint8_t digitalRead(uint8_t pinnum) const; + bool digitalWrite(uint8_t pinnum, uint8_t level); + bool pinMode(uint8_t pinnum, uint8_t mode); + bool pinIRQMode(uint8_t pinnum, uint8_t mode); // MODE FALLING or RISING + + // enable / disable interrupts for matrix and GPI pins + void enableInterrupts(); + void disableInterrupts(); + + // ignore key events when FIFO buffer is full or not. + void enableMatrixOverflow(); + void disableMatrixOverflow(); + + // debounce keys. + void enableDebounce(); + void disableDebounce(); + + void setBacklight(bool on); + + uint8_t readRegister(uint8_t reg) const; + void writeRegister(uint8_t reg, uint8_t value); + + private: + TwoWire *m_wire; + uint8_t m_addr; + i2c_com_fptr_t readCallback; + i2c_com_fptr_t writeCallback; +}; diff --git a/src/input/cardKbI2cImpl.cpp b/src/input/cardKbI2cImpl.cpp index eb9b07d6e..21ecf381a 100644 --- a/src/input/cardKbI2cImpl.cpp +++ b/src/input/cardKbI2cImpl.cpp @@ -12,8 +12,8 @@ void CardKbI2cImpl::init() #if !MESHTASTIC_EXCLUDE_I2C && !defined(ARCH_PORTDUINO) && !defined(I2C_NO_RESCAN) if (cardkb_found.address == 0x00) { LOG_DEBUG("Rescan for I2C keyboard"); - uint8_t i2caddr_scan[] = {CARDKB_ADDR, TDECK_KB_ADDR, BBQ10_KB_ADDR, MPR121_KB_ADDR}; - uint8_t i2caddr_asize = 4; + uint8_t i2caddr_scan[] = {CARDKB_ADDR, TDECK_KB_ADDR, BBQ10_KB_ADDR, MPR121_KB_ADDR, XPOWERS_AXP192_AXP2101_ADDRESS}; + uint8_t i2caddr_asize = 5; auto i2cScanner = std::unique_ptr(new ScanI2CTwoWire()); #if WIRE_INTERFACES_COUNT == 2 @@ -43,6 +43,10 @@ void CardKbI2cImpl::init() // assign an arbitrary value to distinguish from other models kb_model = 0x37; break; + case ScanI2C::DeviceType::TCA8418KB: + // assign an arbitrary value to distinguish from other models + kb_model = 0x84; + break; default: // use this as default since it's also just zero LOG_WARN("kb_info.type is unknown(0x%02x), setting kb_model=0x00", kb_info.type); diff --git a/src/input/kbI2cBase.cpp b/src/input/kbI2cBase.cpp index 9b1a27745..70e9e4365 100644 --- a/src/input/kbI2cBase.cpp +++ b/src/input/kbI2cBase.cpp @@ -43,6 +43,9 @@ int32_t KbI2cBase::runOnce() if (cardkb_found.address == MPR121_KB_ADDR) { MPRkeyboard.begin(MPR121_KB_ADDR, &Wire1); } + if (cardkb_found.address == XPOWERS_AXP192_AXP2101_ADDRESS) { + TCAKeyboard.begin(XPOWERS_AXP192_AXP2101_ADDRESS, &Wire1); + } break; #endif case ScanI2C::WIRE: @@ -55,6 +58,9 @@ int32_t KbI2cBase::runOnce() if (cardkb_found.address == MPR121_KB_ADDR) { MPRkeyboard.begin(MPR121_KB_ADDR, &Wire); } + if (cardkb_found.address == XPOWERS_AXP192_AXP2101_ADDRESS) { + TCAKeyboard.begin(XPOWERS_AXP192_AXP2101_ADDRESS, &Wire); + } break; case ScanI2C::NO_I2C: default: @@ -226,6 +232,68 @@ int32_t KbI2cBase::runOnce() } break; } + case 0x84: { // Adafruit TCA8418 + TCAKeyboard.trigger(); + InputEvent e; + while (TCAKeyboard.hasEvent()) { + char nextEvent = TCAKeyboard.dequeueEvent(); + e.inputEvent = ANYKEY; + e.kbchar = 0x00; + e.source = this->_originName; + switch (nextEvent) { + case _TCA8418_NONE: + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE; + e.kbchar = 0x00; + break; + case _TCA8418_REBOOT: + e.inputEvent = ANYKEY; + e.kbchar = INPUT_BROKER_MSG_REBOOT; + break; + case _TCA8418_LEFT: + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT; + e.kbchar = 0x00; + break; + case _TCA8418_UP: + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP; + e.kbchar = 0x00; + break; + case _TCA8418_DOWN: + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_DOWN; + e.kbchar = 0x00; + break; + case _TCA8418_RIGHT: + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT; + e.kbchar = 0x00; + break; + case _TCA8418_BSP: + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_BACK; + e.kbchar = 0x08; + break; + case _TCA8418_SELECT: + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT; + e.kbchar = 0x0d; + break; + case _TCA8418_ESC: + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL; + e.kbchar = 0x1b; + break; + default: + if (nextEvent > 127) { + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE; + e.kbchar = 0x00; + break; + } + e.inputEvent = ANYKEY; + e.kbchar = nextEvent; + break; + } + if (e.inputEvent != meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE) { + LOG_DEBUG("TCA8418 Notifying: %i Char: %c", e.inputEvent, e.kbchar); + this->notifyObservers(&e); + } + } + break; + } case 0x02: { // RAK14004 uint8_t rDataBuf[8] = {0}; diff --git a/src/input/kbI2cBase.h b/src/input/kbI2cBase.h index dc2414fc0..8193433fe 100644 --- a/src/input/kbI2cBase.h +++ b/src/input/kbI2cBase.h @@ -3,6 +3,7 @@ #include "BBQ10Keyboard.h" #include "InputBroker.h" #include "MPR121Keyboard.h" +#include "TCA8418Keyboard.h" #include "Wire.h" #include "concurrency/OSThread.h" @@ -21,5 +22,6 @@ class KbI2cBase : public Observable, public concurrency::OST BBQ10Keyboard Q10keyboard; MPR121Keyboard MPRkeyboard; + TCA8418Keyboard TCAKeyboard; bool is_sym = false; }; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 4b098b3f3..fd65830ef 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -587,6 +587,10 @@ void setup() // assign an arbitrary value to distinguish from other models kb_model = 0x37; break; + case ScanI2C::DeviceType::TCA8418KB: + // assign an arbitrary value to distinguish from other models + kb_model = 0x84; + break; default: // use this as default since it's also just zero LOG_WARN("kb_info.type is unknown(0x%02x), setting kb_model=0x00", kb_info.type); From 4dfba503044d7d77bdd40f151aa95e6df80cb8bb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 3 Apr 2025 20:23:44 -0500 Subject: [PATCH 376/381] [create-pull-request] automated change (#6490) Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/mesh.pb.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/protobufs b/protobufs index 484d002a5..13a3e5dce 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 484d002a52bc20fa9f91ebf1b216d585c5f93a1b +Subproject commit 13a3e5dcee25a2d2d4f1fbaba4c091c66d698ca5 diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index defaaad28..191f9e121 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -237,6 +237,8 @@ typedef enum _meshtastic_HardwareModel { meshtastic_HardwareModel_T_ETH_ELITE = 91, /* Heltec HRI-3621 industrial probe */ meshtastic_HardwareModel_HELTEC_SENSOR_HUB = 92, + /* Reserved Fried Chicken ID for future use */ + meshtastic_HardwareModel_RESERVED_FRIED_CHICKEN = 93, /* ------------------------------------------------------------------------------------------------------------------------------------------ Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. ------------------------------------------------------------------------------------------------------------------------------------------ */ From 01102754945ac2bc8d52062fcb2b4a446ea35b35 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 4 Apr 2025 04:59:31 -0500 Subject: [PATCH 377/381] Revert "Try-fix ESP32 wifi disconnects (#6363)" (#6493) This reverts commit a902776e578bc2574c95eff8c13402e8cb5f5fbd. --- src/mesh/wifi/WiFiAPClient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index e050c2057..4d0b74f7c 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -163,7 +163,7 @@ static int32_t reconnectWiFi() delay(5000); if (!WiFi.isConnected()) { -#ifdef ARCH_ESP32 +#ifdef CONFIG_IDF_TARGET_ESP32C3 WiFi.mode(WIFI_MODE_NULL); WiFi.useStaticBuffers(true); WiFi.mode(WIFI_STA); From 25237a15ff68d482c16369b4b802a2931b733ab2 Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Fri, 4 Apr 2025 23:53:54 +1300 Subject: [PATCH 378/381] feat: menu entry to send adhoc-ping (#6492) --- .../InkHUD/Applets/System/Menu/MenuAction.h | 3 +-- .../InkHUD/Applets/System/Menu/MenuApplet.cpp | 21 ++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h index 4f8205647..f162aa385 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h @@ -18,8 +18,7 @@ namespace NicheGraphics::InkHUD enum MenuAction { NO_ACTION, - SEND_NODEINFO, - SEND_POSITION, + SEND_PING, SHUTDOWN, NEXT_TILE, TOGGLE_BACKLIGHT, diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp index f59579230..5ca9692c8 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp @@ -4,6 +4,7 @@ #include "RTC.h" +#include "MeshService.h" #include "airtime.h" #include "main.h" #include "power.h" @@ -144,6 +145,14 @@ void InkHUD::MenuApplet::execute(MenuItem item) inkhud->nextTile(); break; + case SEND_PING: + service->refreshLocalMeshNode(); + service->trySendPosition(NODENUM_BROADCAST, true); + + // Force the next refresh to use FULL, to protect the display, as some users will probably spam this button + inkhud->forceUpdate(Drivers::EInk::UpdateTypes::FULL); + break; + case ROTATE: inkhud->rotate(); break; @@ -242,7 +251,7 @@ void InkHUD::MenuApplet::showPage(MenuPage page) if (settings->optionalMenuItems.nextTile && settings->userTiles.count > 1) items.push_back(MenuItem("Next Tile", MenuAction::NEXT_TILE, MenuPage::ROOT)); // Only if multiple applets shown - // items.push_back(MenuItem("Send", MenuPage::SEND)); // TODO + items.push_back(MenuItem("Send", MenuPage::SEND)); items.push_back(MenuItem("Options", MenuPage::OPTIONS)); // items.push_back(MenuItem("Display Off", MenuPage::EXIT)); // TODO items.push_back(MenuItem("Save & Shut Down", MenuAction::SHUTDOWN)); @@ -250,9 +259,8 @@ void InkHUD::MenuApplet::showPage(MenuPage page) break; case SEND: - items.push_back(MenuItem("Send Message", MenuPage::EXIT)); - items.push_back(MenuItem("Send NodeInfo", MenuAction::SEND_NODEINFO)); - items.push_back(MenuItem("Send Position", MenuAction::SEND_POSITION)); + items.push_back(MenuItem("Ping", MenuAction::SEND_PING, MenuPage::EXIT)); + // Todo: canned messages items.push_back(MenuItem("Exit", MenuPage::EXIT)); break; @@ -389,11 +397,14 @@ void InkHUD::MenuApplet::onRender() // Center-line for the text int16_t center = itemT + (itemH / 2); + // Box, if currently selected if (cursorShown && i == cursor) drawRect(itemL, itemT, itemW, itemH, BLACK); + + // Item's text printAt(itemL + X(padding), center, item.label, LEFT, MIDDLE); - // Testing only: circle instead of check box + // Checkbox, if relevant if (item.checkState) { const uint16_t cbWH = fontSmall.lineHeight(); // Checkbox: width / height const int16_t cbL = itemR - X(padding) - cbWH; // Checkbox: left From 1b33189fe62d57b067b98facd84656531903457b Mon Sep 17 00:00:00 2001 From: Nasimovy Date: Fri, 4 Apr 2025 13:35:15 +0000 Subject: [PATCH 379/381] remove duplicate HAS_LP5562 introduced by #6422 (#6494) --- src/detect/ScanI2CTwoWire.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index 230271b94..9781cbf56 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -227,9 +227,6 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) type = PMU_AXP192_AXP2101; } break; -#ifdef HAS_LP5562 - SCAN_SIMPLE_CASE(LP5562_ADDR, LP5562, "LP5562", (uint8_t)addr.address); -#endif case BME_ADDR: case BME_ADDR_ALTERNATE: registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0xD0), 1); // GET_ID From 56eb0c08b288b5b549399a5f441f07c51bc8d459 Mon Sep 17 00:00:00 2001 From: Chris LaFlash Date: Sat, 5 Apr 2025 20:49:01 -0700 Subject: [PATCH 380/381] Add support for Quectel-L96, a MT3333 module (#6498) --- src/gps/GPS.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 41a2ff980..a2e7ebbc7 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -1206,7 +1206,8 @@ GnssModel_t GPS::probe(int serialSpeed) delay(20); std::vector mtk = {{"L76B", "Quectel-L76B", GNSS_MODEL_MTK_L76B}, {"PA1616S", "1616S", GNSS_MODEL_MTK_PA1616S}, - {"LS20031", "MC-1513", GNSS_MODEL_MTK_L76B}}; + {"LS20031", "MC-1513", GNSS_MODEL_MTK_L76B}, + {"L96", "Quectel-L96", GNSS_MODEL_MTK_L76B}}; PROBE_FAMILY("MTK Family", "$PMTK605*31", mtk, 500); uint8_t cfg_rate[] = {0xB5, 0x62, 0x06, 0x08, 0x00, 0x00, 0x00, 0x00}; From 2125c039745aa06248b2e76819303a9c99c4de63 Mon Sep 17 00:00:00 2001 From: Nasimovy Date: Mon, 7 Apr 2025 01:27:46 +0000 Subject: [PATCH 381/381] Fix for PSRAM detection on ESP32-S3R8 and t-beam (#6504) * remove duplicate HAS_LP5562 introduced by #6422 * T190 PSRAM fix * all the boards with a ESP32-S3R8 * T-beam V1.1 PSRAM --- boards/heltec_vision_master_e213.json | 4 +++- boards/heltec_vision_master_e290.json | 4 +++- boards/heltec_vision_master_t190.json | 4 +++- boards/seeed-sensecap-indicator.json | 1 + boards/seeed-xiao-s3.json | 1 + boards/t-watch-s3.json | 1 + variants/tbeam/platformio.ini | 2 ++ 7 files changed, 14 insertions(+), 3 deletions(-) diff --git a/boards/heltec_vision_master_e213.json b/boards/heltec_vision_master_e213.json index bf5fe15ad..152515cf3 100644 --- a/boards/heltec_vision_master_e213.json +++ b/boards/heltec_vision_master_e213.json @@ -2,7 +2,8 @@ "build": { "arduino": { "ldscript": "esp32s3_out.ld", - "partitions": "default_8MB.csv" + "partitions": "default_8MB.csv", + "memory_type": "qio_opi" }, "core": "esp32", "extra_flags": [ @@ -15,6 +16,7 @@ "f_cpu": "240000000L", "f_flash": "80000000L", "flash_mode": "qio", + "psram_type": "opi", "hwids": [ ["0x303A", "0x1001"], ["0x303A", "0x0002"] diff --git a/boards/heltec_vision_master_e290.json b/boards/heltec_vision_master_e290.json index 70f7d5f02..b7cbac878 100644 --- a/boards/heltec_vision_master_e290.json +++ b/boards/heltec_vision_master_e290.json @@ -2,7 +2,8 @@ "build": { "arduino": { "ldscript": "esp32s3_out.ld", - "partitions": "default_8MB.csv" + "partitions": "default_8MB.csv", + "memory_type": "qio_opi" }, "core": "esp32", "extra_flags": [ @@ -15,6 +16,7 @@ "f_cpu": "240000000L", "f_flash": "80000000L", "flash_mode": "qio", + "psram_type": "opi", "hwids": [ ["0x303A", "0x1001"], ["0x303A", "0x0002"] diff --git a/boards/heltec_vision_master_t190.json b/boards/heltec_vision_master_t190.json index 341e70218..440f76ad0 100644 --- a/boards/heltec_vision_master_t190.json +++ b/boards/heltec_vision_master_t190.json @@ -2,7 +2,8 @@ "build": { "arduino": { "ldscript": "esp32s3_out.ld", - "partitions": "default_8MB.csv" + "partitions": "default_8MB.csv", + "memory_type": "qio_opi" }, "core": "esp32", "extra_flags": [ @@ -15,6 +16,7 @@ "f_cpu": "240000000L", "f_flash": "80000000L", "flash_mode": "qio", + "psram_type": "opi", "hwids": [ ["0x303A", "0x1001"], ["0x303A", "0x0002"] diff --git a/boards/seeed-sensecap-indicator.json b/boards/seeed-sensecap-indicator.json index 0a02fc882..03bff35b5 100644 --- a/boards/seeed-sensecap-indicator.json +++ b/boards/seeed-sensecap-indicator.json @@ -18,6 +18,7 @@ "f_boot": "120000000L", "boot": "qio", "flash_mode": "qio", + "psram_type": "opi", "hwids": [["0x1A86", "0x7523"]], "mcu": "esp32s3", "variant": "esp32s3" diff --git a/boards/seeed-xiao-s3.json b/boards/seeed-xiao-s3.json index 0b7b432a0..6981085dd 100644 --- a/boards/seeed-xiao-s3.json +++ b/boards/seeed-xiao-s3.json @@ -15,6 +15,7 @@ "f_cpu": "240000000L", "f_flash": "80000000L", "flash_mode": "qio", + "psram_type": "opi", "hwids": [["0x2886", "0x0059"]], "mcu": "esp32s3", "variant": "seeed-xiao-s3" diff --git a/boards/t-watch-s3.json b/boards/t-watch-s3.json index 5d4afd322..51bb7cf4b 100644 --- a/boards/t-watch-s3.json +++ b/boards/t-watch-s3.json @@ -16,6 +16,7 @@ "f_cpu": "240000000L", "f_flash": "80000000L", "flash_mode": "qio", + "psram_type": "opi", "hwids": [ ["0x303A", "0x1001"], ["0x303A", "0x0002"] diff --git a/variants/tbeam/platformio.ini b/variants/tbeam/platformio.ini index 85e66c2dd..9049836a3 100644 --- a/variants/tbeam/platformio.ini +++ b/variants/tbeam/platformio.ini @@ -8,4 +8,6 @@ lib_deps = build_flags = ${esp32_base.build_flags} -D TBEAM_V10 -I variants/tbeam -DGPS_POWER_TOGGLE ; comment this line to disable double press function on the user button to turn off gps entirely. + -DBOARD_HAS_PSRAM + -mfix-esp32-psram-cache-issue upload_speed = 921600 \ No newline at end of file