[avr] cmd parameter checking for enable/disable

This commit is contained in:
Bart Van Der Meerssche 2011-01-28 16:30:50 +01:00
parent 3cff549f8c
commit 035bc2d4fe
1 changed files with 17 additions and 11 deletions

View File

@ -289,8 +289,11 @@ void ctrlCmdGet(uint8_t cmd)
case 'e': /* port enabled | disabled */ case 'e': /* port enabled | disabled */
ctrlReadCharFromRxBuffer(&i); ctrlReadCharFromRxBuffer(&i);
if (i < MAX_SENSORS) {
ctrlWriteCharToTxBuffer(i); ctrlWriteCharToTxBuffer(i);
ctrlWriteCharToTxBuffer((enabled >> i) & 0x01); ctrlWriteCharToTxBuffer((enabled >> i) & 0x01);
}
break; break;
case 'p': /* phy-to-logical mapping */ case 'p': /* phy-to-logical mapping */
@ -374,6 +377,8 @@ void ctrlCmdSet(uint8_t cmd)
case 'e': /* port enabled | disabled */ case 'e': /* port enabled | disabled */
ctrlReadCharFromRxBuffer(&i); ctrlReadCharFromRxBuffer(&i);
if (i < MAX_SENSORS) {
ctrlReadCharFromRxBuffer(&tmp8); ctrlReadCharFromRxBuffer(&tmp8);
if (tmp8) { if (tmp8) {
@ -385,6 +390,7 @@ void ctrlCmdSet(uint8_t cmd)
ctrlWriteCharToTxBuffer(i); ctrlWriteCharToTxBuffer(i);
ctrlWriteCharToTxBuffer((enabled >> i) & 0x01); ctrlWriteCharToTxBuffer((enabled >> i) & 0x01);
}
break; break;
case 'p': /* phy-to-logical mapping */ case 'p': /* phy-to-logical mapping */