Skip to content

Commit f7646c4

Browse files
chores: remove simuTimerMicros()
1 parent b8aa711 commit f7646c4

File tree

5 files changed

+10
-34
lines changed

5 files changed

+10
-34
lines changed

radio/src/gui/colorlcd/libui/mainwindow.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@
2222
#include "keyboard_base.h"
2323
#include "layout.h"
2424
#include "etx_lv_theme.h"
25-
#include "sdcard.h"
2625

27-
// timers_driver.h
28-
uint32_t timersGetMsTick();
26+
#include "os/time.h"
27+
#include "sdcard.h"
2928

3029
MainWindow* MainWindow::_instance = nullptr;
3130

@@ -55,7 +54,7 @@ void MainWindow::emptyTrash()
5554

5655
void MainWindow::run(bool trash)
5756
{
58-
auto start = timersGetMsTick();
57+
auto start = time_get_ms();
5958

6059
auto opaque = Layer::getFirstOpaque();
6160
if (opaque) {
@@ -71,7 +70,7 @@ void MainWindow::run(bool trash)
7170

7271
if (trash) emptyTrash();
7372

74-
auto delta = timersGetMsTick() - start;
73+
auto delta = time_get_ms() - start;
7574
if (delta > 10) {
7675
TRACE_WINDOWS("MainWindow::run took %dms", delta);
7776
}

radio/src/os/time_native.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@
2323

2424
#include <chrono>
2525

26-
extern uint64_t simuTimerMicros(void);
27-
2826
uint32_t time_get_ms()
2927
{
30-
return simuTimerMicros() / 1000;
28+
static auto _start = std::chrono::steady_clock::now();;
29+
auto now = std::chrono::steady_clock::now();
30+
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now - _start);
31+
return duration.count();
3132
}
3233

3334
time_point_t time_point_now()

radio/src/targets/simu/opentxsimulator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
#define GET_SWITCH_BOOL(sw__) getSwitch((sw__), 0);
4242

43-
#define ETXS_DBG qDebug() << "(" << simuTimerMicros() << "us)"
43+
#define ETXS_DBG qDebug() << "(" << time_get_ms() << "us)"
4444

4545
int16_t g_anas[MAX_ANALOG_INPUTS];
4646
QVector<QIODevice *> OpenTxSimulator::tracebackDevices;
@@ -765,7 +765,7 @@ void OpenTxSimulator::run()
765765
}
766766

767767
if (!(loops % (SIMULATOR_INTERFACE_HEARTBEAT_PERIOD / 10))) {
768-
emit heartbeat(loops, simuTimerMicros() / 1000);
768+
emit heartbeat(loops, time_get_ms());
769769
}
770770
}
771771

radio/src/targets/simu/simulib.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include "edgetx.h"
3333

3434
#include <assert.h>
35-
#include <chrono>
3635

3736
int g_snapshot_idx = 0;
3837

@@ -56,27 +55,6 @@ extern const etx_hal_adc_driver_t simu_adc_driver;
5655

5756
void lcdCopy(void * dest, void * src);
5857

59-
uint64_t simuTimerMicros(void)
60-
{
61-
auto now = std::chrono::steady_clock::now();
62-
return (uint64_t) std::chrono::duration_cast<std::chrono::microseconds>(now.time_since_epoch()).count();
63-
}
64-
65-
uint16_t getTmr16KHz()
66-
{
67-
return simuTimerMicros() * 2 / 125;
68-
}
69-
70-
uint16_t getTmr2MHz()
71-
{
72-
return simuTimerMicros() * 2;
73-
}
74-
75-
uint32_t timersGetMsTick(void)
76-
{
77-
return simuTimerMicros() / 1000;
78-
}
79-
8058
void simuInit()
8159
{
8260
#if defined(ROTARY_ENCODER_NAVIGATION)

radio/src/targets/simu/simulib.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ void WASM_IMPORT(simuQueueAudio)(const uint8_t* buf, uint32_t len);
5353

5454
void simuMain();
5555

56-
uint64_t simuTimerMicros();
57-
5856
void simuFatfsSetPaths(const char * sdPath, const char * settingsPath);
5957
std::string simuFatfsGetCurrentPath();
6058
std::string simuFatfsGetRealPath(const std::string& p);

0 commit comments

Comments
 (0)