second in
This commit is contained in:
33
main.cpp
33
main.cpp
@ -1008,6 +1008,7 @@ void expect_ok(const Api& api, int32_t err, const std::string& what) {
|
||||
constexpr uint32_t kE502DiSyn2Mask =
|
||||
(static_cast<uint32_t>(1U) << 13U) | (static_cast<uint32_t>(1U) << 17U);
|
||||
constexpr uint32_t kE502Digital1Mask = (static_cast<uint32_t>(1U) << 0U);
|
||||
constexpr uint32_t kE502Digital2Mask = (static_cast<uint32_t>(1U) << 1U);
|
||||
constexpr uint32_t kStreamInputAdcFlag = 0x80000000U;
|
||||
constexpr uint32_t kStreamInputCalibratedAdcFlag = 0x40000000U;
|
||||
|
||||
@ -1497,6 +1498,9 @@ int run(const Config& cfg) {
|
||||
std::size_t csv_global_frame_index = 0;
|
||||
std::size_t packet_avg_steps = 0;
|
||||
std::size_t fast_packet_frames = 0;
|
||||
uint64_t packet_clock_count = 0;
|
||||
uint64_t packet_di2_high_clocks = 0;
|
||||
uint64_t packet_di2_low_clocks = 0;
|
||||
|
||||
bool capture_started = false;
|
||||
bool stop_loop_requested = false;
|
||||
@ -1634,6 +1638,9 @@ int run(const Config& cfg) {
|
||||
}
|
||||
packet_avg_steps = 0;
|
||||
fast_packet_frames = 0;
|
||||
packet_clock_count = 0;
|
||||
packet_di2_high_clocks = 0;
|
||||
packet_di2_low_clocks = 0;
|
||||
if (!fast_tty_avg_stream_mode) {
|
||||
current_packet.reset(target_frames, cfg.channel_count);
|
||||
}
|
||||
@ -1645,6 +1652,14 @@ int run(const Config& cfg) {
|
||||
};
|
||||
|
||||
auto finish_packet = [&](PacketCloseReason reason) {
|
||||
if (packet_clock_count != (packet_di2_high_clocks + packet_di2_low_clocks)) {
|
||||
std::ostringstream message;
|
||||
message << "DI2 clock split invariant failed: clocks=" << packet_clock_count
|
||||
<< ", high=" << packet_di2_high_clocks
|
||||
<< ", low=" << packet_di2_low_clocks;
|
||||
fail(message.str());
|
||||
}
|
||||
|
||||
if (tty_di1_group_average) {
|
||||
append_tty_group_step();
|
||||
tty_group_state.clear_step();
|
||||
@ -1662,6 +1677,9 @@ int run(const Config& cfg) {
|
||||
<< ": frames/ch=" << frames
|
||||
<< ", duration_ms=" << packet_duration_ms
|
||||
<< ", close_reason=" << packet_close_reason_to_string(reason)
|
||||
<< ", clocks=" << packet_clock_count
|
||||
<< ", di2_high_clocks=" << packet_di2_high_clocks
|
||||
<< ", di2_low_clocks=" << packet_di2_low_clocks
|
||||
<< ", avg_steps=" << packet_avg_steps
|
||||
<< "\n";
|
||||
} else {
|
||||
@ -1694,7 +1712,10 @@ int run(const Config& cfg) {
|
||||
<< "Packet " << packet.packet_index
|
||||
<< ": frames/ch=" << frames
|
||||
<< ", duration_ms=" << packet_duration_ms
|
||||
<< ", close_reason=" << packet_close_reason_to_string(reason);
|
||||
<< ", close_reason=" << packet_close_reason_to_string(reason)
|
||||
<< ", clocks=" << packet_clock_count
|
||||
<< ", di2_high_clocks=" << packet_di2_high_clocks
|
||||
<< ", di2_low_clocks=" << packet_di2_low_clocks;
|
||||
if (cfg.di1_mode == Di1Mode::ZeroOnChange) {
|
||||
std::cout << ", zeroed_on_DI1_change=" << zeroed_fraction << "% ("
|
||||
<< current_packet.zeroed_samples << "/" << current_packet.stored_samples << ")";
|
||||
@ -1752,6 +1773,9 @@ int run(const Config& cfg) {
|
||||
packet_active = false;
|
||||
packet_avg_steps = 0;
|
||||
fast_packet_frames = 0;
|
||||
packet_clock_count = 0;
|
||||
packet_di2_high_clocks = 0;
|
||||
packet_di2_low_clocks = 0;
|
||||
if (!fast_tty_avg_stream_mode) {
|
||||
current_packet.reset(target_frames, cfg.channel_count);
|
||||
}
|
||||
@ -2009,6 +2033,13 @@ int run(const Config& cfg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((din_value & kE502Digital2Mask) != 0U) {
|
||||
++packet_di2_high_clocks;
|
||||
} else {
|
||||
++packet_di2_low_clocks;
|
||||
}
|
||||
++packet_clock_count;
|
||||
|
||||
if (tty_di1_group_average && di1_changed) {
|
||||
append_tty_group_step();
|
||||
tty_group_state.clear_step();
|
||||
|
||||
Reference in New Issue
Block a user