Skip to content

Commit

Permalink
BISS-C first packet sets lastPos
Browse files Browse the repository at this point in the history
Fixes one rotation offset with some startup positions
  • Loading branch information
Ultrawipf committed Apr 8, 2024
1 parent bf044f1 commit b3f9b32
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Firmware/FFBoard/UserExtensions/Src/EncoderBissC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ EncoderBissC::EncoderBissC() :
}

void EncoderBissC::Run(){
bool first = true;
while(true){
requestNewDataSem.Take(); // Wait until a position is requested
waitData = true;
Expand All @@ -49,6 +50,10 @@ void EncoderBissC::Run(){

if(updateFrame()){
pos = newPos;
if(first){ // Prevent immediate multiturn update
lastPos = pos;
first = false;
}
//handle multiturn
if(pos-lastPos > 1<<(lenghtDataBit-1)){
mtpos--;
Expand Down

0 comments on commit b3f9b32

Please sign in to comment.