Adjusted rtc's year setting ...
This commit is contained in:
parent
e03c8d1585
commit
f1af0cd0d6
@ -68,7 +68,7 @@ static void setTimeCb(uint8_t *hour, uint8_t *minute, uint8_t *second, uint8_t *
|
||||
*second = timeToSet.tm_sec;
|
||||
*day = timeToSet.tm_mday;
|
||||
*month = timeToSet.tm_mon;
|
||||
*year = timeToSet.tm_year-100;
|
||||
*year = timeToSet.tm_year;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -88,7 +88,7 @@ static void setTimeCb(uint8_t *hour, uint8_t *minute, uint8_t *second, uint8_t *
|
||||
timeToSet.tm_mon = *month;
|
||||
|
||||
if(*year != 0xFF)
|
||||
timeToSet.tm_year = *year + 100;
|
||||
timeToSet.tm_year = *year;
|
||||
|
||||
tls_set_rtc(&timeToSet);
|
||||
}
|
||||
@ -271,7 +271,11 @@ void gfx_task(void *param)
|
||||
So we start the RTC */
|
||||
if(!tls_is_rtc_running())
|
||||
{
|
||||
struct tm curr_time = {0};
|
||||
struct tm curr_time = {
|
||||
.tm_mday = 1,
|
||||
.tm_mon = 1,
|
||||
.tm_year = 22, // Starting from 2000
|
||||
};
|
||||
tls_set_rtc(&curr_time);
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
static const char *day_options = "01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31";
|
||||
static const char *month_options = "01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12";
|
||||
static const char *year_options = "22\n23\n24\n25\n26\n27\n28\n29\n30";
|
||||
static const char *year_options = "22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40";
|
||||
static const char *hour_options = "00\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23";
|
||||
static const char *second_minute_options = "00\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59";
|
||||
static const char *date_format = "dd/mm/yyyy\ndd/mm/yy\nyyyy/mm/dd\nyy/mm/dd";
|
||||
@ -99,7 +99,7 @@ static void time_roller_cb(lv_event_t *e)
|
||||
}
|
||||
else
|
||||
{
|
||||
index+=22;
|
||||
index+=22; // Year is starting from 2000
|
||||
settingsScreen->settingsScreenAPIInterface.setTimeSettingsCb(&NOT_SELECTED, &NOT_SELECTED, &NOT_SELECTED, &NOT_SELECTED, &NOT_SELECTED, &index, SETTING_MODE_SET);
|
||||
}
|
||||
}
|
||||
@ -110,11 +110,17 @@ static void time_format_cb(lv_event_t *e)
|
||||
|
||||
if(e->target == settingsScreen->checkbox_time_12H)
|
||||
{
|
||||
//Make the 12H checkbox not uncheckable
|
||||
lv_obj_clear_flag(settingsScreen->checkbox_time_12H, LV_OBJ_FLAG_CHECKABLE);
|
||||
lv_obj_add_flag(settingsScreen->checkbox_time_24H, LV_OBJ_FLAG_CHECKABLE);
|
||||
lv_obj_clear_state(settingsScreen->checkbox_time_24H, LV_STATE_CHECKED);
|
||||
}
|
||||
else if(e->target == settingsScreen->checkbox_time_24H)
|
||||
{
|
||||
//Make the 24H checkbox not uncheckable
|
||||
lv_obj_clear_flag(settingsScreen->checkbox_time_24H, LV_OBJ_FLAG_CHECKABLE);
|
||||
lv_obj_clear_state(settingsScreen->checkbox_time_12H, LV_STATE_CHECKED);
|
||||
lv_obj_add_flag(settingsScreen->checkbox_time_12H, LV_OBJ_FLAG_CHECKABLE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -675,6 +681,6 @@ static void _set_rtc_time_to_label(SettingsScreen_t * const settingsScreen)
|
||||
sprintf(settingsScreen->currentTime.current_time_text, "%u:%u:%u %s%u/%s%u/%u", hour, minute, second,
|
||||
day < 10 ? "0":"", day,
|
||||
month < 10 ? "0":"", month,
|
||||
year+1900);
|
||||
year+2000);
|
||||
lv_label_set_text_static(settingsScreen->currentTime.current_time_label, settingsScreen->currentTime.current_time_text);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user