Bugfix: Correct normalisation
This commit is contained in:
parent
dea7940b2e
commit
7761b0e1aa
3 changed files with 11 additions and 7 deletions
2
build
2
build
|
@ -158,7 +158,7 @@ task_client-watch() {
|
|||
while :; do # : = infinite loop
|
||||
# Wait for an update
|
||||
# inotifywait's non-0 exit code forces an exit for some reason :-/
|
||||
inotifywait -qr --event modify --format '%:e %f' client_src rollup.*.config.js;
|
||||
inotifywait -qr --event modify --format '%:e %f' client_src common rollup.*.config.js;
|
||||
|
||||
task_begin "Copying html";
|
||||
execute cp client_src/index.html "app/";
|
||||
|
|
|
@ -84,8 +84,10 @@ class AIWrapper {
|
|||
next_value[0]
|
||||
);
|
||||
}
|
||||
|
||||
let chance = Math.random() < 0.01;
|
||||
if(chance) console.log(max_predicted_rssi);
|
||||
max_predicted_rssi = unnormalise_rssi(max_predicted_rssi);
|
||||
if(chance) console.log(max_predicted_rssi);
|
||||
|
||||
if(max_predicted_rssi > stats.rssi_max)
|
||||
stats.rssi_max = max_predicted_rssi;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
import { normalise, clamp } from './Math.mjs';
|
||||
|
||||
function normalise_lat(lat) {
|
||||
|
@ -32,14 +34,14 @@ function normalise_gateway_distance(distance) {
|
|||
return clamp(normalise(distance,
|
||||
{ min: 0, max: 20000 },
|
||||
{ min: 0, max: 1 }
|
||||
), 0, 20000);
|
||||
), 0, 1);
|
||||
}
|
||||
|
||||
function unnormalise_gateway_distance(ndistance) {
|
||||
return clamp(normalise(ndistance,
|
||||
return normalise(ndistance,
|
||||
{ min: 0, max: 1 },
|
||||
{ min: 0, max: 20000 }
|
||||
), 0, 20000);
|
||||
);
|
||||
}
|
||||
|
||||
function normalise_rssi(rssi) {
|
||||
|
@ -49,10 +51,10 @@ function normalise_rssi(rssi) {
|
|||
), 0, 1)
|
||||
}
|
||||
function unnormalise_rssi(rssi) {
|
||||
return clamp(normalise(rssi,
|
||||
return normalise(rssi,
|
||||
{ min: 0, max: 1 },
|
||||
{ min: -150, max: 0 }
|
||||
), 0, 1)
|
||||
);
|
||||
}
|
||||
|
||||
export {
|
||||
|
|
Loading…
Reference in a new issue