mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 15:38:11 +01:00
Move ESPHome version define (#607)
* Move ESPHome version define * Lint
This commit is contained in:
parent
caa5b20791
commit
a933d4aeb6
10 changed files with 19 additions and 6 deletions
|
@ -6,6 +6,7 @@
|
||||||
#include "esphome/core/application.h"
|
#include "esphome/core/application.h"
|
||||||
#include "esphome/core/util.h"
|
#include "esphome/core/util.h"
|
||||||
#include "esphome/core/defines.h"
|
#include "esphome/core/defines.h"
|
||||||
|
#include "esphome/core/version.h"
|
||||||
|
|
||||||
#ifdef USE_DEEP_SLEEP
|
#ifdef USE_DEEP_SLEEP
|
||||||
#include "esphome/components/deep_sleep/deep_sleep_component.h"
|
#include "esphome/components/deep_sleep/deep_sleep_component.h"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include "esphome/core/helpers.h"
|
#include "esphome/core/helpers.h"
|
||||||
#include "esphome/core/defines.h"
|
#include "esphome/core/defines.h"
|
||||||
|
#include "esphome/core/version.h"
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
#include <rom/rtc.h>
|
#include <rom/rtc.h>
|
||||||
|
@ -19,7 +20,7 @@ void DebugComponent::dump_config() {
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ESP_LOGD(TAG, "ESPHome Core version %s", ESPHOME_VERSION);
|
ESP_LOGD(TAG, "ESPHome version %s", ESPHOME_VERSION);
|
||||||
this->free_heap_ = ESP.getFreeHeap();
|
this->free_heap_ = ESP.getFreeHeap();
|
||||||
ESP_LOGD(TAG, "Free Heap Size: %u bytes", this->free_heap_);
|
ESP_LOGD(TAG, "Free Heap Size: %u bytes", this->free_heap_);
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include "esphome/core/application.h"
|
#include "esphome/core/application.h"
|
||||||
#include "esphome/core/helpers.h"
|
#include "esphome/core/helpers.h"
|
||||||
|
#include "esphome/core/version.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace mqtt {
|
namespace mqtt {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "version_text_sensor.h"
|
#include "version_text_sensor.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include "esphome/core/application.h"
|
#include "esphome/core/application.h"
|
||||||
|
#include "esphome/core/version.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace version {
|
namespace version {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "esphome/core/application.h"
|
#include "esphome/core/application.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
|
#include "esphome/core/version.h"
|
||||||
|
|
||||||
#ifdef USE_STATUS_LED
|
#ifdef USE_STATUS_LED
|
||||||
#include "esphome/components/status_led/status_led.h"
|
#include "esphome/components/status_led/status_led.h"
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
// This file is auto-generated! Do not edit!
|
// This file is auto-generated! Do not edit!
|
||||||
|
|
||||||
#define ESPHOME_VERSION "dev"
|
|
||||||
|
|
||||||
#define USE_API
|
#define USE_API
|
||||||
#define USE_LOGGER
|
#define USE_LOGGER
|
||||||
#define USE_BINARY_SENSOR
|
#define USE_BINARY_SENSOR
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "esphome/core/util.h"
|
#include "esphome/core/util.h"
|
||||||
#include "esphome/core/defines.h"
|
#include "esphome/core/defines.h"
|
||||||
#include "esphome/core/application.h"
|
#include "esphome/core/application.h"
|
||||||
|
#include "esphome/core/version.h"
|
||||||
|
|
||||||
#ifdef USE_WIFI
|
#ifdef USE_WIFI
|
||||||
#include "esphome/components/wifi/wifi_component.h"
|
#include "esphome/components/wifi/wifi_component.h"
|
||||||
|
|
3
esphome/core/version.h
Normal file
3
esphome/core/version.h
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#pragma once
|
||||||
|
// This file is auto-generated! Do not edit!
|
||||||
|
#define ESPHOME_VERSION "dev"
|
|
@ -10,7 +10,7 @@ from esphome.const import ARDUINO_VERSION_ESP32_DEV, ARDUINO_VERSION_ESP8266_DEV
|
||||||
CONF_ESPHOME, CONF_INCLUDES, CONF_LIBRARIES, \
|
CONF_ESPHOME, CONF_INCLUDES, CONF_LIBRARIES, \
|
||||||
CONF_NAME, CONF_ON_BOOT, CONF_ON_LOOP, CONF_ON_SHUTDOWN, CONF_PLATFORM, \
|
CONF_NAME, CONF_ON_BOOT, CONF_ON_LOOP, CONF_ON_SHUTDOWN, CONF_PLATFORM, \
|
||||||
CONF_PLATFORMIO_OPTIONS, CONF_PRIORITY, CONF_TRIGGER_ID, \
|
CONF_PLATFORMIO_OPTIONS, CONF_PRIORITY, CONF_TRIGGER_ID, \
|
||||||
CONF_ESP8266_RESTORE_FROM_FLASH, __version__, ARDUINO_VERSION_ESP8266_2_3_0, \
|
CONF_ESP8266_RESTORE_FROM_FLASH, ARDUINO_VERSION_ESP8266_2_3_0, \
|
||||||
ARDUINO_VERSION_ESP8266_2_5_0, ARDUINO_VERSION_ESP8266_2_5_1, ARDUINO_VERSION_ESP8266_2_5_2
|
ARDUINO_VERSION_ESP8266_2_5_0, ARDUINO_VERSION_ESP8266_2_5_1, ARDUINO_VERSION_ESP8266_2_5_2
|
||||||
from esphome.core import CORE, coroutine_with_priority
|
from esphome.core import CORE, coroutine_with_priority
|
||||||
from esphome.helpers import copy_file_if_changed, walk_files
|
from esphome.helpers import copy_file_if_changed, walk_files
|
||||||
|
@ -201,7 +201,6 @@ def add_includes(includes):
|
||||||
@coroutine_with_priority(100.0)
|
@coroutine_with_priority(100.0)
|
||||||
def to_code(config):
|
def to_code(config):
|
||||||
cg.add_global(cg.global_ns.namespace('esphome').using)
|
cg.add_global(cg.global_ns.namespace('esphome').using)
|
||||||
cg.add_define('ESPHOME_VERSION', __version__)
|
|
||||||
cg.add(cg.App.pre_setup(config[CONF_NAME], cg.RawExpression('__DATE__ ", " __TIME__')))
|
cg.add(cg.App.pre_setup(config[CONF_NAME], cg.RawExpression('__DATE__ ", " __TIME__')))
|
||||||
|
|
||||||
for conf in config.get(CONF_ON_BOOT, []):
|
for conf in config.get(CONF_ON_BOOT, []):
|
||||||
|
|
|
@ -6,7 +6,7 @@ import re
|
||||||
|
|
||||||
from esphome.config import iter_components
|
from esphome.config import iter_components
|
||||||
from esphome.const import CONF_BOARD_FLASH_MODE, CONF_ESPHOME, CONF_PLATFORMIO_OPTIONS, \
|
from esphome.const import CONF_BOARD_FLASH_MODE, CONF_ESPHOME, CONF_PLATFORMIO_OPTIONS, \
|
||||||
HEADER_FILE_EXTENSIONS, SOURCE_FILE_EXTENSIONS
|
HEADER_FILE_EXTENSIONS, SOURCE_FILE_EXTENSIONS, __version__
|
||||||
from esphome.core import CORE, EsphomeError
|
from esphome.core import CORE, EsphomeError
|
||||||
from esphome.helpers import mkdir_p, read_file, write_file_if_changed, walk_files
|
from esphome.helpers import mkdir_p, read_file, write_file_if_changed, walk_files
|
||||||
from esphome.storage_json import StorageJSON, storage_path
|
from esphome.storage_json import StorageJSON, storage_path
|
||||||
|
@ -268,7 +268,12 @@ DEFINES_H_FORMAT = ESPHOME_H_FORMAT = u"""\
|
||||||
#pragma once
|
#pragma once
|
||||||
{}
|
{}
|
||||||
"""
|
"""
|
||||||
|
VERSION_H_FORMAT = u"""\
|
||||||
|
#pragma once
|
||||||
|
#define ESPHOME_VERSION "{}"
|
||||||
|
"""
|
||||||
DEFINES_H_TARGET = 'esphome/core/defines.h'
|
DEFINES_H_TARGET = 'esphome/core/defines.h'
|
||||||
|
VERSION_H_TARGET = 'esphome/core/version.h'
|
||||||
ESPHOME_README_TXT = u"""
|
ESPHOME_README_TXT = u"""
|
||||||
THIS DIRECTORY IS AUTO-GENERATED, DO NOT MODIFY
|
THIS DIRECTORY IS AUTO-GENERATED, DO NOT MODIFY
|
||||||
|
|
||||||
|
@ -335,6 +340,8 @@ def copy_src_tree():
|
||||||
CORE.relative_src_path('esphome', 'README.txt'))
|
CORE.relative_src_path('esphome', 'README.txt'))
|
||||||
write_file_if_changed(ESPHOME_H_FORMAT.format(include_s),
|
write_file_if_changed(ESPHOME_H_FORMAT.format(include_s),
|
||||||
CORE.relative_src_path('esphome.h'))
|
CORE.relative_src_path('esphome.h'))
|
||||||
|
write_file_if_changed(VERSION_H_FORMAT.format(__version__),
|
||||||
|
CORE.relative_src_path('esphome' 'core', 'version.h'))
|
||||||
|
|
||||||
|
|
||||||
def generate_defines_h():
|
def generate_defines_h():
|
||||||
|
|
Loading…
Reference in a new issue