Skip to content

Commit dcb0397

Browse files
committed
1 parent 0a243b7 commit dcb0397

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

src/eez/modules/psu/persist_conf.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,13 @@ bool writeTotalOnTime(int type, uint32_t time) {
826826
buffer[5] = crc32((uint8_t *)(buffer + 3), 8);
827827

828828
if (type == ontime::ON_TIME_COUNTER_MCU) {
829+
// static uint32_t lastTime = time;
830+
// DebugTrace("On-time counter: %u, systick: %u\n", time, millis());
831+
// if (lastTime != 0 && (time - lastTime) >= 2 * WRITE_ONTIME_INTERVAL) {
832+
// psu::gui::errorMessage("On time counter alert!");
833+
// }
834+
// lastTime = time;
835+
829836
return confWrite((uint8_t *)buffer, sizeof(buffer), mcu::eeprom::EEPROM_ONTIME_START_ADDRESS);
830837
} else {
831838
return moduleConfWrite(

src/eez/system.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <main.h>
2525
#include <iwdg.h>
2626

27-
volatile uint32_t g_tickCount;
27+
volatile uint64_t g_tickCount;
2828

2929
int g_watchdogExpectingTask = WATCHDOG_HIGH_PRIORITY_THREAD;
3030

@@ -53,7 +53,7 @@ namespace eez {
5353

5454
uint32_t millis() {
5555
#if defined(EEZ_PLATFORM_STM32)
56-
return g_tickCount / 5;
56+
return (uint32_t)(g_tickCount / 5);
5757
#endif
5858

5959
#if defined(EEZ_PLATFORM_SIMULATOR)
@@ -77,9 +77,9 @@ uint32_t micros() {
7777
auto cnt = TIM7->CNT;
7878
auto tc2 = g_tickCount;
7979
if (tc1 == tc2) {
80-
return tc1 * 200 + 2 * cnt;
80+
return (uint32_t)(tc1 * 200 + 2 * cnt);
8181
}
82-
return tc2 * 200;
82+
return (uint32_t)(tc2 * 200);
8383
#endif
8484

8585
#if defined(EEZ_PLATFORM_SIMULATOR)

src/eez/system.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
void doWatchdogReset(int fromTask);
3131
#define WATCHDOG_RESET(fromTask) doWatchdogReset(fromTask)
3232

33-
extern volatile uint32_t g_tickCount;
33+
extern volatile uint64_t g_tickCount;
3434

3535
#else
3636

src/eez/unit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ enum Unit {
5151
UNIT_MICRO_FARAD,
5252
UNIT_NANO_FARAD,
5353
UNIT_PICO_FARAD,
54-
UNIT_BIT,
5554
UNIT_MINUTE,
55+
UNIT_BIT,
5656
};
5757

5858
extern const char *g_unitNames[];

0 commit comments

Comments
 (0)