Skip to content

Commit

Permalink
add a ping command to check status of the link
Browse files Browse the repository at this point in the history
LOOP_TEST is great for some things but because the state of
the sentinel is not determined it's not great for checking
link integrity.
  • Loading branch information
bunnie committed Jan 31, 2022
1 parent deff791 commit 6102eb1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sw/com_rs
Submodule com_rs updated 1 files
+1 −0 src/lib.rs
12 changes: 12 additions & 0 deletions sw/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,18 @@ fn main() -> ! {
logln!(LL::Debug, "CLoop");
com_tx((rx & 0xFF) | ((com_sentinel as u16 & 0xFF) << 8));
com_sentinel += 1;
} else if rx == ComState::LINK_PING.verb {
logln!(LL::Debug, "CPing");
match com_rx(500) {
Ok(ping) => {
com_tx(!ping);
com_tx(0x600d);
},
_ => {
com_tx(0xEEEE);
com_tx(0xFFFF);
}
}
} else if rx == ComState::GAS_GAUGE.verb {
logln!(LL::Trace, "CGg"); // This gets polled frequently
com_tx(pow.current as u16);
Expand Down

0 comments on commit 6102eb1

Please sign in to comment.