Merge pull request #80 from Avamander/patch-1
Switched from NULL to nullptr
This commit is contained in:
commit
0a8d8953f7
|
@ -11,15 +11,15 @@ void slider_event_cb(lv_obj_t * slider, lv_event_t event) {
|
|||
}
|
||||
|
||||
Brightness::Brightness(Pinetime::Applications::DisplayApp *app, Controllers::BrightnessController& brightness) : Screen(app), brightness{brightness} {
|
||||
slider = lv_slider_create(lv_scr_act(), NULL);
|
||||
slider = lv_slider_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_user_data(slider, this);
|
||||
lv_obj_set_width(slider, LV_DPI * 2);
|
||||
lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_align(slider, nullptr, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_set_event_cb(slider, slider_event_cb);
|
||||
lv_slider_set_range(slider, 0, 2);
|
||||
lv_slider_set_value(slider, LevelToInt(brightness.Level()), LV_ANIM_OFF);
|
||||
|
||||
slider_label = lv_label_create(lv_scr_act(), NULL);
|
||||
slider_label = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(slider_label, LevelToString(brightness.Level()));
|
||||
lv_obj_set_auto_realign(slider_label, true);
|
||||
lv_obj_align(slider_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
|
||||
|
|
|
@ -29,28 +29,28 @@ Clock::Clock(DisplayApp* app,
|
|||
displayedChar[3] = 0;
|
||||
displayedChar[4] = 0;
|
||||
|
||||
batteryIcon = lv_label_create(lv_scr_act(), NULL);
|
||||
batteryIcon = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(batteryIcon, Symbols::batteryFull);
|
||||
lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -5, 2);
|
||||
|
||||
batteryPlug = lv_label_create(lv_scr_act(), NULL);
|
||||
batteryPlug = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(batteryPlug, Symbols::plug);
|
||||
lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0);
|
||||
|
||||
bleIcon = lv_label_create(lv_scr_act(), NULL);
|
||||
bleIcon = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(bleIcon, Symbols::bluetooth);
|
||||
lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0);
|
||||
|
||||
|
||||
label_date = lv_label_create(lv_scr_act(), NULL);
|
||||
label_date = lv_label_create(lv_scr_act(), nullptr);
|
||||
|
||||
lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60);
|
||||
|
||||
label_time = lv_label_create(lv_scr_act(), NULL);
|
||||
label_time = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_style(label_time, LV_LABEL_STYLE_MAIN, LabelBigStyle);
|
||||
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0);
|
||||
|
||||
backgroundLabel = lv_label_create(lv_scr_act(), NULL);
|
||||
backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
|
||||
backgroundLabel->user_data = this;
|
||||
lv_obj_set_click(backgroundLabel, true);
|
||||
lv_obj_set_event_cb(backgroundLabel, event_handler);
|
||||
|
@ -60,23 +60,23 @@ Clock::Clock(DisplayApp* app,
|
|||
lv_label_set_text(backgroundLabel, "");
|
||||
|
||||
|
||||
heartbeatIcon = lv_label_create(lv_scr_act(), NULL);
|
||||
heartbeatIcon = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(heartbeatIcon, Symbols::heartBeat);
|
||||
lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2);
|
||||
|
||||
heartbeatValue = lv_label_create(lv_scr_act(), NULL);
|
||||
heartbeatValue = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(heartbeatValue, "0");
|
||||
lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
|
||||
|
||||
heartbeatBpm = lv_label_create(lv_scr_act(), NULL);
|
||||
heartbeatBpm = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(heartbeatBpm, "BPM");
|
||||
lv_obj_align(heartbeatBpm, heartbeatValue, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
|
||||
|
||||
stepValue = lv_label_create(lv_scr_act(), NULL);
|
||||
stepValue = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(stepValue, "0");
|
||||
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2);
|
||||
|
||||
stepIcon = lv_label_create(lv_scr_act(), NULL);
|
||||
stepIcon = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(stepIcon, Symbols::shoe);
|
||||
lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ extern lv_font_t jetbrains_mono_bold_20;
|
|||
|
||||
DropDownDemo::DropDownDemo(Pinetime::Applications::DisplayApp *app) : Screen(app) {
|
||||
// Create the dropdown object, with many item, and fix its height
|
||||
ddlist = lv_ddlist_create(lv_scr_act(), NULL);
|
||||
ddlist = lv_ddlist_create(lv_scr_act(), nullptr);
|
||||
lv_ddlist_set_options(ddlist, "Apple\n"
|
||||
"Banana\n"
|
||||
"Orange\n"
|
||||
|
@ -24,7 +24,7 @@ DropDownDemo::DropDownDemo(Pinetime::Applications::DisplayApp *app) : Screen(app
|
|||
lv_ddlist_set_fix_width(ddlist, 150);
|
||||
lv_ddlist_set_draw_arrow(ddlist, true);
|
||||
lv_ddlist_set_fix_height(ddlist, 150);
|
||||
lv_obj_align(ddlist, NULL, LV_ALIGN_IN_TOP_MID, 0, 20);
|
||||
lv_obj_align(ddlist, nullptr, LV_ALIGN_IN_TOP_MID, 0, 20);
|
||||
}
|
||||
|
||||
DropDownDemo::~DropDownDemo() {
|
||||
|
|
|
@ -10,19 +10,19 @@ extern lv_font_t jetbrains_mono_bold_20;
|
|||
FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Ble& bleController) :
|
||||
Screen(app), bleController{bleController} {
|
||||
|
||||
titleLabel = lv_label_create(lv_scr_act(), NULL);
|
||||
titleLabel = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(titleLabel, "Firmware update");
|
||||
lv_obj_set_auto_realign(titleLabel, true);
|
||||
lv_obj_align(titleLabel, NULL, LV_ALIGN_IN_TOP_MID, 0, 50);
|
||||
lv_obj_align(titleLabel, nullptr, LV_ALIGN_IN_TOP_MID, 0, 50);
|
||||
|
||||
bar1 = lv_bar_create(lv_scr_act(), NULL);
|
||||
bar1 = lv_bar_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_size(bar1, 200, 30);
|
||||
lv_obj_align(bar1, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_align(bar1, nullptr, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_bar_set_anim_time(bar1, 10);
|
||||
lv_bar_set_range(bar1, 0, 100);
|
||||
lv_bar_set_value(bar1, 0, LV_ANIM_OFF);
|
||||
|
||||
percentLabel = lv_label_create(lv_scr_act(), NULL);
|
||||
percentLabel = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(percentLabel, "");
|
||||
lv_obj_set_auto_realign(percentLabel, true);
|
||||
lv_obj_align(percentLabel, bar1, LV_ALIGN_OUT_TOP_MID, 0, 60);
|
||||
|
|
|
@ -20,20 +20,20 @@ namespace {
|
|||
FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp *app,
|
||||
Pinetime::Controllers::FirmwareValidator &validator)
|
||||
: Screen{app}, validator{validator} {
|
||||
labelVersionInfo = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_obj_align(labelVersionInfo, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
|
||||
labelVersionInfo = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_align(labelVersionInfo, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0);
|
||||
lv_label_set_text(labelVersionInfo, "Version : ");
|
||||
lv_label_set_align(labelVersionInfo, LV_LABEL_ALIGN_LEFT);
|
||||
|
||||
|
||||
labelVersionValue = lv_label_create(lv_scr_act(), NULL);
|
||||
labelVersionValue = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_align(labelVersionValue, labelVersionInfo, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
|
||||
lv_label_set_recolor(labelVersionValue, true);
|
||||
sprintf(version, "%ld.%ld.%ld", Version::Major(), Version::Minor(), Version::Patch());
|
||||
lv_label_set_text(labelVersionValue, version);
|
||||
|
||||
labelIsValidated = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_obj_align(labelIsValidated, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 50);
|
||||
labelIsValidated = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_align(labelIsValidated, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 50);
|
||||
lv_label_set_recolor(labelIsValidated, true);
|
||||
lv_label_set_long_mode(labelIsValidated, LV_LABEL_LONG_BREAK);
|
||||
lv_obj_set_width(labelIsValidated, 240);
|
||||
|
@ -44,21 +44,21 @@ FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp *app,
|
|||
lv_label_set_text(labelIsValidated,
|
||||
"Please #00ff00 Validate# this version or\n#ff0000 Reset# to rollback to the previous version.");
|
||||
|
||||
buttonValidate = lv_btn_create(lv_scr_act(), NULL);
|
||||
buttonValidate = lv_btn_create(lv_scr_act(), nullptr);
|
||||
lv_obj_align(buttonValidate, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
|
||||
buttonValidate->user_data = this;
|
||||
lv_obj_set_event_cb(buttonValidate, ButtonEventHandler);
|
||||
|
||||
labelButtonValidate = lv_label_create(buttonValidate, NULL);
|
||||
labelButtonValidate = lv_label_create(buttonValidate, nullptr);
|
||||
lv_label_set_recolor(labelButtonValidate, true);
|
||||
lv_label_set_text(labelButtonValidate, "#00ff00 Validate#");
|
||||
|
||||
buttonReset = lv_btn_create(lv_scr_act(), NULL);
|
||||
buttonReset = lv_btn_create(lv_scr_act(), nullptr);
|
||||
buttonReset->user_data = this;
|
||||
lv_obj_align(buttonReset, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
|
||||
lv_obj_align(buttonReset, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
|
||||
lv_obj_set_event_cb(buttonReset, ButtonEventHandler);
|
||||
|
||||
labelButtonReset = lv_label_create(buttonReset, NULL);
|
||||
labelButtonReset = lv_label_create(buttonReset, nullptr);
|
||||
lv_label_set_recolor(labelButtonReset, true);
|
||||
lv_label_set_text(labelButtonReset, "#ff0000 Reset#");
|
||||
}
|
||||
|
|
|
@ -25,11 +25,11 @@ Gauge::Gauge(Pinetime::Applications::DisplayApp *app) : Screen(app) {
|
|||
needle_colors[0] = LV_COLOR_ORANGE;
|
||||
|
||||
/*Create a gauge*/
|
||||
gauge1 = lv_gauge_create(lv_scr_act(), NULL);
|
||||
gauge1 = lv_gauge_create(lv_scr_act(), nullptr);
|
||||
lv_gauge_set_style(gauge1, LV_GAUGE_STYLE_MAIN, &style);
|
||||
lv_gauge_set_needle_count(gauge1, 1, needle_colors);
|
||||
lv_obj_set_size(gauge1, 180, 180);
|
||||
lv_obj_align(gauge1, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_align(gauge1, nullptr, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_gauge_set_scale(gauge1, 360, 60, 0);
|
||||
lv_gauge_set_range(gauge1, 0, 59);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
using namespace Pinetime::Applications::Screens;
|
||||
|
||||
Label::Label(Pinetime::Applications::DisplayApp *app, const char *text) : Screen(app), text{text} {
|
||||
label = lv_label_create(lv_scr_act(), NULL);
|
||||
label = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_align(label, LV_LABEL_ALIGN_LEFT);
|
||||
lv_obj_set_size(label, 240, 240);
|
||||
lv_label_set_text(label, text);
|
||||
|
|
|
@ -17,14 +17,14 @@ Meter::Meter(Pinetime::Applications::DisplayApp *app) : Screen(app) {
|
|||
style_lmeter.body.padding.left = 16; /*Line length*/
|
||||
|
||||
/*Create a line meter */
|
||||
lmeter = lv_lmeter_create(lv_scr_act(), NULL);
|
||||
lmeter = lv_lmeter_create(lv_scr_act(), nullptr);
|
||||
lv_lmeter_set_range(lmeter, 0, 60); /*Set the range*/
|
||||
lv_lmeter_set_value(lmeter, value); /*Set the current value*/
|
||||
lv_lmeter_set_angle_offset(lmeter, 180);
|
||||
lv_lmeter_set_scale(lmeter, 360, 60); /*Set the angle and number of lines*/
|
||||
lv_lmeter_set_style(lmeter, LV_LMETER_STYLE_MAIN, &style_lmeter); /*Apply the new style*/
|
||||
lv_obj_set_size(lmeter, 150, 150);
|
||||
lv_obj_align(lmeter, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_align(lmeter, nullptr, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ void Modal::Show(const char* msg) {
|
|||
modal_style.body.main_color = modal_style.body.grad_color = LV_COLOR_BLACK;
|
||||
modal_style.body.opa = LV_OPA_50;
|
||||
|
||||
obj = lv_obj_create(lv_scr_act(), NULL);
|
||||
obj = lv_obj_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_style(obj, &modal_style);
|
||||
lv_obj_set_pos(obj, 0, 0);
|
||||
lv_obj_set_size(obj, LV_HOR_RES, LV_VER_RES);
|
||||
|
@ -63,10 +63,10 @@ void Modal::Show(const char* msg) {
|
|||
static const char * btns2[] = {"Ok", ""};
|
||||
|
||||
/* Create the message box as a child of the modal background */
|
||||
mbox = lv_mbox_create(obj, NULL);
|
||||
mbox = lv_mbox_create(obj, nullptr);
|
||||
lv_mbox_add_btns(mbox, btns2);
|
||||
lv_mbox_set_text(mbox, msg);
|
||||
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_align(mbox, nullptr, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_set_event_cb(mbox, Modal::mbox_event_cb);
|
||||
|
||||
mbox->user_data = this;
|
||||
|
|
|
@ -30,7 +30,7 @@ Tile::Tile(DisplayApp* app, std::array<Applications, 6>& applications) : Screen(
|
|||
}
|
||||
modal.reset(new Modal(app));
|
||||
|
||||
btnm1 = lv_btnm_create(lv_scr_act(), NULL);
|
||||
btnm1 = lv_btnm_create(lv_scr_act(), nullptr);
|
||||
lv_btnm_set_map(btnm1, btnm_map1);
|
||||
lv_obj_set_size(btnm1, LV_HOR_RES, LV_VER_RES);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Pinetime {
|
|||
void Process() const {
|
||||
if(xTaskGetTickCount() - lastTick > 10000) {
|
||||
NRF_LOG_INFO("---------------------------------------\nFree heap : %d", xPortGetFreeHeapSize());
|
||||
auto nb = uxTaskGetSystemState(tasksStatus, 10, NULL);
|
||||
auto nb = uxTaskGetSystemState(tasksStatus, 10, nullptr);
|
||||
for (uint32_t i = 0; i < nb; i++) {
|
||||
NRF_LOG_INFO("Task [%s] - %d", tasksStatus[i].pcTaskName, tasksStatus[i].usStackHighWaterMark);
|
||||
if (tasksStatus[i].usStackHighWaterMark < 20)
|
||||
|
|
Loading…
Reference in New Issue