Skip to content

Commit

Permalink
Merge pull request #1 from 74th/feature/ci
Browse files Browse the repository at this point in the history
Feature/ci
  • Loading branch information
74th authored Feb 12, 2024
2 parents f229325 + 2e7f3b2 commit a17866d
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 3 deletions.
121 changes: 121 additions & 0 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: build
on:
push:
branches:
- main
pull_request:

permissions:
contents: write

jobs:
build-m5dial-simple-pointer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio

- uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install PlatformIO Core
run: pip install --upgrade platformio

- name: Build
run: |
cd m5dial-simple-pointer
cp src/ssid.h.template src/ssid.h
pio run
- name: Rename Firmware
if: startsWith(github.ref, 'refs/tags/m5dial-simple-pointer')
run: |
cp m5dial-simple-pointer/.pio/build/m5dial/firmware.elf ./m5dial-simple-pointer.elf
cp m5dial-simple-pointer/.pio/build/m5dial/firmware.bin ./m5dial-simple-pointer.bin
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/m5dial-simple-pointer')
with:
files: |
m5dial-simple-pointer.elf
m5dial-simple-pointer.bin
build-m5stackcore2-simple-pointer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio

- uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install PlatformIO Core
run: pip install --upgrade platformio

- name: Build
run: |
cd m5stackcore2-simple-pointer
pio run
- name: Rename Firmware
if: startsWith(github.ref, 'refs/tags/m5stackcore2-simple-pointer')
run: |
cp m5stackcore2-simple-pointer/.pio/build/m5stack-core2/firmware.elf ./m5stackcore2-simple-pointer.elf
cp m5stackcore2-simple-pointer/.pio/build/m5stack-core2/firmware.bin ./m5stackcore2-simple-pointer.bin
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/m5stackcore2-simple-pointer')
with:
files: |
m5stackcore2-simple-pointer.elf
m5stackcore2-simple-pointer.bin
build-m5dial-pimoroni-trackball-compatible:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio

- uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install PlatformIO Core
run: pip install --upgrade platformio

- name: Build
run: |
cd m5dial-pimoroni-trackball-compatible
pio run
- name: Rename Firmware
if: startsWith(github.ref, 'refs/tags/m5dial-pimoroni-trackball-compatible')
run: |
cp m5dial-pimoroni-trackball-compatible/.pio/build/m5dial/firmware.elf ./m5dial-pimoroni-trackball-compatible.elf
cp m5dial-pimoroni-trackball-compatible/.pio/build/m5dial/firmware.bin ./m5dial-pimoroni-trackball-compatible.bin
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/m5dial-pimoroni-trackball-compatible')
with:
files: |
m5dial-pimoroni-trackball-compatible.elf m5dial-pimoroni-trackball-compatible.bin
6 changes: 6 additions & 0 deletions m5dial-pimoroni-trackball-compatible/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
src/ssid.h
12 changes: 12 additions & 0 deletions m5dial-pimoroni-trackball-compatible/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[env:m5dial]
platform = espressif32@^6.5.0
board = m5stack-stamps3
framework = arduino
monitor_speed = 115200

lib_deps =
m5stack/M5Dial@^1.0.2
m5stack/M5Unified@^0.1.12

upload_protocol = custom
upload_command = curl -F "image=@.pio/build/m5dial/firmware.bin" m5dial.local/update
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <Arduino.h>
#include <M5Dial.h>
#include <Wire.h>

Expand All @@ -8,6 +9,9 @@

#define MULTIPLE 2

void receiveEvent(int numBytes);
void sendEvent();

volatile uint8_t i2c_buf[I2C_BUF_SIZE] = {0, 0, 0, 0, 0};

void set_move_size(uint16_t step_dx, uint16_t step_dy)
Expand Down Expand Up @@ -67,6 +71,8 @@ void set_move_size(uint16_t step_dx, uint16_t step_dy)

void setup()
{
auto cfg = M5.config();
M5Dial.begin(cfg, true, false);

#if TESTING > 0
Serial.begin(115200);
Expand All @@ -76,9 +82,6 @@ void setup()
Wire.onReceive(receiveEvent);
Wire.onRequest(sendEvent);
#endif

auto cfg = M5.config();
M5Dial.begin(cfg, true, false);
}

long oldPosition = -999;
Expand Down

0 comments on commit a17866d

Please sign in to comment.