summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Didron <florian@111studio.jp>2019-07-02 14:32:28 +0900
committerFlorian Didron <florian@111studio.jp>2019-07-02 14:32:28 +0900
commitf109619499bc39dd8842cde245d935208befd844 (patch)
treea3687179ec51a5603f92672015f947998da13360
parentd6009eff50adb0633552199feafc57748f126350 (diff)
fix #6 allows to back out once keyboard or f/w is selected1.1.0-win1.1.0-linux
-rw-r--r--ui/src/components/App.js1
-rw-r--r--ui/src/components/Footer.js21
-rw-r--r--ui/src/css/wally.css9
-rw-r--r--wally/dfu.go7
-rw-r--r--wally/teensy.go8
5 files changed, 42 insertions, 4 deletions
diff --git a/ui/src/components/App.js b/ui/src/components/App.js
index adc68f3..f808e4f 100644
--- a/ui/src/components/App.js
+++ b/ui/src/components/App.js
@@ -126,6 +126,7 @@ export default function App(props) {
hasError={hasError}
step={step}
model={device.model}
+ resetState={resetState}
toggleLog={() => {
setToggleLog(!toggleLog);
}}
diff --git a/ui/src/components/Footer.js b/ui/src/components/Footer.js
index ad89cfe..ca57fea 100644
--- a/ui/src/components/Footer.js
+++ b/ui/src/components/Footer.js
@@ -4,7 +4,14 @@ import ZSALogo from "../images/zsa-logo.png";
import ErgodoxLogo from "../images/ergodox-logo.svg";
import PlanckLogo from "../images/planck-logo.svg";
-export default ({ appVersion, model, step, toggleLog, hasError }) => {
+export default ({
+ appVersion,
+ model,
+ step,
+ toggleLog,
+ hasError,
+ resetState
+}) => {
return (
<div className="footer">
<div className="title">KEYBOARD:</div>
@@ -18,6 +25,18 @@ export default ({ appVersion, model, step, toggleLog, hasError }) => {
src={model === 0 ? PlanckLogo : ErgodoxLogo}
/>
)}
+ {(step === 2 || step === 3) && (
+ <a
+ className="reset"
+ href="#reset"
+ onClick={e => {
+ e.preventDefault();
+ resetState();
+ }}
+ >
+ restart
+ </a>
+ )}
</div>
<div className="log-toggle" onClick={toggleLog}>
>_
diff --git a/ui/src/css/wally.css b/ui/src/css/wally.css
index 653dd41..88e6359 100644
--- a/ui/src/css/wally.css
+++ b/ui/src/css/wally.css
@@ -77,10 +77,12 @@ body {
}
.footer .status {
+ align-items: center;
color: #FFFFFF;
+ display: flex;
+ flex: 1;
font-weight: bold;
margin-left: 16px;
- flex: 1;
}
.footer .status .logo{
@@ -88,6 +90,11 @@ body {
top: 1px;
}
+.footer .status .reset{
+ margin-left: 10px;
+ color: #fff;
+}
+
.footer .logo {
position: relative;
top: 1px;
diff --git a/wally/dfu.go b/wally/dfu.go
index 9fc4631..6a5cdc7 100644
--- a/wally/dfu.go
+++ b/wally/dfu.go
@@ -138,6 +138,11 @@ func DFUFlash(path string, s *State) {
// Get the list of device that match TMK's vendor id
for {
+ // if the app is reset stop this goroutine and close the usb context
+ if s.Step != 3 {
+ s.Log("info", "App reset, interrupting the flashing process.")
+ return
+ }
s.Log("info", "Waiting for a DFU capable device")
devs, err := ctx.OpenDevices(func(desc *gousb.DeviceDesc) bool {
if desc.Vendor == gousb.ID(dfuVendorID) && desc.Product == gousb.ID(dfuProductID) {
@@ -152,7 +157,7 @@ func DFUFlash(path string, s *State) {
}
}()
- if (err != nil && runtime.GOOS != "windows") {
+ if err != nil && runtime.GOOS != "windows" {
message := fmt.Sprintf("OpenDevices: %s", err)
s.Log("error", message)
return
diff --git a/wally/teensy.go b/wally/teensy.go
index 0333e75..454d335 100644
--- a/wally/teensy.go
+++ b/wally/teensy.go
@@ -37,6 +37,12 @@ func TeensyFlash(path string, s *State) {
// Loop until a keyboard is ready to flash
for {
s.Log("info", "Waiting for a DFU capable device")
+ // if the app is reset stop this goroutine and close the usb context
+ if s.Step != 3 {
+ s.Log("info", "App reset, interrupting the flashing process.")
+ return
+ }
+
devs, err := ctx.OpenDevices(func(desc *gousb.DeviceDesc) bool {
if desc.Vendor == gousb.ID(halfKayVendorID) && desc.Product == gousb.ID(halfKayProductID) {
return true
@@ -50,7 +56,7 @@ func TeensyFlash(path string, s *State) {
}
}()
- if (err != nil && runtime.GOOS != "windows") {
+ if err != nil && runtime.GOOS != "windows" {
message := fmt.Sprintf("OpenDevices: %s", err)
s.Log("error", message)
return