diff --git a/protobufs b/protobufs index 61d7ca656..b41970669 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 61d7ca65652dfe832ead74719700d3d33d6bae7c +Subproject commit b419706693e0120f7b032d0be0121ae758cfd6e4 diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 6100f6ef1..43b9dffcb 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -163,8 +163,8 @@ static void drawIconScreen(const char *upperMsg, OLEDDisplay *display, OLEDDispl display->setFont(FONT_MEDIUM); display->setTextAlignment(TEXT_ALIGN_LEFT); -#ifdef SPLASH_TITLE_USERPREFS - const char *title = SPLASH_TITLE_USERPREFS; +#ifdef USERPREFS_SPLASH_TITLE + const char *title = USERPREFS_SPLASH_TITLE; #else const char *title = "meshtastic.org"; #endif diff --git a/src/graphics/img/icon.xbm b/src/graphics/img/icon.xbm index f90cf4946..4e78ae8a1 100644 --- a/src/graphics/img/icon.xbm +++ b/src/graphics/img/icon.xbm @@ -1,4 +1,4 @@ -#ifndef HAS_USERPREFS_SPLASH +#ifndef USERPREFS_HAS_SPLASH #define icon_width 50 #define icon_height 28 static uint8_t icon_bits[] = { diff --git a/src/mesh/Channels.cpp b/src/mesh/Channels.cpp index 47c013443..c8ac09a37 100644 --- a/src/mesh/Channels.cpp +++ b/src/mesh/Channels.cpp @@ -99,26 +99,26 @@ void Channels::initDefaultChannel(ChannelIndex chIndex) ch.has_settings = true; ch.role = meshtastic_Channel_Role_PRIMARY; -#ifdef LORACONFIG_MODEM_PRESET_USERPREFS - loraConfig.modem_preset = LORACONFIG_MODEM_PRESET_USERPREFS; +#ifdef USERPREFS_LORACONFIG_MODEM_PRESET + loraConfig.modem_preset = USERPREFS_LORACONFIG_MODEM_PRESET; #endif -#ifdef LORACONFIG_CHANNEL_NUM_USERPREFS - loraConfig.channel_num = LORACONFIG_CHANNEL_NUM_USERPREFS; +#ifdef USERPREFS_LORACONFIG_CHANNEL_NUM + loraConfig.channel_num = USERPREFS_LORACONFIG_CHANNEL_NUM; #endif // Install custom defaults. Will eventually support setting multiple default channels if (chIndex == 0) { -#ifdef CHANNEL_0_PSK_USERPREFS - static const uint8_t defaultpsk[] = CHANNEL_0_PSK_USERPREFS; +#ifdef USERPREFS_CHANNEL_0_PSK + static const uint8_t defaultpsk[] = USERPREFS_CHANNEL_0_PSK; memcpy(channelSettings.psk.bytes, defaultpsk, sizeof(defaultpsk)); channelSettings.psk.size = sizeof(defaultpsk); #endif -#ifdef CHANNEL_0_NAME_USERPREFS - strcpy(channelSettings.name, CHANNEL_0_NAME_USERPREFS); +#ifdef USERPREFS_CHANNEL_0_NAME + strcpy(channelSettings.name, USERPREFS_CHANNEL_0_NAME); #endif -#ifdef CHANNEL_0_PRECISION_USERPREFS - channelSettings.module_settings.position_precision = CHANNEL_0_PRECISION_USERPREFS; +#ifdef USERPREFS_CHANNEL_0_PRECISION + channelSettings.module_settings.position_precision = USERPREFS_CHANNEL_0_PRECISION; #endif } } @@ -273,7 +273,7 @@ void Channels::setChannel(const meshtastic_Channel &c) bool Channels::anyMqttEnabled() { -#if EVENT_MODE +#if USERPREFS_EVENT_MODE // Don't publish messages on the public MQTT broker if we are in event mode if (strcmp(moduleConfig.mqtt.address, default_mqtt_address) == 0) { return false; diff --git a/src/mesh/Default.cpp b/src/mesh/Default.cpp index ac7441394..0bedcfc91 100644 --- a/src/mesh/Default.cpp +++ b/src/mesh/Default.cpp @@ -45,7 +45,7 @@ uint32_t Default::getConfiguredOrDefaultMsScaled(uint32_t configured, uint32_t d uint8_t Default::getConfiguredOrDefaultHopLimit(uint8_t configured) { -#if EVENT_MODE +#if USERPREFS_EVENT_MODE return (configured > HOP_RELIABLE) ? HOP_RELIABLE : config.lora.hop_limit; #else return (configured >= HOP_MAX) ? HOP_MAX : config.lora.hop_limit; diff --git a/src/mesh/FloodingRouter.cpp b/src/mesh/FloodingRouter.cpp index e2dbd8997..037fdd2ae 100644 --- a/src/mesh/FloodingRouter.cpp +++ b/src/mesh/FloodingRouter.cpp @@ -47,7 +47,7 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas meshtastic_MeshPacket *tosend = packetPool.allocCopy(*p); // keep a copy because we will be sending it tosend->hop_limit--; // bump down the hop count -#if EVENT_MODE +#if USERPREFS_EVENT_MODE if (tosend->hop_limit > 2) { // if we are "correcting" the hop_limit, "correct" the hop_start by the same amount to preserve hops away. tosend->hop_start -= (tosend->hop_limit - 2); diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 12109bf66..dc111e792 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -293,24 +293,24 @@ void NodeDB::installDefaultConfig(bool preserveKey = false) true; // FIXME: maybe false in the future, and setting region to enable it. (unset region forces it off) config.lora.override_duty_cycle = false; config.lora.config_ok_to_mqtt = false; -#ifdef CONFIG_LORA_REGION_USERPREFS - config.lora.region = CONFIG_LORA_REGION_USERPREFS; +#ifdef USERPREFS_CONFIG_LORA_REGION + config.lora.region = USERPREFS_CONFIG_LORA_REGION; #else config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_UNSET; #endif -#ifdef LORACONFIG_MODEM_PRESET_USERPREFS - config.lora.modem_preset = LORACONFIG_MODEM_PRESET_USERPREFS; +#ifdef USERPREFS_LORACONFIG_MODEM_PRESET + config.lora.modem_preset = USERPREFS_LORACONFIG_MODEM_PRESET; #else config.lora.modem_preset = meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST; #endif config.lora.hop_limit = HOP_RELIABLE; -#ifdef CONFIG_LORA_IGNORE_MQTT_USERPREFS - config.lora.ignore_mqtt = CONFIG_LORA_IGNORE_MQTT_USERPREFS; +#ifdef USERPREFS_CONFIG_LORA_IGNORE_MQTT + config.lora.ignore_mqtt = USERPREFS_CONFIG_LORA_IGNORE_MQTT; #else config.lora.ignore_mqtt = false; #endif -#ifdef ADMIN_KEY_USERPREFS - memcpy(config.security.admin_key[0].bytes, admin_key_userprefs, 32); +#ifdef USERPREFS_USE_ADMIN_KEY + memcpy(config.security.admin_key[0].bytes, USERPREFS_ADMIN_KEY, 32); config.security.admin_key[0].size = 32; #else config.security.admin_key[0].size = 0; @@ -624,13 +624,13 @@ void NodeDB::installDefaultDeviceState() // Set default owner name pickNewNodeNum(); // based on macaddr now -#ifdef CONFIG_OWNER_LONG_NAME_USERPREFS - snprintf(owner.long_name, sizeof(owner.long_name), CONFIG_OWNER_LONG_NAME_USERPREFS); +#ifdef USERPREFS_CONFIG_OWNER_LONG_NAME + snprintf(owner.long_name, sizeof(owner.long_name), USERPREFS_CONFIG_OWNER_LONG_NAME); #else snprintf(owner.long_name, sizeof(owner.long_name), "Meshtastic %02x%02x", ourMacAddr[4], ourMacAddr[5]); #endif -#ifdef CONFIG_OWNER_SHORT_NAME_USERPREFS - snprintf(owner.short_name, sizeof(owner.short_name), CONFIG_OWNER_SHORT_NAME_USERPREFS); +#ifdef USERPREFS_CONFIG_OWNER_SHORT_NAME + snprintf(owner.short_name, sizeof(owner.short_name), USERPREFS_CONFIG_OWNER_SHORT_NAME); #else snprintf(owner.short_name, sizeof(owner.short_name), "%02x%02x", ourMacAddr[4], ourMacAddr[5]); #endif diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index 610d5303e..6ff4364d1 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -590,7 +590,7 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src) skipHandle = true; } -#if EVENT_MODE +#if USERPREFS_EVENT_MODE if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag && (p->decoded.portnum == meshtastic_PortNum_ATAK_FORWARDER || p->decoded.portnum == meshtastic_PortNum_ATAK_PLUGIN || p->decoded.portnum == meshtastic_PortNum_PAXCOUNTER_APP || p->decoded.portnum == meshtastic_PortNum_IP_TUNNEL_APP || diff --git a/src/mesh/generated/meshtastic/deviceonly.pb.h b/src/mesh/generated/meshtastic/deviceonly.pb.h index a905c4526..0fc09daca 100644 --- a/src/mesh/generated/meshtastic/deviceonly.pb.h +++ b/src/mesh/generated/meshtastic/deviceonly.pb.h @@ -359,7 +359,7 @@ extern const pb_msgdesc_t meshtastic_OEMStore_msg; #define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_OEMStore_size #define meshtastic_ChannelFile_size 718 #define meshtastic_NodeInfoLite_size 183 -#define meshtastic_OEMStore_size 3568 +#define meshtastic_OEMStore_size 3576 #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 19600856f..bac67942c 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 735 -#define meshtastic_LocalModuleConfig_size 687 +#define meshtastic_LocalModuleConfig_size 695 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/module_config.pb.h b/src/mesh/generated/meshtastic/module_config.pb.h index d4b82c93b..ce8b8891a 100644 --- a/src/mesh/generated/meshtastic/module_config.pb.h +++ b/src/mesh/generated/meshtastic/module_config.pb.h @@ -336,6 +336,12 @@ typedef struct _meshtastic_ModuleConfig_TelemetryConfig { /* Interval in seconds of how often we should try to send our air quality metrics to the mesh */ bool power_screen_enabled; + /* Preferences for the (Health) Telemetry Module + Enable/Disable the telemetry measurement module measurement collection */ + bool health_measurement_enabled; + /* Interval in seconds of how often we should try to send our + health metrics to the mesh */ + uint32_t health_update_interval; } meshtastic_ModuleConfig_TelemetryConfig; /* TODO: REPLACE */ @@ -503,7 +509,7 @@ extern "C" { #define meshtastic_ModuleConfig_ExternalNotificationConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_ModuleConfig_StoreForwardConfig_init_default {0, 0, 0, 0, 0, 0} #define meshtastic_ModuleConfig_RangeTestConfig_init_default {0, 0, 0} -#define meshtastic_ModuleConfig_TelemetryConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_ModuleConfig_TelemetryConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_ModuleConfig_CannedMessageConfig_init_default {0, 0, 0, 0, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0} #define meshtastic_ModuleConfig_AmbientLightingConfig_init_default {0, 0, 0, 0, 0} #define meshtastic_RemoteHardwarePin_init_default {0, "", _meshtastic_RemoteHardwarePinType_MIN} @@ -519,7 +525,7 @@ extern "C" { #define meshtastic_ModuleConfig_ExternalNotificationConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_ModuleConfig_StoreForwardConfig_init_zero {0, 0, 0, 0, 0, 0} #define meshtastic_ModuleConfig_RangeTestConfig_init_zero {0, 0, 0} -#define meshtastic_ModuleConfig_TelemetryConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_ModuleConfig_TelemetryConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} #define meshtastic_ModuleConfig_CannedMessageConfig_init_zero {0, 0, 0, 0, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0} #define meshtastic_ModuleConfig_AmbientLightingConfig_init_zero {0, 0, 0, 0, 0} #define meshtastic_RemoteHardwarePin_init_zero {0, "", _meshtastic_RemoteHardwarePinType_MIN} @@ -601,6 +607,8 @@ extern "C" { #define meshtastic_ModuleConfig_TelemetryConfig_power_measurement_enabled_tag 8 #define meshtastic_ModuleConfig_TelemetryConfig_power_update_interval_tag 9 #define meshtastic_ModuleConfig_TelemetryConfig_power_screen_enabled_tag 10 +#define meshtastic_ModuleConfig_TelemetryConfig_health_measurement_enabled_tag 11 +#define meshtastic_ModuleConfig_TelemetryConfig_health_update_interval_tag 12 #define meshtastic_ModuleConfig_CannedMessageConfig_rotary1_enabled_tag 1 #define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_pin_a_tag 2 #define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_pin_b_tag 3 @@ -793,7 +801,9 @@ X(a, STATIC, SINGULAR, BOOL, air_quality_enabled, 6) \ X(a, STATIC, SINGULAR, UINT32, air_quality_interval, 7) \ X(a, STATIC, SINGULAR, BOOL, power_measurement_enabled, 8) \ X(a, STATIC, SINGULAR, UINT32, power_update_interval, 9) \ -X(a, STATIC, SINGULAR, BOOL, power_screen_enabled, 10) +X(a, STATIC, SINGULAR, BOOL, power_screen_enabled, 10) \ +X(a, STATIC, SINGULAR, BOOL, health_measurement_enabled, 11) \ +X(a, STATIC, SINGULAR, UINT32, health_update_interval, 12) #define meshtastic_ModuleConfig_TelemetryConfig_CALLBACK NULL #define meshtastic_ModuleConfig_TelemetryConfig_DEFAULT NULL @@ -878,7 +888,7 @@ extern const pb_msgdesc_t meshtastic_RemoteHardwarePin_msg; #define meshtastic_ModuleConfig_RemoteHardwareConfig_size 96 #define meshtastic_ModuleConfig_SerialConfig_size 28 #define meshtastic_ModuleConfig_StoreForwardConfig_size 24 -#define meshtastic_ModuleConfig_TelemetryConfig_size 36 +#define meshtastic_ModuleConfig_TelemetryConfig_size 44 #define meshtastic_ModuleConfig_size 257 #define meshtastic_RemoteHardwarePin_size 21 diff --git a/src/mesh/generated/meshtastic/telemetry.pb.cpp b/src/mesh/generated/meshtastic/telemetry.pb.cpp index 90859c98e..b9c1da7a0 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.cpp +++ b/src/mesh/generated/meshtastic/telemetry.pb.cpp @@ -21,6 +21,9 @@ PB_BIND(meshtastic_AirQualityMetrics, meshtastic_AirQualityMetrics, AUTO) PB_BIND(meshtastic_LocalStats, meshtastic_LocalStats, AUTO) +PB_BIND(meshtastic_HealthMetrics, meshtastic_HealthMetrics, AUTO) + + PB_BIND(meshtastic_Telemetry, meshtastic_Telemetry, AUTO) diff --git a/src/mesh/generated/meshtastic/telemetry.pb.h b/src/mesh/generated/meshtastic/telemetry.pb.h index cedc2867e..61897fc5c 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.h +++ b/src/mesh/generated/meshtastic/telemetry.pb.h @@ -71,7 +71,9 @@ typedef enum _meshtastic_TelemetrySensorType { /* MAX17048 1S lipo battery sensor (voltage, state of charge, time to go) */ meshtastic_TelemetrySensorType_MAX17048 = 28, /* Custom I2C sensor implementation based on https://github.com/meshtastic/i2c-sensor */ - meshtastic_TelemetrySensorType_CUSTOM_SENSOR = 29 + meshtastic_TelemetrySensorType_CUSTOM_SENSOR = 29, + /* MAX30102 Pulse Oximeter and Heart-Rate Sensor */ + meshtastic_TelemetrySensorType_MAX30102 = 30 } meshtastic_TelemetrySensorType; /* Struct definitions */ @@ -233,6 +235,19 @@ typedef struct _meshtastic_LocalStats { uint16_t num_total_nodes; } meshtastic_LocalStats; +/* Health telemetry metrics */ +typedef struct _meshtastic_HealthMetrics { + /* Heart rate (beats per minute) */ + bool has_heart_bpm; + uint8_t heart_bpm; + /* SpO2 (blood oxygen saturation) level */ + bool has_spO2; + uint8_t spO2; + /* Body temperature in degrees Celsius */ + bool has_temperature; + float temperature; +} meshtastic_HealthMetrics; + /* Types of Measurements the telemetry module is equipped to handle */ typedef struct _meshtastic_Telemetry { /* Seconds since 1970 - or 0 for unknown/unset */ @@ -249,6 +264,8 @@ typedef struct _meshtastic_Telemetry { meshtastic_PowerMetrics power_metrics; /* Local device mesh statistics */ meshtastic_LocalStats local_stats; + /* Health telemetry metrics */ + meshtastic_HealthMetrics health_metrics; } variant; } meshtastic_Telemetry; @@ -267,8 +284,9 @@ extern "C" { /* Helper constants for enums */ #define _meshtastic_TelemetrySensorType_MIN meshtastic_TelemetrySensorType_SENSOR_UNSET -#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_CUSTOM_SENSOR -#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_CUSTOM_SENSOR+1)) +#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_MAX30102 +#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_MAX30102+1)) + @@ -284,6 +302,7 @@ extern "C" { #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} #define meshtastic_LocalStats_init_default {0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_HealthMetrics_init_default {false, 0, false, 0, false, 0} #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} @@ -291,6 +310,7 @@ extern "C" { #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} #define meshtastic_LocalStats_init_zero {0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_HealthMetrics_init_zero {false, 0, false, 0, false, 0} #define meshtastic_Telemetry_init_zero {0, 0, {meshtastic_DeviceMetrics_init_zero}} #define meshtastic_Nau7802Config_init_zero {0, 0} @@ -343,12 +363,16 @@ extern "C" { #define meshtastic_LocalStats_num_packets_rx_bad_tag 6 #define meshtastic_LocalStats_num_online_nodes_tag 7 #define meshtastic_LocalStats_num_total_nodes_tag 8 +#define meshtastic_HealthMetrics_heart_bpm_tag 1 +#define meshtastic_HealthMetrics_spO2_tag 2 +#define meshtastic_HealthMetrics_temperature_tag 3 #define meshtastic_Telemetry_time_tag 1 #define meshtastic_Telemetry_device_metrics_tag 2 #define meshtastic_Telemetry_environment_metrics_tag 3 #define meshtastic_Telemetry_air_quality_metrics_tag 4 #define meshtastic_Telemetry_power_metrics_tag 5 #define meshtastic_Telemetry_local_stats_tag 6 +#define meshtastic_Telemetry_health_metrics_tag 7 #define meshtastic_Nau7802Config_zeroOffset_tag 1 #define meshtastic_Nau7802Config_calibrationFactor_tag 2 @@ -421,13 +445,21 @@ X(a, STATIC, SINGULAR, UINT32, num_total_nodes, 8) #define meshtastic_LocalStats_CALLBACK NULL #define meshtastic_LocalStats_DEFAULT NULL +#define meshtastic_HealthMetrics_FIELDLIST(X, a) \ +X(a, STATIC, OPTIONAL, UINT32, heart_bpm, 1) \ +X(a, STATIC, OPTIONAL, UINT32, spO2, 2) \ +X(a, STATIC, OPTIONAL, FLOAT, temperature, 3) +#define meshtastic_HealthMetrics_CALLBACK NULL +#define meshtastic_HealthMetrics_DEFAULT NULL + #define meshtastic_Telemetry_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, FIXED32, time, 1) \ X(a, STATIC, ONEOF, MESSAGE, (variant,device_metrics,variant.device_metrics), 2) \ X(a, STATIC, ONEOF, MESSAGE, (variant,environment_metrics,variant.environment_metrics), 3) \ X(a, STATIC, ONEOF, MESSAGE, (variant,air_quality_metrics,variant.air_quality_metrics), 4) \ X(a, STATIC, ONEOF, MESSAGE, (variant,power_metrics,variant.power_metrics), 5) \ -X(a, STATIC, ONEOF, MESSAGE, (variant,local_stats,variant.local_stats), 6) +X(a, STATIC, ONEOF, MESSAGE, (variant,local_stats,variant.local_stats), 6) \ +X(a, STATIC, ONEOF, MESSAGE, (variant,health_metrics,variant.health_metrics), 7) #define meshtastic_Telemetry_CALLBACK NULL #define meshtastic_Telemetry_DEFAULT NULL #define meshtastic_Telemetry_variant_device_metrics_MSGTYPE meshtastic_DeviceMetrics @@ -435,6 +467,7 @@ X(a, STATIC, ONEOF, MESSAGE, (variant,local_stats,variant.local_stats), #define meshtastic_Telemetry_variant_air_quality_metrics_MSGTYPE meshtastic_AirQualityMetrics #define meshtastic_Telemetry_variant_power_metrics_MSGTYPE meshtastic_PowerMetrics #define meshtastic_Telemetry_variant_local_stats_MSGTYPE meshtastic_LocalStats +#define meshtastic_Telemetry_variant_health_metrics_MSGTYPE meshtastic_HealthMetrics #define meshtastic_Nau7802Config_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, INT32, zeroOffset, 1) \ @@ -447,6 +480,7 @@ extern const pb_msgdesc_t meshtastic_EnvironmentMetrics_msg; extern const pb_msgdesc_t meshtastic_PowerMetrics_msg; extern const pb_msgdesc_t meshtastic_AirQualityMetrics_msg; extern const pb_msgdesc_t meshtastic_LocalStats_msg; +extern const pb_msgdesc_t meshtastic_HealthMetrics_msg; extern const pb_msgdesc_t meshtastic_Telemetry_msg; extern const pb_msgdesc_t meshtastic_Nau7802Config_msg; @@ -456,6 +490,7 @@ extern const pb_msgdesc_t meshtastic_Nau7802Config_msg; #define meshtastic_PowerMetrics_fields &meshtastic_PowerMetrics_msg #define meshtastic_AirQualityMetrics_fields &meshtastic_AirQualityMetrics_msg #define meshtastic_LocalStats_fields &meshtastic_LocalStats_msg +#define meshtastic_HealthMetrics_fields &meshtastic_HealthMetrics_msg #define meshtastic_Telemetry_fields &meshtastic_Telemetry_msg #define meshtastic_Nau7802Config_fields &meshtastic_Nau7802Config_msg @@ -464,6 +499,7 @@ extern const pb_msgdesc_t meshtastic_Nau7802Config_msg; #define meshtastic_AirQualityMetrics_size 72 #define meshtastic_DeviceMetrics_size 27 #define meshtastic_EnvironmentMetrics_size 85 +#define meshtastic_HealthMetrics_size 11 #define meshtastic_LocalStats_size 42 #define meshtastic_Nau7802Config_size 16 #define meshtastic_PowerMetrics_size 30 diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 250a64560..2b1b35000 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -467,7 +467,7 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c) requiresReboot = true; } } -#if EVENT_MODE +#if USERPREFS_EVENT_MODE // If we're in event mode, nobody is a Router or Repeater if (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER || config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER) { diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index 52efa8b5b..e0ea6a495 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -999,7 +999,7 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st int16_t rssiY = 130; // If dislay is *slighly* too small for the original consants, squish up a bit - if (display->getHeight() < rssiY) { + if (display->getHeight() < rssiY + FONT_HEIGHT_SMALL) { snrY = display->getHeight() - ((1.5) * FONT_HEIGHT_SMALL); rssiY = display->getHeight() - ((2.5) * FONT_HEIGHT_SMALL); } diff --git a/userPrefs.h b/userPrefs.h index 3b32bf79b..40f2cc6d2 100644 --- a/userPrefs.h +++ b/userPrefs.h @@ -3,29 +3,29 @@ // Uncomment and modify to set device defaults -// #define EVENT_MODE 1 +// #define USERPREFS_EVENT_MODE 1 -// #define CONFIG_LORA_REGION_USERPREFS meshtastic_Config_LoRaConfig_RegionCode_US -// #define LORACONFIG_MODEM_PRESET_USERPREFS meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST -// #define LORACONFIG_CHANNEL_NUM_USERPREFS 31 -// #define CONFIG_LORA_IGNORE_MQTT_USERPREFS true +// #define USERPREFS_CONFIG_LORA_REGION meshtastic_Config_LoRaConfig_RegionCode_US +// #define USERPREFS_LORACONFIG_MODEM_PRESET meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST +// #define USERPREFS_LORACONFIG_CHANNEL_NUM 31 +// #define USERPREFS_CONFIG_LORA_IGNORE_MQTT true /* -#define CHANNEL_0_PSK_USERPREFS \ +#define USERPREFS_CHANNEL_0_PSK \ { \ 0x38, 0x4b, 0xbc, 0xc0, 0x1d, 0xc0, 0x22, 0xd1, 0x81, 0xbf, 0x36, 0xb8, 0x61, 0x21, 0xe1, 0xfb, 0x96, 0xb7, 0x2e, 0x55, \ 0xbf, 0x74, 0x22, 0x7e, 0x9d, 0x6a, 0xfb, 0x48, 0xd6, 0x4c, 0xb1, 0xa1 \ } */ -// #define CHANNEL_0_NAME_USERPREFS "DEFCONnect" -// #define CHANNEL_0_PRECISION_USERPREFS 14 +// #define USERPREFS_CHANNEL_0_NAME "DEFCONnect" +// #define USERPREFS_CHANNEL_0_PRECISION 14 -// #define CONFIG_OWNER_LONG_NAME_USERPREFS "My Long Name" -// #define CONFIG_OWNER_SHORT_NAME_USERPREFS "MLN" +// #define USERPREFS_CONFIG_OWNER_LONG_NAME "My Long Name" +// #define USERPREFS_CONFIG_OWNER_SHORT_NAME "MLN" -// #define SPLASH_TITLE_USERPREFS "DEFCONtastic" +// #define USERPREFS_SPLASH_TITLE "DEFCONtastic" // #define icon_width 34 // #define icon_height 29 -// #define HAS_USERPREFS_SPLASH +// #define USERPREFS_HAS_SPLASH /* static unsigned char icon_bits[] = { 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0x00, 0x00, 0x00, @@ -37,8 +37,8 @@ static unsigned char icon_bits[] = { 0x00, 0x00, 0x1C, 0x00, 0x70, 0x00, 0x00, 0x1C, 0x00, 0x70, 0x00, 0x00, 0x1C, 0x00, 0x70, 0x00, 0x00, 0x1C, 0x00}; */ /* -#define ADMIN_KEY_USERPREFS 1 -static unsigned char admin_key_userprefs[] = {0xcd, 0xc0, 0xb4, 0x3c, 0x53, 0x24, 0xdf, 0x13, 0xca, 0x5a, 0xa6, +#define USERPREFS_USE_ADMIN_KEY 1 +static unsigned char USERPREFS_ADMIN_KEY[] = {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}; */