aprs: ensure symbol is selected (and show in config editor); gps speed over ground on displays (GSm/GSk in m/s or km/h)

This commit is contained in:
Hansi, dl9rdz 2024-08-12 20:59:46 +00:00
parent 1ce326ac32
commit 2dc09763b5
5 changed files with 68 additions and 13 deletions

View File

@ -1605,7 +1605,8 @@ void handlePMUirq() {
button2.keydownTime = my_millis();
}
} else {
Serial.println("handlePMIirq() called. THIS SHOULD NOT HAPPEN w/o button2_axp set");
// WiFi loop intentionally calls this in order to react to PMU key press
//Serial.println("handlePMIirq() called. THIS SHOULD NOT HAPPEN w/o button2_axp set");
pmu_irq = 0; // prevent main loop blocking
}
}

View File

@ -5,6 +5,36 @@ stypes.set('D', 'DFM');
stypes.set('M', 'M10/M20');
stypes.set('3', 'MP3H');
function loadaprs(baseurl,callback) {
var link = document.createElement('link');
link.rel = 'stylesheet';
link.href = baseurl + "/aprs-symbols.css";
document.head.appendChild(link);
var script = document.createElement('script');
script.src = baseurl + "/aprs-symbols.js";
script.onload = function() { if (typeof callback === 'function') { callback(); } }
document.head.appendChild(script);
}
loadaprs("http://rdzsonde.mooo.com/aprs", function() {
var inputBox = document.querySelector('input[name="tcp.beaconsym"]');
if(inputBox) {
inputBox.addEventListener('input', showaprs);
var newdiv = document.createElement('div');
newdiv.id = 'aprsSyms';
inputBox.insertAdjacentElement('afterend', newdiv);
function showaprs() {
var inp = inputBox.value;
var tag1 = getAPRSSymbolImageTag(inp.slice(0,2));
var tag2 = getAPRSSymbolImageTag(inp.slice(2,4));
if(typeof tag1 === 'string') { newdiv.innerHTML = "Fixed: "+tag1; }
if(typeof tag2 === 'string') { newdiv.innerHTML += " Chase: "+tag2; }
}
showaprs();
inputBox.addEventListener('input', function() { showaprs(); });
}
});
function footer() {
document.addEventListener("DOMContentLoaded", function(){
var form = document.querySelector(".wrapper");

View File

@ -1555,6 +1555,22 @@ void Display::drawGPS(DispEntry *de) {
snprintf(buf, 4, "%3d", gpsPos.course);
drawString(de, buf);
break;
case 'S':
// GPS speed over ground
// extra[1]: m for m/s, k for km/h
// extra[2...]: additional text that is appended, like "m/s" or "km/h"
// if omitted, the m/s or km/h tile is appended on LCD displays (not TFT)
if(!de->extra[1]) break; // missing m or k
{
float speed = gpsPos.speed;
if(de->extra[1] != 'm') speed *= 3.6;
snprintf(buf, 16, "%.2f%s", speed, de->extra+2);
drawString(de, buf);
if(!de->extra[2]) {
rdis->drawTile(de->x+5, de->y, 2, de->extra[1]=='m' ? ms_tiles : kmh_tiles);
}
}
break;
case 'D':
{
// distance

View File

@ -287,6 +287,13 @@ void Sonde::checkConfig() {
if(config.sondehub.fimaxage==0) config.sondehub.fimaxage = 2;
// auto upgrade config to new version with format arguments in string
if(!strchr(sonde.config.ephftp,'%')) strcpy(sonde.config.ephftp,DEFEPH);
switch(strlen(config.beaconsym)) {
case 0: case 1:
strcpy(config.beaconsym,"/`/("); // default: dish antenne, mobile sat station
break;
case 2: case 3:
strcpy(config.beaconsym+2, "/("); // default sym2: mobile sat station
}
}
void Sonde::setConfig(const char *cfg) {
while(*cfg==' '||*cfg=='\t') cfg++;

View File

@ -107,6 +107,7 @@ void gpsTask(void *parameter) {
if (gpsPos.valid) {
gpsPos.lon = nmea.getLongitude() * 0.000001;
gpsPos.lat = nmea.getLatitude() * 0.000001;
gpsPos.speed = nmea.getSpeed() / 1000.0 * 0.514444; // speed is in m/s nmea.getSpeed is in 0.001 knots
long alt = 0;
nmea.getAltitude(alt);
gpsPos.alt = (int)(alt / 1000);