Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 11:b5f4a9e69d96, committed 2016-03-05
- Comitter:
- sk398
- Date:
- Sat Mar 05 01:07:37 2016 +0000
- Parent:
- 10:55cb02b00338
- Commit message:
- Most up to date
Changed in this revision
| SerialComms.cpp | Show annotated file Show diff for this revision Revisions of this file |
| SerialComms.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/SerialComms.cpp Fri Mar 04 23:07:43 2016 +0000
+++ b/SerialComms.cpp Sat Mar 05 01:07:37 2016 +0000
@@ -46,21 +46,28 @@
{
if(incomingDataUpdate == TRUE)
{
- if( (receiverBuffer&0x0F)==MOTORS_FORWARD ||
+ if( ((receiverBuffer&0x0F)==MOTORS_FORWARD ||
(receiverBuffer&0x0F)==MOTORS_BACKWARD ||
(receiverBuffer&0x0F)==MOTORS_LEFT ||
(receiverBuffer&0x0F)==MOTORS_RIGHT ||
- (receiverBuffer&0x0F)==MOTORS_ARM
- /* AND BALLAST REQUIREMENTS */)
+ (receiverBuffer&0x0F)==MOTORS_ARM ||
+ (receiverBuffer&0x0F)==MOTORS_OFF ||
+ (receiverBuffer>>4)&(0x0F)==MAGNET_ON ||
+ (receiverBuffer>>4)&(0x0F)==MAGNET_OFF
+ /* AND BALLAST REQUIREMENTS */ ) )
{
incomingDataUpdate = FALSE;
return receiverBuffer;
}
- }
+ else
+ {
+ incomingDataUpdate = FALSE;
+ return 0xFF;
+ }
+ }
else
{
incomingDataUpdate = FALSE;
return 0xFF;
- }
- return;
+ }
}
--- a/SerialComms.h Fri Mar 04 23:07:43 2016 +0000 +++ b/SerialComms.h Sat Mar 05 01:07:37 2016 +0000 @@ -35,6 +35,7 @@ #define MOTORS_LEFT 0x05 #define MOTORS_RIGHT 0x0A #define MOTORS_ARM 0x01 +#define MOTORS_OFF 0x00 #define MAGNET_ON 0x0D #define MAGNET_OFF 0x0E