Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

Commit

Permalink
DateTime lib refactor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed Feb 16, 2024
1 parent 2b8db65 commit 9656fa3
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 22 deletions.
2 changes: 1 addition & 1 deletion applications/external
Submodule external updated 128 files
4 changes: 2 additions & 2 deletions applications/main/subghz/scenes/subghz_scene_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ static void subghz_scene_add_to_history_callback(
const char* suf = subghz->last_settings->protocol_file_names ?
decoder_base->protocol->name :
SUBGHZ_APP_FILENAME_PREFIX;
FuriHalRtcDateTime time = subghz_history_get_datetime(history, idx);
DateTime time = subghz_history_get_datetime(history, idx);
name_generator_make_detailed_datetime(file, sizeof(file), suf, &time, true);
// Dir name
FuriString* path = furi_string_alloc_set(SUBGHZ_APP_FOLDER "/Autosave");
Expand Down Expand Up @@ -493,7 +493,7 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) {
subghz->threshold_rssi, subghz_txrx_radio_device_get_rssi(subghz->txrx));

if(subghz->last_settings->gps_baudrate != 0) {
FuriHalRtcDateTime datetime;
DateTime datetime;
furi_hal_rtc_get_datetime(&datetime);
if((datetime.second - subghz->gps->fix_second) > 15) {
subghz->gps->latitude = NAN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void subghz_scene_saved_show_gps_draw_satellites(void* context) {

subghz_txrx_get_latitude_and_longitude(subghz->txrx, lat_str, lon_str);

FuriHalRtcDateTime datetime;
DateTime datetime;
furi_hal_rtc_get_datetime(&datetime);
if((datetime.second - subghz->gps->fix_second) > 15) {
subghz->gps->latitude = NAN;
Expand Down
2 changes: 1 addition & 1 deletion applications/main/subghz/scenes/subghz_scene_show_gps.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ void subghz_scene_show_gps_draw_satellites(void* context) {
FuriString* text = furi_string_alloc();
FuriString* time_text = furi_string_alloc();

FuriHalRtcDateTime datetime;
DateTime datetime;
furi_hal_rtc_get_datetime(&datetime);
if((datetime.second - subghz->gps->fix_second) > 15) {
subghz->gps->latitude = NAN;
Expand Down
5 changes: 1 addition & 4 deletions applications/main/subghz/subghz_history.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,7 @@ bool subghz_history_get_text_space_left(
furi_string_printf(output, "%02u", instance->last_index_write);
return false;
} else {
FuriHalRtcDateTime datetime;
furi_hal_rtc_get_datetime(&datetime);

if(furi_hal_rtc_datetime_to_timestamp(&datetime) % 2) {
if(furi_hal_rtc_get_timestamp() % 2) {
furi_string_printf(output, "%02u", instance->last_index_write);
} else {
furi_string_printf(output, "%d sats", sats);
Expand Down
2 changes: 1 addition & 1 deletion applications/services/desktop/views/desktop_view_locked.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void desktop_view_locked_draw_lockscreen(Canvas* canvas, void* m) {
char second_str[5];
char date_str[14];
char meridian_str[3];
FuriHalRtcDateTime datetime;
DateTime datetime;
furi_hal_rtc_get_datetime(&datetime);
LocaleTimeFormat time_format = locale_get_time_format();
LocaleDateFormat date_format = locale_get_date_format();
Expand Down
4 changes: 1 addition & 3 deletions applications/services/dolphin/helpers/dolphin_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ bool dolphin_state_load(DolphinState* dolphin_state) {
}

uint64_t dolphin_state_timestamp() {
DateTime datetime;
furi_hal_rtc_get_datetime(&datetime);
return datetime_datetime_to_timestamp(&datetime);
return furi_hal_rtc_get_timestamp();
}

bool dolphin_state_is_levelup(uint32_t icounter) {
Expand Down
4 changes: 1 addition & 3 deletions applications/system/nightstand/clock_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,7 @@ static void clock_tick(void* ctx) {

void timer_start_stop(ClockState* plugin_state) {
// START/STOP TIMER
FuriHalRtcDateTime curr_dt;
furi_hal_rtc_get_datetime(&curr_dt);
uint32_t curr_ts = furi_hal_rtc_datetime_to_timestamp(&curr_dt);
uint32_t curr_ts = furi_hal_rtc_get_timestamp();

if(plugin_state->timer_running) {
// Update stopped seconds
Expand Down
4 changes: 1 addition & 3 deletions lib/subghz/protocols/tpms_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ SubGhzProtocolStatus tpms_block_generic_serialize(
}

//DATE AGE set
FuriHalRtcDateTime curr_dt;
furi_hal_rtc_get_datetime(&curr_dt);
uint32_t curr_ts = furi_hal_rtc_datetime_to_timestamp(&curr_dt);
uint32_t curr_ts = furi_hal_rtc_get_timestamp();

temp_data = curr_ts;
if(!flipper_format_write_uint32(flipper_format, "Ts", &temp_data, 1)) {
Expand Down
4 changes: 1 addition & 3 deletions lib/subghz/protocols/ws_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ SubGhzProtocolStatus ws_block_generic_serialize(
}

//DATE AGE set
FuriHalRtcDateTime curr_dt;
furi_hal_rtc_get_datetime(&curr_dt);
uint32_t curr_ts = furi_hal_rtc_datetime_to_timestamp(&curr_dt);
uint32_t curr_ts = furi_hal_rtc_get_timestamp();

temp_data = curr_ts;
if(!flipper_format_write_uint32(flipper_format, "Ts", &temp_data, 1)) {
Expand Down

0 comments on commit 9656fa3

Please sign in to comment.