Skip to content

Commit 7836554

Browse files
Riksu9000JF002
authored andcommitted
Replace airplane mode with a bluetooth toggle
1 parent 8f436e1 commit 7836554

File tree

14 files changed

+72
-90
lines changed

14 files changed

+72
-90
lines changed

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ list(APPEND SOURCE_FILES
449449
displayapp/screens/settings/SettingSetTime.cpp
450450
displayapp/screens/settings/SettingChimes.cpp
451451
displayapp/screens/settings/SettingShakeThreshold.cpp
452-
displayapp/screens/settings/SettingAirplaneMode.cpp
452+
displayapp/screens/settings/SettingBluetooth.cpp
453453

454454
## Watch faces
455455
displayapp/icons/bg_clock.c

src/components/settings/Settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ namespace Pinetime {
237237

238238
uint8_t appMenu = 0;
239239
uint8_t settingsMenu = 0;
240-
/* airplaneMode is intentionally not saved with the other watch settings and initialized
240+
/* ble state is intentionally not saved with the other watch settings and initialized
241241
* to off (false) on every boot because we always want ble to be enabled on startup
242242
*/
243243
bool bleRadioEnabled = true;

src/displayapp/Apps.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace Pinetime {
3838
SettingSetTime,
3939
SettingChimes,
4040
SettingShakeThreshold,
41-
SettingAirplaneMode,
41+
SettingBluetooth,
4242
Error
4343
};
4444
}

src/displayapp/DisplayApp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
#include "displayapp/screens/settings/SettingSetTime.h"
5050
#include "displayapp/screens/settings/SettingChimes.h"
5151
#include "displayapp/screens/settings/SettingShakeThreshold.h"
52-
#include "displayapp/screens/settings/SettingAirplaneMode.h"
52+
#include "displayapp/screens/settings/SettingBluetooth.h"
5353

5454
#include "libs/lv_conf.h"
5555

@@ -434,8 +434,8 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
434434
currentScreen = std::make_unique<Screens::SettingShakeThreshold>(this, settingsController, motionController, *systemTask);
435435
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
436436
break;
437-
case Apps::SettingAirplaneMode:
438-
currentScreen = std::make_unique<Screens::SettingAirplaneMode>(this, settingsController);
437+
case Apps::SettingBluetooth:
438+
currentScreen = std::make_unique<Screens::SettingBluetooth>(this, settingsController);
439439
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
440440
break;
441441
case Apps::BatteryInfo:

src/displayapp/fonts/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static constexpr const char* newSymbol = "\xEF\x86\x85";
3131
* Do not enable font compression or horizontal subpixel rendering
3232
* Load the file `JetBrainsMono-Bold.tff` (use the file in this repo to ensure the version matches) and specify the following range: `0x20-0x7e, 0x410-0x44f`
3333
* Add a 2nd font, load the file `FontAwesome5-Solid+Brands+Regular.woff` and specify the following
34-
range: `0xf293, 0xf294, 0xf244, 0xf240, 0xf242, 0xf243, 0xf241, 0xf54b, 0xf21e, 0xf1e6, 0xf54b, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf069, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf029, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf201, 0xf06e, 0xf015, 0xf072`
34+
range: `0xf293, 0xf294, 0xf244, 0xf240, 0xf242, 0xf243, 0xf241, 0xf54b, 0xf21e, 0xf1e6, 0xf54b, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf069, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf029, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf201, 0xf06e, 0xf015`
3535
* Fix an error in the font conversion.
3636

3737
Replace the following:

src/displayapp/fonts/jetbrains_mono_bold_20.c

Lines changed: 30 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -840,16 +840,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
840840
0xf8, 0xf, 0x80, 0xf8, 0x3e, 0x0, 0xff, 0xf0,
841841
0x0, 0x3f, 0x80, 0x0,
842842

843-
/* U+F072 "" */
844-
0x1, 0xc0, 0x0, 0x7, 0xc0, 0x0, 0x7, 0x80,
845-
0x0, 0xf, 0x80, 0x0, 0x1f, 0x0, 0x0, 0x1f,
846-
0x0, 0x38, 0x3e, 0x0, 0x78, 0x7e, 0x0, 0x7f,
847-
0xff, 0xe0, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xf3,
848-
0xff, 0xff, 0xe7, 0xff, 0xff, 0xdf, 0xff, 0xfc,
849-
0x3c, 0x3f, 0x0, 0x70, 0x7c, 0x0, 0x1, 0xf0,
850-
0x0, 0x3, 0xe0, 0x0, 0x7, 0x80, 0x0, 0xf,
851-
0x0, 0x0, 0x1c, 0x0, 0x0,
852-
853843
/* U+F095 "" */
854844
0x0, 0x0, 0x0, 0x0, 0x3e, 0x0, 0x7, 0xf0,
855845
0x0, 0x7f, 0x0, 0x7, 0xf0, 0x0, 0xff, 0x0,
@@ -1230,32 +1220,31 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
12301220
{.bitmap_index = 3027, .adv_w = 280, .box_w = 13, .box_h = 17, .ofs_x = 2, .ofs_y = -1},
12311221
{.bitmap_index = 3055, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3},
12321222
{.bitmap_index = 3103, .adv_w = 360, .box_w = 23, .box_h = 15, .ofs_x = 0, .ofs_y = 0},
1233-
{.bitmap_index = 3147, .adv_w = 360, .box_w = 23, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
1234-
{.bitmap_index = 3208, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
1235-
{.bitmap_index = 3261, .adv_w = 120, .box_w = 8, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
1236-
{.bitmap_index = 3280, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3},
1237-
{.bitmap_index = 3330, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
1238-
{.bitmap_index = 3366, .adv_w = 320, .box_w = 20, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
1239-
{.bitmap_index = 3414, .adv_w = 320, .box_w = 21, .box_h = 15, .ofs_x = 0, .ofs_y = 0},
1240-
{.bitmap_index = 3454, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
1241-
{.bitmap_index = 3497, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
1242-
{.bitmap_index = 3535, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
1243-
{.bitmap_index = 3573, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
1244-
{.bitmap_index = 3611, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
1245-
{.bitmap_index = 3649, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
1246-
{.bitmap_index = 3687, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
1247-
{.bitmap_index = 3723, .adv_w = 280, .box_w = 15, .box_h = 20, .ofs_x = 1, .ofs_y = -3},
1248-
{.bitmap_index = 3761, .adv_w = 200, .box_w = 11, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
1249-
{.bitmap_index = 3790, .adv_w = 280, .box_w = 16, .box_h = 19, .ofs_x = 1, .ofs_y = -2},
1250-
{.bitmap_index = 3828, .adv_w = 400, .box_w = 25, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
1251-
{.bitmap_index = 3894, .adv_w = 360, .box_w = 23, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
1252-
{.bitmap_index = 3943, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -2},
1253-
{.bitmap_index = 3993, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
1254-
{.bitmap_index = 4053, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
1255-
{.bitmap_index = 4106, .adv_w = 360, .box_w = 23, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
1256-
{.bitmap_index = 4167, .adv_w = 360, .box_w = 22, .box_h = 20, .ofs_x = 0, .ofs_y = -2},
1257-
{.bitmap_index = 4222, .adv_w = 360, .box_w = 22, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
1258-
{.bitmap_index = 4275, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = 0}
1223+
{.bitmap_index = 3147, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
1224+
{.bitmap_index = 3200, .adv_w = 120, .box_w = 8, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
1225+
{.bitmap_index = 3219, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3},
1226+
{.bitmap_index = 3269, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
1227+
{.bitmap_index = 3305, .adv_w = 320, .box_w = 20, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
1228+
{.bitmap_index = 3353, .adv_w = 320, .box_w = 21, .box_h = 15, .ofs_x = 0, .ofs_y = 0},
1229+
{.bitmap_index = 3393, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
1230+
{.bitmap_index = 3436, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
1231+
{.bitmap_index = 3474, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
1232+
{.bitmap_index = 3512, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
1233+
{.bitmap_index = 3550, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
1234+
{.bitmap_index = 3588, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1},
1235+
{.bitmap_index = 3626, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
1236+
{.bitmap_index = 3662, .adv_w = 280, .box_w = 15, .box_h = 20, .ofs_x = 1, .ofs_y = -3},
1237+
{.bitmap_index = 3700, .adv_w = 200, .box_w = 11, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
1238+
{.bitmap_index = 3729, .adv_w = 280, .box_w = 16, .box_h = 19, .ofs_x = 1, .ofs_y = -2},
1239+
{.bitmap_index = 3767, .adv_w = 400, .box_w = 25, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
1240+
{.bitmap_index = 3833, .adv_w = 360, .box_w = 23, .box_h = 17, .ofs_x = 0, .ofs_y = -1},
1241+
{.bitmap_index = 3882, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -2},
1242+
{.bitmap_index = 3932, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
1243+
{.bitmap_index = 3992, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
1244+
{.bitmap_index = 4045, .adv_w = 360, .box_w = 23, .box_h = 21, .ofs_x = 0, .ofs_y = -3},
1245+
{.bitmap_index = 4106, .adv_w = 360, .box_w = 22, .box_h = 20, .ofs_x = 0, .ofs_y = -2},
1246+
{.bitmap_index = 4161, .adv_w = 360, .box_w = 22, .box_h = 19, .ofs_x = 0, .ofs_y = -2},
1247+
{.bitmap_index = 4214, .adv_w = 320, .box_w = 20, .box_h = 15, .ofs_x = 0, .ofs_y = 0}
12591248
};
12601249

12611250
/*---------------------
@@ -1264,11 +1253,10 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
12641253

12651254
static const uint16_t unicode_list_2[] = {
12661255
0x0, 0x14, 0x16, 0x23, 0x26, 0x27, 0x28, 0x39,
1267-
0x47, 0x4a, 0x4b, 0x4c, 0x50, 0x68, 0x6d, 0x71,
1268-
0x94, 0x128, 0x184, 0x1e5, 0x1fb, 0x200, 0x21d, 0x23f,
1269-
0x240, 0x241, 0x242, 0x243, 0x251, 0x292, 0x293, 0x2f1,
1270-
0x3dc, 0x3fc, 0x45c, 0x54a, 0x55f, 0x568, 0x59e, 0x59f,
1271-
0x6a8
1256+
0x47, 0x4a, 0x4b, 0x4c, 0x50, 0x68, 0x6d, 0x94,
1257+
0x128, 0x184, 0x1e5, 0x1fb, 0x200, 0x21d, 0x23f, 0x240,
1258+
0x241, 0x242, 0x243, 0x251, 0x292, 0x293, 0x2f1, 0x3dc,
1259+
0x3fc, 0x45c, 0x54a, 0x55f, 0x568, 0x59e, 0x59f, 0x6a8
12721260
};
12731261

12741262
/*Collect the unicode lists and glyph_id offsets*/
@@ -1284,7 +1272,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] =
12841272
},
12851273
{
12861274
.range_start = 61441, .range_length = 1705, .glyph_id_start = 160,
1287-
.unicode_list = unicode_list_2, .glyph_id_ofs_list = NULL, .list_length = 41, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY
1275+
.unicode_list = unicode_list_2, .glyph_id_ofs_list = NULL, .list_length = 40, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY
12881276
}
12891277
};
12901278

src/displayapp/screens/BleIcon.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
#include "displayapp/screens/Symbols.h"
33
using namespace Pinetime::Applications::Screens;
44

5-
const char* BleIcon::GetIcon(bool isRadioEnabled, bool isConnected) {
6-
if(!isRadioEnabled) {
7-
return Symbols::airplane;
8-
}
9-
5+
const char* BleIcon::GetIcon(bool isConnected) {
106
if (isConnected) {
117
return Symbols::bluetooth;
128
}

src/displayapp/screens/BleIcon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Pinetime {
77
namespace Screens {
88
class BleIcon {
99
public:
10-
static const char* GetIcon(bool isRadioEnabled, bool isConnected);
10+
static const char* GetIcon(bool isConnected);
1111
};
1212
}
1313
}

src/displayapp/screens/PineTimeStyle.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,10 @@ void PineTimeStyle::SetBatteryIcon() {
345345

346346

347347
void PineTimeStyle::AlignIcons() {
348-
bool isBleIconVisible = IsBleIconVisible(bleRadioEnabled.Get(), bleState.Get());
349-
if (notificationState.Get() && isBleIconVisible) {
348+
if (notificationState.Get() && bleState.Get()) {
350349
lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 8, 25);
351350
lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, -8, 25);
352-
} else if (notificationState.Get() && !isBleIconVisible) {
351+
} else if (notificationState.Get() && !bleState.Get()) {
353352
lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25);
354353
} else {
355354
lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25);
@@ -375,7 +374,7 @@ void PineTimeStyle::Refresh() {
375374
bleState = bleController.IsConnected();
376375
bleRadioEnabled = bleController.IsRadioEnabled();
377376
if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) {
378-
lv_label_set_text(bleIcon, BleIcon::GetIcon(bleRadioEnabled.Get(), bleState.Get()));
377+
lv_label_set_text(bleIcon, BleIcon::GetIcon(bleState.Get()));
379378
AlignIcons();
380379
}
381380

src/displayapp/screens/Symbols.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ namespace Pinetime {
4444
static constexpr const char* chartLine = "\xEF\x88\x81";
4545
static constexpr const char* eye = "\xEF\x81\xAE";
4646
static constexpr const char* home = "\xEF\x80\x95";
47-
static constexpr const char* airplane = "\xEF\x81\xB2";
4847

4948
// lv_font_sys_48.c
5049
static constexpr const char* settings = "\xEE\xA4\x82"; // e902

0 commit comments

Comments
 (0)