display control loop ticks on waterfall
This commit is contained in:
parent
747c7d2e38
commit
57d41479b3
5
main.cpp
5
main.cpp
|
@ -79,6 +79,7 @@ static void dsp_thread() {
|
||||||
frames_mag[i + len/2] = abs(frames_ft_rev[i]);
|
frames_mag[i + len/2] = abs(frames_ft_rev[i]);
|
||||||
|
|
||||||
// stabilize laser
|
// stabilize laser
|
||||||
|
bool tick = false;
|
||||||
if((std::chrono::steady_clock::now() - last_tec) >= 100ms) {
|
if((std::chrono::steady_clock::now() - last_tec) >= 100ms) {
|
||||||
float freq_peak_local;
|
float freq_peak_local;
|
||||||
freq_peak_local = 40.0f*float(distance(frames_mag.begin(), max_element(frames_mag.begin(), frames_mag.end())))/float(len);
|
freq_peak_local = 40.0f*float(distance(frames_mag.begin(), max_element(frames_mag.begin(), frames_mag.end())))/float(len);
|
||||||
|
@ -88,6 +89,7 @@ static void dsp_thread() {
|
||||||
tec_socket.write_some(net::buffer(std::format(":SOUR2:VOLT {:.3f}\n",
|
tec_socket.write_some(net::buffer(std::format(":SOUR2:VOLT {:.3f}\n",
|
||||||
std::max(tec_bias+tec_p*freq_error, 0.0f))));
|
std::max(tec_bias+tec_p*freq_error, 0.0f))));
|
||||||
last_tec += 100ms;
|
last_tec += 100ms;
|
||||||
|
tick = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// update waterfall
|
// update waterfall
|
||||||
|
@ -99,6 +101,9 @@ static void dsp_thread() {
|
||||||
waterfall_data[i] = 0xff000000 | 0x010101*std::min(int(frames_mag[j]/900.0f), 255);
|
waterfall_data[i] = 0xff000000 | 0x010101*std::min(int(frames_mag[j]/900.0f), 255);
|
||||||
}
|
}
|
||||||
waterfall_data[int(freq_setpoint*waterfall_width)/40] = 0xff0000ff;
|
waterfall_data[int(freq_setpoint*waterfall_width)/40] = 0xff0000ff;
|
||||||
|
if(tick)
|
||||||
|
for(int i=0;i<100;i++)
|
||||||
|
waterfall_data[i] = 0xffff0000;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FPS counter
|
// FPS counter
|
||||||
|
|
Loading…
Reference in New Issue