packet loss: fix phase

This commit is contained in:
Matthias Schiffer 2013-07-29 21:33:57 +02:00
parent 1ff55d4c9a
commit fd99a7ea34

View file

@ -38,10 +38,10 @@ float network_t::get_etx() const {
if (etx_min == etx_max)
return etx_min;
float val = float(std::sin(2*M_PI * (mmss->now()/1000.0 - phase)/period));
float val = float(std::sin(2*M_PI * (mmss->now()/1000.0 + phase)/period));
float diff = etx_max - etx_min;
mmss->logf(LOG_DEBUG, "ETX: %.3f", etx_min + diff * (val+1)/2);
mmss->logf(LOG_DEBUG, "ETX for `%s' is %.3f now", name.c_str(), etx_min + diff * (val+1)/2);
return etx_min + diff * (val+1)/2;
}