display control loop ticks on waterfall

master
Sebastien Bourdeauducq 2023-09-11 20:40:47 +08:00
parent 747c7d2e38
commit 57d41479b3
1 changed files with 5 additions and 0 deletions

View File

@ -79,6 +79,7 @@ static void dsp_thread() {
frames_mag[i + len/2] = abs(frames_ft_rev[i]);
// stabilize laser
bool tick = false;
if((std::chrono::steady_clock::now() - last_tec) >= 100ms) {
float freq_peak_local;
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",
std::max(tec_bias+tec_p*freq_error, 0.0f))));
last_tec += 100ms;
tick = true;
}
// 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[int(freq_setpoint*waterfall_width)/40] = 0xff0000ff;
if(tick)
for(int i=0;i<100;i++)
waterfall_data[i] = 0xffff0000;
}
// FPS counter