Click here to Skip to main content
15,905,316 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: In defense of spaghetti code. *ducks* Pin
Greg Utas18-May-23 1:15
professionalGreg Utas18-May-23 1:15 
GeneralRe: In defense of spaghetti code. *ducks* Pin
Eusebiu Marcu18-May-23 1:41
Eusebiu Marcu18-May-23 1:41 
GeneralRe: In defense of spaghetti code. *ducks* Pin
jschell18-May-23 6:50
jschell18-May-23 6:50 
GeneralRe: In defense of spaghetti code. *ducks* Pin
honey the codewitch18-May-23 3:58
mvahoney the codewitch18-May-23 3:58 
GeneralRe: In defense of spaghetti code. *ducks* Pin
BernardIE531718-May-23 1:49
BernardIE531718-May-23 1:49 
GeneralRe: In defense of spaghetti code. *ducks* Pin
honey the codewitch18-May-23 3:54
mvahoney the codewitch18-May-23 3:54 
GeneralRe: In defense of spaghetti code. *ducks* Pin
BernardIE531718-May-23 4:02
BernardIE531718-May-23 4:02 
GeneralRe: In defense of spaghetti code. *ducks* Pin
honey the codewitch18-May-23 5:14
mvahoney the codewitch18-May-23 5:14 
It is pretty much the same, just presented slightly differently. The screens are basically state transition "landings", the arrows, the transitions themselves.

I wish I could just show you the diagram but I'm not at liberty to share it. It would make things clear.

The actual logical flow isn't terrible, per se. But it folds back on itself some (due to inactivity of button presses, or otherwise navigating from screen to screen)

There is a quirk that impacts all of the startup code, and that is the startup code must run on wake or on boot, with a different "start reason" associated with it. The machine otherwise has no indication to determine whether it was woken from sleep vs. powered on. It remembers nothing.

Also, I have a watchdog timer in the code, for robustness - this is out of band, and what it does is it starts counting down, and if it reaches the end, it reboots. This is regardless of what else happens. The reason for that is to prevent a hang, not that my code hangs, but in production, who knows?

So that's a separate flow on top of everything else.

Basically what it amounts to is rather than one state machine, it's several state machines working in tandem. That's messier than what I'd like in an ideal world, but making it cleaner just wasn't going to pay for itself.
To err is human. Fortune favors the monsters.

GeneralRe: In defense of spaghetti code. *ducks* Pin
Alister Morton18-May-23 4:56
Alister Morton18-May-23 4:56 
GeneralRe: In defense of spaghetti code. *ducks* Pin
MikeCO1018-May-23 2:46
MikeCO1018-May-23 2:46 
GeneralRe: In defense of spaghetti code. *ducks* Pin
Cpichols18-May-23 2:13
Cpichols18-May-23 2:13 
GeneralRe: In defense of spaghetti code. *ducks* Pin
Juan Pablo Reyes Altamirano18-May-23 4:10
Juan Pablo Reyes Altamirano18-May-23 4:10 
GeneralRe: In defense of spaghetti code. *ducks* Pin
honey the codewitch18-May-23 5:20
mvahoney the codewitch18-May-23 5:20 
GeneralRe: In defense of spaghetti code. *ducks* Pin
Matt Bond18-May-23 4:56
Matt Bond18-May-23 4:56 
GeneralRe: In defense of spaghetti code. *ducks* Pin
honey the codewitch18-May-23 5:17
mvahoney the codewitch18-May-23 5:17 
GeneralRe: In defense of spaghetti code. *ducks* Pin
jkirkerx18-May-23 7:03
professionaljkirkerx18-May-23 7:03 
GeneralRe: In defense of spaghetti code. *ducks* Pin
honey the codewitch18-May-23 7:06
mvahoney the codewitch18-May-23 7:06 
GeneralRe: In defense of spaghetti code. *ducks* Pin
jkirkerx18-May-23 8:33
professionaljkirkerx18-May-23 8:33 
GeneralRe: In defense of spaghetti code. *ducks* Pin
Eusebiu Marcu18-May-23 8:54
Eusebiu Marcu18-May-23 8:54 
GeneralRe: In defense of spaghetti code. *ducks* Pin
honey the codewitch18-May-23 9:07
mvahoney the codewitch18-May-23 9:07 
GeneralRe: In defense of spaghetti code. *ducks* Pin
Eusebiu Marcu18-May-23 9:16
Eusebiu Marcu18-May-23 9:16 
GeneralRe: In defense of spaghetti code. *ducks* Pin
honey the codewitch18-May-23 9:18
mvahoney the codewitch18-May-23 9:18 
GeneralRe: In defense of spaghetti code. *ducks* Pin
Eusebiu Marcu18-May-23 9:27
Eusebiu Marcu18-May-23 9:27 
GeneralRe: In defense of spaghetti code. *ducks* Pin
honey the codewitch18-May-23 9:28
mvahoney the codewitch18-May-23 9:28 
GeneralRe: In defense of spaghetti code. *ducks* Pin
Eusebiu Marcu18-May-23 9:30
Eusebiu Marcu18-May-23 9:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.