Compare commits

...

3 Commits

1 changed files with 7 additions and 2 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);
@ -86,8 +87,9 @@ static void dsp_thread() {
// FIXME: net::write seems unimplemented as of libstdc++ 13
float freq_error = freq_peak_local - freq_setpoint;
tec_socket.write_some(net::buffer(std::format(":SOUR2:VOLT {:.3f}\n",
std::min(tec_bias+tec_p*freq_error, 0.0f))));
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
@ -165,7 +170,7 @@ int main(int argc, char* argv[])
bladerf_close(bladerf_dev);
};
std::atexit(BladeRFClose);
if((status = bladerf_set_frequency(bladerf_dev, BLADERF_CHANNEL_RX(0), 1'664'000'000)) != 0) {
if((status = bladerf_set_frequency(bladerf_dev, BLADERF_CHANNEL_RX(0), 1'655'000'000)) != 0) {
std::cerr << "failed to set bladeRF frequency: " << bladerf_strerror(status) << std::endl;
return 1;
}