Compare commits

..

10 Commits

Author SHA1 Message Date
Robert Kossessa
23326938c9 FIX: Not recognizing lowercase VID/PID
Some checks failed
/ 🐧 Linux Build (push) Has been cancelled
/ 🍏 Mac Build (push) Has been cancelled
/ 🪟 Windows Build (push) Has been cancelled
2024-06-13 21:51:45 +02:00
Robert Kossessa
31e061a852 UPD: Skip uploading artifacts in build workflow 2024-06-12 18:16:55 +02:00
Robert Kossessa
252fe1bcda Merge pull request #9 from frysee/fix-builds
Thanks! This will do well for now 😊 I gotta look into stripping some of the redundant code.
No need to upload the artifacts tho, as the build workflow doesn't create a release.
2024-06-12 18:14:24 +02:00
frysee
f1b4d43380 Fixed Win/Linux builds
Bumped pnpm
Added generic build to run after each commit (feel free to remove)
2024-06-12 16:08:03 +02:00
Robert Kossessa
04bc46b37e FIX: Rogue brace 2024-06-07 14:32:42 +02:00
Robert Kossessa
58320efbb3 FIX: Check for another VID/PID pair
Nano shouldn't show up like this 😳
2024-06-07 14:29:34 +02:00
Robert Kossessa
8fee963c77 FIX: Double profile request delay to not overload serial buffer 2024-06-07 12:12:04 +02:00
Robert Kossessa
afc2eec6c1 UPD: Print port opening errors in backend 2024-06-07 12:09:55 +02:00
Robert Kossessa
51141b3f05 FIX: IdleTimeout 'Off' = 999999999 for now
to be changed when FW properly handles 0 timeout
2024-06-06 17:11:56 +02:00
Robert Kossessa
fbf76ea6fa FIX: Send less data for feedback updates 2024-06-06 17:06:34 +02:00
6 changed files with 88 additions and 24 deletions

54
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,54 @@
on:
push:
branches:
- '*'
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- name: 🐧 Linux
os: ubuntu-latest
pnpm_command: 'build:linux'
binary_path: dist/*.AppImage
asset_name: zeroone.AppImage
- name: 🪟 Windows
os: windows-latest
pnpm_command: 'build:win'
binary_path: dist/*.exe
asset_name: zeroone.exe
- name: 🍏 Mac
os: macos-latest
pnpm_command: 'build:mac'
binary_path: dist/*.dmg
asset_name: zeroone.dmg
name: ${{ matrix.name }} Build
runs-on: ${{ matrix.os }}
steps:
- name: 🚚 Checkout latest code
uses: actions/checkout@v4
- name: 🟩 Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: ⚡ Setup pnpm
uses: pnpm/action-setup@v4.0.0
#TODO - Remove this once https://github.com/electron-userland/electron-builder/issues/6933#issuecomment-1213438889 is resolved
- name: 💡 Tweak pnpm.cjs
if: ${{ contains(matrix.os, 'windows') }}
run: sed -i 's/\/usr\/bin\/env node/node/g' /c/Users/runneradmin/setup-pnpm/node_modules/.pnpm/pnpm@9.3.0/node_modules/pnpm/bin/pnpm.cjs
shell: bash
- name: 🔨 Build Project
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pnpm i
pnpm ${{ matrix.pnpm_command }}
permissions:
contents: write

View File

@@ -13,10 +13,10 @@ jobs:
- name: 🐧 Linux
os: ubuntu-latest
pnpm_command: 'build:linux'
binary_path: dist/*.deb
asset_name: zeroone.deb
binary_path: dist/*.AppImage
asset_name: zeroone.AppImage
- name: 🪟 Windows
os: macos-latest
os: windows-latest
pnpm_command: 'build:win'
binary_path: dist/*.exe
asset_name: zeroone.exe
@@ -44,7 +44,13 @@ jobs:
node-version: '20.x'
- name: ⚡ Setup pnpm
uses: pnpm/action-setup@v3.0.0
uses: pnpm/action-setup@v4.0.0
#TODO - Remove this once https://github.com/electron-userland/electron-builder/issues/6933#issuecomment-1213438889 is resolved
- name: Tweak pnpm.cjs
if: ${{ contains(matrix.os, 'windows') }}
run: sed -i 's/\/usr\/bin\/env node/node/g' /c/Users/runneradmin/setup-pnpm/node_modules/.pnpm/pnpm@9.3.0/node_modules/pnpm/bin/pnpm.cjs
shell: bash
- name: 🔨 Build Project
env:

View File

@@ -4,7 +4,7 @@
"description": "Configuration Suite for Binaris Devices",
"main": "./out/main/index.js",
"author": "katbinaris",
"packageManager": "pnpm@8.14.1",
"packageManager": "pnpm@9.3.0",
"homepage": "https://github.com/katbinaris/zeroone",
"build": {
"productName": "ZERO_ONE"

View File

@@ -3,8 +3,10 @@ import { PortInfo } from '@serialport/bindings-interface'
import { EventEmitter } from 'events'
// JTAG interface, TODO: change me!
const NANO_PRODUCT_ID = '8010'
const NANO_VENDOR_ID = '239A'
const NANO_VID_PID_PAIRS = [
{ vid: '239A', pid: '8010' },
{ vid: '303A', pid: '1001' }
]
const NANO_BAUD_RATE = 115200
class NanoSerialApi extends EventEmitter {
@@ -18,9 +20,12 @@ class NanoSerialApi extends EventEmitter {
const found_nano_devices: string[] = []
for (const port of ports) {
if (
port.productId?.toUpperCase() === NANO_PRODUCT_ID &&
port.vendorId?.toUpperCase() === NANO_VENDOR_ID &&
port.serialNumber
port.serialNumber &&
NANO_VID_PID_PAIRS.some(
(pair) =>
pair.vid === port.vendorId?.toUpperCase() &&
pair.pid === port.productId?.toUpperCase()
)
) {
found_nano_devices.push(port.serialNumber)
if (this.all_nano_devices[port.serialNumber] === undefined) {
@@ -30,14 +35,6 @@ class NanoSerialApi extends EventEmitter {
}
}
}
resolve(found_nano_devices)
for (const serialNumber in this.all_nano_devices) {
if (found_nano_devices.indexOf(serialNumber) === -1) {
delete this.all_nano_devices[serialNumber]
this.emit('nanoSerialApi:device-detached', serialNumber)
console.log('detached', serialNumber)
}
}
})
.catch((error) => {
reject(error)
@@ -120,6 +117,7 @@ class NanoSerialApi extends EventEmitter {
})
port.open((err) => {
if (err) {
console.log('Error opening port: ', err)
reject(err)
}
})

View File

@@ -67,7 +67,7 @@
<p>Idle Timeout:&nbsp;</p>
<p>
{{
deviceStore.settings?.idleTimeout
deviceStore.settings?.idleTimeout !== 999999999
? `${Math.round(deviceStore.settings.idleTimeout / 1000)}s`
: 'Off'
}}

View File

@@ -401,14 +401,14 @@ export const useDeviceStore = defineStore('device', {
}
},
cycleIdleTimeout() {
if (this.settings!.idleTimeout === 0) {
if (this.settings!.idleTimeout === 999999999) {
this.setIdleTimeout(10000)
} else if (this.settings!.idleTimeout === 10000) {
this.setIdleTimeout(30000)
} else if (this.settings!.idleTimeout === 30000) {
this.setIdleTimeout(60000)
} else {
this.setIdleTimeout(0)
this.setIdleTimeout(999999999)
}
},
setPosition(position: number) {
@@ -649,7 +649,10 @@ export const useDeviceStore = defineStore('device', {
JSON.stringify({
profile: this.currentProfileName,
updates: {
knob: this.currentProfile!.knob
knob: this.currentProfile!.knob.map((v) => ({
haptic: { outputRamp: v.haptic.outputRamp },
type: v.type
}))
}
})
)
@@ -666,7 +669,10 @@ export const useDeviceStore = defineStore('device', {
JSON.stringify({
profile: this.currentProfileName,
updates: {
knob: this.currentProfile!.knob
knob: this.currentProfile!.knob.map((v) => ({
haptic: { detentStrength: v.haptic.detentStrength },
type: v.type
}))
}
})
)
@@ -749,7 +755,7 @@ export const initializeDevices = () => {
setTimeout(function timer() {
console.log('Requesting profile', profileName)
nanoIpc.send(deviceid, JSON.stringify({ profile: profileName }))
}, i * 15)
}, i * 30)
})
}
if (update.current !== undefined) {