embrace upstream __compiled_constants.h approach
This commit is contained in:
parent
255e81e6bd
commit
841523f028
@ -5,4 +5,5 @@
|
|||||||
|
|
||||||
|
|
||||||
extern const char *__COMPILED_GIT_HASH__;
|
extern const char *__COMPILED_GIT_HASH__;
|
||||||
|
extern const char *__COMPILED_GIT_BRANCH__;
|
||||||
// extern const char *__COMPILED_DATE_TIME_UTC_STR__;
|
// extern const char *__COMPILED_DATE_TIME_UTC_STR__;
|
||||||
|
|||||||
@ -81,6 +81,8 @@ def do_main():
|
|||||||
if 1:
|
if 1:
|
||||||
# Add the description of the current git revision
|
# Add the description of the current git revision
|
||||||
lines += 'const char *__COMPILED_GIT_HASH__ = "%s";\n' % (get_build_version())
|
lines += 'const char *__COMPILED_GIT_HASH__ = "%s";\n' % (get_build_version())
|
||||||
|
# ... and git branch
|
||||||
|
lines += 'const char *__COMPILED_GIT_BRANCH__ = "%s";\n' % (get_build_branch())
|
||||||
|
|
||||||
updateFileIfChanged(targetfile, bytes(lines, "utf-8"))
|
updateFileIfChanged(targetfile, bytes(lines, "utf-8"))
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
#include "MessageOutput.h"
|
#include "MessageOutput.h"
|
||||||
#include "VictronMppt.h"
|
#include "VictronMppt.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
#include "__compiled_constants.h"
|
||||||
|
|
||||||
MqttHandleVedirectHassClass MqttHandleVedirectHass;
|
MqttHandleVedirectHassClass MqttHandleVedirectHass;
|
||||||
|
|
||||||
@ -214,7 +215,7 @@ void MqttHandleVedirectHassClass::createDeviceInfo(JsonObject &object,
|
|||||||
object["cu"] = String("http://") + NetworkSettings.localIP().toString();
|
object["cu"] = String("http://") + NetworkSettings.localIP().toString();
|
||||||
object["mf"] = "OpenDTU";
|
object["mf"] = "OpenDTU";
|
||||||
object["mdl"] = mpptData.getPidAsString();
|
object["mdl"] = mpptData.getPidAsString();
|
||||||
object["sw"] = AUTO_GIT_HASH;
|
object["sw"] = __COMPILED_GIT_HASH__;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttHandleVedirectHassClass::publish(const String& subtopic, const String& payload)
|
void MqttHandleVedirectHassClass::publish(const String& subtopic, const String& payload)
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
#include "MqttSettings.h"
|
#include "MqttSettings.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
#include "__compiled_constants.h"
|
||||||
|
|
||||||
MqttHandleBatteryHassClass MqttHandleBatteryHass;
|
MqttHandleBatteryHassClass MqttHandleBatteryHass;
|
||||||
|
|
||||||
@ -237,7 +238,7 @@ void MqttHandleBatteryHassClass::createDeviceInfo(JsonObject& object)
|
|||||||
object["cu"] = String("http://") + NetworkSettings.localIP().toString();
|
object["cu"] = String("http://") + NetworkSettings.localIP().toString();
|
||||||
object["mf"] = "OpenDTU";
|
object["mf"] = "OpenDTU";
|
||||||
object["mdl"] = Battery.getStats()->getManufacturer();
|
object["mdl"] = Battery.getStats()->getManufacturer();
|
||||||
object["sw"] = AUTO_GIT_HASH;
|
object["sw"] = __COMPILED_GIT_HASH__;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttHandleBatteryHassClass::publish(const String& subtopic, const String& payload)
|
void MqttHandleBatteryHassClass::publish(const String& subtopic, const String& payload)
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
#include "NetworkSettings.h"
|
#include "NetworkSettings.h"
|
||||||
#include "MessageOutput.h"
|
#include "MessageOutput.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
#include "__compiled_constants.h"
|
||||||
|
|
||||||
MqttHandlePowerLimiterHassClass MqttHandlePowerLimiterHass;
|
MqttHandlePowerLimiterHassClass MqttHandlePowerLimiterHass;
|
||||||
|
|
||||||
@ -193,7 +194,7 @@ void MqttHandlePowerLimiterHassClass::createDeviceInfo(JsonObject& object)
|
|||||||
object["cu"] = String("http://") + NetworkSettings.localIP().toString();
|
object["cu"] = String("http://") + NetworkSettings.localIP().toString();
|
||||||
object["mf"] = "OpenDTU";
|
object["mf"] = "OpenDTU";
|
||||||
object["mdl"] = "Dynamic Power Limiter";
|
object["mdl"] = "Dynamic Power Limiter";
|
||||||
object["sw"] = AUTO_GIT_HASH;
|
object["sw"] = __COMPILED_GIT_HASH__;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttHandlePowerLimiterHassClass::publish(const String& subtopic, const String& payload)
|
void MqttHandlePowerLimiterHassClass::publish(const String& subtopic, const String& payload)
|
||||||
|
|||||||
@ -13,10 +13,6 @@
|
|||||||
#include <ResetReason.h>
|
#include <ResetReason.h>
|
||||||
#include "__compiled_constants.h"
|
#include "__compiled_constants.h"
|
||||||
|
|
||||||
#ifndef AUTO_GIT_BRANCH
|
|
||||||
#define AUTO_GIT_BRANCH ""
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void WebApiSysstatusClass::init(AsyncWebServer& server, Scheduler& scheduler)
|
void WebApiSysstatusClass::init(AsyncWebServer& server, Scheduler& scheduler)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
@ -66,7 +62,7 @@ void WebApiSysstatusClass::onSystemStatus(AsyncWebServerRequest* request)
|
|||||||
snprintf(version, sizeof(version), "%d.%d.%d", CONFIG_VERSION >> 24 & 0xff, CONFIG_VERSION >> 16 & 0xff, CONFIG_VERSION >> 8 & 0xff);
|
snprintf(version, sizeof(version), "%d.%d.%d", CONFIG_VERSION >> 24 & 0xff, CONFIG_VERSION >> 16 & 0xff, CONFIG_VERSION >> 8 & 0xff);
|
||||||
root["config_version"] = version;
|
root["config_version"] = version;
|
||||||
root["git_hash"] = __COMPILED_GIT_HASH__;
|
root["git_hash"] = __COMPILED_GIT_HASH__;
|
||||||
root["git_branch"] = AUTO_GIT_BRANCH;
|
root["git_branch"] = __COMPILED_GIT_BRANCH__;
|
||||||
root["pioenv"] = PIOENV;
|
root["pioenv"] = PIOENV;
|
||||||
|
|
||||||
root["uptime"] = esp_timer_get_time() / 1000000;
|
root["uptime"] = esp_timer_get_time() / 1000000;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user