mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 11:47:30 +01:00
Fix project version longer than 30 characters breaking compilation (#6535)
This commit is contained in:
parent
6370e68670
commit
dc200948fa
@ -134,7 +134,7 @@ class ProjectUpdateTrigger : public Trigger<std::string>, public Component {
|
||||
uint32_t hash = fnv1_hash(ESPHOME_PROJECT_NAME);
|
||||
ESPPreferenceObject pref = global_preferences->make_preference<char[30]>(hash, true);
|
||||
char previous_version[30];
|
||||
char current_version[30] = ESPHOME_PROJECT_VERSION;
|
||||
char current_version[30] = ESPHOME_PROJECT_VERSION_30;
|
||||
if (pref.load(&previous_version)) {
|
||||
int cmp = strcmp(previous_version, current_version);
|
||||
if (cmp < 0) {
|
||||
|
@ -394,6 +394,7 @@ async def to_code(config):
|
||||
if project_conf := config.get(CONF_PROJECT):
|
||||
cg.add_define("ESPHOME_PROJECT_NAME", project_conf[CONF_NAME])
|
||||
cg.add_define("ESPHOME_PROJECT_VERSION", project_conf[CONF_VERSION])
|
||||
cg.add_define("ESPHOME_PROJECT_VERSION_30", project_conf[CONF_VERSION][:30])
|
||||
for conf in project_conf.get(CONF_ON_UPDATE, []):
|
||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID])
|
||||
await cg.register_component(trigger, conf)
|
||||
|
@ -11,6 +11,7 @@
|
||||
#define ESPHOME_BOARD "dummy_board"
|
||||
#define ESPHOME_PROJECT_NAME "dummy project"
|
||||
#define ESPHOME_PROJECT_VERSION "v2"
|
||||
#define ESPHOME_PROJECT_VERSION_30 "v2"
|
||||
#define ESPHOME_VARIANT "ESP32"
|
||||
|
||||
// Feature flags
|
||||
|
Loading…
Reference in New Issue
Block a user