[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 */
|
case 'c': /* sensor counter value */
|
||||||
ctrlReadCharFromRxBuffer(&i);
|
ctrlReadCharFromRxBuffer(&i);
|
||||||
|
|
||||||
cli();
|
if (i < MAX_SENSORS) {
|
||||||
tmp32 = sensor[i].counter;
|
cli();
|
||||||
sei();
|
tmp32 = sensor[i].counter;
|
||||||
|
sei();
|
||||||
|
|
||||||
ctrlWriteCharToTxBuffer(i);
|
ctrlWriteCharToTxBuffer(i);
|
||||||
ctrlWriteLongToTxBuffer(tmp32);
|
ctrlWriteLongToTxBuffer(tmp32);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm': /* sensor meterconstant */
|
case 'm': /* sensor meterconstant */
|
||||||
ctrlReadCharFromRxBuffer(&i);
|
ctrlReadCharFromRxBuffer(&i);
|
||||||
ctrlWriteCharToTxBuffer(i);
|
|
||||||
ctrlWriteShortToTxBuffer(sensor[i].meterconst);
|
if (i < MAX_SENSORS) {
|
||||||
|
ctrlWriteCharToTxBuffer(i);
|
||||||
|
ctrlWriteShortToTxBuffer(sensor[i].meterconst);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'w': /* watchdog counter */
|
case 'w': /* watchdog counter */
|
||||||
|
@ -396,26 +401,32 @@ void ctrlCmdSet(uint8_t cmd)
|
||||||
|
|
||||||
case 'c': /* sensor counter value */
|
case 'c': /* sensor counter value */
|
||||||
ctrlReadCharFromRxBuffer(&i);
|
ctrlReadCharFromRxBuffer(&i);
|
||||||
ctrlReadLongFromRxBuffer(&tmp32);
|
|
||||||
|
|
||||||
cli();
|
if (i < MAX_SENSORS) {
|
||||||
sensor[i].counter = tmp32;
|
ctrlReadLongFromRxBuffer(&tmp32);
|
||||||
sei();
|
|
||||||
|
|
||||||
ctrlWriteCharToTxBuffer(i);
|
cli();
|
||||||
ctrlWriteLongToTxBuffer(tmp32);
|
sensor[i].counter = tmp32;
|
||||||
|
sei();
|
||||||
|
|
||||||
|
ctrlWriteCharToTxBuffer(i);
|
||||||
|
ctrlWriteLongToTxBuffer(tmp32);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm': /* sensor meterconstant */
|
case 'm': /* sensor meterconstant */
|
||||||
ctrlReadCharFromRxBuffer(&i);
|
ctrlReadCharFromRxBuffer(&i);
|
||||||
ctrlReadShortFromRxBuffer(&tmp16);
|
|
||||||
|
|
||||||
cli();
|
if (i < MAX_SENSORS) {
|
||||||
sensor[i].meterconst = tmp16;
|
ctrlReadShortFromRxBuffer(&tmp16);
|
||||||
sei();
|
|
||||||
|
|
||||||
ctrlWriteCharToTxBuffer(i);
|
cli();
|
||||||
ctrlWriteShortToTxBuffer(sensor[i].meterconst);
|
sensor[i].meterconst = tmp16;
|
||||||
|
sei();
|
||||||
|
|
||||||
|
ctrlWriteCharToTxBuffer(i);
|
||||||
|
ctrlWriteShortToTxBuffer(sensor[i].meterconst);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'w': /* watchdog counter */
|
case 'w': /* watchdog counter */
|
||||||
|
|
Loading…
Reference in New Issue