kopia lustrzana https://github.com/dl9rdz/rdz_ttgo_sonde
pull/175/head
rodzic
e00d70b385
commit
a30f51e5a0
|
@ -147,6 +147,18 @@ int readLine(Stream &stream, char *buffer, int maxlen) {
|
|||
// Replaces placeholder with LED state value
|
||||
String processor(const String& var) {
|
||||
Serial.println(var);
|
||||
if (var == "MAPCENTER") {
|
||||
double lat, lon;
|
||||
if(gpsPos.valid) { lat=gpsPos.lat; lon=gpsPos.lon; }
|
||||
else { lat = sonde.config.rxlat; lon = sonde.config.rxlon; }
|
||||
if( !isnan(lat) && !isnan(lon) ) {
|
||||
char p[40];
|
||||
snprintf(p, 40, "%g,%g", lat, lon);
|
||||
return String(p);
|
||||
} else {
|
||||
return String("48,13");
|
||||
}
|
||||
}
|
||||
if (var == "VERSION_NAME") {
|
||||
return String(version_name);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" />
|
||||
<script>var mapcenter=[%MAPCENTER%];</script>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
|
||||
<script src="https://unpkg.com/leaflet.marker.slideto@0.2.0/Leaflet.Marker.SlideTo.js"></script>
|
||||
|
|
|
@ -40,7 +40,8 @@ $(document).ready(function(){
|
|||
}
|
||||
};
|
||||
|
||||
map.setView([51.163361,10.447683], 5); // Mitte DE
|
||||
if(mapcenter) map.setView(mapcenter, 5);
|
||||
else map.setView([51.163361,10.447683], 5); // Mitte DE
|
||||
|
||||
var reddot = '<span class="ldot rbg"></span>';
|
||||
var yellowdot = '<span class="ldot ybg"></span>';
|
||||
|
|
Ładowanie…
Reference in New Issue