Browse Source

[CODE] add build info (git commit) to info line

tags/v1.1.0
Jannik Beyerstedt 4 months ago
parent
commit
dfd592fc37
3 changed files with 14 additions and 5 deletions
  1. 4
    0
      .gitignore
  2. 3
    0
      main/component.mk
  3. 7
    5
      main/esp32-sensornode_main.cpp

+ 4
- 0
.gitignore View File

@@ -6,3 +6,7 @@ components/
6 6
 # KiCAD EDA
7 7
 *.bak
8 8
 *.kicad_pcb-bak
9
+
10
+# VS Code
11
+.vscode/arduino.json
12
+.vscode/c_cpp_properties.json

+ 3
- 0
main/component.mk View File

@@ -3,3 +3,6 @@
3 3
 #
4 4
 # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
5 5
 
6
+PROJ_GIT_VER := $(shell git describe --always --tags --dirty)
7
+
8
+CPPFLAGS += -D PROJ_VER=\"$(PROJ_GIT_VER)\"

+ 7
- 5
main/esp32-sensornode_main.cpp View File

@@ -28,7 +28,7 @@
28 28
 #endif
29 29
 
30 30
 #ifndef BOARD
31
-#define BOARD 0 /* IMPORTANT: select one of the BOARD_* types */
31
+#define BOARD 4 /* IMPORTANT: select one of the BOARD_* types */
32 32
 #endif
33 33
 
34 34
 #define DB_HOSTNAME "ursaminor.fra80"
@@ -176,12 +176,14 @@ extern "C" void app_main() {
176 176
   delay(100);
177 177
   Serial.println("");
178 178
 
179
-  Serial.print("[INFO ] Node ");
179
+  Serial.print("[INFO ] Type ");
180
+  Serial.print(BOARD);
181
+  Serial.print(", Node: ");
180 182
   Serial.print(loggerId);
181
-  Serial.print(", Name: ");
183
+  Serial.print(" (");
182 184
   Serial.print(loggerName);
183
-  Serial.print(", BoardType: ");
184
-  Serial.println(BOARD);
185
+  Serial.print("), Build: ");
186
+  Serial.println(PROJ_VER);
185 187
 #endif
186 188
 #ifdef PRINT_DEBUG
187 189
   printWakeupReason();

Loading…
Cancel
Save