Add tag in version info

Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
This commit is contained in:
2025-09-24 12:06:09 +09:00
parent 39ca2d205a
commit 873ccc91c5
3 changed files with 12 additions and 3 deletions

View File

@@ -78,3 +78,12 @@ execute_process(
)
add_compile_definitions(VERSION_HASH="${GIT_HASH}")
execute_process(
COMMAND git describe --tags --abbrev=0
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE
)
add_compile_definitions(VERSION_TAG="${GIT_TAG}")

View File

@@ -15,7 +15,7 @@
void app_main(void)
{
printf("\n\n== ODROID POWER-MATE ===\n");
printf("Versgition: %s\n\n", VERSION_HASH);
printf("Version: %s-%s\n\n", VERSION_TAG, VERSION_HASH);
ESP_ERROR_CHECK(i2cdev_init());
init_led();

View File

@@ -82,7 +82,7 @@ static esp_err_t version_get_handler(httpd_req_t* req)
{
httpd_resp_set_type(req, "application/json");
char buf[100];
sprintf(buf, "{\"version\": \"%s\"}", VERSION_HASH);
sprintf(buf, "{\"version\": \"%s-%s\"}", VERSION_TAG, VERSION_HASH);
httpd_resp_send(req, buf, strlen(buf));
return ESP_OK;
}