Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fisiolog
respirometro
Commits
57132aa5
Commit
57132aa5
authored
May 18, 2016
by
Béuren F. Bechlin
Browse files
ADD: python requeriments, ATT:storeBinData
parent
5ce38a43
Changes
8
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
57132aa5
.build
sources/python/
sources/*.log
sources/*.logbin
Makefile
View file @
57132aa5
...
...
@@ -15,7 +15,8 @@ help:
@
echo
" firmware Compile and upload the firmware to the Arduino board via serial"
@
echo
" serial Starts a serial session with Python for board communication"
@
echo
""
@
echo
" run Execute the logger on the foreground. Hit Ctrl+C to stop it."
@
echo
" store Execute the logger on the foreground. Hit Ctrl+C to stop it."
@
echo
" analyse Execute the analyses data routine"
install-debian-deps
:
sudo
apt-get
install
-y
python3 supervisor curl dialog
...
...
@@ -26,48 +27,23 @@ install-pip3:
rm
get-pip.py
install-python-deps
:
install-pip3
sudo
pip3
install
-
U
virtualenv
sudo
pip3
install
-
r
scripts/requirements.pip
install-platformio
:
sudo
python
-c
"
$$
(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
setup
:
install-debian-deps install-python-deps install-platformio venv
venv
:
clean-venv
@
echo
"-------------------------------------------------------"
virtualenv
-v
--python
=
'
${PYBIN}
'
${VENVDIR}
--no-site-packages
${VENVDIR}
/bin/pip
install
-r
logger/requirements.pip
@
echo
"-------------------------------------------------------"
@
echo
"Required Python virtual environment sucessfully installed at "
@
du
-sh
${VENVDIR}
clean-venv
:
rm
-rf
${VENVDIR}
check-venv
:
@
command
-v
${VENVPY}
>
/dev/null 2>&1
||
\
{
printf
"You need to prepare the required Python virtual environment"
;
\
printf
"
\n
for running this software. Excecute, just once:"
;
\
printf
"
\n\n
$$
make setup
\n\n
or
\n\n
"
;
\
printf
"
$$
make setup PYBIN=<python_binary>
\n\n
for specifying a "
;
\
printf
"Python binary other than 'python3', like
\n
'python-3.x' "
;
\
printf
"(where x is a number) for instance.
\n\n
"
;
exit
1
;
}
firmware
:
python3 scripts/run_platformio.py
serial
:
check-venv
${VENVPY}
scripts/init_serial.py
--loop
pyserial
:
check-venv
${VENVPY}
-i
scripts/init_serial.py
syncrtc
:
${VENVPY}
scripts/init_serial.py
--syncrtc
serial
:
python3 scripts/init_serial.py
--loop
boardhash
:
${VENVPY}
scripts/getboardhash
.py
pyserial
:
python3
-i
scripts/init_serial
.py
run
:
check-venv
${VENVPY}
logger/run.py
run
:
python3
logger/run.py
firmware/respirometro/respirometro.ino
View file @
57132aa5
...
...
@@ -36,7 +36,8 @@ sobre a licença GPL v3, como também os arquivos:
/* Criando estruturas de dados para definir como será enviado os
dados de comunicação*/
struct
{
short
int
controlFlag
=
0xAAAA
;
byte
controlFlag01
=
0xAA
;
byte
controlFlag02
=
0xAA
;
short
int
frequency
=
FREQUENCY
;;
}
headerStruct
;
...
...
@@ -54,12 +55,7 @@ Interface interface(&measures, 1000.0/FREQUENCY);
void
setup
(){
/* Iniciando comunicação serial*/
Serial
.
begin
(
115200
);
while
(
!
Serial
){
}
delay
(
50
);
commHeader
.
send
();
delay
(
50
);
}
void
loop
(){
...
...
scripts/requirements.pip
0 → 100644
View file @
57132aa5
pyserial==3.0.1
pythondialog==3.2.0
scripts/run_platformio.py
View file @
57132aa5
...
...
@@ -15,9 +15,11 @@ def get_plataformio_serial_ports():
'''
serial_raw
=
shexec
(
"platformio serialports list"
).
splitlines
()
serial_ports
=
[
serial_raw
[
i
-
1
]
if
serial_raw
==
[]:
return
[(
"ERRO"
,
"ERRO: nenhuma porta serial encontrada"
)]
else
:
serial_ports
=
[
serial_raw
[
i
-
1
]
for
i
,
x
in
enumerate
(
serial_raw
)
if
'----'
in
x
]
return
[(
x
,
x
)
for
x
in
serial_ports
]
...
...
@@ -69,15 +71,17 @@ def exec_dialog_select_board():
def
platformio_setup
(
source_dir
,
build_dir
=
'.build'
):
board_name
=
exec_dialog_select_board
()
serial_port
=
exec_dialog_select_serial_port
()
os
.
system
(
"""
rm -rf {build_dir} &&
mkdir -p {build_dir} &&
cd {build_dir} &&
yes | platformio init --board {board_name} &&
cp -r ../{source_dir}/* src/. &&
platformio run -t upload --upload-port {serial_port}
"""
.
format
(
**
locals
()).
strip
())
if
serial_port
!=
"ERRO"
:
os
.
system
(
"""
rm -rf {build_dir} &&
mkdir -p {build_dir} &&
cd {build_dir} &&
yes | platformio init --board {board_name} &&
cp -r ../{source_dir}/* src/. &&
platformio run -t upload --upload-port {serial_port}
"""
.
format
(
**
locals
()).
strip
())
else
:
os
.
system
(
"clear"
)
platformio_setup
(
source_dir
=
SOURCE_DIR
)
sources/coleta_Nome_Exemplo_1min.log
deleted
100644 → 0
View file @
5ce38a43
250
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023
1023