Browse Source

utils: simplify version + revision into just version

mcspr-patch-1
Maxim Prokhorov 4 years ago
parent
commit
f0f6f1b8c9
27 changed files with 24788 additions and 24772 deletions
  1. BIN
      code/espurna/data/index.all.html.gz
  2. BIN
      code/espurna/data/index.curtain.html.gz
  3. BIN
      code/espurna/data/index.garland.html.gz
  4. BIN
      code/espurna/data/index.light.html.gz
  5. BIN
      code/espurna/data/index.lightfox.html.gz
  6. BIN
      code/espurna/data/index.rfbridge.html.gz
  7. BIN
      code/espurna/data/index.rfm69.html.gz
  8. BIN
      code/espurna/data/index.sensor.html.gz
  9. BIN
      code/espurna/data/index.small.html.gz
  10. BIN
      code/espurna/data/index.thermostat.html.gz
  11. +15
    -11
      code/espurna/homeassistant.cpp
  12. +1
    -1
      code/espurna/mdns.cpp
  13. +3106
    -3092
      code/espurna/static/index.all.html.gz.h
  14. +2157
    -2157
      code/espurna/static/index.curtain.html.gz.h
  15. +2412
    -2413
      code/espurna/static/index.garland.html.gz.h
  16. +2528
    -2528
      code/espurna/static/index.light.html.gz.h
  17. +2431
    -2431
      code/espurna/static/index.lightfox.html.gz.h
  18. +2159
    -2159
      code/espurna/static/index.rfbridge.html.gz.h
  19. +3506
    -3506
      code/espurna/static/index.rfm69.html.gz.h
  20. +2204
    -2204
      code/espurna/static/index.sensor.html.gz.h
  21. +2107
    -2107
      code/espurna/static/index.small.html.gz.h
  22. +2144
    -2144
      code/espurna/static/index.thermostat.html.gz.h
  23. +13
    -9
      code/espurna/utils.cpp
  24. +1
    -0
      code/espurna/utils.h
  25. +3
    -3
      code/espurna/web.cpp
  26. +1
    -4
      code/espurna/ws.cpp
  27. +0
    -3
      code/html/index.html

BIN
code/espurna/data/index.all.html.gz View File


BIN
code/espurna/data/index.curtain.html.gz View File


BIN
code/espurna/data/index.garland.html.gz View File


BIN
code/espurna/data/index.light.html.gz View File


BIN
code/espurna/data/index.lightfox.html.gz View File


BIN
code/espurna/data/index.rfbridge.html.gz View File


BIN
code/espurna/data/index.rfm69.html.gz View File


BIN
code/espurna/data/index.sensor.html.gz View File


BIN
code/espurna/data/index.small.html.gz View File


BIN
code/espurna/data/index.thermostat.html.gz View File


+ 15
- 11
code/espurna/homeassistant.cpp View File

@ -75,15 +75,17 @@ struct ha_config_t {
jsonBuffer(size),
deviceConfig(jsonBuffer.createObject()),
root(jsonBuffer.createObject()),
identifier(getIdentifier()),
name(getSetting("desc", getSetting("hostname"))),
version(String(APP_NAME " " APP_VERSION " (") + getCoreVersion() + ")")
identifier(getIdentifier().c_str()),
version(getVersion().c_str()),
manufacturer(getManufacturer().c_str()),
device(getDevice().c_str())
{
deviceConfig.createNestedArray("identifiers").add(identifier.c_str());
deviceConfig.createNestedArray("identifiers").add(identifier);
deviceConfig["name"] = name.c_str();
deviceConfig["sw_version"] = version.c_str();
deviceConfig["manufacturer"] = getManufacturer().c_str();
deviceConfig["model"] = getDevice().c_str();
deviceConfig["sw_version"] = version;
deviceConfig["manufacturer"] = manufacturer;
deviceConfig["model"] = device;
}
ha_config_t() : ha_config_t(DEFAULT_BUFFER_SIZE) {}
@ -94,9 +96,11 @@ struct ha_config_t {
JsonObject& deviceConfig;
JsonObject& root;
const String identifier;
const String name;
const String version;
String name;
const char* identifier;
const char* version;
const char* manufacturer;
const char* device;
};
// -----------------------------------------------------------------------------
@ -396,11 +400,11 @@ void _haSensorYaml(unsigned char index, JsonObject& root) {
#endif // SENSOR_SUPPORT
void _haGetDeviceConfig(JsonObject& config) {
config.createNestedArray("identifiers").add(getIdentifier());
config.createNestedArray("identifiers").add(getIdentifier().c_str());
config["name"] = getSetting("desc", getSetting("hostname"));
config["manufacturer"] = getManufacturer().c_str();
config["model"] = getDevice().c_str();
config["sw_version"] = String(APP_NAME) + " " + APP_VERSION + " (" + getCoreVersion() + ")";
config["sw_version"] = getVersion().c_str();
}
void _haSend() {


+ 1
- 1
code/espurna/mdns.cpp View File

@ -54,7 +54,7 @@ void mdnsServerSetup() {
// Public ESPurna related txt for OTA discovery
MDNS.addServiceTxt("arduino", "tcp", "app_name", APP_NAME);
MDNS.addServiceTxt("arduino", "tcp", "app_version", APP_VERSION);
MDNS.addServiceTxt("arduino", "tcp", "app_version", getVersion());
MDNS.addServiceTxt("arduino", "tcp", "build_date", buildTime());
MDNS.addServiceTxt("arduino", "tcp", "mac", WiFi.macAddress());
MDNS.addServiceTxt("arduino", "tcp", "target_board", getBoardName());


+ 3106
- 3092
code/espurna/static/index.all.html.gz.h
File diff suppressed because it is too large
View File


+ 2157
- 2157
code/espurna/static/index.curtain.html.gz.h
File diff suppressed because it is too large
View File


+ 2412
- 2413
code/espurna/static/index.garland.html.gz.h
File diff suppressed because it is too large
View File


+ 2528
- 2528
code/espurna/static/index.light.html.gz.h
File diff suppressed because it is too large
View File


+ 2431
- 2431
code/espurna/static/index.lightfox.html.gz.h
File diff suppressed because it is too large
View File


+ 2159
- 2159
code/espurna/static/index.rfbridge.html.gz.h
File diff suppressed because it is too large
View File


+ 3506
- 3506
code/espurna/static/index.rfm69.html.gz.h
File diff suppressed because it is too large
View File


+ 2204
- 2204
code/espurna/static/index.sensor.html.gz.h
File diff suppressed because it is too large
View File


+ 2107
- 2107
code/espurna/static/index.small.html.gz.h
File diff suppressed because it is too large
View File


+ 2144
- 2144
code/espurna/static/index.thermostat.html.gz.h
File diff suppressed because it is too large
View File


+ 13
- 9
code/espurna/utils.cpp View File

@ -60,8 +60,7 @@ const String& getManufacturer() {
}
String getBoardName() {
static const String defaultValue(F(DEVICE_NAME));
return getSetting("boardName", defaultValue);
return getSetting("boardName", F(DEVICE_NAME));
}
void setBoardName() {
@ -107,6 +106,15 @@ const String& getCoreRevision() {
return revision;
}
const String& getVersion() {
#if defined(APP_REVISION)
static const String value(F(APP_VERSION " (" APP_REVISION ")"));
#else
static const String value(F(APP_VERSION));
#endif
return value;
}
int getHeartbeatMode() {
return getSetting("hbMode", HEARTBEAT_MODE);
}
@ -341,7 +349,7 @@ void heartbeat() {
mqttSend(MQTT_TOPIC_APP, APP_NAME);
if (hb_cfg & Heartbeat::Version)
mqttSend(MQTT_TOPIC_VERSION, APP_VERSION);
mqttSend(MQTT_TOPIC_VERSION, getVersion().c_str());
if (hb_cfg & Heartbeat::Board)
mqttSend(MQTT_TOPIC_BOARD, getBoardName().c_str());
@ -544,11 +552,7 @@ void info(bool first) {
// -------------------------------------------------------------------------
#if defined(APP_REVISION)
DEBUG_MSG_P(PSTR("[MAIN] " APP_NAME " " APP_VERSION " (" APP_REVISION ")\n"));
#else
DEBUG_MSG_P(PSTR("[MAIN] " APP_NAME " " APP_VERSION "\n"));
#endif
DEBUG_MSG_P(PSTR("[MAIN] " APP_NAME " %s\n"), getVersion().c_str());
DEBUG_MSG_P(PSTR("[MAIN] " APP_AUTHOR "\n"));
DEBUG_MSG_P(PSTR("[MAIN] " APP_WEBSITE "\n\n"));
DEBUG_MSG_P(PSTR("[MAIN] CPU chip ID: 0x%06X\n"), ESP.getChipId());
@ -556,7 +560,7 @@ void info(bool first) {
DEBUG_MSG_P(PSTR("[MAIN] SDK version: %s\n"), ESP.getSdkVersion());
DEBUG_MSG_P(PSTR("[MAIN] Core version: %s\n"), getCoreVersion().c_str());
DEBUG_MSG_P(PSTR("[MAIN] Core revision: %s\n"), getCoreRevision().c_str());
DEBUG_MSG_P(PSTR("[MAIN] Build time: %lu\n"), __UNIX_TIMESTAMP__);
DEBUG_MSG_P(PSTR("[MAIN] Built: %s\n"), buildTime().c_str());
DEBUG_MSG_P(PSTR("\n"));
// -------------------------------------------------------------------------


+ 1
- 0
code/espurna/utils.h View File

@ -31,6 +31,7 @@ const String& getDevice();
const String& getManufacturer();
const String& getCoreVersion();
const String& getCoreRevision();
const String& getVersion();
int getHeartbeatMode();
unsigned long getHeartbeatInterval();


+ 3
- 3
code/espurna/web.cpp View File

@ -240,7 +240,7 @@ void _onDiscover(AsyncWebServerRequest *request) {
StaticJsonBuffer<JSON_OBJECT_SIZE(4)> jsonBuffer;
JsonObject &root = jsonBuffer.createObject();
root["app"] = APP_NAME;
root["version"] = APP_VERSION;
root["version"] = getVersion().c_str();
root["device"] = device.c_str();
root["hostname"] = hostname.c_str();
@ -267,8 +267,8 @@ void _onGetConfig(AsyncWebServerRequest *request) {
response->addHeader("X-Content-Type-Options", "nosniff");
response->addHeader("X-Frame-Options", "deny");
response->printf("{\n\"app\": \"%s\"", APP_NAME);
response->printf(",\n\"version\": \"%s\"", APP_VERSION);
response->printf("{\n\"app\": \"" APP_NAME "\"");
response->printf(",\n\"version\": \"%s\"", getVersion().c_str());
response->printf(",\n\"backup\": \"1\"");
#if NTP_SUPPORT
response->printf(",\n\"timestamp\": \"%s\"", ntpDateTime().c_str());


+ 1
- 4
code/espurna/ws.cpp View File

@ -469,11 +469,8 @@ void _wsOnConnected(JsonObject& root) {
root["webMode"] = WEB_MODE_NORMAL;
root["app_name"] = APP_NAME;
root["app_version"] = APP_VERSION;
root["app_version"] = getVersion().c_str();
root["app_build"] = buildTime();
#if defined(APP_REVISION)
root["app_revision"] = APP_REVISION;
#endif
root["device"] = getDevice().c_str();
root["manufacturer"] = getManufacturer().c_str();
root["chipid"] = getChipId().c_str();


+ 0
- 3
code/html/index.html View File

@ -292,9 +292,6 @@
<div class="pure-u-1-2">Firmware version</div>
<div class="pure-u-11-24"><span class="right" name="app_version"></span></div>
<div class="pure-u-1-2">Firmware revision</div>
<div class="pure-u-11-24"><span class="right" name="app_revision"></span></div>
<div class="pure-u-1-2">Firmware build date</div>
<div class="pure-u-11-24"><span class="right" name="app_build"></span></div>


Loading…
Cancel
Save