Boss lady
Boss lady
DIIDevHeads IoT Integration Server
Created by Marvee Amasi on 6/12/2024 in #middleware-and-os
How can I modify the state machine logic?
Hi @Marvee Amasi to prevent the invalid transition from CoinInserted to Dispensing when the selection hasn't been made yet, you can modify the state machine logic to introduce an intermediate state between CoinInserted and SelectionMade. your code for the VendingMachineState enum should be
typedef enum {
STATE_IDLE,
STATE_COIN_INSERTED,
STATE_SELECTION_IN_PROGRESS,
STATE_SELECTION_MADE,
STATE_DISPENSING
} VendingMachineState;
typedef enum {
STATE_IDLE,
STATE_COIN_INSERTED,
STATE_SELECTION_IN_PROGRESS,
STATE_SELECTION_MADE,
STATE_DISPENSING
} VendingMachineState;
3 replies