[esp32] Fix some compiler warnings & bugs (#15610)

Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
This commit is contained in:
Diorcet Yann
2026-04-13 09:40:49 -04:00
committed by GitHub
co-authored by Jonathan Swoboda
parent fe6ecb24b4
commit 7918a93a7f
5 changed files with 11 additions and 9 deletions
+2 -1
View File
@@ -113,7 +113,8 @@ def _generate_source_table_code(
entries = ", ".join(var_names)
lines.append(f"static const char *const {table_var}[] PROGMEM = {{{entries}}};")
lines.append(f"const LogString *{lookup_fn}(uint8_t index) {{")
lines.append(f' if (index == 0 || index > {count}) return LOG_STR("<unknown>");')
cond = "index == 0" if count >= 255 else f"index == 0 || index > {count}"
lines.append(f' if ({cond}) return LOG_STR("<unknown>");')
lines.append(" return reinterpret_cast<const LogString *>(")
lines.append(f" progmem_read_ptr(&{table_var}[index - 1]));")
lines.append("}")