From 2e89370f1ecd9b4620a4843d2f6fc256158c1e71 Mon Sep 17 00:00:00 2001 From: Patrick Domack Date: Wed, 22 Jan 2020 16:49:28 -0500 Subject: [PATCH] Add ability to define more subversions in user overrides and remove ram/flash usage to store all versions. --- tasmota/tasmota.h | 1 + tasmota/tasmota.ino | 5 +---- tasmota/tasmota_post.h | 12 ++++++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tasmota/tasmota.h b/tasmota/tasmota.h index b4b944d80..4cb435a55 100644 --- a/tasmota/tasmota.h +++ b/tasmota/tasmota.h @@ -31,6 +31,7 @@ \*********************************************************************************************/ #define CODE_IMAGE 0 +#define CODE_IMAGE_STR "tasmota" #define USE_LIGHT // Enable light control #define USE_ENERGY_SENSOR // Use energy sensors (+14k code) diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index 15375e338..5c20da3ad 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -68,7 +68,7 @@ // Structs #include "settings.h" -const char kCodeImage[] PROGMEM = "tasmota|minimal|sensors|knx|lite|display|ir"; +const char my_image[] PROGMEM = "(" CODE_IMAGE_STR ")"; /*********************************************************************************************\ * Global variables @@ -159,7 +159,6 @@ myio my_module; // Active copy of Module GPIOs (17 x gpio_flag my_module_flag; // Active copy of Template GPIO flags StateBitfield global_state; // Global states (currently Wifi and Mqtt) (8 bits) char my_version[33]; // Composed version string -char my_image[33]; // Code image and/or commit char my_hostname[33]; // Composed Wifi hostname char mqtt_client[TOPSZ]; // Composed MQTT Clientname char mqtt_topic[TOPSZ]; // Composed MQTT topic @@ -200,8 +199,6 @@ void setup(void) if (VERSION & 0xff) { // Development or patched version 6.3.0.10 snprintf_P(my_version, sizeof(my_version), PSTR("%s.%d"), my_version, VERSION & 0xff); } - char code_image[20]; - snprintf_P(my_image, sizeof(my_image), PSTR("(%s)"), GetTextIndexed(code_image, sizeof(code_image), CODE_IMAGE, kCodeImage)); SettingsLoad(); SettingsDelta(); diff --git a/tasmota/tasmota_post.h b/tasmota/tasmota_post.h index af2fe00f7..bef9c567d 100644 --- a/tasmota/tasmota_post.h +++ b/tasmota/tasmota_post.h @@ -79,6 +79,8 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack #undef CODE_IMAGE #define CODE_IMAGE 2 +#undef CODE_IMAGE_STR +#define CODE_IMAGE_STR "sensors" #undef USE_DISCOVERY // Disable mDNS (+8k code or +23.5k code with core 2_5_x, +0.3k mem) @@ -228,6 +230,8 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack #undef CODE_IMAGE #define CODE_IMAGE 3 +#undef CODE_IMAGE_STR +#define CODE_IMAGE_STR "knx" #ifndef USE_KNX #define USE_KNX // Enable KNX IP Protocol Support (+23k code, +3k3 mem) @@ -248,6 +252,8 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack #undef CODE_IMAGE #define CODE_IMAGE 5 +#undef CODE_IMAGE_STR +#define CODE_IMAGE_STR "display" #undef USE_EMULATION // Disable Belkin WeMo and Hue Bridge emulation for Alexa (-16k code, -2k mem) #undef USE_EMULATION_HUE // Disable Hue Bridge emulation for Alexa (+14k code, +2k mem common) @@ -313,6 +319,8 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack #undef CODE_IMAGE #define CODE_IMAGE 6 +#undef CODE_IMAGE_STR +#define CODE_IMAGE_STR "ir" #undef USE_EMULATION #undef USE_EMULATION_HUE // Disable Hue emulation - only for lights and relays @@ -406,6 +414,8 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack #undef CODE_IMAGE #define CODE_IMAGE 4 +#undef CODE_IMAGE_STR +#define CODE_IMAGE_STR "lite" #undef APP_SLEEP #define APP_SLEEP 1 // Default to sleep = 1 for FIRMWARE_LITE @@ -511,6 +521,8 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack #undef CODE_IMAGE #define CODE_IMAGE 1 +#undef CODE_IMAGE_STR +#define CODE_IMAGE_STR "minimal" #undef FIRMWARE_LITE // Disable tasmota-lite with no sensors #undef FIRMWARE_SENSORS // Disable tasmota-sensors with useful sensors enabled