[avr] set commands should repeat the params in the reply
This commit is contained in:
parent
5dcac14c60
commit
fc1f955b51
|
@ -297,11 +297,13 @@ void ctrlCmdGet(uint8_t cmd)
|
||||||
tmp32 = sensor[i].counter;
|
tmp32 = sensor[i].counter;
|
||||||
sei();
|
sei();
|
||||||
|
|
||||||
|
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);
|
ctrlWriteShortToTxBuffer(sensor[i].meterconst);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -335,29 +337,26 @@ void ctrlCmdGet(uint8_t cmd)
|
||||||
|
|
||||||
void ctrlCmdSet(uint8_t cmd)
|
void ctrlCmdSet(uint8_t cmd)
|
||||||
{
|
{
|
||||||
uint8_t i = 0, tmp8 = 0, tmp8_bis = 0;
|
uint8_t i = 0, tmp8 = 0;
|
||||||
uint16_t tmp16 = 0;
|
uint16_t tmp16 = 0;
|
||||||
uint32_t tmp32 = 0;
|
uint32_t tmp32 = 0;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case 'h': /* hardware {major,minor} version */
|
case 'h': /* hardware {major,minor} version */
|
||||||
ctrlReadShortFromRxBuffer(&tmp16);
|
ctrlReadShortFromRxBuffer(&version.hw_major);
|
||||||
ctrlReadCharFromRxBuffer(&tmp8);
|
ctrlReadCharFromRxBuffer(&version.hw_minor);
|
||||||
|
|
||||||
cli();
|
ctrlWriteShortToTxBuffer(version.hw_major);
|
||||||
version.hw_major = tmp16;
|
ctrlWriteCharToTxBuffer(version.hw_minor);
|
||||||
version.hw_minor = tmp8;
|
|
||||||
sei();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's': /* software {major,minor} version */
|
case 's': /* software {major,minor} version */
|
||||||
ctrlReadCharFromRxBuffer(&tmp8);
|
ctrlReadCharFromRxBuffer(&version.sw_major);
|
||||||
ctrlReadCharFromRxBuffer(&tmp8_bis);
|
ctrlReadCharFromRxBuffer(&version.sw_minor);
|
||||||
|
|
||||||
cli();
|
ctrlWriteCharToTxBuffer(version.sw_major);
|
||||||
version.sw_major = tmp8;
|
ctrlWriteCharToTxBuffer(version.sw_minor);
|
||||||
version.sw_minor = tmp8_bis;
|
break;
|
||||||
sei();
|
|
||||||
|
|
||||||
case 'p': /* phy-to-logical mapping */
|
case 'p': /* phy-to-logical mapping */
|
||||||
for (i = 0 ; i < MAX_SENSORS; i++) {
|
for (i = 0 ; i < MAX_SENSORS; i++) {
|
||||||
|
@ -366,6 +365,8 @@ void ctrlCmdSet(uint8_t cmd)
|
||||||
cli();
|
cli();
|
||||||
phy_to_log[i] = tmp8;
|
phy_to_log[i] = tmp8;
|
||||||
sei();
|
sei();
|
||||||
|
|
||||||
|
ctrlWriteCharToTxBuffer(phy_to_log[i]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -376,6 +377,9 @@ void ctrlCmdSet(uint8_t cmd)
|
||||||
cli();
|
cli();
|
||||||
sensor[i].counter = tmp32;
|
sensor[i].counter = tmp32;
|
||||||
sei();
|
sei();
|
||||||
|
|
||||||
|
ctrlWriteCharToTxBuffer(i);
|
||||||
|
ctrlWriteLongToTxBuffer(tmp32);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm': /* sensor meterconstant */
|
case 'm': /* sensor meterconstant */
|
||||||
|
@ -385,6 +389,9 @@ void ctrlCmdSet(uint8_t cmd)
|
||||||
cli();
|
cli();
|
||||||
sensor[i].meterconst = tmp16;
|
sensor[i].meterconst = tmp16;
|
||||||
sei();
|
sei();
|
||||||
|
|
||||||
|
ctrlWriteCharToTxBuffer(i);
|
||||||
|
ctrlWriteShortToTxBuffer(sensor[i].meterconst);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'w': /* watchdog counter */
|
case 'w': /* watchdog counter */
|
||||||
|
@ -393,6 +400,8 @@ void ctrlCmdSet(uint8_t cmd)
|
||||||
cli();
|
cli();
|
||||||
event.wdt = tmp16;
|
event.wdt = tmp16;
|
||||||
sei();
|
sei();
|
||||||
|
|
||||||
|
ctrlWriteShortToTxBuffer(event.wdt);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'b': /* brown-out counter */
|
case 'b': /* brown-out counter */
|
||||||
|
@ -401,6 +410,8 @@ void ctrlCmdSet(uint8_t cmd)
|
||||||
cli();
|
cli();
|
||||||
event.brown_out = tmp16;
|
event.brown_out = tmp16;
|
||||||
sei();
|
sei();
|
||||||
|
|
||||||
|
ctrlWriteShortToTxBuffer(event.brown_out);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue