kopia lustrzana https://github.com/ogre/habdec
Merge branch 'master' of github.com:ogre/habdec into ssdv
commit
4206e8d30d
|
@ -84,7 +84,7 @@ function ws_onOpen(evt)
|
||||||
console.debug("ws_onOpen: init refresh.");
|
console.debug("ws_onOpen: init refresh.");
|
||||||
RefreshPowerSpectrum();
|
RefreshPowerSpectrum();
|
||||||
RefreshDemod();
|
RefreshDemod();
|
||||||
// RefreshLivePrint();
|
RefreshStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -271,6 +271,7 @@ function DisplayStats(i_str)
|
||||||
'dist_circ': 0,
|
'dist_circ': 0,
|
||||||
'max_dist': 0,
|
'max_dist': 0,
|
||||||
'min_elev': 90,
|
'min_elev': 90,
|
||||||
|
'age': -1
|
||||||
};
|
};
|
||||||
|
|
||||||
var stats_arr = i_str.split(",");
|
var stats_arr = i_str.split(",");
|
||||||
|
@ -291,14 +292,20 @@ function DisplayStats(i_str)
|
||||||
stats.max_dist = parseFloat(v);
|
stats.max_dist = parseFloat(v);
|
||||||
if(k == 'min_elev')
|
if(k == 'min_elev')
|
||||||
stats.min_elev = parseFloat(v);
|
stats.min_elev = parseFloat(v);
|
||||||
|
if(k == 'age')
|
||||||
|
stats.age = parseInt(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById("cnt_stats").innerHTML =
|
var stats_string = "Ok: " + stats.ok
|
||||||
"Ok: " + stats.ok
|
|
||||||
+ " | Dist-Line: " + (stats.dist_line / 1000).toFixed(1) + "km "
|
+ " | Dist-Line: " + (stats.dist_line / 1000).toFixed(1) + "km "
|
||||||
+ "(" + (stats.max_dist / 1000).toFixed(1) + "km)"
|
+ "(" + (stats.max_dist / 1000).toFixed(1) + "km)"
|
||||||
+ " | Dist-Circle: " + (stats.dist_circ / 1000).toFixed(1) + "km "
|
+ " | Dist-Circle: " + (stats.dist_circ / 1000).toFixed(1) + "km "
|
||||||
+ " | MinElev: " + (stats.min_elev).toFixed(1);
|
+ " | MinElev: " + (stats.min_elev).toFixed(1)
|
||||||
|
+ " | Age: " + stats.age;
|
||||||
|
if(stats.age > 30)
|
||||||
|
document.getElementById("cnt_stats").innerHTML = "<font color=red>" + stats_string + "</font>";
|
||||||
|
else
|
||||||
|
document.getElementById("cnt_stats").innerHTML = "<font color=yellow>" + stats_string + "</font>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,15 +374,15 @@ function RefreshDemod()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
// stats are send from server on every success sentence
|
||||||
function RefreshLivePrint()
|
// but update every 2 seconds to display sentence age
|
||||||
|
function RefreshStats()
|
||||||
{
|
{
|
||||||
if(!G_HD_CONNECTED)
|
if(!G_HD_CONNECTED)
|
||||||
return;
|
return;
|
||||||
SendCommand("liveprint");
|
SendCommand("stats");
|
||||||
setTimeout(function () {RefreshLivePrint();}, 1000 / 4);
|
setTimeout(function () {RefreshStats();}, 2000);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function SetBiasT()
|
function SetBiasT()
|
||||||
|
|
|
@ -68,7 +68,8 @@ public:
|
||||||
unsigned int num_ok_ = 0; // num of decoded packets
|
unsigned int num_ok_ = 0; // num of decoded packets
|
||||||
habdec::GpsDistance D_;
|
habdec::GpsDistance D_;
|
||||||
double dist_max_ = 0;
|
double dist_max_ = 0;
|
||||||
double elev_min_ = std::numeric_limits<double>::max();
|
double elev_min_ = 90.0;
|
||||||
|
std::chrono::steady_clock::time_point last_sentence_timestamp_ = std::chrono::steady_clock::now();
|
||||||
};
|
};
|
||||||
STATS stats_;
|
STATS stats_;
|
||||||
|
|
||||||
|
|
|
@ -548,6 +548,10 @@ std::vector< std::shared_ptr<HabdecMessage> > HandleRequest(std::string command
|
||||||
p_msg->data_stream_<<",lon:"<<GLOBALS::get().par_.station_lon_;
|
p_msg->data_stream_<<",lon:"<<GLOBALS::get().par_.station_lon_;
|
||||||
p_msg->data_stream_<<",alt:"<<GLOBALS::get().par_.station_alt_;
|
p_msg->data_stream_<<",alt:"<<GLOBALS::get().par_.station_alt_;
|
||||||
|
|
||||||
|
const auto last_sentence_age = std::chrono::duration_cast<std::chrono::seconds>(
|
||||||
|
std::chrono::steady_clock::now() - stats.last_sentence_timestamp_).count();
|
||||||
|
p_msg->data_stream_<<",age:"<<int(round(last_sentence_age));
|
||||||
|
|
||||||
result.push_back(p_msg);
|
result.push_back(p_msg);
|
||||||
}
|
}
|
||||||
// cmd::****
|
// cmd::****
|
||||||
|
|
|
@ -298,10 +298,12 @@ void SentenceCallback(std::string callsign, std::string data, std::string crc, s
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using Ms = std::chrono::milliseconds;
|
using Ms = std::chrono::milliseconds;
|
||||||
|
|
||||||
|
auto& stats = GLOBALS::get().stats_;
|
||||||
|
stats.last_sentence_timestamp_ = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
const string sentence = callsign + "," + data + "*" + crc;
|
const string sentence = callsign + "," + data + "*" + crc;
|
||||||
const int sentence_number = stoi( data.substr(0, data.find(',')) );
|
const int sentence_number = stoi( data.substr(0, data.find(',')) );
|
||||||
|
|
||||||
|
|
||||||
// notify all websocket clients
|
// notify all websocket clients
|
||||||
if(p_ws)
|
if(p_ws)
|
||||||
{
|
{
|
||||||
|
@ -352,7 +354,6 @@ void SentenceCallback(std::string callsign, std::string data, std::string crc, s
|
||||||
GLOBALS::get().par_.coord_format_lat_,
|
GLOBALS::get().par_.coord_format_lat_,
|
||||||
GLOBALS::get().par_.coord_format_lon_);
|
GLOBALS::get().par_.coord_format_lon_);
|
||||||
|
|
||||||
auto& stats = GLOBALS::get().stats_;
|
|
||||||
stats.D_ = habdec::CalcGpsDistance(
|
stats.D_ = habdec::CalcGpsDistance(
|
||||||
GLOBALS::get().par_.station_lat_, GLOBALS::get().par_.station_lon_,
|
GLOBALS::get().par_.station_lat_, GLOBALS::get().par_.station_lon_,
|
||||||
GLOBALS::get().par_.station_alt_,
|
GLOBALS::get().par_.station_alt_,
|
||||||
|
|
Ładowanie…
Reference in New Issue