Fix bugs in C++ software
This commit is contained in:
parent
f5d027cecc
commit
30939214df
|
@ -35,14 +35,14 @@ void show_status(puzzlefw::PuzzleFwDevice& device)
|
|||
{
|
||||
printf("Status:\n");
|
||||
|
||||
printf(" timestamp = %llu\n",
|
||||
printf(" timestamp = %llu\n",
|
||||
(unsigned long long)device.get_timestamp());
|
||||
|
||||
for (unsigned int i = 0; i < device.get_analog_channel_count(); i++) {
|
||||
unsigned int sample, min_sample, max_sample;
|
||||
sample = device.get_adc_sample(i);
|
||||
device.get_adc_range(i, min_sample, max_sample);
|
||||
printf(" channel %u = %5u (min = %u, max = %u)\n",
|
||||
printf(" channel %u = %5u (min = %u, max = %u)\n",
|
||||
i, sample, min_sample, max_sample);
|
||||
}
|
||||
|
||||
|
@ -56,10 +56,10 @@ void show_status(puzzlefw::PuzzleFwDevice& device)
|
|||
printf(" acquisition = %s\n",
|
||||
device.is_acquisition_enabled() ? "on" : "off");
|
||||
|
||||
printf(" channel mode = %d channels",
|
||||
printf(" channel mode = %d channels\n",
|
||||
device.is_4channel_mode() ? 4 : 2);
|
||||
|
||||
printf(" trigger mode = %s, channel=%u, edge=%s\n",
|
||||
printf(" trigger mode = %s, ch=%u, edge=%s\n",
|
||||
trigger_mode_to_string(device.get_trigger_mode()).c_str(),
|
||||
device.get_trigger_ext_channel(),
|
||||
device.get_trigger_ext_falling() ? "falling" : "rising");
|
||||
|
@ -71,7 +71,7 @@ void show_status(puzzlefw::PuzzleFwDevice& device)
|
|||
device.get_record_length());
|
||||
|
||||
unsigned int divisor = device.get_decimation_factor();
|
||||
printf(" rate divisor = %u, sample rate = %u Sa/s\n",
|
||||
printf(" rate divisor = %u (%u Sa/s)\n",
|
||||
divisor, 125000000 / divisor);
|
||||
|
||||
printf(" averaging = %s\n",
|
||||
|
@ -88,13 +88,13 @@ void show_status(puzzlefw::PuzzleFwDevice& device)
|
|||
|
||||
if (device.is_digital_simulation_enabled()) {
|
||||
uint32_t simulation_state = device.get_digital_simulation_state();
|
||||
printf(" digital simulation = %u %u %u %u\n",
|
||||
printf(" digital sim = %u %u %u %u\n",
|
||||
simulation_state & 1,
|
||||
(simulation_state >> 1) & 1,
|
||||
(simulation_state >> 2) & 1,
|
||||
(simulation_state >> 3) & 1);
|
||||
} else {
|
||||
printf(" digital simulation = off\n");
|
||||
printf(" digital sim = off\n");
|
||||
}
|
||||
|
||||
uint32_t dma_status = device.get_dma_status();
|
||||
|
|
|
@ -36,7 +36,8 @@ static std::string find_puzzlefw_device_name()
|
|||
// Find entry matching "*.puzzlefw" in /sys filesystem.
|
||||
for (const auto& entry : fs::directory_iterator(SOC_DEVICES_DIR)) {
|
||||
std::string fname = entry.path().filename().string();
|
||||
if (fname.compare(fname.size() - 9, 9, ".puzzlefw") == 0) {
|
||||
if (fname.size() > 9
|
||||
&& fname.compare(fname.size() - 9, 9, ".puzzlefw") == 0) {
|
||||
return fname;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,7 +202,6 @@ public:
|
|||
/** Return the number of analog channels (2 or 4). */
|
||||
unsigned int get_analog_channel_count()
|
||||
{
|
||||
// TODO -- modify firmware to add ch4-support bit
|
||||
uint32_t v = read_reg(REG_CH4_MODE);
|
||||
return (v & 0x100) ? 4 : 2;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue