Skip to content

Commit

Permalink
Software: Revamp JS code, add Web Serial support, new Pages site (#220)
Browse files Browse the repository at this point in the history
- set up NPM workspaces for JS modules
- separate core splitflap protocol logic from interface-specific code (web serial vs Node serialport): splitflapjs-core, splitflapjs-node, splitflapjs-webserial
- added web serial demo code
- configured web serial demo code to publish to Pages
- migrated old static Pages site into webserial demo (as static assets), and updated it a little bit
  • Loading branch information
scottbez1 authored Oct 9, 2023
1 parent eb5f173 commit 9ea173f
Show file tree
Hide file tree
Showing 77 changed files with 30,585 additions and 13,016 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: JS

on:
push:
pull_request:
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
working-directory: software/chainlink/js
run: npm ci
- name: Build
working-directory: software/chainlink/js
run: PUBLIC_URL="/splitflap" npm run build
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: './software/chainlink/js/packages/example-webserial-basic/build'

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: github.repository == 'scottbez1/splitflap' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ I'd love to hear your thoughts and questions about this project, and happy to in
Please note, updated documentation for the Chainlink system is still in progress; you may see outdated references to the "Classic" electronics in some documentation in the meantime. If you have any questions, please don't hesitate to ask in the [community Discord server](https://discord.gg/Hxnftc8PyW)!

* [**Ordering guide (the "easy" route) - updated for Chainlink**](https://paper.dropbox.com/doc/Splitflap-Ordering-the-easy-route--BsXzf8VyILR3nl1vUpOi28TWAg-0i6r3aqw6kZVXQOP2MyNr)
* [**Chainlink Driver Electronics User Guide**]https://paper.dropbox.com/doc/Chainlink-Driver-v1.1-Electronics-User-Guide--BsVuP9OHVo952_ZdJDBomCCzAg-U0DAXrSxEoOhgSoRU39hq
* [**Chainlink Driver Electronics User Guide**](https://paper.dropbox.com/doc/Chainlink-Driver-v1.1-Electronics-User-Guide--BsVuP9OHVo952_ZdJDBomCCzAg-U0DAXrSxEoOhgSoRU39hq)
* [**Latest stable release**](https://github.com/scottbez1/splitflap/releases)
* [**Assembly instructions (v0.5/0.6/0.7)**](https://paper.dropbox.com/doc/Splitflap-Kit-v0.5v1.0-Instructions--ASQDu1uoa6n4_t1pva1bM1MgAg-bxXJlke5ROmamcx4OH44r)

Expand Down
17 changes: 10 additions & 7 deletions arduino/splitflap/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
4 changes: 4 additions & 0 deletions arduino/splitflap/Splitflap/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ const uint8_t flaps[NUM_FLAPS] = {
#error NUM_MODULES must be at least 1
#endif
#ifdef CHAINLINK
#if NUM_MODULES % 6 != 0
#error NUM_MODULES must be a multiple of 6, to match the capacity of the connected Chainlink Drivers. You can use fewer than this number of modules, but the setting must match the Chainlink Driver outputs.
#endif

#define NUM_LOOPBACKS (NUM_MODULES / 3)
#define CHAINLINK_ENFORCE_LOOPBACKS 1
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

static SerialProtoProtocol* singleton_for_packet_serial = 0;

static const uint16_t MIN_STATE_INTERVAL_MILLIS = 250;
static const uint16_t MIN_STATE_INTERVAL_MILLIS = 100;
static const uint16_t PERIODIC_STATE_INTERVAL_MILLIS = 5000;

SerialProtoProtocol::SerialProtoProtocol(SplitflapTask& splitflap_task, Stream& stream) :
Expand Down
1 change: 1 addition & 0 deletions software/chainlink/js/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
lib/
dist
1 change: 1 addition & 0 deletions software/chainlink/js/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
13 changes: 13 additions & 0 deletions software/chainlink/js/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Typescript Splitflap protobuf interface library and examples

### Requirements (nvm is recommended)

- node >= 18.11.0
- npm >= 8.19.2

### Setup

```
npm ci
npm run build
```
Loading

0 comments on commit 9ea173f

Please sign in to comment.