Skip to content

Commit

Permalink
Merge pull request #80 from philwmcdonald/dev
Browse files Browse the repository at this point in the history
More accurate position seeks. Fix for #77
  • Loading branch information
gcormier authored Aug 26, 2021
2 parents a4aef36 + 23d0b78 commit 9126678
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 130 deletions.
18 changes: 15 additions & 3 deletions Code/include/megadesk.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,28 @@ const char command_write = 'W';
const char command_read = 'R';
const char command_current = 'C'; // report current height
const char command_tone = 'T';

// responses only..
const char txMarker = '>'; // default start marker from desk (Tx)
const char response_error = 'E'; // indicates an error
const char response_calibration = 'X'; // indicates calibration is starting

// error markers
const char lateMarker = '!'; // when reporting delayUntil was late
const char bootfailMarker = '*'; // when linInit fails to communicate
const char badPID8Marker = '8'; // when pid8 fails to respond
const char badPID9Marker = '9'; // when pid9 fails to respond
const char DriftMarker = 'D'; // when pid8 and pid9 report different positions
const char response_idle = 'i'; // indicates the type of idle packet
const char response_error = 'E'; // indicates an error
const char response_calibration = 'X'; // indicates calibration is starting

// idle markers
const char idleMarker = 'i'; // indicates the type of idle packet
const char response_stop = 's'; // during stop idle
const char response_off = 'o'; // when starting from off-state

// debugheight markers
const char response_up = '^'; // raising to targetheight
const char response_down = 'v'; // lowering to targetheight
const char response_halt = '~'; // halt moving! aim for targetheight

void playTone(uint16_t freq, uint16_t duration);
void beep(uint16_t freq, byte count=1);
Expand Down
4 changes: 2 additions & 2 deletions Code/src/lin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ int Lin::read_withtimeout(int16_t &countDown)
return serial.read();
}

// returns character read or:
// returns number of characters read (including checksum) or:
// returns 0xfd if serial isn't echoing
// returns 0xfe if serial echoed only the sync - a fluke?
// returns 0xff for checksum error
// returns 0 if no characters.
// returns 0 if no response.
uint8_t Lin::recv(uint8_t addr, uint8_t* message, uint8_t nBytes)
{
uint8_t bytesRcvd=0;
Expand Down
Loading

0 comments on commit 9126678

Please sign in to comment.