Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Casio weather #15

Open
wants to merge 17 commits into
base: casio_weather_1.15
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: tests/test-format.sh

- name: Upload patches
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: Patches
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,22 @@ jobs:
ref_name: ${{ github.head_ref || github.ref_name }}
run: echo "REF_NAME=${ref_name//\//-}" >> $GITHUB_ENV
- name: Upload DFU artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: InfiniTime DFU ${{ env.REF_NAME }}
path: ./build/output/pinetime-mcuboot-app-dfu/*
- name: Upload MCUBoot image artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: InfiniTime MCUBoot image ${{ env.REF_NAME }}
path: ./build/output/pinetime-mcuboot-app-image-*.bin
- name: Upload standalone ELF artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: InfiniTime image ${{ env.REF_NAME }}
path: ./build/output/src/pinetime-app-*.out
- name: Upload resources artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: InfiniTime resources ${{ env.REF_NAME }}
path: ./build/output/infinitime-resources-*.zip
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
cmake --build build_lv_sim

- name: Upload simulator executable
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: infinisim-${{ env.REF_NAME }}
path: build_lv_sim/infinisim
Expand Down Expand Up @@ -208,7 +208,7 @@ jobs:
EOF

- name: Upload comment
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: comment
path: comment
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@ src/arm-none-eabi

# clangd
.cache/

node_modules/
1 change: 0 additions & 1 deletion src/components/alarm/AlarmController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ uint32_t AlarmController::SecondsToAlarm() const {

void AlarmController::DisableAlarm() {
xTimerStop(alarmTimer, 0);
isAlerting = false;
if (alarm.isEnabled) {
alarm.isEnabled = false;
alarmChanged = true;
Expand Down
30 changes: 30 additions & 0 deletions src/components/settings/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ namespace Pinetime {
PTSWeather weatherEnable = PTSWeather::Off;
};

enum class CasioWeatherSegment : uint8_t { WeekNumber, DayCounter, DayOfWeek };

struct CasioStyleG7710 {
PTSWeather weatherEnable = PTSWeather::Off;
CasioWeatherSegment weatherSegment = CasioWeatherSegment::DayCounter;
};

struct WatchFaceInfineat {
bool showSideCover = true;
int colorIndex = 0;
Expand Down Expand Up @@ -154,6 +161,27 @@ namespace Pinetime {
return settings.PTS.weatherEnable;
};

void SetCasioWeather(PTSWeather weatherEnable) {
if (weatherEnable != settings.casio.weatherEnable)
settingsChanged = true;
settings.casio.weatherEnable = weatherEnable;
}

PTSWeather GetCasioWeather() const {
return settings.casio.weatherEnable;
}

void SetCasioWeatherSegment(CasioWeatherSegment weatherSegment) {
if (weatherSegment != settings.casio.weatherSegment)
settingsChanged = true;

settings.casio.weatherSegment = weatherSegment;
}

CasioWeatherSegment GetCasioWeatherSegment() const {
return settings.casio.weatherSegment;
}

void SetAppMenu(uint8_t menu) {
appMenu = menu;
};
Expand Down Expand Up @@ -319,6 +347,8 @@ namespace Pinetime {

PineTimeStyle PTS;

CasioStyleG7710 casio;

WatchFaceInfineat watchFaceInfineat;

std::bitset<5> wakeUpMode {0};
Expand Down
4 changes: 3 additions & 1 deletion src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
settingsController,
batteryController,
bleController,
alarmController,
dateTimeController,
filesystem,
std::move(apps));
Expand Down Expand Up @@ -580,7 +581,8 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
brightnessController,
motorController,
settingsController,
bleController);
bleController,
alarmController);
break;
case Apps::Settings:
currentScreen = std::make_unique<Screens::Settings>(this, settingsController);
Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/apps/Apps.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace Pinetime {
PineTimeStyle,
Terminal,
Infineat,
CasioStyleG7710,
CasioStyleG7710
};

template <Apps>
Expand Down
12 changes: 10 additions & 2 deletions src/displayapp/screens/Alarm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Alarm::Alarm(Controllers::AlarmController& alarmController,
btnStop = lv_btn_create(lv_scr_act(), nullptr);
btnStop->user_data = this;
lv_obj_set_event_cb(btnStop, btnEventHandler);
lv_obj_set_size(btnStop, 115, 50);
lv_obj_set_size(btnStop, 240, 70);
lv_obj_align(btnStop, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
lv_obj_set_style_local_bg_color(btnStop, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED);
txtStop = lv_label_create(btnStop, nullptr);
Expand Down Expand Up @@ -203,6 +203,10 @@ void Alarm::UpdateAlarmTime() {

void Alarm::SetAlerting() {
lv_obj_set_hidden(enableSwitch, true);
lv_obj_set_hidden(btnRecur, true);
lv_obj_set_hidden(btnInfo, true);
hourCounter.HideControls();
minuteCounter.HideControls();
lv_obj_set_hidden(btnStop, false);
taskStopAlarm = lv_task_create(StopAlarmTaskCallback, pdMS_TO_TICKS(60 * 1000), LV_TASK_PRIO_MID, this);
motorController.StartRinging();
Expand All @@ -218,8 +222,12 @@ void Alarm::StopAlerting() {
taskStopAlarm = nullptr;
}
wakeLock.Release();
lv_obj_set_hidden(enableSwitch, false);
lv_obj_set_hidden(btnStop, true);
hourCounter.ShowControls();
minuteCounter.ShowControls();
lv_obj_set_hidden(btnInfo, false);
lv_obj_set_hidden(btnRecur, false);
lv_obj_set_hidden(enableSwitch, false);
}

void Alarm::SetSwitchState(lv_anim_enable_t anim) {
Expand Down
3 changes: 3 additions & 0 deletions src/displayapp/screens/ApplicationList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ ApplicationList::ApplicationList(DisplayApp* app,
Pinetime::Controllers::Settings& settingsController,
const Pinetime::Controllers::Battery& batteryController,
const Pinetime::Controllers::Ble& bleController,
const Pinetime::Controllers::AlarmController& alarmController,
Controllers::DateTime& dateTimeController,
Pinetime::Controllers::FS& filesystem,
std::array<Tile::Applications, UserAppTypes::Count>&& apps)
: app {app},
settingsController {settingsController},
batteryController {batteryController},
bleController {bleController},
alarmController {alarmController},
dateTimeController {dateTimeController},
filesystem {filesystem},
apps {std::move(apps)},
Expand Down Expand Up @@ -59,6 +61,7 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen(unsigned int screenNum) co
settingsController,
batteryController,
bleController,
alarmController,
dateTimeController,
pageApps);
}
2 changes: 2 additions & 0 deletions src/displayapp/screens/ApplicationList.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace Pinetime {
Pinetime::Controllers::Settings& settingsController,
const Pinetime::Controllers::Battery& batteryController,
const Pinetime::Controllers::Ble& bleController,
const Pinetime::Controllers::AlarmController& alarmController,
Controllers::DateTime& dateTimeController,
Pinetime::Controllers::FS& filesystem,
std::array<Tile::Applications, UserAppTypes::Count>&& apps);
Expand All @@ -32,6 +33,7 @@ namespace Pinetime {
Controllers::Settings& settingsController;
const Pinetime::Controllers::Battery& batteryController;
const Pinetime::Controllers::Ble& bleController;
const Pinetime::Controllers::AlarmController& alarmController;
Controllers::DateTime& dateTimeController;
Pinetime::Controllers::FS& filesystem;
std::array<Tile::Applications, UserAppTypes::Count> apps;
Expand Down
6 changes: 5 additions & 1 deletion src/displayapp/screens/Tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ Tile::Tile(uint8_t screenID,
Controllers::Settings& settingsController,
const Controllers::Battery& batteryController,
const Controllers::Ble& bleController,
const Controllers::AlarmController& alarmController,
Controllers::DateTime& dateTimeController,
std::array<Applications, 6>& applications)
: app {app}, dateTimeController {dateTimeController}, pageIndicator(screenID, numScreens), statusIcons(batteryController, bleController) {
: app {app},
dateTimeController {dateTimeController},
pageIndicator(screenID, numScreens),
statusIcons(batteryController, bleController, alarmController) {

settingsController.SetAppMenu(screenID);

Expand Down
1 change: 1 addition & 0 deletions src/displayapp/screens/Tile.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace Pinetime {
Controllers::Settings& settingsController,
const Controllers::Battery& batteryController,
const Controllers::Ble& bleController,
const Controllers::AlarmController& alarmController,
Controllers::DateTime& dateTimeController,
std::array<Applications, 6>& applications);

Expand Down
Loading