rdmenezes / qmast

Automatically exported from code.google.com/p/qmast
0 stars 0 forks source link

Implement error codes into sensors and motor control #25

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
There's error codes returned, but only in terrible cases; error codes should be 
returned for different errors that we are presently seeing (ie no data, data 
corrupt, etc); clear when we encounter good data - as we empty the buffer we'll 
encounter multiple strings of data

Maybe use a bit-mask to indicate which errors we received, and if the final 
data is good?

Original issue reported on code.google.com by cdmblair@gmail.com on 20 Apr 2011 at 9:15

GoogleCodeExporter commented 9 years ago
Maybe have a separate function to interpret the error codes and spit out the 
result? e.g. every time we call error = sensorData(), have a call to something 
like interpretSensorDataError(error). 

Tom - I'm hoping you'll have the chance to work on this from home. It should be 
relatively straightforward, even if you don't have an Arduino. I'll send a more 
descriptive email later today, with more of a timeline.

Original comment by valtas...@gmail.com on 8 May 2011 at 5:05

GoogleCodeExporter commented 9 years ago
I've added some methods to deal with the issue discussed here. There is now a 
variable "errorCode" which should replace "error". The variable is an integer 
that contains 6 error flags represented by six binary digits.

The six flags are the same as the 6 indicators that the LEDS give. The only 
exception being I changed the "goodCompassData" flag to "badCompassData" so 
that when all flags are off the overall error code is 0.

To set a flag call method setErrorBit(int bit,int &errorCode).

The integer bit determines which flag you are setting but I've defined 6 
constants (noDataBit,oldDataBit,etc) so that you don't actually need to know 
which bit corresponds to which flag. errorCode is just the error code so far 
that will be modified to have the new flag set.

To clear a flag use method method setErrorBit(int bit,int &errorCode) which 
works similarly.

To check whether a particular flag is set you use the function int 
checkErrorBit(int bit, int errorCode). Again "bit" is which flag we want to 
check and we can use the defined constants again. 1 means the flag is set, 0 it 
is not.
--------------------------------------------------------------------------------
----
Implementation:

So far I have gone through and added the appropriate method calls whenever the 
LED indicator status is changed so that the error code is modified to reflect 
that change.

I also added lines which are commented out every time the old variable "error" 
is changed. I left them commented out because I didn't want to break the 
working code by sending error codes that are not expected. 

Also I was thinking that I we will need a combine error code method so that 
when you call a method which returns an error code you can combine errors 
coming from that method with the one you are in since it may have set different 
flags then the ones you already have set which you don't want to have 
overwritten. I just thought of this now so I can implement it tommorro. 

I've attached the files I modified to this bug

Original comment by thomas.g...@gmail.com on 26 May 2011 at 9:02

Attachments:

GoogleCodeExporter commented 9 years ago
Actually to combine error codes I think all you should have to do is an or 
between the two codes ie: newErrorCode=(errorCode1 | errorCode2); Since its so 
simple it's probably not worth making a full method for it

Original comment by thomas.g...@gmail.com on 27 May 2011 at 6:42

GoogleCodeExporter commented 9 years ago
Not sure if this should have a new issue, but existing "led" displays on the 
LabView GUI do not work as expected. If we want to keep them, we should 
definitely make them actually work.

Original comment by valtas...@gmail.com on 11 Oct 2011 at 8:10