Author: JF002 <JF002@users.noreply.github.com>
Merge pull request #80 from Avamander/patch-1 Switched from NULL to nullptr
src/displayapp/screens/Brightness.cpp | 6 ++-- src/displayapp/screens/Clock.cpp | 22 ++++++++++---------- src/displayapp/screens/DropDownDemo.cpp | 4 +- src/displayapp/screens/FirmwareUpdate.cpp | 10 ++++---- src/displayapp/screens/FirmwareValidation.cpp | 20 +++++++++--------- src/displayapp/screens/Gauge.cpp | 4 +- src/displayapp/screens/Label.cpp | 2 src/displayapp/screens/Meter.cpp | 4 +- src/displayapp/screens/Modal.cpp | 6 ++-- src/displayapp/screens/Tile.cpp | 2 src/systemtask/SystemMonitor.h | 2
diff --git a/src/displayapp/screens/Brightness.cpp b/src/displayapp/screens/Brightness.cpp index 9e3416c0d958fe8c4983305fcae49b7552baf92d..8ea9a771b743941ac6175244b1bd43f727484ca0 100644 --- a/src/displayapp/screens/Brightness.cpp +++ b/src/displayapp/screens/Brightness.cpp @@ -11,15 +11,15 @@ } } 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); diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index 243d4c0495a1f15cf27667ab69deb5f96b24e6ec..bb14d520aa64a0d544b4275599d82d626508c9d7 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -29,28 +29,28 @@ displayedChar[2] = 0; 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 @@ lv_obj_set_pos(backgroundLabel, 0, 0); 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); } diff --git a/src/displayapp/screens/DropDownDemo.cpp b/src/displayapp/screens/DropDownDemo.cpp index 735a0ccedecbcc71b51825830b919677eb7f28ea..ce3acd538f41767f205347fa9de1ab084bc6f182 100644 --- a/src/displayapp/screens/DropDownDemo.cpp +++ b/src/displayapp/screens/DropDownDemo.cpp @@ -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 @@ "E"); 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() { diff --git a/src/displayapp/screens/FirmwareUpdate.cpp b/src/displayapp/screens/FirmwareUpdate.cpp index e831114d4ff5878be506deb68811ed895a5c791e..778409ebf2b100910da5c9538afbfb776c78709a 100644 --- a/src/displayapp/screens/FirmwareUpdate.cpp +++ b/src/displayapp/screens/FirmwareUpdate.cpp @@ -10,19 +10,19 @@ 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); diff --git a/src/displayapp/screens/FirmwareValidation.cpp b/src/displayapp/screens/FirmwareValidation.cpp index 2300b41d47477b14ad00987f71ae522a9a52c852..4ac399ffa384ff3f8f7a314521ebf88261db5d7d 100644 --- a/src/displayapp/screens/FirmwareValidation.cpp +++ b/src/displayapp/screens/FirmwareValidation.cpp @@ -20,20 +20,20 @@ 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 @@ else { 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#"); } diff --git a/src/displayapp/screens/Gauge.cpp b/src/displayapp/screens/Gauge.cpp index fd905231fd835b5b66d92cd2b3541c68061e53f4..81c283ca4a1f1960bae7518995ceb9138136e29b 100644 --- a/src/displayapp/screens/Gauge.cpp +++ b/src/displayapp/screens/Gauge.cpp @@ -25,11 +25,11 @@ 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); diff --git a/src/displayapp/screens/Label.cpp b/src/displayapp/screens/Label.cpp index 780ee88eb25b832d61ad0368e2b1cb5dec5e2e59..540776cc071b405d1a9c6ad39c2b7b57a88d60b2 100644 --- a/src/displayapp/screens/Label.cpp +++ b/src/displayapp/screens/Label.cpp @@ -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); diff --git a/src/displayapp/screens/Meter.cpp b/src/displayapp/screens/Meter.cpp index c74b8bdfa1f0297a3f4d56205034be4a0ce0f32f..273e111dadc7c4d271d7f5eb04fbd1d8adcedaf9 100644 --- a/src/displayapp/screens/Meter.cpp +++ b/src/displayapp/screens/Meter.cpp @@ -17,14 +17,14 @@ style_lmeter.body.grad_color = lv_color_make(160,0,0); 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); } diff --git a/src/displayapp/screens/Modal.cpp b/src/displayapp/screens/Modal.cpp index 63ae70c033d7514800107d6b56e5d6ce0f4f3915..29f7bfa7943e414d459178a3e2774f0f3e4c0347 100644 --- a/src/displayapp/screens/Modal.cpp +++ b/src/displayapp/screens/Modal.cpp @@ -54,7 +54,7 @@ lv_style_copy(&modal_style, &lv_style_plain_color); 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 @@ 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; diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp index deb88472eb8593bea8679b4912d47af878fc42ae..75fa6ef54f4f91bf055d73e86deb32f8dc9afad4 100644 --- a/src/displayapp/screens/Tile.cpp +++ b/src/displayapp/screens/Tile.cpp @@ -30,7 +30,7 @@ } } 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); diff --git a/src/systemtask/SystemMonitor.h b/src/systemtask/SystemMonitor.h index ec1fd817a035ecf3f55cdac3b02ecff686431f82..029a13641a1481a6e3f78c240d1efa968053bf28 100644 --- a/src/systemtask/SystemMonitor.h +++ b/src/systemtask/SystemMonitor.h @@ -27,7 +27,7 @@ public: 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)