fix of indexed data

This commit is contained in:
foglar 2024-03-18 12:49:16 +01:00
parent ad18313705
commit 446176b877
2 changed files with 8 additions and 1 deletions

View File

@ -191,6 +191,7 @@ $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 communication in both ways, `start`, `stop`, `system health check` commands
- [ ] detection of apogeum and recovery system launch
- [ ] add timestamps and save everything to sd card
### Monitor app issues
@ -204,6 +205,7 @@ $GPGAA,HHMMSS.SS,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx
- [ ] 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
- [ ] save all recieved data
## Sources

View File

@ -51,6 +51,8 @@ void loop() {
float magn[] = {stMagnRawData.s16X, stMagnRawData.s16Y, stMagnRawData.s16Z};
char msg[64];
// Send angles data
for (int i = 0; i < 3; i++) {
char float_str[8];
dtostrf(angles[i], 6, 2, float_str);
@ -59,6 +61,7 @@ void loop() {
radio.write(&msg, sizeof(msg));
}
// Send other sensor data
float sensor_data[][3] = {
{temperature, pressure, altitude},
{gyro[0], gyro[1], gyro[2]},
@ -66,13 +69,15 @@ void loop() {
{magn[0], magn[1], magn[2]}
};
int index = 4;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 3; j++) {
char float_str[8];
dtostrf(sensor_data[i][j], 6, 2, float_str);
String str = String("$") + String(i + 4) + ";" + String(float_str) + "*";
String str = String("$") + String(index) + ";" + String(float_str) + "*";
str.toCharArray(msg, sizeof(msg));
radio.write(&msg, sizeof(msg));
index++;
}
}
}