[avr] add cmd check on sensor id
This commit is contained in:
parent
9fbbb99a88
commit
62f36ce02d
|
@ -302,18 +302,23 @@ void ctrlCmdGet(uint8_t cmd)
|
|||
case 'c': /* sensor counter value */
|
||||
ctrlReadCharFromRxBuffer(&i);
|
||||
|
||||
if (i < MAX_SENSORS) {
|
||||
cli();
|
||||
tmp32 = sensor[i].counter;
|
||||
sei();
|
||||
|
||||
ctrlWriteCharToTxBuffer(i);
|
||||
ctrlWriteLongToTxBuffer(tmp32);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'm': /* sensor meterconstant */
|
||||
ctrlReadCharFromRxBuffer(&i);
|
||||
|
||||
if (i < MAX_SENSORS) {
|
||||
ctrlWriteCharToTxBuffer(i);
|
||||
ctrlWriteShortToTxBuffer(sensor[i].meterconst);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'w': /* watchdog counter */
|
||||
|
@ -396,6 +401,8 @@ void ctrlCmdSet(uint8_t cmd)
|
|||
|
||||
case 'c': /* sensor counter value */
|
||||
ctrlReadCharFromRxBuffer(&i);
|
||||
|
||||
if (i < MAX_SENSORS) {
|
||||
ctrlReadLongFromRxBuffer(&tmp32);
|
||||
|
||||
cli();
|
||||
|
@ -404,10 +411,13 @@ void ctrlCmdSet(uint8_t cmd)
|
|||
|
||||
ctrlWriteCharToTxBuffer(i);
|
||||
ctrlWriteLongToTxBuffer(tmp32);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'm': /* sensor meterconstant */
|
||||
ctrlReadCharFromRxBuffer(&i);
|
||||
|
||||
if (i < MAX_SENSORS) {
|
||||
ctrlReadShortFromRxBuffer(&tmp16);
|
||||
|
||||
cli();
|
||||
|
@ -416,6 +426,7 @@ void ctrlCmdSet(uint8_t cmd)
|
|||
|
||||
ctrlWriteCharToTxBuffer(i);
|
||||
ctrlWriteShortToTxBuffer(sensor[i].meterconst);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'w': /* watchdog counter */
|
||||
|
|
Loading…
Reference in New Issue