changed from setXState to a more discripive setDeviceStateToX

This commit is contained in:
sirlilpanda
2025-08-29 00:12:44 +12:00
parent aead22a646
commit 0ed9111af3
5 changed files with 26 additions and 17 deletions

View File

@@ -3,27 +3,30 @@
#include <stdio.h>
#include <string.h>
// this is me being lazy
const char name[] = __FILE_NAME__;
// so when a button is pressed it updates the state to the new one
static void pressPwrMethod(Device_t *device) {
printf("turning off device\n");
setOffState(device);
setDeviceStateToOff(device);
}
static void pressStrInputMethod(Device_t *device) {
if (strcmp(device->entered_string, "dbg") == 0) {
printf("entering debug state\n");
setDebugState(device);
setDeviceStateToDebug(device);
return;
}
printf("unknown string %s\n", device->entered_string);
}
static void pressLockMethod(Device_t *device) {
printf("locking device\n");
setLockState(device);
setDeviceStateToLock(device);
}
void setUnlockState(Device_t *device) {
void setDeviceStateToUnlock(Device_t *device) {
device->state = (DeviceState_t){
.state_name = name,
.device = device,