diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 08b5942e8..0d508f1a5 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,4 +1,7 @@ -/* 6.3.0.4 20181106 +/* 6.3.0.5 20181107 + * Add code image and optional commit number to version + * + * 6.3.0.4 20181106 * Add command SetSensorXX 0/1 to disable/re-enable compiled xsns_XX_sensor.ino driver * * 6.3.0.3 20181105 diff --git a/sonoff/i18n.h b/sonoff/i18n.h index 73e1d0be2..112959a25 100644 --- a/sonoff/i18n.h +++ b/sonoff/i18n.h @@ -518,6 +518,8 @@ const char kPrefixes[3][PRFX_MAX_STRING_LENGTH] PROGMEM = { D_STAT, D_TELE }; +const char kCodeImage[] PROGMEM = "sonoff|minimal|classic|sensors|knx|basic|display"; + // support.ino static const char kMonthNames[] = D_MONTH3LIST; diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h index 1e27988e0..d13460e64 100644 --- a/sonoff/sonoff.h +++ b/sonoff/sonoff.h @@ -30,6 +30,8 @@ * Default sensor states \*********************************************************************************************/ +#define CODE_IMAGE 0 + #define USE_DHT // Default DHT11 sensor needs no external library #define USE_ENERGY_SENSOR // Use energy sensors (+14k code) #define USE_HLW8012 // Use energy sensor for Sonoff Pow and WolfBlitz diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 42a541162..d4c38f479 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -193,6 +193,7 @@ boolean mdns_begun = false; // mDNS active mytmplt my_module; // Active copy of Module name and GPIOs (23 x 8 bits) 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[33]; // Composed MQTT Clientname char mqtt_topic[33]; // Composed MQTT topic @@ -609,7 +610,6 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len) // We also need at least 3 chars to make a valid version number string. if (((1 == data_len) && (1 == payload)) || ((data_len >= 3) && NewerVersion(dataBuf))) { ota_state_flag = 3; -// snprintf_P(mqtt_data, sizeof(mqtt_data), "{\"%s\":\"" D_JSON_VERSION " %s " D_JSON_FROM " %s\"}", command, my_version, Settings.ota_url); snprintf_P(mqtt_data, sizeof(mqtt_data), "{\"%s\":\"" D_JSON_VERSION " %s " D_JSON_FROM " %s\"}", command, my_version, GetOtaUrl(stemp1, sizeof(stemp1))); } else { snprintf_P(mqtt_data, sizeof(mqtt_data), "{\"%s\":\"" D_JSON_ONE_OR_GT "\"}", command, my_version); @@ -1497,8 +1497,8 @@ void PublishStatus(uint8_t payload) } if ((0 == payload) || (2 == payload)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS2_FIRMWARE "\":{\"" D_JSON_VERSION "\":\"%s\",\"" D_JSON_BUILDDATETIME "\":\"%s\",\"" D_JSON_BOOTVERSION "\":%d,\"" D_JSON_COREVERSION "\":\"" ARDUINO_ESP8266_RELEASE "\",\"" D_JSON_SDKVERSION "\":\"%s\"}}"), - my_version, GetBuildDateAndTime().c_str(), ESP.getBootVersion(), ESP.getSdkVersion()); + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS2_FIRMWARE "\":{\"" D_JSON_VERSION "\":\"%s%s\",\"" D_JSON_BUILDDATETIME "\":\"%s\",\"" D_JSON_BOOTVERSION "\":%d,\"" D_JSON_COREVERSION "\":\"" ARDUINO_ESP8266_RELEASE "\",\"" D_JSON_SDKVERSION "\":\"%s\"}}"), + my_version, my_image, GetBuildDateAndTime().c_str(), ESP.getBootVersion(), ESP.getSdkVersion()); MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "2")); } @@ -2610,13 +2610,12 @@ void setup() Serial.println(); seriallog_level = LOG_LEVEL_INFO; // Allow specific serial messages until config loaded - snprintf_P(my_version, sizeof(my_version), PSTR("%d.%d.%d"), VERSION >> 24 & 0xff, VERSION >> 16 & 0xff, VERSION >> 8 & 0xff); - if (VERSION & 0xff) { + snprintf_P(my_version, sizeof(my_version), PSTR("%d.%d.%d"), VERSION >> 24 & 0xff, VERSION >> 16 & 0xff, VERSION >> 8 & 0xff); // Release version 6.3.0 + 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); } -#ifdef BE_MINIMAL - snprintf_P(my_version, sizeof(my_version), PSTR("%s-" D_JSON_MINIMAL), my_version); -#endif // BE_MINIMAL + char code_image[20]; + snprintf_P(my_image, sizeof(my_image), PSTR("(%s)"), GetTextIndexed(code_image, sizeof(code_image), CODE_IMAGE, kCodeImage)); SettingsLoad(); SettingsDelta(); @@ -2731,8 +2730,8 @@ void setup() } blink_powersave = power; - snprintf_P(log_data, sizeof(log_data), PSTR(D_PROJECT " %s %s (" D_CMND_TOPIC " %s, " D_FALLBACK " %s, " D_CMND_GROUPTOPIC " %s) " D_VERSION " %s-" ARDUINO_ESP8266_RELEASE), - PROJECT, Settings.friendlyname[0], mqtt_topic, mqtt_client, Settings.mqtt_grptopic, my_version); + snprintf_P(log_data, sizeof(log_data), PSTR(D_PROJECT " %s %s (" D_CMND_TOPIC " %s, " D_FALLBACK " %s, " D_CMND_GROUPTOPIC " %s) " D_VERSION " %s%s-" ARDUINO_ESP8266_RELEASE), + PROJECT, Settings.friendlyname[0], mqtt_topic, mqtt_client, Settings.mqtt_grptopic, my_version, my_image); AddLog(LOG_LEVEL_INFO); #ifdef BE_MINIMAL snprintf_P(log_data, sizeof(log_data), PSTR(D_WARNING_MINIMAL_VERSION)); diff --git a/sonoff/sonoff_post.h b/sonoff/sonoff_post.h index 7498d40e9..86b2c810d 100644 --- a/sonoff/sonoff_post.h +++ b/sonoff/sonoff_post.h @@ -57,6 +57,9 @@ void KNX_CB_Action(message_t const &msg, void *arg); #ifdef USE_SENSORS +#undef CODE_IMAGE +#define CODE_IMAGE 3 + #undef USE_ADC_VCC // Add Analog input on selected devices #define USE_DS18x20 // For more than one DS18x20 sensors with id sort, single scan and read retry (+1k3 code) //#define USE_DS18x20_LEGACY // For more than one DS18x20 sensors with dynamic scan using library OneWire (+1k5 code) @@ -134,6 +137,9 @@ void KNX_CB_Action(message_t const &msg, void *arg); #ifdef USE_CLASSIC +#undef CODE_IMAGE +#define CODE_IMAGE 2 + #ifndef USE_WPS #define USE_WPS // Add support for WPS as initial wifi configuration tool (+33k code, 1k mem (5k mem with core v2.4.2+)) #endif @@ -183,6 +189,9 @@ void KNX_CB_Action(message_t const &msg, void *arg); #ifdef USE_KNX_NO_EMULATION +#undef CODE_IMAGE +#define CODE_IMAGE 4 + #ifndef USE_KNX #define USE_KNX // Enable KNX IP Protocol Support (+23k code, +3k3 mem) #endif @@ -196,6 +205,9 @@ void KNX_CB_Action(message_t const &msg, void *arg); #ifdef USE_DISPLAYS +#undef CODE_IMAGE +#define CODE_IMAGE 6 + #undef USE_ENERGY_SENSOR // Disable energy sensors (-14k code) #undef USE_EMULATION // Disable Belkin WeMo and Hue Bridge emulation for Alexa (-16k code, -2k mem) @@ -229,6 +241,9 @@ void KNX_CB_Action(message_t const &msg, void *arg); #ifdef USE_BASIC +#undef CODE_IMAGE +#define CODE_IMAGE 5 + #undef APP_SLEEP #define APP_SLEEP 1 // Default to sleep = 1 for USE_BASIC @@ -288,6 +303,9 @@ void KNX_CB_Action(message_t const &msg, void *arg); #ifdef BE_MINIMAL +#undef CODE_IMAGE +#define CODE_IMAGE 1 + #undef USE_ENERGY_SENSOR // Disable energy sensors #undef USE_ARDUINO_OTA // Disable support for Arduino OTA #undef USE_WPS // Disable support for WPS as initial wifi configuration tool diff --git a/sonoff/sonoff_version.h b/sonoff/sonoff_version.h index 7bb3242ae..aef909e8a 100644 --- a/sonoff/sonoff_version.h +++ b/sonoff/sonoff_version.h @@ -20,7 +20,7 @@ #ifndef _SONOFF_VERSION_H_ #define _SONOFF_VERSION_H_ -#define VERSION 0x06030004 +#define VERSION 0x06030005 #define D_PROGRAMNAME "Sonoff-Tasmota" #define D_AUTHOR "Theo Arends" diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino index 8352e9820..627cebc52 100644 --- a/sonoff/xdrv_01_webserver.ino +++ b/sonoff/xdrv_01_webserver.ino @@ -1244,7 +1244,7 @@ void HandleInformation() // }2 = String func = FPSTR(HTTP_SCRIPT_INFO_BEGIN); func += F("
"); - func += F(D_PROGRAM_VERSION "}2"); func += my_version; + func += F(D_PROGRAM_VERSION "}2"); func += my_version; func += my_image; func += F("}1" D_BUILD_DATE_AND_TIME "}2"); func += GetBuildDateAndTime(); func += F("}1" D_CORE_AND_SDK_VERSION "}2" ARDUINO_ESP8266_RELEASE "/"); func += String(ESP.getSdkVersion()); func += F("}1" D_UPTIME "}2"); func += GetUptime(); diff --git a/sonoff/xdrv_02_mqtt.ino b/sonoff/xdrv_02_mqtt.ino index 40f69d93a..b74577a75 100644 --- a/sonoff/xdrv_02_mqtt.ino +++ b/sonoff/xdrv_02_mqtt.ino @@ -404,8 +404,8 @@ void MqttConnected() } if (mqtt_initial_connection_state) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_MODULE "\":\"%s\",\"" D_JSON_VERSION "\":\"%s\",\"" D_JSON_FALLBACKTOPIC "\":\"%s\",\"" D_CMND_GROUPTOPIC "\":\"%s\"}"), - my_module.name, my_version, mqtt_client, Settings.mqtt_grptopic); + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_MODULE "\":\"%s\",\"" D_JSON_VERSION "\":\"%s%s\",\"" D_JSON_FALLBACKTOPIC "\":\"%s\",\"" D_CMND_GROUPTOPIC "\":\"%s\"}"), + my_module.name, my_version, my_image, mqtt_client, Settings.mqtt_grptopic); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_INFO "1")); #ifdef USE_WEBSERVER if (Settings.webserver) { diff --git a/sonoff/xdrv_13_display.ino b/sonoff/xdrv_13_display.ino index 9656c14ec..26438aabe 100644 --- a/sonoff/xdrv_13_display.ino +++ b/sonoff/xdrv_13_display.ino @@ -629,7 +629,7 @@ void DisplayLogBufferInit() DisplayReAllocLogBuffer(); char buffer[40]; - snprintf_P(buffer, sizeof(buffer), PSTR(D_VERSION " %s"), my_version); + snprintf_P(buffer, sizeof(buffer), PSTR(D_VERSION " %s%s"), my_version, my_image); DisplayLogBufferAdd(buffer); snprintf_P(buffer, sizeof(buffer), PSTR("Display mode %d"), Settings.display_mode); DisplayLogBufferAdd(buffer);