Skip to content

Commit

Permalink
Merge branch 'develop' into hebrew-support
Browse files Browse the repository at this point in the history
  • Loading branch information
yehoshuapw committed Apr 2, 2022
2 parents 1df13a1 + b498e1d commit 0adbc80
Show file tree
Hide file tree
Showing 85 changed files with 1,840 additions and 1,052 deletions.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: PineTime community chat (Matrix)
url: https://app.element.io/#/room/#pinetime:matrix.org
about: Please ask questions about PineTime here.
- name: PineTime developers chat (Matrix)
url: https://app.element.io/#/room/#pinetime-dev:matrix.org
about: Please ask questions about PineTime development here.
74 changes: 74 additions & 0 deletions .github/workflows/lv_sim.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# GitHub Actions Workflow to build Simulator for PineTime Smart Watch LVGL Interface

# Name of this Workflow
name: Build PineTime LVGL Simulator

# When to run this Workflow...
on:

# Run on all branches
push:
branches: []

# Also run this Workflow when a Pull Request is created or updated in the "master" and "develop" Branch
pull_request:
branches: [ master, develop ]

# Steps to run for the Workflow
jobs:
build:

# Run these steps on Ubuntu
runs-on: ubuntu-latest

steps:

#########################################################################################
# Download and Install Dependencies

- name: Install cmake
uses: lukka/[email protected]

- name: Install SDL2 development package
run: |
sudo apt-get update
sudo apt-get -y install libsdl2-dev
#########################################################################################
# Checkout

- name: Checkout source files
uses: actions/checkout@v2
with:
submodules: recursive

#########################################################################################
# get InfiniSim repo

- name: Get InfiniSim repo
run: |
git clone https://github.com/InfiniTimeOrg/InfiniSim.git --depth 1 --branch main
git -C InfiniSim submodule update --init lv_drivers libpng
#########################################################################################
# CMake

- name: CMake
run: |
cmake -G Ninja -S InfiniSim -B build_lv_sim -DInfiniTime_DIR="${PWD}"
#########################################################################################
# Build and Upload simulator

# For Debugging Builds: Remove "make" option "-j" for clearer output. Add "--trace" to see details.
# For Faster Builds: Add "make" option "-j"

- name: Build simulator executable
run: |
cmake --build build_lv_sim
- name: Upload simulator executable
uses: actions/upload-artifact@v2
with:
name: infinisim
path: build_lv_sim/infinisim
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10)
project(pinetime VERSION 1.8.0 LANGUAGES C CXX ASM)
project(pinetime VERSION 1.9.0 LANGUAGES C CXX ASM)

set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 14)
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Fast open-source firmware for the [PineTime smartwatch](https://www.pine64.org/p
- [AmazFish](https://openrepos.net/content/piggz/amazfish/) (SailfishOS)
- [Siglo](https://github.com/alexr4535/siglo) (Linux)
- [InfiniLink](https://github.com/xan-m/InfiniLink) **[Experimental]** (iOS)
- [ITD](https://gitea.arsenm.dev/Arsen6331/itd) (Linux)

## Development

Expand All @@ -25,6 +26,10 @@ Fast open-source firmware for the [PineTime smartwatch](https://www.pine64.org/p
- [Creating a stopwatch in Pinetime(article)](https://pankajraghav.com/2021/04/03/PINETIME-STOPCLOCK.html)
- [Tips on designing an app UI](doc/ui_guidelines.md)

### InfiniSim Simulator
Use the [InfiniSim Simulator](https://github.com/InfiniTimeOrg/InfiniSim) to experience the `InfiniTime` user interface directly on your PC, to shorten the time until you get your hands on a real [PineTime smartwatch](https://www.pine64.org/pinetime/).
Or use it to develop new Watchfaces, new Screens, or quickly iterate on the user interface.

### Contributing
- [How to contribute?](/doc/contribute.md)
- [Coding conventions](/doc/coding-convention.md)
Expand Down
1 change: 1 addition & 0 deletions doc/ui_guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
- Top bar takes at least 20px + padding
- Top bar right icons move 8px to the left when using a page indicator
- A black background helps to hide the screen border, allowing the UI to look less cramped when utilizing the entire display area.
- A switch should be twice as wide as it is tall.

![example layouts](./ui/example.png)
5 changes: 4 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -449,11 +449,13 @@ list(APPEND SOURCE_FILES
displayapp/screens/settings/SettingSetTime.cpp
displayapp/screens/settings/SettingChimes.cpp
displayapp/screens/settings/SettingShakeThreshold.cpp
displayapp/screens/settings/SettingBluetooth.cpp

## Watch faces
displayapp/icons/bg_clock.c
displayapp/screens/WatchFaceAnalog.cpp
displayapp/screens/WatchFaceDigital.cpp
displayapp/screens/WatchFaceTerminal.cpp
displayapp/screens/PineTimeStyle.cpp

##
Expand Down Expand Up @@ -514,6 +516,7 @@ list(APPEND SOURCE_FILES
displayapp/lv_pinetime_theme.c

systemtask/SystemTask.cpp
systemtask/SystemMonitor.cpp
drivers/TwiMaster.cpp

heartratetask/HeartRateTask.cpp
Expand Down Expand Up @@ -575,6 +578,7 @@ list(APPEND RECOVERY_SOURCE_FILES
FreeRTOS/port_cmsis.c

systemtask/SystemTask.cpp
systemtask/SystemMonitor.cpp
drivers/TwiMaster.cpp
components/gfx/Gfx.cpp
components/rle/RleDecoder.cpp
Expand Down Expand Up @@ -626,7 +630,6 @@ set(INCLUDE_FILES
displayapp/screens/InfiniPaint.h
displayapp/screens/StopWatch.h
displayapp/screens/Paddle.h
displayapp/screens/DropDownDemo.h
displayapp/screens/BatteryIcon.h
displayapp/screens/BleIcon.h
displayapp/screens/NotificationIcon.h
Expand Down
2 changes: 1 addition & 1 deletion src/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@

/* Software timer definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY (0)
#define configTIMER_TASK_PRIORITY (1)
#define configTIMER_QUEUE_LENGTH 32
#define configTIMER_TASK_STACK_DEPTH (300)

Expand Down
1 change: 1 addition & 0 deletions src/components/ble/AlertNotificationClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <algorithm>
#include "components/ble/NotificationManager.h"
#include "systemtask/SystemTask.h"
#include <nrf_log.h>

using namespace Pinetime::Controllers;
constexpr ble_uuid16_t AlertNotificationClient::ansServiceUuid;
Expand Down
16 changes: 16 additions & 0 deletions src/components/ble/BleController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

using namespace Pinetime::Controllers;

bool Ble::IsConnected() const {
return isConnected;
}

void Ble::Connect() {
isConnected = true;
}
Expand All @@ -10,6 +14,18 @@ void Ble::Disconnect() {
isConnected = false;
}

bool Ble::IsRadioEnabled() const {
return isRadioEnabled;
}

void Ble::EnableRadio() {
isRadioEnabled = true;
}

void Ble::DisableRadio() {
isRadioEnabled = false;
}

void Ble::StartFirmwareUpdate() {
isFirmwareUpdating = true;
}
Expand Down
9 changes: 6 additions & 3 deletions src/components/ble/BleController.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ namespace Pinetime {
enum class AddressTypes { Public, Random, RPA_Public, RPA_Random };

Ble() = default;
bool IsConnected() const {
return isConnected;
}
bool IsConnected() const;
void Connect();
void Disconnect();

bool IsRadioEnabled() const;
void EnableRadio();
void DisableRadio();

void StartFirmwareUpdate();
void StopFirmwareUpdate();
void FirmwareUpdateTotalBytes(uint32_t totalBytes);
Expand Down Expand Up @@ -57,6 +59,7 @@ namespace Pinetime {

private:
bool isConnected = false;
bool isRadioEnabled = true;
bool isFirmwareUpdating = false;
uint32_t firmwareUpdateTotalBytes = 0;
uint32_t firmwareUpdateCurrentBytes = 0;
Expand Down
1 change: 1 addition & 0 deletions src/components/ble/DfuService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "components/ble/BleController.h"
#include "drivers/SpiNorFlash.h"
#include "systemtask/SystemTask.h"
#include <nrf_log.h>

using namespace Pinetime::Controllers;

Expand Down
1 change: 1 addition & 0 deletions src/components/ble/HeartRateService.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "components/ble/HeartRateService.h"
#include "components/heartrate/HeartRateController.h"
#include "systemtask/SystemTask.h"
#include <nrf_log.h>

using namespace Pinetime::Controllers;

Expand Down
1 change: 1 addition & 0 deletions src/components/ble/MotionService.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "components/ble/MotionService.h"
#include "components/motion/MotionController.h"
#include "systemtask/SystemTask.h"
#include <nrf_log.h>

using namespace Pinetime::Controllers;

Expand Down
21 changes: 18 additions & 3 deletions src/components/ble/MusicService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
#include "components/ble/MusicService.h"
#include "systemtask/SystemTask.h"
#include <cstring>

namespace {
// 0000yyxx-78fc-48fe-8e23-433b3a1942d0
Expand Down Expand Up @@ -47,6 +48,8 @@ namespace {
constexpr ble_uuid128_t msRepeatCharUuid {CharUuid(0x0b, 0x00)};
constexpr ble_uuid128_t msShuffleCharUuid {CharUuid(0x0c, 0x00)};

constexpr uint8_t MaxStringSize {40};

int MusicCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) {
return static_cast<Pinetime::Controllers::MusicService*>(arg)->OnCommand(conn_handle, attr_handle, ctxt);
}
Expand Down Expand Up @@ -125,9 +128,21 @@ void Pinetime::Controllers::MusicService::Init() {
int Pinetime::Controllers::MusicService::OnCommand(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt) {
if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
size_t notifSize = OS_MBUF_PKTLEN(ctxt->om);
char data[notifSize + 1];
data[notifSize] = '\0';
os_mbuf_copydata(ctxt->om, 0, notifSize, data);
size_t bufferSize = notifSize;
if (notifSize > MaxStringSize) {
bufferSize = MaxStringSize;
}

char data[bufferSize + 1];
os_mbuf_copydata(ctxt->om, 0, bufferSize, data);

if (notifSize > bufferSize) {
data[bufferSize-1] = '.';
data[bufferSize-2] = '.';
data[bufferSize-3] = '.';
}
data[bufferSize] = '\0';

char* s = &data[0];
if (ble_uuid_cmp(ctxt->chr->uuid, &msArtistCharUuid.u) == 0) {
artistName = s;
Expand Down
Loading

0 comments on commit 0adbc80

Please sign in to comment.