Compare commits
10 commits
ef88e8165c
...
2625ed39e5
Author | SHA1 | Date | |
---|---|---|---|
|
2625ed39e5 | ||
|
a3dbcd62f6 | ||
|
4fddf93114 | ||
|
83922fb3de | ||
|
95917c65a5 | ||
|
3a0d673df4 | ||
|
53dc9dafe7 | ||
|
a407902b06 | ||
|
3e8accde69 | ||
|
2bb611db8e |
5
.github/workflows/main.yml
vendored
|
@ -56,6 +56,11 @@ jobs:
|
|||
with:
|
||||
name: InfiniTime MCUBoot image ${{ github.head_ref }}
|
||||
path: ./build/output/pinetime-mcuboot-app-image-*.bin
|
||||
- name: Upload standalone ELF artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: InfiniTime image ${{ github.head_ref }}
|
||||
path: ./build/output/src/pinetime-app-*.out
|
||||
- name: Upload resources artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
|
|
|
@ -9,6 +9,8 @@ Fast open-source firmware for the [PineTime smartwatch](https://pine64.org/devic
|
|||
- [Getting started with InfiniTime](doc/gettingStarted/gettingStarted-1.0.md)
|
||||
- [Updating the software](doc/gettingStarted/updating-software.md)
|
||||
- [About the firmware and bootloader](doc/gettingStarted/about-software.md)
|
||||
- [Available apps](doc/gettingStarted/Applications.md)
|
||||
- [Available watch faces](/doc/gettingStarted/Watchfaces.md)
|
||||
- [PineTimeStyle Watch face](https://pine64.org/documentation/PineTime/Watchfaces/PineTimeStyle)
|
||||
- [Weather integration](https://pine64.org/documentation/PineTime/Software/InfiniTime_weather/)
|
||||
|
||||
|
@ -35,7 +37,7 @@ Fast open-source firmware for the [PineTime smartwatch](https://pine64.org/devic
|
|||
|
||||
### Contributing
|
||||
|
||||
- [How to contribute?](CONTRIBUTING.md)
|
||||
- [How to contribute](CONTRIBUTING.md)
|
||||
- [Coding conventions](doc/coding-convention.md)
|
||||
|
||||
### Build, flash and debug
|
||||
|
|
99
doc/gettingStarted/Applications.md
Normal file
|
@ -0,0 +1,99 @@
|
|||
# Applications
|
||||
|
||||
InfiniTime has 13 apps on the `main` branch at the time of writing.
|
||||
|
||||
## List of apps
|
||||
- Stopwatch
|
||||
- Alarm
|
||||
- Timer
|
||||
- Steps
|
||||
- Heartrate
|
||||
- Music
|
||||
- InfiniPaint
|
||||
- Paddle
|
||||
- 2
|
||||
- InfiniDice
|
||||
- Metronome
|
||||
- Maps
|
||||
- Weather
|
||||
|
||||
### Stopwatch
|
||||
![Stopwatch UI](/doc/gettingStarted/AppsScreenshots/stopwatch.png)
|
||||
- Press the Start button (bottom right) to start or stop the timer.
|
||||
- You can also press the side button while the timer is running to pause the timer.
|
||||
- Press the Flag button (bottom left) to add a lap.
|
||||
- The stopwatch will not yet continue counting time while the app is closed.
|
||||
|
||||
### Alarm
|
||||
![Alarm UI](/doc/gettingStarted/AppsScreenshots/alarm.png)
|
||||
- Ajust the time with the time picker.
|
||||
- Press the Info button in the top middle to see time remaning.
|
||||
- Use the toggle in the bottom left to turn the alarm on/off.
|
||||
- Use the button in the bottom right to change the alarm frequency.
|
||||
- You can choose between once, daily, or Monday - Friday.
|
||||
|
||||
### Timer
|
||||
![Timer UI](/doc/gettingStarted/AppsScreenshots/timer.png)
|
||||
- Ajust how long the timer should go for with the time picker.
|
||||
- Press the Start button at the bottom to start/stop the timer.
|
||||
|
||||
### Steps
|
||||
![Steps UI](/doc/gettingStarted/AppsScreenshots/steps.png)
|
||||
- The total count of steps for the current display will show in the middle of the screen.
|
||||
- The Reset button in the bottom middle resets the Trip counter. (Total of all steps taken.)
|
||||
- The progress circle shows the percentage of your daily goal completed.
|
||||
|
||||
### Heartrate
|
||||
![Heartrate UI](/doc/gettingStarted/AppsScreenshots/Heartrate.png)
|
||||
- Press Start to start measuring your heartrate.
|
||||
- It may take a bit to get the first measurement.
|
||||
|
||||
### Music
|
||||
![Music UI](/doc/gettingStarted/AppsScreenshots/Music.png)
|
||||
- This app shows currently playing music.
|
||||
- Please note that this app is not very useful without a device connected.
|
||||
- Press the button in the center to play/pause, and the buttons on the left and right to go to the previous and next tracks, respectively.
|
||||
- Swipe up to get to volume controls.
|
||||
|
||||
### InfiniPaint
|
||||
![InfiniPaint UI](/doc/gettingStarted/AppsScreenshots/Paint.png)
|
||||
- This app does not allow you to swipe from the top to exit, use the side button instead.
|
||||
- Draw on the screen to add lines.
|
||||
- Hold down in one spot to change paint colors.
|
||||
|
||||
### Paddle
|
||||
![Paddle UI](/doc/gettingStarted/AppsScreenshots/Pong.png)
|
||||
- This app does not allow you to swipe from the top to exit, use the side button instead.
|
||||
- Drag your finger to move the paddle.
|
||||
- Goal: Don't let the ball go off the left side of the screen.
|
||||
|
||||
### 2
|
||||
![2 UI](/doc/gettingStarted/AppsScreenshots/2048.png)
|
||||
- This app does not allow you to swipe from the top to exit, use the side button instead.
|
||||
- Play a game of 2048.
|
||||
- Swipe up, down, left, or right tomove the tiles.
|
||||
- When two tiles with the same number run into each other, they will add together.
|
||||
- Goal: Don't let the screen fill up with tiles, and get to the 2048 tile to win.
|
||||
|
||||
### InfiniDice
|
||||
![InfiniDice UI](/doc/gettingStarted/AppsScreenshots/Dice.png)
|
||||
- Ajust the count to change the number of dice.
|
||||
- Ajust the sides to change the number of sides.
|
||||
- Press the button at the bottom to roll.
|
||||
- The result will be on the right side of the screen.
|
||||
|
||||
### Metronome
|
||||
![Metronome UI](/doc/gettingStarted/AppsScreenshots/Metronome.png)
|
||||
- Ajust the BPM with the circular slider.
|
||||
- A bug currently makes it always snap to 98 BPM.
|
||||
- Use the button in the bottom left to start the metronome.
|
||||
|
||||
### Maps
|
||||
![Maps UI](/doc/gettingStarted/AppsScreenshots/Maps.png)
|
||||
- This app shows info from a navigation app.
|
||||
- Please note that this app is not very useful without a device connected.
|
||||
|
||||
### Weather
|
||||
![Weather UI](/doc/gettingStarted/AppsScreenshots/Weather.png)
|
||||
- This app shows weather info.
|
||||
- Please note that this app is not very useful without a device connected.
|
BIN
doc/gettingStarted/AppsScreenshots/2048.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
doc/gettingStarted/AppsScreenshots/Dice.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
doc/gettingStarted/AppsScreenshots/Heartrate.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
doc/gettingStarted/AppsScreenshots/Maps.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
doc/gettingStarted/AppsScreenshots/Metronome.png
Normal file
After Width: | Height: | Size: 8.8 KiB |
BIN
doc/gettingStarted/AppsScreenshots/Music.png
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
doc/gettingStarted/AppsScreenshots/Paint.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
doc/gettingStarted/AppsScreenshots/Pong.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
doc/gettingStarted/AppsScreenshots/Weather.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
doc/gettingStarted/AppsScreenshots/alarm.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
doc/gettingStarted/AppsScreenshots/steps.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
doc/gettingStarted/AppsScreenshots/stopwatch.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
doc/gettingStarted/AppsScreenshots/timer.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
31
doc/gettingStarted/Watchfaces.md
Normal file
|
@ -0,0 +1,31 @@
|
|||
# Watchfaces
|
||||
|
||||
InfiniTime has 6 apps on the `main` branch at the time of writing.
|
||||
|
||||
## List of apps
|
||||
- Digital
|
||||
- Analog
|
||||
- PineTimeStyle
|
||||
- Terminal
|
||||
- Infinineat
|
||||
- Casio G7710
|
||||
|
||||
### Digital
|
||||
![Digital face](/doc/gettingStarted/Watchfaces/Digital.png)
|
||||
|
||||
### Analog
|
||||
![Analog face](/doc/gettingStarted/Watchfaces/Analog.png)
|
||||
|
||||
### PineTimeStyle
|
||||
![PineTimeStyle face](/doc/gettingStarted/Watchfaces/PineTimeStyle.png)
|
||||
- You can long-press on the display to change colors, step style, and weather.
|
||||
|
||||
### Terminal
|
||||
![Terminal face](/doc/gettingStarted/Watchfaces/Terminal.png)
|
||||
|
||||
### Infinineat
|
||||
![Infinineat face](/doc/gettingStarted/Watchfaces/Infinineat.png)
|
||||
- You can long-press on the display to change colors.
|
||||
|
||||
### Casio G7710
|
||||
![Casio G7710 face](/doc/gettingStarted/Watchfaces/CasioG7710.png)
|
BIN
doc/gettingStarted/Watchfaces/Analog.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
doc/gettingStarted/Watchfaces/CasioG7710.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
doc/gettingStarted/Watchfaces/Digital.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
doc/gettingStarted/Watchfaces/Infinineat.png
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
doc/gettingStarted/Watchfaces/PineTimeStyle.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
doc/gettingStarted/Watchfaces/Terminal.png
Normal file
After Width: | Height: | Size: 6 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 127 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 87 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 104 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 124 KiB |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 256 KiB |
|
@ -14,7 +14,7 @@ You can sync the time using companion apps.
|
|||
|
||||
- Gadgetbridge automatically synchronizes the time when you connect it to your watch. More information on Gadgetbridge [here](/doc/gettingStarted/ota-gadgetbridge.md)
|
||||
- [Sync the time with NRFConnect](/doc/gettingStarted/time-nrfconnect.md)
|
||||
- Sync the time with your browser https://hubmartin.github.io/WebBLEWatch/
|
||||
- [Sync the time with your browser](https://hubmartin.github.io/WebBLEWatch/)
|
||||
|
||||
You can also set the time in the settings without a companion app. (version >1.7.0)
|
||||
|
||||
|
@ -46,7 +46,7 @@ On the bottom right, you can see how many steps you have taken today.
|
|||
![Settings](ui/settings.jpg)
|
||||
|
||||
- Swipe **up** to display the application menus. Apps (stopwatch, music, step, games,...) can be started from this menu.
|
||||
- Swipe **down** to display the notification panel. Notification sent by your companion app will be displayed here.
|
||||
- Swipe **down** to display the notification panel. Notifications sent by your companion app will be displayed here.
|
||||
- Swipe **right** to display the Quick Actions menu. This menu allows you to
|
||||
- Set the brightness of the display
|
||||
- Start the **flashlight** app
|
||||
|
|
|
@ -1,29 +1,35 @@
|
|||
# Connecting to Gadgetbridge
|
||||
|
||||
Launch Gadgetbridge and tap on the **"+"** button on the bottom right to add a new device:
|
||||
Launch Gadgetbridge and tap on the menu button in the top left:
|
||||
|
||||
![Gadgetbridge 0](gadgetbridge0.jpg)
|
||||
|
||||
Wait for the scan to complete, your PineTime should be detected:
|
||||
Press the "Connect new device" button:
|
||||
|
||||
![Gadgetbridge 1](gadgetbridge1.jpg)
|
||||
|
||||
Your PineTime should appear on the list. Tap on it.
|
||||
|
||||
Tap on it. Gadgdetbridge will pair and connect to your device:
|
||||
|
||||
![Gadgetbridge 2](gadgetbridge2.jpg)
|
||||
|
||||
# Updating with Gadgetbridge
|
||||
|
||||
Now that Gadgetbridge is connected to your PineTime, use a file browser application and find the DFU file (`pinetime-mcuboot-app-dfu-x.x.x.zip`) you downloaded previously. Tap on it and open it using the Gadgetbridge application/firmware installer:
|
||||
Now that Gadgetbridge is connected to your PineTime, press the three dots on the device card:
|
||||
|
||||
![Gadgetbridge 3](gadgetbridge3.jpg)
|
||||
|
||||
Read the warning carefully and tap **Install**:
|
||||
Now press the "File Installer" button:
|
||||
|
||||
![Gadgetbridge 4](gadgetbridge4.jpg)
|
||||
|
||||
Wait for the transfer to finish. Your PineTime should reset and reboot with the new version of InfiniTime!
|
||||
|
||||
Don't forget to **validate** your firmware. In the InfiniTime go to the settings (swipe right, select gear icon) and Firmware option and click **validate**. Otherwise after reboot the previous firmware will be used.
|
||||
Select the firmware you downloaded (`pinetime-mcuboot-app-dfu-x.x.x.zip`) from the [Releases tab](https://github.com/InfiniTimeOrg/InfiniTime/releases/latest):
|
||||
|
||||
![Gadgetbridge 5](gadgetbridge5.jpg)
|
||||
|
||||
Wait for the transfer to finish. There will be a progress bar on both the watch and the phone. Your PineTime should reboot with the new version of InfiniTime!
|
||||
|
||||
Don't forget to **validate** your firmware. In the InfiniTime go to the settings (swipe right, select gear icon) and scroll to the Firmware option and click **validate**. Otherwise, after reboot the previous firmware will be used.
|
||||
|
||||
![Validate](validate.png)
|
||||
|
|
|
@ -6,7 +6,7 @@ If you just want to flash or upgrade InfiniTime on your PineTime, this page is f
|
|||
|
||||
You can check the InfiniTime version by first swiping right on the watch face to open quick settings, tapping the cogwheel to open settings, swipe up until you find an entry named "About" and tap on it.
|
||||
|
||||
![InfiniTime 1.0 version](version-1.0.jpg)
|
||||
![InfiniTime 1.14 version](version.png)
|
||||
|
||||
PineTimes shipped after June 2021 will ship with the latest version of [the bootloader](https://github.com/JF002/pinetime-mcuboot-bootloader/releases/tag/1.0.0) and [recovery firmware](https://github.com/InfiniTimeOrg/InfiniTime/releases/tag/0.14.1)
|
||||
|
||||
|
@ -49,7 +49,7 @@ Since those resources are not part of the firmware, they need to be flashed and
|
|||
Resources are packaged into a single .zip file named `infinitime-resources-x.y.z.zip` (where `x`, `y` and `z` are the version numbers of InfiniTime).
|
||||
You can use the companion app of your choice to flash the resources.
|
||||
|
||||
**Note : at the time of writing this page, [Amazfish](https://github.com/piggz/harbour-amazfish) and [ITD](https://gitea.arsenm.dev/Arsen6331/itd) have already integrated this functionality. Other companion apps will hopefully implement it soon!*
|
||||
**Note: at the time of writing this page, [Amazfish](https://github.com/piggz/harbour-amazfish) and [ITD](https://gitea.arsenm.dev/Arsen6331/itd) have already integrated this functionality. Other companion apps will hopefully implement it soon!*
|
||||
|
||||
## Amazfish
|
||||
Use the `Download file` functionality of Amazfish.
|
||||
|
|
BIN
doc/gettingStarted/validate.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
doc/gettingStarted/version.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
|
@ -77,6 +77,10 @@ namespace Pinetime {
|
|||
uint16_t ComputeCrc(uint8_t const* p_data, uint32_t size, uint16_t const* p_crc);
|
||||
};
|
||||
|
||||
static constexpr ble_uuid128_t serviceUuid {
|
||||
.u {.type = BLE_UUID_TYPE_128},
|
||||
.value = {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x30, 0x15, 0x00, 0x00}};
|
||||
|
||||
private:
|
||||
Pinetime::System::SystemTask& systemTask;
|
||||
Pinetime::Controllers::Ble& bleController;
|
||||
|
@ -90,10 +94,6 @@ namespace Pinetime {
|
|||
|
||||
uint16_t revision {0x0008};
|
||||
|
||||
static constexpr ble_uuid128_t serviceUuid {
|
||||
.u {.type = BLE_UUID_TYPE_128},
|
||||
.value = {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x30, 0x15, 0x00, 0x00}};
|
||||
|
||||
static constexpr ble_uuid128_t packetCharacteristicUuid {
|
||||
.u {.type = BLE_UUID_TYPE_128},
|
||||
.value = {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x32, 0x15, 0x00, 0x00}};
|
||||
|
|
|
@ -21,14 +21,14 @@ namespace Pinetime {
|
|||
void SubscribeNotification(uint16_t attributeHandle);
|
||||
void UnsubscribeNotification(uint16_t attributeHandle);
|
||||
|
||||
static constexpr uint16_t heartRateServiceId {0x180D};
|
||||
static constexpr ble_uuid16_t heartRateServiceUuid {.u {.type = BLE_UUID_TYPE_16}, .value = heartRateServiceId};
|
||||
|
||||
private:
|
||||
NimbleController& nimble;
|
||||
Controllers::HeartRateController& heartRateController;
|
||||
static constexpr uint16_t heartRateServiceId {0x180D};
|
||||
static constexpr uint16_t heartRateMeasurementId {0x2A37};
|
||||
|
||||
static constexpr ble_uuid16_t heartRateServiceUuid {.u {.type = BLE_UUID_TYPE_16}, .value = heartRateServiceId};
|
||||
|
||||
static constexpr ble_uuid16_t heartRateMeasurementUuid {.u {.type = BLE_UUID_TYPE_16}, .value = heartRateMeasurementId};
|
||||
|
||||
struct ble_gatt_chr_def characteristicDefinition[2];
|
||||
|
|
|
@ -158,7 +158,10 @@ void NimbleController::StartAdvertising() {
|
|||
}
|
||||
|
||||
fields.flags = BLE_HS_ADV_F_DISC_GEN | BLE_HS_ADV_F_BREDR_UNSUP;
|
||||
fields.uuids128 = &dfuServiceUuid;
|
||||
fields.uuids16 = &HeartRateService::heartRateServiceUuid;
|
||||
fields.num_uuids16 = 1;
|
||||
fields.uuids16_is_complete = 1;
|
||||
fields.uuids128 = &DfuService::serviceUuid;
|
||||
fields.num_uuids128 = 1;
|
||||
fields.uuids128_is_complete = 1;
|
||||
fields.tx_pwr_lvl = BLE_HS_ADV_TX_PWR_LVL_AUTO;
|
||||
|
|
|
@ -112,10 +112,6 @@ namespace Pinetime {
|
|||
uint16_t connectionHandle = BLE_HS_CONN_HANDLE_NONE;
|
||||
uint8_t fastAdvCount = 0;
|
||||
uint8_t bondId[16] = {0};
|
||||
|
||||
ble_uuid128_t dfuServiceUuid {
|
||||
.u {.type = BLE_UUID_TYPE_128},
|
||||
.value = {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x30, 0x15, 0x00, 0x00}};
|
||||
};
|
||||
|
||||
static NimbleController* nptr;
|
||||
|
|
|
@ -196,14 +196,6 @@ namespace Pinetime {
|
|||
if (status != settings.notificationStatus) {
|
||||
settingsChanged = true;
|
||||
}
|
||||
// Disable always on screen while sleep mode is enabled
|
||||
if (settings.alwaysOnDisplay.enabled) {
|
||||
if (status == Notification::Sleep) {
|
||||
settings.alwaysOnDisplay.state = false;
|
||||
} else {
|
||||
settings.alwaysOnDisplay.state = true;
|
||||
}
|
||||
}
|
||||
settings.notificationStatus = status;
|
||||
};
|
||||
|
||||
|
@ -222,31 +214,19 @@ namespace Pinetime {
|
|||
return settings.screenTimeOut;
|
||||
};
|
||||
|
||||
void SetAlwaysOnDisplay(bool state) {
|
||||
if (state != settings.alwaysOnDisplay.state) {
|
||||
settingsChanged = true;
|
||||
}
|
||||
settings.alwaysOnDisplay.state = state;
|
||||
};
|
||||
|
||||
bool GetAlwaysOnDisplay() const {
|
||||
return settings.alwaysOnDisplay.state;
|
||||
return settings.alwaysOnDisplay && GetNotificationStatus() != Notification::Sleep;
|
||||
};
|
||||
|
||||
void SetAlwaysOnDisplaySetting(bool state) {
|
||||
if (state != settings.alwaysOnDisplay.enabled) {
|
||||
if (state != settings.alwaysOnDisplay) {
|
||||
settingsChanged = true;
|
||||
}
|
||||
settings.alwaysOnDisplay.enabled = state;
|
||||
|
||||
// Don't enable always on if we are currently in notification sleep
|
||||
if (GetNotificationStatus() != Notification::Sleep) {
|
||||
SetAlwaysOnDisplay(state);
|
||||
}
|
||||
settings.alwaysOnDisplay = state;
|
||||
}
|
||||
|
||||
bool GetAlwaysOnDisplaySetting() const {
|
||||
return settings.alwaysOnDisplay.enabled;
|
||||
return settings.alwaysOnDisplay;
|
||||
}
|
||||
|
||||
void SetShakeThreshold(uint16_t thresh) {
|
||||
|
@ -323,19 +303,12 @@ namespace Pinetime {
|
|||
|
||||
static constexpr uint32_t settingsVersion = 0x0008;
|
||||
|
||||
// To enable disabling it during notification sleep, differentiate between
|
||||
// the setting being on, and the setting being set by the user
|
||||
struct alwaysOnDisplayData {
|
||||
bool enabled = false;
|
||||
bool state = false;
|
||||
};
|
||||
|
||||
struct SettingsData {
|
||||
uint32_t version = settingsVersion;
|
||||
uint32_t stepsGoal = 10000;
|
||||
uint32_t screenTimeOut = 15000;
|
||||
|
||||
alwaysOnDisplayData alwaysOnDisplay;
|
||||
bool alwaysOnDisplay = false;
|
||||
|
||||
ClockType clockType = ClockType::H24;
|
||||
WeatherFormat weatherFormat = WeatherFormat::Metric;
|
||||
|
|
|
@ -81,7 +81,8 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
|
|||
Pinetime::Controllers::AlarmController& alarmController,
|
||||
Pinetime::Controllers::BrightnessController& brightnessController,
|
||||
Pinetime::Controllers::TouchHandler& touchHandler,
|
||||
Pinetime::Controllers::FS& filesystem)
|
||||
Pinetime::Controllers::FS& filesystem,
|
||||
Pinetime::Drivers::SpiNorFlash& spiNorFlash)
|
||||
: lcd {lcd},
|
||||
touchPanel {touchPanel},
|
||||
batteryController {batteryController},
|
||||
|
@ -97,6 +98,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
|
|||
brightnessController {brightnessController},
|
||||
touchHandler {touchHandler},
|
||||
filesystem {filesystem},
|
||||
spiNorFlash {spiNorFlash},
|
||||
lvgl {lcd, filesystem},
|
||||
timer(this, TimerCallback),
|
||||
controllers {batteryController,
|
||||
|
@ -154,6 +156,36 @@ void DisplayApp::InitHw() {
|
|||
lcd.Init();
|
||||
}
|
||||
|
||||
TickType_t DisplayApp::CalculateSleepTime() {
|
||||
TickType_t ticksElapsed = xTaskGetTickCount() - alwaysOnStartTime;
|
||||
// Divide both the numerator and denominator by 8 to increase the number of ticks (frames) before the overflow tick is reached
|
||||
TickType_t elapsedTarget = ROUNDED_DIV((configTICK_RATE_HZ / 8) * alwaysOnTickCount * alwaysOnRefreshPeriod, 1000 / 8);
|
||||
// ROUNDED_DIV overflows when numerator + (denominator floordiv 2) > uint32 max
|
||||
// in this case around 9 hours
|
||||
constexpr TickType_t overflowTick = (UINT32_MAX - (1000 / 16)) / ((configTICK_RATE_HZ / 8) * alwaysOnRefreshPeriod);
|
||||
|
||||
// Assumptions
|
||||
|
||||
// Tick rate is multiple of 8
|
||||
// Needed for division trick above
|
||||
static_assert(configTICK_RATE_HZ % 8 == 0);
|
||||
|
||||
// Local tick count must always wraparound before the system tick count does
|
||||
// As a static assert we can use 64 bit ints and therefore dodge overflows
|
||||
// Always on overflow time (ms) < system tick overflow time (ms)
|
||||
static_assert((uint64_t) overflowTick * (uint64_t) alwaysOnRefreshPeriod < (uint64_t) UINT32_MAX * 1000ULL / configTICK_RATE_HZ);
|
||||
|
||||
if (alwaysOnTickCount == overflowTick) {
|
||||
alwaysOnTickCount = 0;
|
||||
alwaysOnStartTime = xTaskGetTickCount();
|
||||
}
|
||||
if (elapsedTarget > ticksElapsed) {
|
||||
return elapsedTarget - ticksElapsed;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayApp::Refresh() {
|
||||
auto LoadPreviousScreen = [this]() {
|
||||
FullRefreshDirections returnDirection;
|
||||
|
@ -204,7 +236,25 @@ void DisplayApp::Refresh() {
|
|||
switch (state) {
|
||||
case States::Idle:
|
||||
if (settingsController.GetAlwaysOnDisplay()) {
|
||||
queueTimeout = lv_task_handler();
|
||||
if (!currentScreen->IsRunning()) {
|
||||
LoadPreviousScreen();
|
||||
}
|
||||
// Check we've slept long enough
|
||||
// Might not be true if the loop received an event
|
||||
// If not true, then wait that amount of time
|
||||
queueTimeout = CalculateSleepTime();
|
||||
if (queueTimeout == 0) {
|
||||
// Only advance the tick count when LVGL is done
|
||||
// Otherwise keep running the task handler while it still has things to draw
|
||||
// Note: under high graphics load, LVGL will always have more work to do
|
||||
if (lv_task_handler() > 0) {
|
||||
// Drop frames that we've missed if drawing/event handling took way longer than expected
|
||||
while (queueTimeout == 0) {
|
||||
alwaysOnTickCount += 1;
|
||||
queueTimeout = CalculateSleepTime();
|
||||
}
|
||||
};
|
||||
}
|
||||
} else {
|
||||
queueTimeout = portMAX_DELAY;
|
||||
}
|
||||
|
@ -243,12 +293,27 @@ void DisplayApp::Refresh() {
|
|||
brightnessController.Lower();
|
||||
vTaskDelay(100);
|
||||
}
|
||||
// Don't actually turn off the display for AlwaysOn mode
|
||||
// Turn brightness down (or set to AlwaysOn mode)
|
||||
if (settingsController.GetAlwaysOnDisplay()) {
|
||||
brightnessController.Set(Controllers::BrightnessController::Levels::AlwaysOn);
|
||||
lcd.LowPowerOn();
|
||||
} else {
|
||||
brightnessController.Set(Controllers::BrightnessController::Levels::Off);
|
||||
}
|
||||
// Since the active screen is not really an app, go back to Clock.
|
||||
if (currentApp == Apps::Launcher || currentApp == Apps::Notifications || currentApp == Apps::QuickSettings ||
|
||||
currentApp == Apps::Settings) {
|
||||
LoadScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None);
|
||||
// Wait for the clock app to load before moving on.
|
||||
while (!lv_task_handler()) {
|
||||
};
|
||||
}
|
||||
// Turn LCD display off (or set to low power for AlwaysOn mode)
|
||||
if (settingsController.GetAlwaysOnDisplay()) {
|
||||
lcd.LowPowerOn();
|
||||
// Record idle entry time
|
||||
alwaysOnTickCount = 0;
|
||||
alwaysOnStartTime = xTaskGetTickCount();
|
||||
} else {
|
||||
lcd.Sleep();
|
||||
}
|
||||
PushMessageToSystemTask(Pinetime::System::Messages::OnDisplayTaskSleeping);
|
||||
|
@ -550,7 +615,8 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
|
|||
bleController,
|
||||
watchdog,
|
||||
motionController,
|
||||
touchPanel);
|
||||
touchPanel,
|
||||
spiNorFlash);
|
||||
break;
|
||||
case Apps::FlashLight:
|
||||
currentScreen = std::make_unique<Screens::FlashLight>(*systemTask, brightnessController);
|
||||
|
|
|
@ -66,7 +66,8 @@ namespace Pinetime {
|
|||
Pinetime::Controllers::AlarmController& alarmController,
|
||||
Pinetime::Controllers::BrightnessController& brightnessController,
|
||||
Pinetime::Controllers::TouchHandler& touchHandler,
|
||||
Pinetime::Controllers::FS& filesystem);
|
||||
Pinetime::Controllers::FS& filesystem,
|
||||
Pinetime::Drivers::SpiNorFlash& spiNorFlash);
|
||||
void Start(System::BootErrors error);
|
||||
void PushMessage(Display::Messages msg);
|
||||
|
||||
|
@ -96,6 +97,7 @@ namespace Pinetime {
|
|||
Pinetime::Controllers::BrightnessController& brightnessController;
|
||||
Pinetime::Controllers::TouchHandler& touchHandler;
|
||||
Pinetime::Controllers::FS& filesystem;
|
||||
Pinetime::Drivers::SpiNorFlash& spiNorFlash;
|
||||
|
||||
Pinetime::Controllers::FirmwareValidator validator;
|
||||
Pinetime::Components::LittleVgl lvgl;
|
||||
|
@ -135,6 +137,13 @@ namespace Pinetime {
|
|||
Utility::StaticStack<FullRefreshDirections, returnAppStackSize> appStackDirections;
|
||||
|
||||
bool isDimmed = false;
|
||||
|
||||
TickType_t CalculateSleepTime();
|
||||
TickType_t alwaysOnTickCount;
|
||||
TickType_t alwaysOnStartTime;
|
||||
// If this is to be changed, make sure the actual always on refresh rate is changed
|
||||
// by configuring the LCD refresh timings
|
||||
static constexpr uint32_t alwaysOnRefreshPeriod = 500;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,8 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
|
|||
Pinetime::Controllers::AlarmController& /*alarmController*/,
|
||||
Pinetime::Controllers::BrightnessController& /*brightnessController*/,
|
||||
Pinetime::Controllers::TouchHandler& /*touchHandler*/,
|
||||
Pinetime::Controllers::FS& /*filesystem*/)
|
||||
Pinetime::Controllers::FS& /*filesystem*/,
|
||||
Pinetime::Drivers::SpiNorFlash& /*spiNorFlash*/)
|
||||
: lcd {lcd}, bleController {bleController} {
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace Pinetime {
|
|||
class St7789;
|
||||
class Cst816S;
|
||||
class Watchdog;
|
||||
class SpiNorFlash;
|
||||
}
|
||||
|
||||
namespace Controllers {
|
||||
|
@ -59,7 +60,8 @@ namespace Pinetime {
|
|||
Pinetime::Controllers::AlarmController& alarmController,
|
||||
Pinetime::Controllers::BrightnessController& brightnessController,
|
||||
Pinetime::Controllers::TouchHandler& touchHandler,
|
||||
Pinetime::Controllers::FS& filesystem);
|
||||
Pinetime::Controllers::FS& filesystem,
|
||||
Pinetime::Drivers::SpiNorFlash& spiNorFlash);
|
||||
void Start();
|
||||
|
||||
void Start(Pinetime::System::BootErrors) {
|
||||
|
|
|
@ -17,8 +17,8 @@ namespace {
|
|||
FirmwareValidation::FirmwareValidation(Pinetime::Controllers::FirmwareValidator& validator) : validator {validator} {
|
||||
labelVersion = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text_fmt(labelVersion,
|
||||
"Version : %lu.%lu.%lu\n"
|
||||
"ShortRef : %s",
|
||||
"Version: %lu.%lu.%lu\n"
|
||||
"ShortRef: %s",
|
||||
Version::Major(),
|
||||
Version::Minor(),
|
||||
Version::Patch(),
|
||||
|
|
|
@ -38,7 +38,8 @@ SystemInfo::SystemInfo(Pinetime::Applications::DisplayApp* app,
|
|||
const Pinetime::Controllers::Ble& bleController,
|
||||
const Pinetime::Drivers::Watchdog& watchdog,
|
||||
Pinetime::Controllers::MotionController& motionController,
|
||||
const Pinetime::Drivers::Cst816S& touchPanel)
|
||||
const Pinetime::Drivers::Cst816S& touchPanel,
|
||||
const Pinetime::Drivers::SpiNorFlash& spiNorFlash)
|
||||
: app {app},
|
||||
dateTimeController {dateTimeController},
|
||||
batteryController {batteryController},
|
||||
|
@ -47,6 +48,7 @@ SystemInfo::SystemInfo(Pinetime::Applications::DisplayApp* app,
|
|||
watchdog {watchdog},
|
||||
motionController {motionController},
|
||||
touchPanel {touchPanel},
|
||||
spiNorFlash {spiNorFlash},
|
||||
screens {app,
|
||||
0,
|
||||
{[this]() -> std::unique_ptr<Screen> {
|
||||
|
@ -186,10 +188,12 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
|
|||
lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_recolor(label, true);
|
||||
const auto& bleAddr = bleController.Address();
|
||||
auto spiFlashId = spiNorFlash.GetIdentification();
|
||||
lv_label_set_text_fmt(label,
|
||||
"#808080 BLE MAC#\n"
|
||||
" %02x:%02x:%02x:%02x:%02x:%02x"
|
||||
" %02x:%02x:%02x:%02x:%02x:%02x\n"
|
||||
"\n"
|
||||
"#808080 SPI Flash# %02x-%02x-%02x\n"
|
||||
"\n"
|
||||
"#808080 Memory heap#\n"
|
||||
" #808080 Free# %d\n"
|
||||
|
@ -202,6 +206,9 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
|
|||
bleAddr[2],
|
||||
bleAddr[1],
|
||||
bleAddr[0],
|
||||
spiFlashId.manufacturer,
|
||||
spiFlashId.type,
|
||||
spiFlashId.density,
|
||||
xPortGetFreeHeapSize(),
|
||||
xPortGetMinimumEverFreeHeapSize(),
|
||||
mallocFailedCount,
|
||||
|
|
|
@ -29,7 +29,8 @@ namespace Pinetime {
|
|||
const Pinetime::Controllers::Ble& bleController,
|
||||
const Pinetime::Drivers::Watchdog& watchdog,
|
||||
Pinetime::Controllers::MotionController& motionController,
|
||||
const Pinetime::Drivers::Cst816S& touchPanel);
|
||||
const Pinetime::Drivers::Cst816S& touchPanel,
|
||||
const Pinetime::Drivers::SpiNorFlash& spiNorFlash);
|
||||
~SystemInfo() override;
|
||||
bool OnTouchEvent(TouchEvents event) override;
|
||||
|
||||
|
@ -42,6 +43,7 @@ namespace Pinetime {
|
|||
const Pinetime::Drivers::Watchdog& watchdog;
|
||||
Pinetime::Controllers::MotionController& motionController;
|
||||
const Pinetime::Drivers::Cst816S& touchPanel;
|
||||
const Pinetime::Drivers::SpiNorFlash& spiNorFlash;
|
||||
|
||||
ScreenList<5> screens;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ SpiNorFlash::SpiNorFlash(Spi& spi) : spi {spi} {
|
|||
}
|
||||
|
||||
void SpiNorFlash::Init() {
|
||||
device_id = ReadIdentificaion();
|
||||
device_id = ReadIdentification();
|
||||
NRF_LOG_INFO("[SpiNorFlash] Manufacturer : %d, Memory type : %d, memory density : %d",
|
||||
device_id.manufacturer,
|
||||
device_id.type,
|
||||
|
@ -32,7 +32,7 @@ void SpiNorFlash::Wakeup() {
|
|||
uint8_t cmd[cmdSize] = {static_cast<uint8_t>(Commands::ReleaseFromDeepPowerDown), 0x01, 0x02, 0x03};
|
||||
uint8_t id = 0;
|
||||
spi.Read(reinterpret_cast<uint8_t*>(&cmd), cmdSize, &id, 1);
|
||||
auto devId = device_id = ReadIdentificaion();
|
||||
auto devId = device_id = ReadIdentification();
|
||||
if (devId.type != device_id.type) {
|
||||
NRF_LOG_INFO("[SpiNorFlash] ID on Wakeup: Failed");
|
||||
} else {
|
||||
|
@ -41,7 +41,7 @@ void SpiNorFlash::Wakeup() {
|
|||
NRF_LOG_INFO("[SpiNorFlash] Wakeup")
|
||||
}
|
||||
|
||||
SpiNorFlash::Identification SpiNorFlash::ReadIdentificaion() {
|
||||
SpiNorFlash::Identification SpiNorFlash::ReadIdentification() {
|
||||
auto cmd = static_cast<uint8_t>(Commands::ReadIdentification);
|
||||
Identification identification;
|
||||
spi.Read(&cmd, 1, reinterpret_cast<uint8_t*>(&identification), sizeof(Identification));
|
||||
|
@ -145,3 +145,7 @@ void SpiNorFlash::Write(uint32_t address, const uint8_t* buffer, size_t size) {
|
|||
len -= toWrite;
|
||||
}
|
||||
}
|
||||
|
||||
SpiNorFlash::Identification SpiNorFlash::GetIdentification() const {
|
||||
return device_id;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ namespace Pinetime {
|
|||
uint8_t density = 0;
|
||||
};
|
||||
|
||||
Identification ReadIdentificaion();
|
||||
uint8_t ReadStatusRegister();
|
||||
bool WriteInProgress();
|
||||
bool WriteEnabled();
|
||||
|
@ -33,6 +32,8 @@ namespace Pinetime {
|
|||
bool ProgramFailed();
|
||||
bool EraseFailed();
|
||||
|
||||
Identification GetIdentification() const;
|
||||
|
||||
void Init();
|
||||
void Uninit();
|
||||
|
||||
|
@ -40,6 +41,8 @@ namespace Pinetime {
|
|||
void Wakeup();
|
||||
|
||||
private:
|
||||
Identification ReadIdentification();
|
||||
|
||||
enum class Commands : uint8_t {
|
||||
PageProgram = 0x02,
|
||||
Read = 0x03,
|
||||
|
|
|
@ -123,7 +123,8 @@ Pinetime::Applications::DisplayApp displayApp(lcd,
|
|||
alarmController,
|
||||
brightnessController,
|
||||
touchHandler,
|
||||
fs);
|
||||
fs,
|
||||
spiNorFlash);
|
||||
|
||||
Pinetime::System::SystemTask systemTask(spi,
|
||||
spiNorFlash,
|
||||
|
|