Skip to content

Commit 6911664

Browse files
authored
Merge pull request #3232 from mobrembski/fix_no_compiletime_defines_in_esp32
Fixed compile-time defines not working in ESP32 platform
2 parents 175089d + 654b7fa commit 6911664

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/src/Helpers/CompiletimeDefines.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
#endif // ifndef SET_BUILD_GIT_HEAD
1414

1515
String get_binary_filename() {
16-
#ifndef CORE_POST_2_5_0
17-
return F("firmware.bin");
18-
#else
16+
#if !defined(CORE_POST_2_5_0) && !defined(ESP32)
17+
return F("firmware.bin");
18+
#else
1919
return F(SET_BUILD_BINARY_FILENAME);
20-
#endif
20+
#endif
2121
}
2222

2323
String get_build_time() {
@@ -39,17 +39,17 @@ String get_build_origin() {
3939
}
4040

4141
String get_build_platform() {
42-
#ifndef CORE_POST_2_5_0
42+
#if !defined(CORE_POST_2_5_0) && !defined(ESP32)
4343
return "";
4444
#else
4545
return F(SET_BUILD_PLATFORM);
46-
#endif
46+
#endif
4747
}
4848

4949
String get_git_head() {
50-
#ifndef CORE_POST_2_5_0
51-
return "";
52-
#else
50+
#if !defined(CORE_POST_2_5_0) && !defined(ESP32)
51+
return "";
52+
#else
5353
return F(SET_BUILD_GIT_HEAD);
54-
#endif
54+
#endif
5555
}

tools/pio/generate-compiletime-defines.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ def get_git_description():
1717
try:
1818
from pygit2 import Repository
1919
try:
20-
return Repository('.').head.shorthand
20+
repo = Repository('.')
21+
return "'{0}_{1}'".format(repo.head.shorthand, repo.revparse_single('HEAD').short_id)
2122
except:
2223
return 'No_.git_dir'
2324
except ImportError:
@@ -79,4 +80,4 @@ def gen_compiletime_defines(node):
7980
print("\u001b[32m ------------------------------- \u001b[0m")
8081

8182

82-
env.AddBuildMiddleware(gen_compiletime_defines)
83+
env.AddBuildMiddleware(gen_compiletime_defines)

0 commit comments

Comments
 (0)