diff --git a/src/states/debug_state.c b/src/states/debug_state.c index a8ab12a..07c23e8 100644 --- a/src/states/debug_state.c +++ b/src/states/debug_state.c @@ -7,19 +7,20 @@ const char debug_state_name[] = __FILE_NAME__; static void pressPwrMethod(Device_t *device) { printf("turning off device\n"); - setOffState(device); + setDeviceStateToOff(device); } static void pressStrInputMethod(Device_t *device) { + (void) device; printf("nothing happens\n"); } static void pressLockMethod(Device_t *device) { printf("locking device\n"); - setOffState(device); + setDeviceStateToOff(device); } -void setDebugState(Device_t *device) { +void setDeviceStateToDebug(Device_t *device) { device->state = (DeviceState_t){ .state_name = debug_state_name, .device = device, diff --git a/src/states/lock_state.c b/src/states/lock_state.c index 3ba90d0..245647d 100644 --- a/src/states/lock_state.c +++ b/src/states/lock_state.c @@ -8,18 +8,18 @@ const char lock_state_name[] = __FILE_NAME__; 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; } if (strcmp(device->entered_string, "pwd") == 0) { printf("entering unlock state\n"); - setUnlockState(device); + setDeviceStateToUnlock(device); return; } @@ -28,10 +28,11 @@ static void pressStrInputMethod(Device_t *device) { } static void pressLockMethod(Device_t *device) { + (void) device; printf("nothing happens\n"); } -void setLockState(Device_t *device) { +void setDeviceStateToLock(Device_t *device) { device->state = (DeviceState_t){ .state_name = lock_state_name, .device = device, diff --git a/src/states/off_state.c b/src/states/off_state.c index 8fe81b3..8d3e74f 100644 --- a/src/states/off_state.c +++ b/src/states/off_state.c @@ -6,18 +6,20 @@ const char off_state_name[] = __FILE_NAME__; static void pressPwrMethod(Device_t *device) { printf("turning on device\n"); - setLockState(device); + setDeviceStateToLock(device); } static void pressStrInputMethod(Device_t *device) { + (void) device; printf("nothing happens\n"); } static void pressLockMethod(Device_t *device) { + (void) device; printf("nothing happens\n"); } -void setOffState(Device_t *device) { +void setDeviceStateToOff(Device_t *device) { device->state = (DeviceState_t){ .state_name = off_state_name, .device = device, diff --git a/src/states/state.h b/src/states/state.h index 8095e81..eb34244 100644 --- a/src/states/state.h +++ b/src/states/state.h @@ -1,7 +1,9 @@ #pragma once #include "../device.h" -void setLockState(Device_t *device); -void setUnlockState(Device_t *device); -void setDebugState(Device_t *device); -void setOffState(Device_t *device); \ No newline at end of file +// why nothing working? +// each of these are each state +void setDeviceStateToLock(Device_t *device); +void setDeviceStateToUnlock(Device_t *device); +void setDeviceStateToDebug(Device_t *device); +void setDeviceStateToOff(Device_t *device); \ No newline at end of file diff --git a/src/states/unlock_state.c b/src/states/unlock_state.c index ed7180b..b3abb44 100644 --- a/src/states/unlock_state.c +++ b/src/states/unlock_state.c @@ -3,27 +3,30 @@ #include #include +// 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,