···27272828/*
2929 NOTE: storage_idle_notify usage notes..
3030-3030+31311) The callbacks are called in the ata thread, not main/your thread.
32322) Asynchronous callbacks (like the buffer refill) should be avoided.
3333 If you must use an async callback, remember to check storage_is_active() before
···4646/* Enable storage callbacks everywhere except for bootloaders. Both
4747 * hosted and native targets need this.
4848 */
4949-#define USING_STORAGE_CALLBACK !defined(BOOTLOADER) && !defined(APPLICATION) && !defined(__PCTOOL__)
4949+#if !defined(BOOTLOADER) && !defined(APPLICATION) && !defined(__PCTOOL__)
5050+#define USING_STORAGE_CALLBACK
5151+#endif
50525153extern void register_storage_idle_func(void (*function)(void));
5252-#if USING_STORAGE_CALLBACK
5454+#ifdef USING_STORAGE_CALLBACK
5355extern void unregister_storage_idle_func(void (*function)(void), bool run);
5456extern bool call_storage_idle_notifys(bool force);
5557#else
+6-5
firmware/powermgmt.c
···131131/* Time estimation requires 64 bit math so don't use it in the bootloader.
132132 * Also we need to be able to measure current, and not have a better time
133133 * estimate source available. */
134134-#define HAVE_TIME_ESTIMATION \
135135- (!defined(BOOTLOADER) && !(CONFIG_BATTERY_MEASURE & TIME_MEASURE) && \
134134+#if (!defined(BOOTLOADER) && !(CONFIG_BATTERY_MEASURE & TIME_MEASURE) && \
136135 (defined(CURRENT_NORMAL) || (CONFIG_BATTERY_MEASURE & CURRENT_MEASURE)))
136136+#define HAVE_TIME_ESTIMATION
137137+#endif
137138138139#if !(CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE)
139140int _battery_level(void) { return -1; }
···146147static int time_now; /* Cached to avoid polling too often */
147148#endif
148149149149-#if HAVE_TIME_ESTIMATION
150150+#ifdef HAVE_TIME_ESTIMATION
150151static int time_now; /* reported time in minutes */
151152static int64_t time_cnt; /* reported time in seconds */
152153static int64_t time_err; /* error... it's complicated */
···186187 * on the battery level and the actual current usage. */
187188int battery_time(void)
188189{
189189-#if (CONFIG_BATTERY_MEASURE & TIME_MEASURE) || HAVE_TIME_ESTIMATION
190190+#if (CONFIG_BATTERY_MEASURE & TIME_MEASURE) || defined(HAVE_TIME_ESTIMATION)
190191 return time_now;
191192#else
192193 return -1;
···401402402403#if CONFIG_BATTERY_MEASURE & TIME_MEASURE
403404 time_now = _battery_time();
404404-#elif HAVE_TIME_ESTIMATION
405405+#elif defined(HAVE_TIME_ESTIMATION)
405406 /* TODO: This is essentially a bad version of coloumb counting,
406407 * so in theory using coloumb counters when they are available
407408 * should provide a more accurate result. Also note that this
+1-1
tools/configure
···4614461446154615 if test "$gccnum" -ge "700"; then
46164616 # gcc 7 spews a bunch of warnings by default
46174617- GCCOPTS="$GCCOPTS -Wno-expansion-to-defined -Wimplicit-fallthrough=0"
46174617+ GCCOPTS="$GCCOPTS -Wimplicit-fallthrough=0"
46184618 fi
4619461946204620 case "$GCCOPTS" in