added values that are printed in gui
This commit is contained in:
parent
21512e3030
commit
ad18313705
16
README.md
16
README.md
@ -94,12 +94,12 @@ Required library for antenna: [RF24](https://nrf24.github.io/RF24). Installation
|
|||||||
|
|
||||||
| Identifier | Message Code | Value | Verificator |
|
| Identifier | Message Code | Value | Verificator |
|
||||||
| ---------- | ------------ | -------------------------------- | ------------|
|
| ---------- | ------------ | -------------------------------- | ------------|
|
||||||
| $ | **1**; | roll | * |
|
| $ | **1**; | roll [°] | * |
|
||||||
| $ | **2**; | pitch | * |
|
| $ | **2**; | pitch [°] | * |
|
||||||
| $ | **3**; | yaw | * |
|
| $ | **3**; | yaw [°] | * |
|
||||||
| $ | **4**; | temperature [degrees of Celsius] | * |
|
| $ | **4**; | temperature [°C] | * |
|
||||||
| $ | **5**; | pressure | * |
|
| $ | **5**; | pressure [hPa] | * |
|
||||||
| $ | **6**; | altitude | * |
|
| $ | **6**; | altitude [m] | * |
|
||||||
| $ | **7**; | gyroscope x | * |
|
| $ | **7**; | gyroscope x | * |
|
||||||
| $ | **8**; | gyroscope y | * |
|
| $ | **8**; | gyroscope y | * |
|
||||||
| $ | **9**; | gyroscope z | * |
|
| $ | **9**; | gyroscope z | * |
|
||||||
@ -191,7 +191,6 @@ $GPGAA,HHMMSS.SS,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx
|
|||||||
- [ ] create a version which will send data via **IOT 433MHz LoRa LPWAN SX1278**
|
- [ ] create a version which will send data via **IOT 433MHz LoRa LPWAN SX1278**
|
||||||
- [ ] create a communication in both ways, `start`, `stop`, `system health check` commands
|
- [ ] create a communication in both ways, `start`, `stop`, `system health check` commands
|
||||||
- [ ] detection of apogeum and recovery system launch
|
- [ ] detection of apogeum and recovery system launch
|
||||||
- [ ] if recieved data for the parameter don't correspond with our expectations, change colour of the value indicator
|
|
||||||
|
|
||||||
### Monitor app issues
|
### Monitor app issues
|
||||||
|
|
||||||
@ -201,9 +200,10 @@ $GPGAA,HHMMSS.SS,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx
|
|||||||
- [ ] sender code should be improved
|
- [ ] sender code should be improved
|
||||||
- [x] gui window
|
- [x] gui window
|
||||||
- [ ] error messages as windows not terminal
|
- [ ] error messages as windows not terminal
|
||||||
- [ ] improve readability of code
|
|
||||||
- [ ] serial monitor setup port and baudrate
|
- [ ] serial monitor setup port and baudrate
|
||||||
- [ ] create a gui way of sending commands
|
- [ ] create a gui way of sending commands
|
||||||
|
- [ ] values change colour if they are not what they should be, or what are expected to be
|
||||||
|
- [ ] if recieved data for the parameter don't correspond with our expectations, change colour of the value indicator
|
||||||
|
|
||||||
## Sources
|
## Sources
|
||||||
|
|
||||||
|
|||||||
@ -20,8 +20,13 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
LOG_POSITION = [2]float64{800, 10}
|
LOG_POSITION = [2]float64{900, 10}
|
||||||
INFO_POSITION = [2]float64{100, 740}
|
TEMP_POSITION = [2]float64{600, 100}
|
||||||
|
PRESSURE_POSITION = [2]float64{200, 100}
|
||||||
|
ATTITUDE_POSITION = [2]float64{50, 400}
|
||||||
|
ROLL_POSITION = [2]float64{50, 650}
|
||||||
|
PITCH_POSITION = [2]float64{350, 650}
|
||||||
|
YAW_POSITION = [2]float64{650, 650}
|
||||||
)
|
)
|
||||||
|
|
||||||
func run() {
|
func run() {
|
||||||
@ -55,9 +60,21 @@ func run() {
|
|||||||
|
|
||||||
// Text
|
// Text
|
||||||
logging_serial := text.New(pixel.V(LOG_POSITION[0], LOG_POSITION[1]), log_atlas)
|
logging_serial := text.New(pixel.V(LOG_POSITION[0], LOG_POSITION[1]), log_atlas)
|
||||||
temperature := text.New(pixel.V(INFO_POSITION[0], INFO_POSITION[1]), info_atlas)
|
temperature := text.New(pixel.V(TEMP_POSITION[0], TEMP_POSITION[1]), info_atlas)
|
||||||
|
pressure := text.New(pixel.V(PRESSURE_POSITION[0], PRESSURE_POSITION[1]), info_atlas)
|
||||||
|
attitude := text.New(pixel.V(ATTITUDE_POSITION[0], ATTITUDE_POSITION[1]), info_atlas)
|
||||||
|
roll := text.New(pixel.V(ROLL_POSITION[0], ROLL_POSITION[1]), info_atlas)
|
||||||
|
pitch := text.New(pixel.V(PITCH_POSITION[0], PITCH_POSITION[1]), info_atlas)
|
||||||
|
yaw := text.New(pixel.V(YAW_POSITION[0], YAW_POSITION[1]), info_atlas)
|
||||||
|
|
||||||
var temperature_gui string
|
var (
|
||||||
|
temperature_gui string
|
||||||
|
pressure_gui string
|
||||||
|
attitude_gui string
|
||||||
|
roll_gui string
|
||||||
|
pitch_gui string
|
||||||
|
yaw_gui string
|
||||||
|
)
|
||||||
|
|
||||||
// Window update
|
// Window update
|
||||||
for !win.Closed() {
|
for !win.Closed() {
|
||||||
@ -74,10 +91,20 @@ func run() {
|
|||||||
|
|
||||||
// Clear screen values
|
// Clear screen values
|
||||||
temperature.Clear()
|
temperature.Clear()
|
||||||
|
pressure.Clear()
|
||||||
|
attitude.Clear()
|
||||||
|
roll.Clear()
|
||||||
|
pitch.Clear()
|
||||||
|
yaw.Clear()
|
||||||
|
|
||||||
// Update information if it is in the parsed block
|
// Update information if it is in the parsed block
|
||||||
if _, ok := info[1]; ok {
|
if _, ok := info[1]; ok {
|
||||||
temperature_gui = info[4]
|
temperature_gui = info[4]
|
||||||
|
pressure_gui = info[5]
|
||||||
|
attitude_gui = info[6]
|
||||||
|
roll_gui = info[1]
|
||||||
|
pitch_gui = info[2]
|
||||||
|
yaw_gui = info[3]
|
||||||
}
|
}
|
||||||
|
|
||||||
win.Clear(colornames.Black)
|
win.Clear(colornames.Black)
|
||||||
@ -85,10 +112,20 @@ func run() {
|
|||||||
// Print information to text blocks
|
// Print information to text blocks
|
||||||
logging_serial.WriteString(data)
|
logging_serial.WriteString(data)
|
||||||
temperature.WriteString("Temperature: " + temperature_gui)
|
temperature.WriteString("Temperature: " + temperature_gui)
|
||||||
|
pressure.WriteString("Pressure: [hPa] " + pressure_gui)
|
||||||
|
attitude.WriteString("Attitude: [m] " + attitude_gui)
|
||||||
|
roll.WriteString("Roll: " + roll_gui)
|
||||||
|
pitch.WriteString("Pitch: " + pitch_gui)
|
||||||
|
yaw.WriteString("Yaw: " + yaw_gui)
|
||||||
|
|
||||||
// Draw information to screen
|
// Draw information to screen
|
||||||
logging_serial.Draw(win, pixel.IM)
|
logging_serial.Draw(win, pixel.IM)
|
||||||
temperature.Draw(win, pixel.IM)
|
temperature.Draw(win, pixel.IM)
|
||||||
|
pressure.Draw(win, pixel.IM)
|
||||||
|
attitude.Draw(win, pixel.IM)
|
||||||
|
roll.Draw(win, pixel.IM)
|
||||||
|
pitch.Draw(win, pixel.IM)
|
||||||
|
yaw.Draw(win, pixel.IM)
|
||||||
|
|
||||||
win.Update()
|
win.Update()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,34 +0,0 @@
|
|||||||
package parse
|
|
||||||
|
|
||||||
// TODO: finish reading serial input and parsing it and piping it to the gui component
|
|
||||||
|
|
||||||
import (
|
|
||||||
"log"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Parser(s string) map[int]string {
|
|
||||||
|
|
||||||
// TODO: check if line isn't comment
|
|
||||||
// improve reading data
|
|
||||||
lines := strings.Split(s, "\n")
|
|
||||||
data_structure := make(map[int]string)
|
|
||||||
for _, line := range lines {
|
|
||||||
// find $ and * in text and get value between them
|
|
||||||
startIndex := strings.Index(line, "$")
|
|
||||||
endIndex := strings.Index(line, "*")
|
|
||||||
if startIndex != -1 && endIndex != -1 {
|
|
||||||
value := line[startIndex+1 : endIndex]
|
|
||||||
data := strings.Split(strings.TrimSpace(value), ";")
|
|
||||||
ident, err := strconv.Atoi(strings.TrimSpace(data[0]))
|
|
||||||
if err != nil {
|
|
||||||
log.Print(err)
|
|
||||||
}
|
|
||||||
info := data[1]
|
|
||||||
data_structure[ident] = info
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return data_structure
|
|
||||||
}
|
|
||||||
@ -56,7 +56,7 @@ func inputPort() string {
|
|||||||
var s_port string
|
var s_port string
|
||||||
|
|
||||||
for {
|
for {
|
||||||
fmt.Print("Enter port ([Enter] - /dev/ttyACM0): ")
|
fmt.Print("Enter port (/dev/ttyACM0): ")
|
||||||
fmt.Scanln(&s_port)
|
fmt.Scanln(&s_port)
|
||||||
|
|
||||||
if isPort(s_port) == true {
|
if isPort(s_port) == true {
|
||||||
|
|||||||
@ -19,7 +19,6 @@ void setup() {
|
|||||||
void loop() {
|
void loop() {
|
||||||
//Read the data if available in buffer
|
//Read the data if available in buffer
|
||||||
if (radio.available()) {
|
if (radio.available()) {
|
||||||
Serial.println("#200 Communication is available");
|
|
||||||
char text[64] = { 0 };
|
char text[64] = { 0 };
|
||||||
radio.read(&text, sizeof(text));
|
radio.read(&text, sizeof(text));
|
||||||
Serial.println(text);
|
Serial.println(text);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user