'firmware/command_ctrl.ino' ändern

Some for loop frequency range tests added to prevent a overrun of the specified frequence band.
This commit is contained in:
klaute 2016-10-10 12:09:02 +02:00
parent 3f85812f56
commit 9ab691f081

View file

@ -222,6 +222,12 @@ void cc_startMeasurement()
uint32_t freq = 0; uint32_t freq = 0;
for (freq = start_freq; freq <= end_freq; freq += step_freq) for (freq = start_freq; freq <= end_freq; freq += step_freq)
{ {
if (freq > end_freq)
{
// prevent to step over the end frequency
// maybe the user is not allowed to send data in the frequency band
freq = end_freq;
}
uint32_t a0_sum = 0; uint32_t a0_sum = 0;
uint32_t a1_sum = 0; uint32_t a1_sum = 0;
uint16_t i = 0; uint16_t i = 0;
@ -268,6 +274,9 @@ void cc_startMeasurement()
Serial.write(MSG_EOM2); Serial.write(MSG_EOM2);
si5351.output_enable(SI5351_CLK0, 0); // disable clock output 0 si5351.output_enable(SI5351_CLK0, 0); // disable clock output 0
if (freq >= end_freq)
break; // abort the loop because all is done
} }
// 5. send a measurement end message to the host // 5. send a measurement end message to the host