reform

MNT Reform: Open Source Portable Computer
Log (Feed) | Files | Refs (Tags) | README

commit c085f7ca48b084579be1e2f1003dd7e412bfad00
parent 1a9c21f6cddeb5d7b00cca9f801ce1c3349252c2
Author: Valtteri Koskivuori <vkoskiv@gmail.com>
Date:   Sun, 12 Jun 2022 06:03:55 +0300

lpc+kbd: Disable circle+1 power on cmd when SoM is already on

I encountered this a few too many times when messing around with the
menu. Previously, this would power-cycle the machine, which seems like
an undesirable behaviour.

Diffstat:
Mreform2-keyboard-fw/remote.c | 2++
Mreform2-lpc-fw/src/boards/reform2/board_reform2.c | 11++++++++---
2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/reform2-keyboard-fw/remote.c b/reform2-keyboard-fw/remote.c @@ -321,6 +321,8 @@ int remote_turn_on_som(void) { return ok; } + if (strncmp(response, "system: already on", 18) == 0) ok = 0; + remote_som_power_expected_state = 1; return ok; } diff --git a/reform2-lpc-fw/src/boards/reform2/board_reform2.c b/reform2-lpc-fw/src/boards/reform2/board_reform2.c @@ -630,9 +630,14 @@ void handle_commands() { sprintf(uartBuffer,"system: auxpwr on\r\n"); uartSend((uint8_t*)uartBuffer, strlen(uartBuffer)); } else { - turn_som_power_on(); - sprintf(uartBuffer,"system: on\r\n"); - uartSend((uint8_t*)uartBuffer, strlen(uartBuffer)); + if (som_is_powered) { + sprintf(uartBuffer,"system: already on\r\n"); + uartSend((uint8_t*)uartBuffer, strlen(uartBuffer)); + } else { + turn_som_power_on(); + sprintf(uartBuffer,"system: on\r\n"); + uartSend((uint8_t*)uartBuffer, strlen(uartBuffer)); + } } } else if (remote_cmd == 'x') {