[ntcore] Don't update timestamp when value is unchanged (#5356)

This fixes an issue with commands run/cancel.
This commit is contained in:
Carl Hauser
2023-07-23 17:36:26 -07:00
committed by GitHub
parent 5ec7f18bdc
commit c3fab7f1f2
4 changed files with 121 additions and 30 deletions

View File

@@ -113,9 +113,11 @@ TEST(ShuffleboardInstanceTest, DuplicateSelectTabs) {
NTWrapper ntInst;
frc::detail::ShuffleboardInstance shuffleboardInst{ntInst.inst};
std::atomic_int counter = 0;
auto listener = nt::NetworkTableListener::CreateListener(
ntInst.inst.GetStringTopic("/Shuffleboard/.metadata/Selected"),
nt::EventFlags::kValueAll | nt::EventFlags::kImmediate,
auto subscriber =
ntInst.inst.GetStringTopic("/Shuffleboard/.metadata/Selected")
.Subscribe("", {.keepDuplicates = true});
ntInst.inst.AddListener(
subscriber, nt::EventFlags::kValueAll | nt::EventFlags::kImmediate,
[&counter](auto& event) { counter++; });
// There shouldn't be anything there