Skip to content

Commit fa21023

Browse files
committed
keep version for now while binary is not yet available
1 parent c76cd34 commit fa21023

File tree

6 files changed

+106
-28
lines changed

6 files changed

+106
-28
lines changed

config.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636

3737
<preference name="GradlePluginKotlinEnabled" value="true" />
3838
<preference name="GradlePluginKotlinCodeStyle" value="official" />
39-
<preference name="GradlePluginKotlinVersion" value="1.3.50" />
39+
<preference name="GradlePluginKotlinVersion" value="1.7.21" />
4040

4141
<preference name="android-minSdkVersion" value="23" />
42-
<preference name="android-targetSdkVersion" value="30" />
42+
<preference name="android-targetSdkVersion" value="33" />
4343

4444
<preference name="SplashScreen" value="none" />
4545

package.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@
2222
"xmlhttprequest": "^1.8.0"
2323
},
2424
"devDependencies": {
25-
"cordova-android": "^10.1.2",
26-
"cordova-browser": "^6.0.0",
27-
"cordova-electron": "^3.0.0",
25+
"cordova-android": "^13.0.0",
2826
"cordova-plugin-androidx-adapter": "^1.1.3",
2927
"cordova-plugin-inappbrowser": "^5.0.0",
30-
"rdzwx-plugin": "github:dl9rdz/rdzwx-plugin"
28+
"rdzwx-plugin": "file:../rdzwx-plugin"
3129
},
3230
"cordova": {
3331
"plugins": {
@@ -36,9 +34,7 @@
3634
"de-dl9rdz-rdzwx": {}
3735
},
3836
"platforms": [
39-
"android",
40-
"browser",
41-
"electron"
37+
"android"
4238
]
4339
},
4440
"browser": {
@@ -49,4 +45,4 @@
4945
"net": false,
5046
"fs": false
5147
}
52-
}
48+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Add this to enable AIDL in your Cordova Android project
2+
android {
3+
buildFeatures {
4+
aidl = true
5+
}
6+
}
7+

version.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.1.0",
3-
"url": "https://github.com/dl9rdz/rdzwx-go/releases/tag/v1.1.0",
4-
"apkurl": "https://github.com/dl9rdz/rdzwx-go/releases/download/v1.1.0/rdzSonde-v1.1.0.apk"
2+
"version": "1.0.7",
3+
"url": "https://github.com/dl9rdz/rdzwx-go/releases/tag/v1.0.7",
4+
"apkurl": "https://github.com/dl9rdz/rdzwx-go/releases/download/v1.0.7/rdzSonde-v1.0.7.apk"
55
}

www/index.html

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* Enable inline JS: add 'unsafe-inline' to default-src
3131
-->
3232
<!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;"> -->
33+
3334
<meta name="format-detection" content="telephone=no">
3435
<meta name="msapplication-tap-highlight" content="no">
3536
<meta name="viewport" content="initial-scale=1, width=device-width, viewport-fit=cover, user-scalable=no">
@@ -41,28 +42,29 @@
4142
<script src="js/leaflet.js"></script>
4243
<script src="js/leaflet.contextmenu.js"></script>
4344
<link rel="stylesheet" href="css/easy-button.css">
44-
<!--
45-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet-easybutton@2/src/easy-button.css">
46-
<script src="https://cdn.jsdelivr.net/npm/leaflet-easybutton@2/src/easy-button.js"></script>
47-
-->
4845
<script src="js/easy-button.js"></script>
4946
<script src="js/L.Control.MousePosition.js"></script>
5047

51-
<title>rdzSonde v1.0.7 +experimental</title>
48+
<title>rdzSonde v1.1.0</title>
5249
</head>
5350
<body>
5451
<div id="all">
5552
<div id="toolbar">
5653
<a id="toolbarclose" class="leaflet-popup-close-button" style="cursor: pointer; float: right;">X</a>
57-
<h2>rdzSonde v1.0.7 +experimental</h2>
58-
<p>Copyright &copy; 2022 Hansi Reiser, dl9rdz</p>
54+
<h2>rdzSonde v1.1.0</h2>
55+
<p>Copyright &copy; 2022-2024 Hansi Reiser, dl9rdz</p>
5956
<p>see <a href="https://github.com/dl9rdz/rdzwx-go">https://github.com/dl9rdz/rdzwx-go</a> for details</p>
6057
<p>Apache License Version 2.0</p>
6158
<hr>
6259
<button onclick="RdzWx.selstorage(&quot;map&quot;, function(res) { localStorage.setItem(&quot;mapstorage&quot;, res); })">Select map file </button>
6360
<hr>
6461
<button onclick="RdzWx.selstorage(&quot;theme&quot;, function(res) { localStorage.setItem(&quot;mapstorage&quot;, res); })">Select map theme </button>
6562
<hr>
63+
<div label="connection-options">
64+
<label><input type="radio" name="connection" id="auto-discovery" value="auto"> Automatic (mDNS discovery) </label><br>
65+
<label><input type="radio" name="connection" id="manual-entry" value="manual"> Manual IP/host entry </label><br>
66+
<input type="text" id="manual-address" placeholder="Enter IP/Hostname" style="display:none; width: 100%;">
67+
</div>
6668
<div id="toolbaritems">
6769
</div>
6870
</div>

www/js/index.js

Lines changed: 81 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -324,14 +324,17 @@ function onDeviceReady() {
324324
else { this._hideContent(); }
325325
},
326326
setContent: function(obj) {
327-
//alert(JSON.stringify(obj));
328327
if(!this._infoContentContainer) return;
328+
if( (obj.validPos&7) != 7 ) { return; } // check if we have lat, lon, alt in data; if not no update of display
329+
329330
if(obj.type == null) obj.type = "RS41"; // TODO fix in plugin
330331
distance = "";
331-
distance = L.latLng(obj).distanceTo(L.latLng(mypos))
332-
if(distance>9999) { distance = "d=" + (0.001*distance).toFixed(1) + "km"; }
333-
else if (distance>99) { distance = "d=" + distance.toFixed(0) + "m"; }
334-
else { distance = "d=" + distance.toFixed(1) + "m"; }
332+
try {
333+
distance = L.latLng(obj).distanceTo(L.latLng(mypos))
334+
if(distance>9999) { distance = "d=" + (0.001*distance).toFixed(1) + "km"; }
335+
else if (distance>99) { distance = "d=" + distance.toFixed(0) + "m"; }
336+
else { distance = "d=" + distance.toFixed(1) + "m"; }
337+
} catch(error) {}
335338
sym = "<span class=\"lifenessinfo\">&#x2B24; </span>";
336339
l1 = "<table class=\"infotable\"><tr><td class=\"infotd\">" + sym + obj.type + "</td><td class=\"infotdr\">" + obj.ser + "</td></tr></table>";
337340
// normal layout
@@ -416,6 +419,7 @@ function onDeviceReady() {
416419
}
417420
if(obj.hdop<0) { // GPS fix lost
418421
} else {
422+
console.log("updateMybos..updateMybos....")
419423
var p0 = L.latLng(obj);
420424
var p1 = L.latLng(this._currentObj);
421425
var b = p0.bearingTo(p1);
@@ -499,6 +503,8 @@ function onDeviceReady() {
499503
});
500504
ready = 1;
501505
RdzWx.start("testarg", callBack);
506+
console.log("Starting setupTTGO");
507+
setupTTGOconfig();
502508
setInterval(periodicStatusCheck, 1000);
503509

504510
// just for testing
@@ -781,8 +787,8 @@ function update(obj) {
781787
return;
782788
}
783789

784-
// position update
785-
//console.log("Pos update: "+JSON.stringify(obj));
790+
// sonde data update
791+
//console.log("Sonde update: "+JSON.stringify(obj));
786792
if(obj.egmdiff && obj.alt) { obj.alt -= obj.egmdiff; }
787793
infobox.setContent(obj);
788794
infobox.setStatus(obj.res);
@@ -802,7 +808,7 @@ function update(obj) {
802808
markers[obj.id] = marker;
803809
lastMarker = marker
804810
} else {
805-
console.log("pos update: No valid update: "+JSON.stringify(obj));
811+
//console.log("pos update: No valid update: "+JSON.stringify(obj));
806812
}
807813
return;
808814
}
@@ -923,3 +929,70 @@ function reqauth() {
923929
}
924930
xhr.send('submitted=1&username=DL9RDZ&password=ct1jzmhr&Submit=Login');
925931
}
932+
933+
934+
// Handling settings for TTGO address
935+
// Must be called after RdzWx has been initialized, as it calls updateDiscovery(...)
936+
function setupTTGOconfig() {
937+
// Restore state on application start
938+
const savedState = localStorage.getItem('connectionState') || 'auto';
939+
const savedAddr = localStorage.getItem('manualAddress') || 'rdzsonde.local';
940+
console.log("updating to "+savedState+", "+savedAddr);
941+
updateTTGOaddr(savedState, savedAddr)
942+
943+
if (savedState === 'auto') {
944+
document.getElementById('auto-discovery').checked = true;
945+
document.getElementById('manual-address').style.display = 'none';
946+
} else if (savedState === 'manual') {
947+
document.getElementById('manual-entry').checked = true;
948+
document.getElementById('manual-address').style.display = 'block';
949+
}
950+
951+
if (savedAddr) {
952+
document.getElementById('manual-address').value = savedAddr;
953+
}
954+
955+
// Save state and call updateTTGOaddr on changes
956+
const radioButtons = document.querySelectorAll('input[name="connection"]');
957+
const manualAddressInput = document.getElementById('manual-address');
958+
959+
radioButtons.forEach(radio => {
960+
radio.addEventListener('change', () => {
961+
const state = document.getElementById('auto-discovery').checked ? 'auto' : 'manual'
962+
const addr = manualAddressInput.value;
963+
localStorage.setItem('connectionState', state );
964+
if (state === 'manual') {
965+
manualAddressInput.style.display = 'block';
966+
} else {
967+
manualAddressInput.style.display = 'none';
968+
}
969+
updateTTGOaddr(state, addr);
970+
});
971+
});
972+
973+
manualAddressInput.addEventListener('blur', () => {
974+
if (document.getElementById('manual-entry').checked) {
975+
const addr = manualAddressInput.value;
976+
localStorage.setItem('manualAddress', addr);
977+
updateTTGOaddr('manual', addr);
978+
}
979+
});
980+
981+
manualAddressInput.addEventListener('keypress', (e) => {
982+
if (e.key === 'Enter') {
983+
manualAddressInput.blur(); // Trigger the blur event
984+
}
985+
});
986+
};
987+
988+
// Placeholder for your custom function
989+
function updateTTGOaddr(state, addr) {
990+
console.log('State:', state, 'Address:', addr);
991+
RdzWx.mdnsUpdateDiscovery( state, addr, function(){})
992+
// Implement your custom logic here
993+
}
994+
995+
996+
997+
998+

0 commit comments

Comments
 (0)