Improve ability to run firmware locally for dev
Esse commit está contido em:
+7
-2
@@ -1,12 +1,17 @@
|
|||||||
version = $(shell git describe --tags --dirty)
|
version = $(shell git describe --tags --dirty)
|
||||||
|
host_os = $(shell go env GOOS)
|
||||||
|
host_arch = $(shell go env GOARCH)
|
||||||
|
|
||||||
dev:
|
dev:
|
||||||
./scripts/build.bash -version $(version) dist/dev
|
./scripts/build.bash -version $(version) dist/dev
|
||||||
./dist/dev/deploy
|
./dist/dev/deploy
|
||||||
|
|
||||||
dev-local:
|
dev-local:
|
||||||
go build github.com/felixge/godrone/cmd/godrone
|
env \
|
||||||
./godrone cmd/godrone/godrone.conf
|
BUILD_OS="$(host_os)" \
|
||||||
|
BUILD_ARCH="$(host_arch)" \
|
||||||
|
./scripts/build.bash -version $(version) dist/local-dev
|
||||||
|
cd dist/local-dev && ./godrone
|
||||||
|
|
||||||
dist:
|
dist:
|
||||||
./scripts/dist.bash $(version)
|
./scripts/dist.bash $(version)
|
||||||
|
|||||||
@@ -99,6 +99,8 @@ func (g *GoDrone) Run() error {
|
|||||||
g.log.Info("Starting godrone")
|
g.log.Info("Starting godrone")
|
||||||
defer g.motorboard.Close()
|
defer g.motorboard.Close()
|
||||||
|
|
||||||
|
go g.serveHttp()
|
||||||
|
|
||||||
g.motorboard.SetLeds(green)
|
g.motorboard.SetLeds(green)
|
||||||
time.Sleep(500 * time.Millisecond)
|
time.Sleep(500 * time.Millisecond)
|
||||||
g.motorboard.SetLeds(red)
|
g.motorboard.SetLeds(red)
|
||||||
@@ -112,7 +114,6 @@ func (g *GoDrone) Run() error {
|
|||||||
g.motorboard.SetLeds(green)
|
g.motorboard.SetLeds(green)
|
||||||
|
|
||||||
go g.navboardLoop()
|
go g.navboardLoop()
|
||||||
go g.serveHttp()
|
|
||||||
|
|
||||||
sigCh := make(chan os.Signal, 1)
|
sigCh := make(chan os.Signal, 1)
|
||||||
signal.Notify(sigCh, syscall.SIGINT)
|
signal.Notify(sigCh, syscall.SIGINT)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/felixge/godrone/log"
|
"github.com/felixge/godrone/log"
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// gyroGains are the measured gains for converting the gyroscope output into
|
// gyroGains are the measured gains for converting the gyroscope output into
|
||||||
@@ -52,6 +53,8 @@ func (n *Navboard) NextData() (data Data, err error) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
if err = n.open(); err != nil {
|
if err = n.open(); err != nil {
|
||||||
|
// Don't go too crazy on retry.
|
||||||
|
time.Sleep(time.Second)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -234,7 +234,7 @@
|
|||||||
React.renderComponent(
|
React.renderComponent(
|
||||||
<GoDrone
|
<GoDrone
|
||||||
version={Config.Version}
|
version={Config.Version}
|
||||||
wsUrl="ws://192.168.1.1/ws"
|
wsUrl={'ws://'+window.location.hostname+':'+window.location.port+'/ws'}
|
||||||
gamepadAxisMin={0.01}
|
gamepadAxisMin={0.01}
|
||||||
maxAngle={Config.MaxAngle}
|
maxAngle={Config.MaxAngle}
|
||||||
flyButton={0}
|
flyButton={0}
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ main() {
|
|||||||
GOARCH="${arch}" \
|
GOARCH="${arch}" \
|
||||||
go build -o "${out_dir}/${deploy_name}" "${deploy_pkg}"
|
go build -o "${out_dir}/${deploy_name}" "${deploy_pkg}"
|
||||||
env \
|
env \
|
||||||
GOOS=linux \
|
GOOS="${BUILD_OS:-linux}" \
|
||||||
GOARCH=arm \
|
GOARCH="${BUILD_ARCH:-arm}" \
|
||||||
GOARM=7 \
|
GOARM=7 \
|
||||||
CGO_ENABLED=0 \
|
CGO_ENABLED=0 \
|
||||||
go build \
|
go build \
|
||||||
|
|||||||
Referência em uma Nova Issue
Bloquear um usuário