Skip to content

Commit

Permalink
merge from main tag 1.15
Browse files Browse the repository at this point in the history
  • Loading branch information
Eve1374 committed Dec 4, 2024
2 parents 371e3d1 + 2105a7b commit c23887d
Show file tree
Hide file tree
Showing 26 changed files with 275 additions and 207 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,30 @@ jobs:
# Unzip the package because Upload Artifact will zip up the files
- name: Unzip DFU package
run: unzip ./build/output/pinetime-mcuboot-app-dfu-*.zip -d ./build/output/pinetime-mcuboot-app-dfu
- name: Set ref_name, but replace slashes with dashes.
shell: bash
env:
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
with:
name: InfiniTime DFU ${{ github.head_ref }}
name: InfiniTime DFU ${{ env.REF_NAME }}
path: ./build/output/pinetime-mcuboot-app-dfu/*
- name: Upload MCUBoot image artifacts
uses: actions/upload-artifact@v3
with:
name: InfiniTime MCUBoot image ${{ github.head_ref }}
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
with:
name: InfiniTime image ${{ github.head_ref }}
name: InfiniTime image ${{ env.REF_NAME }}
path: ./build/output/src/pinetime-app-*.out
- name: Upload resources artifacts
uses: actions/upload-artifact@v3
with:
name: InfiniTime resources ${{ github.head_ref }}
name: InfiniTime resources ${{ env.REF_NAME }}
path: ./build/output/infinitime-resources-*.zip

build-simulator:
Expand Down Expand Up @@ -105,7 +110,7 @@ jobs:
- name: Upload simulator executable
uses: actions/upload-artifact@v3
with:
name: infinisim-${{ github.head_ref }}
name: infinisim-${{ env.REF_NAME }}
path: build_lv_sim/infinisim

get-base-ref-size:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10)

set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose Debug or Release")

project(pinetime VERSION 1.14.0 LANGUAGES C CXX ASM)
project(pinetime VERSION 1.15.0 LANGUAGES C CXX ASM)

set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 20)
Expand Down
54 changes: 21 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,24 @@
# [InfiniTime](https://github.com/Eve1374/InfiniTime)
<div align="center">

![InfiniTime logo](doc/logo/infinitime-logo-small.jpg "InfiniTime Logo")
![Header Image](doc/logo/watchface_collage.png)

Fast open-source firmware for the [PineTime smartwatch](https://pine64.org/devices/pinetime/) with many features, written in modern C++.
<br>

## Quick notes on this InfiniTime version
[![GitHub tag](https://img.shields.io/github/tag/InfiniTimeOrg/InfiniTime?include_prereleases=&sort=semver&color=blue)](https://github.com/InfiniTimeOrg/InfiniTime/releases)
[![GitHub License](https://img.shields.io/github/license/InfiniTimeOrg/InfiniTime)](https://github.com/InfiniTimeOrg/InfiniLink/blob/main/LICENSE)
[![Issues - InfiniTime](https://img.shields.io/github/issues/InfiniTimeOrg/InfiniTime)](https://github.com/InfiniTimeOrg/InfiniTime/issues)
[![Pull Requests - InfiniTime](https://img.shields.io/github/issues-pr/InfiniTimeOrg/InfiniTime)](https://github.com/InfiniTimeOrg/InfiniTime/pulls)
[![Downloads - InfiniTime](https://img.shields.io/github/downloads/InfiniTimeOrg/InfiniTime/total)](https://github.com/InfiniTimeOrg/InfiniTime)
[![Stars - InfiniTime](https://img.shields.io/github/stars/InfiniTimeOrg/InfiniTime?style=social)](https://github.com/InfiniTimeOrg/InfiniTime/stargazers)
[![Forks - InfiniTime](https://img.shields.io/github/forks/InfiniTimeOrg/InfiniTime?style=social)](https://github.com/InfiniTimeOrg/InfiniTime/network/members)

- I copied the source code from this git repo : [InfiniTime](https://github.com/InfiniTimeOrg/InfiniTime)
- I added a watch face "WatchFaceMeow" whose main features are to be pink and have info about the alarm status
- I stored the compile commands in scripts compile.sh to run from InfiniTime/ folder, and make_pine_mcu.sh to build the image must be run from InfiniTime/build/ (compile.sh copies make_pine_mcu.sh to build/
- The file to flash to the pinetime is InfiniTime/build/pinetime-mcuboot-app-dfu-1.14.0.zip : I didn't change the version compared to the one I downloaded from [InfiniTime](https://github.com/InfiniTimeOrg/InfiniTime) so make sure not to keep keep a copy of it
# InfiniTime

Here are pictures with and without alarm set :
*Fast open-source firmware for the [PineTime smartwatch](https://pine64.org/devices/pinetime/) with many features, written in modern C++.*

<br>

Original repo : [InfiniTime](https://github.com/InfiniTimeOrg/InfiniTime)

- [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/)

## Welcome to my InfiniTime fork ?!

Branches :

- main : shows this doc
- alarm-status-on-infineat : shows the alarm status on infineat, can be enabled or disabled from the settigns menu that is updated accordingly :

![Infineat settings](doc/ui/infineat_settings.png "Infineat settings")

- my-custom-infinitime : branch were I put things that I want for myself, like a watchface with paw instead of shoe icon for steps counter :

</div>

## New to InfiniTime?

Expand All @@ -49,13 +33,18 @@ Branches :
### Companion apps

- [Gadgetbridge](https://gadgetbridge.org/) (Android)
- [AmazFish](https://openrepos.net/content/piggz/amazfish/) (SailfishOS)
- [Amazfish](https://github.com/piggz/harbour-amazfish/) ([SailfishOS](https://sailfishos-chum.github.io/apps/harbour-amazfish/), [Ubuntu Touch](https://open-store.io/app/uk.co.piggz.amazfish), [Flatpak](https://flathub.org/apps/uk.co.piggz.amazfish))
- [Siglo](https://github.com/alexr4535/siglo) (Linux)
- [InfiniLink](https://github.com/InfiniTimeOrg/InfiniLink) (iOS)
- [ITD](https://gitea.elara.ws/Elara6331/itd) (Linux)
- [WatchMate](https://github.com/azymohliad/watchmate) (Linux)
- [InfiniTimeExplorer](https://infinitimeexplorer.netlify.app) (Web)

<br>

***Note**: We removed mentions to NRFConnect as this app is closed source and recent versions do not work anymore with InfiniTime (the last version known to work is 4.24.3). If you used NRFConnect in the past, we recommend you switch to [Gadgetbridge](https://gadgetbridge.org/).*
> *InfiniTimeExplorer is only compatible with web browsers that support Web BLE. Current fully supported browsers include Chrome and Microsoft Edge.*
>
> *We removed mentions to NRFConnect as this app is closed source and recent versions do not work anymore with InfiniTime (the last version known to work is 4.24.3). If you used NRFConnect in the past, we recommend you switch to [Gadgetbridge](https://gadgetbridge.org/).*
## Development

Expand Down Expand Up @@ -120,4 +109,3 @@ Here are some people I would like to highlight:
- [Atc1441](https://github.com/atc1441/): He works on an Arduino based firmware for the Pinetime and many other smartwatches based on similar hardware. He was of great help when I was implementing support for the BMA421 motion sensor and I²C driver.
- [Koen](https://github.com/bosmoment): He’s working on a firmware based on RiotOS. He integrated similar libs as me: NimBLE, LittleVGL,… His help was invaluable too!
- [Lup Yuen Lee](https://github.com/lupyuen): He is everywhere: he works on a Rust firmware, builds a MCUBoot based bootloader for the Pinetime, designs a Flutter based companion app for smartphones and writes a lot of articles about the Pinetime!
>>>>>>>>> Temporary merge branch 2
Binary file added doc/logo/watchface_collage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ RUN bash -c "source /opt/build.sh; GetMcuBoot;"

# Add the infinitime user for connecting devcontainer
RUN adduser infinitime


# Configure Git to accept the /sources directory as safe
RUN git config --global --add safe.directory /sources

ENV SOURCES_DIR /sources
CMD ["/opt/build.sh"]
24 changes: 12 additions & 12 deletions src/components/ble/SimpleWeatherService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,22 @@ namespace {
std::memcpy(cityName.data(), &dataBuffer[16], 32);
cityName[32] = '\0';
return SimpleWeatherService::CurrentWeather(ToUInt64(&dataBuffer[2]),
ToInt16(&dataBuffer[10]),
ToInt16(&dataBuffer[12]),
ToInt16(&dataBuffer[14]),
SimpleWeatherService::Temperature(ToInt16(&dataBuffer[10])),
SimpleWeatherService::Temperature(ToInt16(&dataBuffer[12])),
SimpleWeatherService::Temperature(ToInt16(&dataBuffer[14])),
SimpleWeatherService::Icons {dataBuffer[16 + 32]},
std::move(cityName));
}

SimpleWeatherService::Forecast CreateForecast(const uint8_t* dataBuffer) {
auto timestamp = static_cast<uint64_t>(ToUInt64(&dataBuffer[2]));

std::array<SimpleWeatherService::Forecast::Day, SimpleWeatherService::MaxNbForecastDays> days;
std::array<std::optional<SimpleWeatherService::Forecast::Day>, SimpleWeatherService::MaxNbForecastDays> days;
const uint8_t nbDaysInBuffer = dataBuffer[10];
const uint8_t nbDays = std::min(SimpleWeatherService::MaxNbForecastDays, nbDaysInBuffer);
for (int i = 0; i < nbDays; i++) {
days[i] = SimpleWeatherService::Forecast::Day {ToInt16(&dataBuffer[11 + (i * 5)]),
ToInt16(&dataBuffer[13 + (i * 5)]),
days[i] = SimpleWeatherService::Forecast::Day {SimpleWeatherService::Temperature(ToInt16(&dataBuffer[11 + (i * 5)])),
SimpleWeatherService::Temperature(ToInt16(&dataBuffer[13 + (i * 5)])),
SimpleWeatherService::Icons {dataBuffer[15 + (i * 5)]}};
}
return SimpleWeatherService::Forecast {timestamp, nbDays, days};
Expand Down Expand Up @@ -98,9 +98,9 @@ int SimpleWeatherService::OnCommand(struct ble_gatt_access_ctxt* ctxt) {
currentWeather = CreateCurrentWeather(dataBuffer);
NRF_LOG_INFO("Current weather :\n\tTimestamp : %d\n\tTemperature:%d\n\tMin:%d\n\tMax:%d\n\tIcon:%d\n\tLocation:%s",
currentWeather->timestamp,
currentWeather->temperature,
currentWeather->minTemperature,
currentWeather->maxTemperature,
currentWeather->temperature.PreciseCelsius(),
currentWeather->minTemperature.PreciseCelsius(),
currentWeather->maxTemperature.PreciseCelsius(),
currentWeather->iconId,
currentWeather->location.data());
}
Expand All @@ -112,9 +112,9 @@ int SimpleWeatherService::OnCommand(struct ble_gatt_access_ctxt* ctxt) {
for (int i = 0; i < 5; i++) {
NRF_LOG_INFO("\t[%d] Min: %d - Max : %d - Icon : %d",
i,
forecast->days[i].minTemperature,
forecast->days[i].maxTemperature,
forecast->days[i].iconId);
forecast->days[i]->minTemperature.PreciseCelsius(),
forecast->days[i]->maxTemperature.PreciseCelsius(),
forecast->days[i]->iconId);
}
}
break;
Expand Down
53 changes: 39 additions & 14 deletions src/components/ble/SimpleWeatherService.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <cstdint>
#include <string>
#include <vector>
#include <array>
#include <memory>

#define min // workaround: nimble's min/max macros conflict with libstdc++
Expand Down Expand Up @@ -61,13 +61,42 @@ namespace Pinetime {
Unknown = 255
};

class Temperature {
public:
explicit Temperature(int16_t raw) : raw {raw} {
}

[[nodiscard]] int16_t PreciseCelsius() const {
return raw;
}

[[nodiscard]] int16_t PreciseFahrenheit() const {
return raw * 9 / 5 + 3200;
}

[[nodiscard]] int16_t Celsius() const {
return (PreciseCelsius() + 50) / 100;
}

[[nodiscard]] int16_t Fahrenheit() const {
return (PreciseFahrenheit() + 50) / 100;
}

bool operator==(const Temperature& other) const {
return raw == other.raw;
}

private:
int16_t raw;
};

using Location = std::array<char, 33>; // 32 char + \0 (end of string)

struct CurrentWeather {
CurrentWeather(uint64_t timestamp,
int16_t temperature,
int16_t minTemperature,
int16_t maxTemperature,
Temperature temperature,
Temperature minTemperature,
Temperature maxTemperature,
Icons iconId,
Location&& location)
: timestamp {timestamp},
Expand All @@ -79,9 +108,9 @@ namespace Pinetime {
}

uint64_t timestamp;
int16_t temperature;
int16_t minTemperature;
int16_t maxTemperature;
Temperature temperature;
Temperature minTemperature;
Temperature maxTemperature;
Icons iconId;
Location location;

Expand All @@ -93,25 +122,21 @@ namespace Pinetime {
uint8_t nbDays;

struct Day {
int16_t minTemperature;
int16_t maxTemperature;
Temperature minTemperature;
Temperature maxTemperature;
Icons iconId;

bool operator==(const Day& other) const;
};

std::array<Day, MaxNbForecastDays> days;
std::array<std::optional<Day>, MaxNbForecastDays> days;

bool operator==(const Forecast& other) const;
};

std::optional<CurrentWeather> Current() const;
std::optional<Forecast> GetForecast() const;

static int16_t CelsiusToFahrenheit(int16_t celsius) {
return celsius * 9 / 5 + 3200;
}

private:
// 00050000-78fc-48fe-8e23-433b3a1942d0
static constexpr ble_uuid128_t BaseUuid() {
Expand Down
25 changes: 20 additions & 5 deletions src/components/datetime/DateTimeController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,29 @@
using namespace Pinetime::Controllers;

namespace {
char const* DaysStringShort[] = {"--", "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
char const* DaysStringShortLow[] = {"--", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
char const* MonthsString[] = {"--", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};
char const* MonthsStringLow[] = {"--", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
constexpr const char* const DaysStringShort[] = {"--", "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
constexpr const char* const DaysStringShortLow[] = {"--", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
constexpr const char* const MonthsString[] = {"--", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};
constexpr const char* const MonthsStringLow[] =
{"--", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};

constexpr int compileTimeAtoi(const char* str) {
int result = 0;
while (*str >= '0' && *str <= '9') {
result = result * 10 + *str - '0';
str++;
}
return result;
}
}

DateTime::DateTime(Controllers::Settings& settingsController) : settingsController {settingsController} {
mutex = xSemaphoreCreateMutex();
ASSERT(mutex != nullptr);
xSemaphoreGive(mutex);

// __DATE__ is a string of the format "MMM DD YYYY", so an offset of 7 gives the start of the year
SetTime(compileTimeAtoi(&__DATE__[7]), 1, 1, 0, 0, 0);
}

void DateTime::SetCurrentTime(std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> t) {
Expand Down Expand Up @@ -46,7 +59,9 @@ void DateTime::SetTime(uint16_t year, uint8_t month, uint8_t day, uint8_t hour,
UpdateTime(previousSystickCounter, true);
xSemaphoreGive(mutex);

systemTask->PushMessage(System::Messages::OnNewTime);
if (systemTask != nullptr) {
systemTask->PushMessage(System::Messages::OnNewTime);
}
}

void DateTime::SetTimeZone(int8_t timezone, int8_t dst) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/datetime/DateTimeController.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace Pinetime {
*
* used to update difference between utc and local time (see UtcOffset())
*
* parameters are in quarters of an our. Following the BLE CTS specification,
* parameters are in quarters of an hour. Following the BLE CTS specification,
* timezone is expected to be constant over DST which will be reported in
* dst field.
*/
Expand Down
Loading

0 comments on commit c23887d

Please sign in to comment.