tell it what ver it is

This commit is contained in:
2026-07-21 20:57:39 +02:00
parent 9419230747
commit 7caef9c744
2 changed files with 25 additions and 2 deletions

View File

@@ -24,6 +24,22 @@ srcs = [
cc = meson.get_compiler('c')
git = find_program('git', required : false)
if git.found()
git_hash = run_command(git, 'rev-parse', '--short', 'HEAD', check: false).stdout().strip()
git_commits = run_command(git, 'rev-list', '--count', 'HEAD', check: false).stdout().strip()
else
git_hash = 'unknown'
git_commits = '0'
endif
add_project_arguments(
'-DGIT_HASH="' + git_hash + '"',
'-DGIT_COMMITS="' + git_commits + '"',
language: 'c'
)
executable(
'linuxSmartie',
srcs,

View File

@@ -98,9 +98,16 @@ static void *display_thread(void *arg) {
lcd_init(&lcd);
lcd_set_backlight(&lcd, true);
lcd_set_contrast(&lcd, lcd_contrast);
lcd_write_buf(&lcd, 1, 9, "Waiting for sensors..."); // need to center this still
lcd_write_buf(&lcd, 0, 14, "linuxSmartie");
lcd_writef(&lcd, 0, 2, "Ver. hash %s", GIT_HASH);
lcd_writef(&lcd, 0, 3, "Commit no. %s", GIT_COMMITS);
lcd_flush_buf(&lcd);
lcd_clear_buf(&lcd);
struct timespec next;
clock_gettime(CLOCK_REALTIME, &next);
timespec_add_ms(&next, refresh_interval_ms);
clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &next, nullptr);
/* setup custom chars */
lcd_set_custom_char(&lcd, 0, &(lcd_glyph_t){16, 6, 9, 8, 8, 9, 6, 0}); // celcius
@@ -172,7 +179,7 @@ static void *display_thread(void *arg) {
}
int main(void) {
applog(LOG_START, "linuxSmartie starting");
applog(LOG_START, "linuxSmartie r%s (%s) starting", GIT_COMMITS, GIT_HASH);
applog(LOG_DBG, "Compiled with %s", C_STD);
/* see if another instance is up, quit if it is */