+kill timer values

This commit is contained in:
Hansi, dl9rdz 2019-12-21 15:30:54 +01:00
parent 7255f567aa
commit e54d63ab22
4 changed files with 60 additions and 2 deletions

View File

@ -38,7 +38,9 @@
# C afC value
# N ip address (only tiny font)
# S launch site
# Mx telemetry value x (t temp p preassure h hyg)
# K RS41 kill timer values: Kl launch timer, Kb burst timer, Kc kill countdown
# format: K_4: h:mm k_6: h:mm:ss k_s: sssss, nothing shown for other sonde
# Mx telemetry value x (t temp p preassure h hyg) [not yet implemented, maybe some day in future]
# Gx GPS-related data
# raw data from GPS: GA, GO, GH, GC: LAtitude, lOngitude, Altutide(Height), Course over ground
# relative to sonde: GD, GI, GB: Distance, dIrection (absolute), relative Bearing

View File

@ -1064,6 +1064,40 @@ void Display::drawSite(DispEntry *de) {
void Display::drawTelemetry(DispEntry *de) {
}
void Display::drawKilltimer(DispEntry *de) {
rdis->setFont(de->fmt);
uint16_t value;
switch(de->extra[0]) {
case 'l': value = sonde.si()->launchKT; break;
case 'b': value = sonde.si()->burstKT; break;
case 'c':
value = sonde.si()->countKT;
if(value!=0xffff) {
value += ((uint16_t)sonde.si()->frame)-sonde.si()->crefKT;
}
break;
}
// format: 4=h:mm; 6=h:mm:ss; s=sssss
uint16_t h=value/3600;
uint16_t m=(value-h*3600)/60;
uint16_t s=value%60;
switch(de->extra[1]) {
case '4':
if(value!=0xffff) snprintf(buf, 5, "%d:%02d", h, m);
else strcpy(buf, " ");
break;
case '6':
if(value!=0xffff) snprintf(buf, 7, "%d:%02d:%02d", h, m, s);
else strcpy(buf, " ");
break;
default:
if(value!=0xffff) snprintf(buf, 6, "%5d", value);
else strcpy(buf, " ");
break;
}
strcat(buf, de->extra[2]);
drawString(de, buf);
}
#define EARTH_RADIUS (6371000.0F)
#ifndef PI
#define PI (3.1415926535897932384626433832795)

View File

@ -438,6 +438,25 @@ int RS41::decode41(byte *data, int maxlen)
strncpy(sonde.si()->ser, (const char *)(data+p+2), 8);
sonde.si()->ser[8]=0;
sonde.si()->validID=true;
int calnr = data[p+23];
// not sure about this
if(calnr==0x31) {
uint16_t bt = data[p+30] + 256*data[p+31];
sonde.si()->burstKT = bt;
}
// this should be right...
if(calnr==0x02) {
uint16_t kt = data[p+31] + 256*data[p+32];
sonde.si()->launchKT = kt;
}
// and this seems fine as well...
if(calnr==0x32) {
uint16_t cntdown = data[p+24] + (data[p+25]<<8);
uint16_t min = cntdown - (cntdown/3600)*3600;
Serial.printf("Countdown value: %d\n [%2d:%02d:%02d]", cntdown, cntdown/3600, min/60, min-(min/60)*60);
sonde.si()->countKT = cntdown;
sonde.si()->crefKT = fnr;
}
}
// TODO: some more data
break;

View File

@ -83,8 +83,11 @@ typedef struct st_sondeinfo {
uint32_t norxStart; // millis() timestamp of continuous no rx start
uint32_t viewStart; // millis() timestamp of viewinf this sonde with current display
int8_t lastState; // -1: disabled; 0: norx; 1: rx
// shut down timers, currently only for RS41; -1=disabled
int16_t launchKT, burstKT, countKT;
uint16_t crefKT; // frame number in which countKT was last sent
} SondeInfo;
// rxStat: 3=undef[empty] 1=timeout[.] 2=errro[E] 3=ok[1] 5=no valid position[°]
// rxStat: 3=undef[empty] 1=timeout[.] 2=errro[E] 0=ok[|] 4=no valid position[°]
// Used for interacting with the RX background task
typedef struct st_RXTask {