Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements Communication Error Bit, resolves #20 #45

Merged
merged 1 commit into from
Feb 13, 2017
Merged

Conversation

daniel-j-h
Copy link
Collaborator

For #20.

@kent-williams @dcyoung can it happen that the sync bit and the error bit is set? (or really: multiple bits, not specific to those two) Also any insights to error codes for other bits? Or are they unused on the firmware level, too, at the moment?

@dcyoung
Copy link

dcyoung commented Feb 11, 2017

You can definitely have a sync bit AND error bits set on a single DATA_BLOCK.

See the last post #27 for a better description of the error codes. There is at least one error code value we may have to avoid producing, so instead of relying on individual error bits to separately indicate different issues, we may want to just consider bits e0-6 as a single 7bit integer error code, of which we avoid using 1 particular error code value. This will also let us simplify the checking to a single error code:

    // Consider the DATA_BLOCK contents...
    // check that the error bits (e0-6) are all 0 (ie: DATA_BLOCK contains NO ERRORS)
    if ( !(responses[received].sync_error >> 1) ) {

      // Check if DATA_BLOCK is a sync reading (ie: first reading of a new 360deg scan)
      // & if we've already been gathering DATA_BLOCKs
      if ( responses[received].sync_error == 1 && received > 0) {
        // Note the end of the scan
        last = received;
        //FIXME: add check that "last" does not exceed SWEEP_MAX_SAMPLES
        
        // BREAK to return the scan (NOT including this DATA_BLOCK)
        break;
      }
    }
    else {
      // some error
      //FIXME: Handle each type of error code and shutdown gracefully if need be. 
      switch(responses[received].sync_error >> 1 ) {
          case 1: // communication error
          case ....
       }

@daniel-j-h
Copy link
Collaborator Author

Thanks - I somehow forgot about this. Changed it to an error check by shifting out the sync bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants