Porównaj commity

...

4 Commity

Autor SHA1 Wiadomość Data
Adrian Batzill c11e5488b7 live-update "my location marker" on map page 2024-03-26 09:34:25 +00:00
Adrian Batzill 64edd25e48 Remove UBX-CFG-PMS configuration. Closes #274 2024-03-26 09:11:22 +01:00
Adrian Batzill 0a5c01a5d8 correctly apply overlay after update script execution 2024-03-24 13:46:29 +01:00
Adrian Batzill e28558aac1 ogn-rx-eu release for new protocol revision 2024-03-24 13:45:16 +01:00
4 zmienionych plików z 86 dodań i 57 usunięć

Wyświetl plik

@ -565,10 +565,6 @@ func writeUbloxGenericCommands(navrate uint16, p *serial.Port) {
// UBX-CFG-NMEA (change NMEA protocol version to 4.0 extended)
p.Write(makeUBXCFG(0x06, 0x17, 20, []byte{0x00, 0x40, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}))
// UBX-CFG-PMS
p.Write(makeUBXCFG(0x06, 0x86, 8, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // Full Power Mode
// p.Write(makeUBXCFG(0x06, 0x86, 8, []byte{0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // Balanced Power Mode
// UBX-CFG-NAV5 |mask1...| dyn
p.Write(makeUBXCFG(0x06, 0x24, 36, []byte{0x01, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) // Dynamic platform model: airborne with <2g acceleration

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -81,7 +81,7 @@ cd /
rm -rf /root/stratux-update
# re-enable overlay if it is configured. TODO: switch to jq for json parsing in the future once it's available in all installations
if [ "$(cat /boot/stratux.conf | grep 'PersistentLogging.:true')" != "" ]; then
if [ "$(cat /boot/stratux.conf | grep 'PersistentLogging.:\s*true')" != "" ]; then
/sbin/overlayctl disable
else
/sbin/overlayctl enable

Wyświetl plik

@ -142,32 +142,49 @@ function MapCtrl($rootScope, $scope, $state, $http, $interval, craftService) {
if (($scope.socket === undefined) || ($scope.socket === null)) {
socket = new WebSocket(URL_TRAFFIC_WS);
$scope.socket = socket; // store socket in scope for enter/exit usage
}
$scope.ConnectState = 'Disconnected';
socket.onopen = function(msg) {
$scope.ConnectState = 'Connected';
$scope.$apply();
};
socket.onclose = function(msg) {
$scope.ConnectState = 'Disconnected';
$scope.$apply();
if ($scope.socket !== null ) {
setTimeout(connect, 1000); // do not set timeout after exit
}
};
socket.onerror = function(msg) {
// $scope.ConnectStyle = "label-danger";
$scope.ConnectState = 'Problem';
$scope.$apply();
};
socket.onopen = function(msg) {
$scope.ConnectState = 'Connected';
$scope.$apply();
};
socket.onmessage = function(msg) {
$scope.onMessage(msg);
};
socket.onclose = function(msg) {
$scope.ConnectState = 'Disconnected';
$scope.$apply();
if ($scope.socket !== null ) {
setTimeout(connect, 1000); // do not set timeout after exit
}
};
socket.onerror = function(msg) {
// $scope.ConnectStyle = "label-danger";
$scope.ConnectState = 'Problem';
$scope.$apply();
};
socket.onmessage = function(msg) {
$scope.onMessage(msg);
};
}
if (($scope.socketgps === undefined) || ($scope.socketgps === null)) {
var socketgps = new WebSocket(URL_GPS_WS);
$scope.socketgps = socketgps; // store socket in scope for enter/exit usage
socketgps.onclose = function (msg) {
delete $scope.socketgps;
setTimeout(function() {connect($scope);}, 1000);
};
socketgps.onmessage = function (msg) {
updateMyLocation(JSON.parse(msg.data));
};
}
}
/**
@ -448,40 +465,53 @@ function MapCtrl($rootScope, $scope, $state, $http, $interval, craftService) {
$scope.removeStaleTraffic();
}
function updateMyLocation(msg) {
const lat = msg.GPSLatitude;
const lon = msg.GPSLongitude;
const fix = msg.GPSFixQuality
if (fix <= 0)
return;
function getLocationForInitialPosition() {
$http.get(URL_GET_SITUATION).then(function(response) {
situation = angular.fromJson(response.data);
if (situation.GPSFixQuality > 0) {
pos = ol.proj.fromLonLat([situation.GPSLongitude, situation.GPSLatitude])
$scope.map.setView(new ol.View({
center: pos,
zoom: 10,
enableRotation: false
}));
const layer = getOrCreateGpsLayer(lat, lon);
const source = layer.getSource();
const geom = new ol.geom.Point(ol.proj.fromLonLat([lon, lat]));
source.getFeatures()[0].setGeometry(geom);
}
let gpsLayer = new ol.layer.Vector({
source: new ol.source.Vector({
features: [
new ol.Feature({
geometry: new ol.geom.Point(pos),
name: 'Your GPS position'
})
]
}),
style: new ol.style.Style({
text: new ol.style.Text({
text: '\uf041',
font: 'normal 35px FontAwesome',
textBaseline: 'bottom'
})
function getOrCreateGpsLayer(lat, lon) {
if ($scope.gpsLayer)
return $scope.gpsLayer;
pos = ol.proj.fromLonLat([lon, lat])
$scope.map.setView(new ol.View({
center: pos,
zoom: 10,
enableRotation: false
}));
$scope.gpsLayer = new ol.layer.Vector({
source: new ol.source.Vector({
features: [
new ol.Feature({
geometry: new ol.geom.Point(pos),
name: 'Your GPS position'
})
});
$scope.map.addLayer(gpsLayer);
}
]
}),
style: new ol.style.Style({
text: new ol.style.Text({
text: '\uf041',
font: 'normal 35px FontAwesome',
textBaseline: 'bottom'
})
})
});
};
$scope.map.addLayer($scope.gpsLayer);
return $scope.gpsLayer;
}
$state.get('map').onExit = function () {
// disconnect from the socket
@ -489,13 +519,16 @@ function MapCtrl($rootScope, $scope, $state, $http, $interval, craftService) {
$scope.socket.close();
$scope.socket = null;
}
if ($scope.socketgps) {
$scope.socketgps.close();
$scope.socketgps = null;
}
// stop stale traffic cleanup
$interval.cancel($scope.update);
}
connect($scope);
getLocationForInitialPosition();
$interval($scope.update, 1000);