[core] Include board name in banner, fix version

This commit is contained in:
Kuba Szczodrzyński
2022-04-29 16:37:58 +02:00
parent 7efc097b1f
commit c7a90c0ec7
4 changed files with 22 additions and 10 deletions

View File

@@ -1,9 +1,18 @@
#pragma once
#ifndef LT_VERSION
#define LT_VERSION "1.0.0"
#define LT_VERSION 1.0.0
#endif
#ifndef LT_BOARD
#define LT_BOARD unknown
#endif
#define STRINGIFY(x) #x
#define STRINGIFY_MACRO(x) STRINGIFY(x)
#define LT_VERSION_STR STRINGIFY_MACRO(LT_VERSION)
#define LT_BOARD_STR STRINGIFY_MACRO(LT_BOARD)
#include <Arduino.h>
#include "LibreTuyaConfig.h"
@@ -19,4 +28,9 @@ extern "C" {
#endif
#define LT_BANNER() \
LT_LOG(LT_LEVEL_INFO, "main.cpp", __LINE__, "LibreTuya v" LT_VERSION " compiled on " __DATE__ " " __TIME__)
LT_LOG( \
LT_LEVEL_INFO, \
"main.cpp", \
__LINE__, \
"LibreTuya v" LT_VERSION_STR " on " LT_BOARD_STR ", compiled at " __DATE__ " " __TIME__ \
)

View File

@@ -19,7 +19,11 @@ env.Prepend(
join(LT_API_DIR),
join(LT_API_DIR, "compat"),
# fmt: on
]
],
CPPDEFINES=[
("LT_VERSION", platform.version),
("LT_BOARD", board.get("build.variant")),
],
)
sources_api = [

View File

@@ -24,12 +24,6 @@ env.Replace(
SIZETOOL="arm-none-eabi-size",
)
env.Append(
CPPDEFINES=[
("LT_VERSION", "0.1.0"),
]
)
# Flash layout defines
flash_layout: dict = board.get("flash")
if flash_layout:

View File

@@ -6,7 +6,7 @@
"type": "git",
"url": "https://github.com/kuba2k2/platformio-libretuya"
},
"version": "1.0.0",
"version": "0.1.0",
"frameworks": {
"realtek-ambz-sdk": {
"tilte": "Realtek AmebaZ - SDK",