update make file with init script
parent
a6de927851
commit
899cde8344
|
@ -1,17 +1,24 @@
|
||||||
TARGET_USER := a2nr
|
TARGET_USER := a2nr
|
||||||
TARGET_HOST := 192.168.1.3
|
TARGET_HOST := 192.168.1.3
|
||||||
TARGET_PATH := /home/a2nr/Documents/dashboard
|
TARGET_PATH := /home/$(TARGET_USER)/Documents/dashboard
|
||||||
|
TARGET_PASS := 'a2nr'
|
||||||
|
|
||||||
all: comp up run
|
all: comp up run
|
||||||
debug: ddebug up run_debug
|
debug: comp_debug up run_debug
|
||||||
|
init: install_dep install_flutter_pi
|
||||||
|
|
||||||
ddebug:
|
comp_debug:
|
||||||
flutterpi_tool build --arch=arm64
|
flutterpi_tool build --arch=arm64
|
||||||
comp:
|
comp:
|
||||||
flutterpi_tool build --arch=arm64 --release
|
flutterpi_tool build --arch=arm64 --release
|
||||||
up:
|
up:
|
||||||
rsync -a --info=progress2 ./build/flutter_assets $(TARGET_USER)@$(TARGET_HOST):$(TARGET_PATH)
|
sshpass -p $(TARGET_PASS) rsync -a --info=progress2 ./build/flutter_assets $(TARGET_USER)@$(TARGET_HOST):$(TARGET_PATH)
|
||||||
run:
|
run:
|
||||||
ssh $(TARGET_USER)@$(TARGET_HOST) 'flutter-pi -o landscape_left --release $(TARGET_PATH)/flutter_assets'
|
sshpass -p $(TARGET_PASS) ssh -t $(TARGET_USER)@$(TARGET_HOST) 'echo $(TARGET_PASS) | sudo -S flutter-pi -o landscape_left --release $(TARGET_PATH)/flutter_assets'
|
||||||
run_debug:
|
run_debug:
|
||||||
ssh $(TARGET_USER)@$(TARGET_HOST) 'flutter-pi -o landscape_left $(TARGET_PATH)/flutter_assets'
|
sshpass -p $(TARGET_PASS) ssh -t $(TARGET_USER)@$(TARGET_HOST) 'echo $(TARGET_PASS) | sudo -S flutter-pi -o landscape_left $(TARGET_PATH)/flutter_assets'
|
||||||
|
install_dep:
|
||||||
|
sshpass -p $(TARGET_PASS) ssh -t $(TARGET_USER)@$(TARGET_HOST) 'echo $(TARGET_PASS) | sudo -S apt-get -y install cmake libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev ttf-mscorefonts-installer fontconfig libsystemd-dev libinput-dev libudev-dev libxkbcommon-dev \
|
||||||
|
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-alsa'
|
||||||
|
install_flutter_pi:
|
||||||
|
sshpass -p $(TARGET_PASS) ssh -t $(TARGET_USER)@$(TARGET_HOST) 'cd ~/Documents && git clone --recursive https://github.com/ardera/flutter-pi || cd flutter-pi && mkdir build || cd build && cmake .. && make -j`nproc` && echo $(TARGET_PASS) | sudo -S make install'
|
||||||
|
|
|
@ -37,20 +37,23 @@ class MyHomePage extends StatefulWidget {
|
||||||
|
|
||||||
class _MyHomePageState extends State<MyHomePage> {
|
class _MyHomePageState extends State<MyHomePage> {
|
||||||
int _counter = 0;
|
int _counter = 0;
|
||||||
var config, gpio;
|
var config, gpio, spi;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState(){
|
void initState(){
|
||||||
super.initState();
|
super.initState();
|
||||||
|
spi = SPI(1, 0, SPImode.mode0, 100000);
|
||||||
config = GPIOconfig.defaultValues();
|
config = GPIOconfig.defaultValues();
|
||||||
config.direction = GPIOdirection.gpioDirOut;
|
config.direction = GPIOdirection.gpioDirOut;
|
||||||
gpio = GPIO(1, GPIOdirection.gpioDirOut, 1);
|
gpio = GPIO(2, GPIOdirection.gpioDirOut, 1);
|
||||||
|
print("SPI info: ${spi.getSPIinfo()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose(){
|
void dispose(){
|
||||||
super.dispose();
|
super.dispose();
|
||||||
gpio.dispose();
|
gpio.dispose();
|
||||||
|
spi.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _incrementCounter() {
|
void _incrementCounter() {
|
||||||
|
@ -58,6 +61,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||||
_counter++;
|
_counter++;
|
||||||
});
|
});
|
||||||
gpio.write(_counter.isOdd);
|
gpio.write(_counter.isOdd);
|
||||||
|
spi.transfer([0, 1, 2, 3, 4, 5, 6, 7], false);
|
||||||
print("gpio.write : $_counter.isOdd");
|
print("gpio.write : $_counter.isOdd");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue