Code: Select all
static uint64_t get_rtc_time_us()
{
uint64_t ticks = rtc_time_get();
return (uint32_t) ((ticks * esp_clk_slowclk_cal_get()) >> RTC_CLK_CAL_FRACT);
}
Is there another time function I should use that does better?
TIA
Code: Select all
static uint64_t get_rtc_time_us()
{
uint64_t ticks = rtc_time_get();
return (uint32_t) ((ticks * esp_clk_slowclk_cal_get()) >> RTC_CLK_CAL_FRACT);
}
Code: Select all
uint64_t system_get_rtc_time(void);
RTC_DATA_ATTR static uint64_t sleep_start_us = 0;
static uint64_t app_start_us = 0;
void app_main () {
app_start_us = system_get_rtc_time();
printf ("sleep_start=%lld app_start=%lld sleep_time=%lld",
sleep_start_us, app_start_us, app_start_us-sleep_start_us);
// do some work, start WiFi, send UDO oacket
sleep_start_us = system_get_rtc_time();
esp_deep_sleep(5*1000000);
}
Code: Select all
sleep_start=1677693 app_start=6981276 sleep_time=5303583
sleep_start=8266798 app_start=13572686 sleep_time=5305888
sleep_start=14857630 app_start=20172103 sleep_time=5314473
sleep_start=21457409 app_start=26750516 sleep_time=5293107
...
sleep_start=2481611524 app_start=2490039438 sleep_time=8427914
...
sleep_start=4633366874 app_start=4633576764 sleep_time=209890
...
sleep_start=4701616082 app_start=4709967971 sleep_time=8351889
Users browsing this forum: No registered users and 176 guests