Skip to content

Commit

Permalink
Merge pull request #277 from Open-Smartwatch/develop
Browse files Browse the repository at this point in the history
New release
  • Loading branch information
simonmicro authored Jul 28, 2022
2 parents bc08af4 + 1440f74 commit a2d2967
Show file tree
Hide file tree
Showing 94 changed files with 870 additions and 421 deletions.
9 changes: 0 additions & 9 deletions .clang-format

This file was deleted.

15 changes: 15 additions & 0 deletions .github/buildEverything.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,23 @@ def doBuild(makeDebug):

ap.add_argument("-l", "--support-language", type=str, required=True, help="# model language to compile. (Enter 'all' to compile all language packs.)")
ap.add_argument("-m", "--support-model", type=str, required=True, help="# model type to compile. (Enter 'all' to compile all model packs.)")
ap.add_argument("-f", "--support-feature", type=str, required=False, default="", help="# feature to compile. (Enter a feature to compile.)")
args = vars(ap.parse_args())

if str(args["support_feature"]) != "":
logging.info('Setting flag ' + str(args["support_feature"]) + '...')
# Setup build flag (using the config file via replacing, as platformio does not allow setting the property using Python)
configIn = open(pioConfig, 'r')
configStr = configIn.read()
configIn.close()
configStr, hitCount = re.subn('build_flags =','build_flags =\n -D '+str(args["support_feature"]),configStr)
if hitCount == 0:
logging.error('Error on setting build flag!')
exit(5)
configOut = open(pioConfig, 'w')
configOut.write(configStr)
configOut.close()

#if you want all-language packs
if args["support_language"] == "all" and args["support_model"] == "all":
for lang in languages:
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/test-FEATURE.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: OSW-FEATURE-test

on:
workflow_dispatch:
push:
pull_request:
branches: [ master, develop ]

jobs:
Find-feature:
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
- id: get-flag
run: |
echo "::set-output name=feature::$(D=$(curl https://api.github.com/repos/Open-smartwatch/open-smartwatch.github.io/contents/docs/resources/firmware.md | jq -r ".content" | base64 --decode | grep -o '^-.*` |'); V=$(echo $D | tr '` |-' ' ');V=($V);jq --compact-output --null-input '$ARGS.positional' --args -- "${V[@]}")"
- id: default_mod
run: |
echo "::set-output name=default_model::$(R=$(x=$(cat platformio.ini | grep "defau"); echo "${x:15}"); R=($R);jq --compact-output --null-input '$ARGS.positional' --args -- "${R[@]}")"
- id: default_lang
run: |
echo "::set-output name=default_language::$(A=$(if [ -e include/locales/en-US.h ]; then s=$(ls include/locales/en-US.h); else s=$(ls include/locales/*.h -1 | head -1); fi; echo ${s:16:5});A=($A);jq --compact-output --null-input '$ARGS.positional' --args -- "${A[@]}")"
outputs:
feature: ${{ steps.get-flag.outputs.feature }}
default_model: ${{ steps.default_mod.outputs.default_model }}
default_language: ${{ steps.default_lang.outputs.default_language }}
build-OSW:
needs: Find-feature
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
feature: ${{ fromJson(needs.Find-feature.outputs.feature) }}
model: ${{ fromJson(needs.Find-feature.outputs.default_model) }}
language: ${{ fromJson(needs.Find-feature.outputs.default_language) }}
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: cache-${{ secrets.CACHE_VERSION }}-${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: cache-${{ secrets.CACHE_VERSION }}-${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Install swig
run: sudo apt-get update && sudo apt-get -y install swig
- name: Set up Python
uses: actions/setup-python@v2
- name: Install PlatformIO
run: python -m pip install --upgrade pip && pip install --upgrade platformio
- name: Rename config
run: mv include/config.h.example include/config.h
- name: Compile language ${{ matrix.language }} model ${{ matrix.model }} feature ${{ matrix.feature }}
run: python3 .github/buildEverything.py -l ${{ matrix.language }} -m ${{ matrix.model }} -f ${{ matrix.feature }}
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# How to contribute to Open-smartwatch

In case the `develop` branch is ahead of the `master` branch and the `develop` branch is stabile enough, we periodically merge it into the `master`.

In order to contribute new or updated documentation, you must first create a GitHub account and fork the original repository to your own account. You can make changes, save them in your repository and then create a pull request against this repository.

Unless you are opening a pull request which only makes small corrections (for instance correcting a typo), you are more likely to get traction for your changes if you open an issue first to discuss the proposed changes.

**IMPORTANT** If you want to create a pull request, please work based on the `develop` branch - so we don't have to rebase it...

If you are reading this page, you are possibly interested in contributing to our project 😄 . We have an active (and friendly) developer group and would love to get your help! Some common ways you can support us are:

* Testing the code
* Filing issues on GitHub, if you see a problem (or adding detail to existing issues that effect you)
* Fixing issues 😁
* Adding new features
* Reviewing existing pull requests and possibly also contributing to them.
* Translation. Always a good idea...

## How to make a good bug report

Submit according to the bug report form. Attach the debug log if necessary. [Read more here!](https://open-smartwatch.github.io/howto/contribute/#how-to-open-an-issue)

## Submitting patches

Please also see our [wiki](https://open-smartwatch.github.io/howto/contribute/) article for that.
53 changes: 38 additions & 15 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,58 @@

## Prerequirements

* install [Platformio Core](https://docs.platformio.org/en/latest/core/installation.html) or [Platformio IDE](https://docs.platformio.org/en/latest/integration/ide/vscode.html#ide-vscode) (which installes Pio core automatically)
* install [PlatformIO Core](https://docs.platformio.org/en/latest/core/installation.html) or [PlatformIO IDE](https://docs.platformio.org/en/latest/integration/ide/vscode.html#ide-vscode) (which installs PlatformIO core automatically)
* **For improved LUA Script support, see env:pico32_LIGHT_EDITION_PREBUILD_LUA**: install [SWIG](http://www.swig.org/Doc4.0/SWIGDocumentation.html#Preface_installation) (also available in most package managers, e.g. `brew install swig`)
* Then clone this repository

```
git clone --recurse-submodules https://github.com/Open-Smartwatch/open-smartwatch-os.git
$ git clone --recurse-submodules https://github.com/Open-Smartwatch/open-smartwatch-os.git
```

## build (Visual Studio Code)
## build

Open the cloned repo in VSCode
The `master` branch is a stable version and the `develop` branch is a beta version. Recommended that you upload the `master` branch.

### Visual Studio Code

Open the cloned repo in VSCode:

```
code open-smartwatch-os
$ code open-smartwatch-os
```

and rename file `include/config.h.example` to `include/config.h` and adapt the values according to your requirements and press f5 to build it.
And rename file `include/config.h.example` to `include/config.h` and adapt the values according to your requirements and press `F5` to build it.

## build (CLI)
### CLI

You can instead go to the repo folder with your terminal and run

```
pio run -e pico32_LIGHT_EDITION -t upload
$ pio run -e pico32_LIGHT_EDITION -t upload
```

respectively

```
pio run -e pico32_GPS_EDITION -t upload
$ pio run -e pico32_GPS_EDITION -t upload
```

depending on the watch model.
Depending on the watch model.

## Debugging(CLI)

If you want to print out the log for debugging, following command:

```
$ pio device monitor
```

## Creating Screen Shots of your Apps

![analog](./watchface_analog_osw.png)
![analog](./watchface_digital_osw.png)
<img src="./screenshots/watchface_analog_osw.png" width="40%"><img src="./screenshots/watchface_digital_osw.png" width="40%">

* Wifi needs to be able to connect for this to work.
* you will need bash and imagemagick for the helper scripts to work
* Wi-Fi needs to be able to connect for this to work.
* you will need bash and ImageMagick for the helper scripts to work

The raw screenserver runs in the background and prints via serial:

Expand All @@ -55,15 +66,27 @@ http://<IP_OF_WATCH>/api/screenserver

### HowTo

* add `-D RAW_SCREEN_SERVER` to your build flags in `platformio.ini``
* add `-D RAW_SCREEN_SERVER` to your build flags in `platformio.ini`
* build + flash + reset watch
* wait for the server to be started (see msg above)
* run `bash fetchScreen.sh <IP_OF_WATCH> screenshot.png`
* run `bash composeScreen.sh screenshot.png screenshot_composed.png`

The `fetchScreen.sh` downloads the raw image buffer from the running screen server, and converts the image to png. The `composeScreen.sh` creates the image with a surrounding smartwatch (light edition).

#### The fast way (recommended)

Run the following inside the `open-smartwatch-os` directory:

```
$ cd scripts/screen_capture/
$ ./createScreenshot.sh <IP_OF_WATCH> <SCREENSHOT>
```
* The captured file can be found in the `screenshot/` folder inside the `open-smartwatch-os` directory.
## Troubleshooting

For more information on troubleshooting, see [Wiki](https://open-smartwatch.github.io/resources/firmware/#troubleshooting).

### Arduino_TFT.h: No such file or directory

You did not clone the repository with the `--recursive-submodules` flag.
Expand Down
7 changes: 2 additions & 5 deletions include/apps/main/stopwatch.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#ifndef OSW_APP_STOPWATCH_H
#define OSW_APP_STOPWATCH_H

#pragma once
#include <osw_hal.h>
#include <osw_ui.h>

Expand Down Expand Up @@ -33,8 +31,7 @@ class OswAppStopWatch : public OswApp {
unsigned char lapNum = 0;
long lastLapTime = 0;
long laps[maxLaps] = {0};
long overall[maxLaps] = {0};
char lapPages = 0;
char lapPage = 0;
};

#endif
8 changes: 3 additions & 5 deletions include/apps/main/switcher.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#ifndef OSW_APP_APPSWITCHER_H
#define OSW_APP_APPSWITCHER_H

#pragma once
#include <osw_app.h>
#include <osw_hal.h>
#include <osw_ui.h>
Expand Down Expand Up @@ -43,6 +41,6 @@ class OswAppSwitcher : public OswApp {
bool _doSleep = false;
bool _doSwitch = false;
long appOnScreenSince = 0;
short _timeForLongPress = APPSWITCHER_LONG_PRESS;
short _timeForSleepPress = APPSWITCHER_SLEEP_TIMEOUT;
};

#endif
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#ifndef OSW_APP_BLE_MEDIA_CTRL_H
#define OSW_APP_BLE_MEDIA_CTRL_H
#ifdef OSW_FEATURE_BLE_MEDIA_CTRL
#pragma once

#include <osw_hal.h>

#include "osw_app.h"

class OswAppBLEMEdiaCtrl : public OswApp {
Expand All @@ -15,5 +14,4 @@ class OswAppBLEMEdiaCtrl : public OswApp {

private:
};

#endif
26 changes: 26 additions & 0 deletions include/apps/tools/OswAppDistStats.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#ifdef OSW_FEATURE_STATS_STEPS

#pragma once

#include <osw_hal.h>
#include <osw_ui.h>
#include "osw_app.h"

class OswAppDistStats : public OswApp {
public:
OswAppDistStats(void) {
ui = OswUI::getInstance();
};
virtual void setup() override;
virtual void loop() override;
virtual void stop() override;
~OswAppDistStats() {};

private:
void showStickChart();
void drawChart();
OswUI* ui;
int32_t cursorPos = 0; // WeekDay position
};

#endif
8 changes: 2 additions & 6 deletions include/apps/tools/OswAppFitnessStats.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#ifndef OSW_APP_FITNESS_STATS_H
#define OSW_APP_FITNESS_STATS_H
#pragma once

#include <osw_hal.h>
#include <osw_ui.h>

#include "osw_app.h"

class OswAppFitnessStats : public OswApp {
Expand All @@ -19,6 +17,4 @@ class OswAppFitnessStats : public OswApp {

private:
OswUI* ui;
};

#endif
};
6 changes: 3 additions & 3 deletions include/apps/tools/OswAppKcalStats.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef OSW_APP_KCAL_STATS_H
#define OSW_APP_KCAL_STATS_H
#ifdef OSW_FEATURE_STATS_STEPS

#pragma once

#include <osw_hal.h>
#include <osw_ui.h>

#include "osw_app.h"

class OswAppKcalStats : public OswApp {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#ifndef OSW_APP_PRINT_DEBUG_H
#define OSW_APP_PRINT_DEBUG_H
#ifndef NDEBUG
#pragma once

#include <osw_hal.h>

#include "osw_app.h"

class OswAppPrintDebug : public OswApp {
Expand All @@ -14,6 +13,8 @@ class OswAppPrintDebug : public OswApp {
~OswAppPrintDebug() {};

private:
uint8_t y = 32;
uint8_t x = 52;
void printStatus(const char* setting, const char* value);
};

#endif
9 changes: 5 additions & 4 deletions include/apps/tools/OswAppStepStats.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef OSW_APP_STEP_STATS_H
#define OSW_APP_STEP_STATS_H
#ifdef OSW_FEATURE_STATS_STEPS

#pragma once

#include <osw_hal.h>
#include <osw_ui.h>

#include "osw_app.h"

class OswAppStepStats : public OswApp {
Expand All @@ -19,7 +19,8 @@ class OswAppStepStats : public OswApp {
private:
void showStickChart();
void drawChart();
int32_t cursorPos=0;
OswUI* ui;
};

#endif
#endif
Loading

0 comments on commit a2d2967

Please sign in to comment.