From a1fd56ba8e761605531f2bbe0a22cc7bef44ebd6 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Thu, 6 Mar 2025 12:39:37 -0500 Subject: [PATCH] [FixRed] Bootloaders, devices without size_t defined Change-Id: I452760478ea7324458a05c7af0a88bcbe92def45 --- apps/plugins/battery_bench.c | 2 +- firmware/export/powermgmt.h | 2 +- firmware/powermgmt.c | 11 +++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c index ab5c767f92..384422fd39 100644 --- a/apps/plugins/battery_bench.c +++ b/apps/plugins/battery_bench.c @@ -32,7 +32,7 @@ struct battery_tables_t { unsigned short * const discharge; #if CONFIG_CHARGING unsigned short * const charge; - const size_t elems; + const unsigned short elems; bool isdefault; #endif }; diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h index 37b3d680cc..7a5c94b0c0 100644 --- a/firmware/export/powermgmt.h +++ b/firmware/export/powermgmt.h @@ -113,7 +113,7 @@ struct battery_tables_t { unsigned short * const discharge; #if CONFIG_CHARGING unsigned short * const charge; - const size_t elems; + const unsigned short elems; bool isdefault; #endif }; diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index 6bb3d0ac32..112f67ad4f 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c @@ -36,9 +36,6 @@ #include "backlight.h" #include "lcd.h" #include "rtc.h" -#include "misc.h" -#include "splash.h" -#include "version.h" #if CONFIG_TUNER #include "fmradio.h" #endif @@ -65,6 +62,10 @@ extern unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11]; extern unsigned short percent_to_volt_charge[11]; #endif +#ifndef BOOTLOADER +#include "misc.h" +#include "splash.h" + struct battery_tables_t device_battery_tables = { .history = power_history, @@ -77,6 +78,7 @@ struct battery_tables_t device_battery_tables = .elems = ARRAYLEN(percent_to_volt_discharge[0]), .isdefault = true, }; +#endif static int last_sent_battery_level = 100; static void set_sleep_timer(int seconds); @@ -849,7 +851,7 @@ static void power_thread(void) } } /* power_thread */ - +#if !defined(BOOTLOADER) static bool battery_table_readln(int fd, char * buf, size_t bufsz, const char *name, char **value, int* linect) INIT_ATTR; static bool battery_table_readln(int fd, char * buf, size_t bufsz, @@ -893,6 +895,7 @@ static bool battery_table_readln(int fd, char * buf, size_t bufsz, } return rd > 0; } +#endif void init_battery_tables(void) {