1516X High Stakes 2.0
Codebase for 1516X High Stakes season
Loading...
Searching...
No Matches
status.cpp
Go to the documentation of this file.
1#include "main.h"
2#include "pros/apix.h"
3#include "robot/drivetrain.h"
4
5using namespace Robot;
6
7static lv_obj_t* label;
8
9static void slider_event_cb(lv_event_t* e) {
10 lv_event_code_t code = lv_event_get_code(e);
11 lv_obj_t* obj = lv_event_get_current_target(e);
12
13 if (code == LV_EVENT_VALUE_CHANGED) {
14 lv_calendar_date_t date;
15 if (lv_calendar_get_pressed_date(obj, &date)) {
16 LV_LOG_USER("Clicked date: %02d.%02d.%d", date.day, date.month,
17 date.year);
18 }
19 }
20}
21
22status_screen::status_screen() {}
26void status_screen::status() {
27 lv_obj_t* calendar = lv_calendar_create(lv_scr_act());
28 lv_obj_set_size(calendar, 185, 230);
29 lv_obj_align(calendar, LV_ALIGN_CENTER, 0, 27);
30 lv_obj_add_event_cb(calendar, slider_event_cb, LV_EVENT_ALL, NULL);
31
32 lv_calendar_set_today_date(calendar, 2021, 02, 23);
33 lv_calendar_set_showed_date(calendar, 2021, 02);
34
35 /*Highlight a few days*/
36 static lv_calendar_date_t highlighted_days[3]; /*Only its pointer will be
37 saved so should be static*/
38 highlighted_days[0].year = 2021;
39 highlighted_days[0].month = 02;
40 highlighted_days[0].day = 6;
41
42 highlighted_days[1].year = 2021;
43 highlighted_days[1].month = 02;
44 highlighted_days[1].day = 11;
45
46 highlighted_days[2].year = 2022;
47 highlighted_days[2].month = 02;
48 highlighted_days[2].day = 22;
49
50 lv_calendar_set_highlighted_dates(calendar, highlighted_days, 3);
51
52#if LV_USE_CALENDAR_HEADER_DROPDOWN
53 lv_calendar_header_dropdown_create(calendar);
54#elif LV_USE_CALENDAR_HEADER_ARROW
55 lv_calendar_header_arrow_create(calendar); /*Align top of the slider*/
56#endif
57}
Contains the declaration of the Drivetrain class.
Definition auton.h:8
static lv_obj_t * label
Definition status.cpp:7
static void slider_event_cb(lv_event_t *e)
Definition status.cpp:9