First try to firmware modelling - C
I try to model a device that already works over here. It is a (simple) embedded microcontroller written in C.
I`m new to modelling like state-charts in UML. Usually i create a overview flowchart and then start "zooming in" in the design.
But this is really a lot of work and also creates what I read "spagetthi" code.
So I`m looking for a better method(s) and tried a state-chart (see below).
I also tried other UML diagrams but failed to set them up the right way. Every-time I struggle to group multiple things. Like the LED, it is used in multiple routines.
I really need some help from someone, maybe someone can give me an example or hints... really out of idea's
Basically what it does is to convert a input voltage to an output loop current (4~20mA).
Usually once, the user want to config the device for a particular sensor.
For example if the user want to have "at 1v input an 4mA output" instead of "2v input an 4mA output".
[Use case scenario for example]
The user puts the external sensor in the 1v position. (external)
Then the user has to enter the config mode by pressing key 3 for long time(5 sec).
After that the user presses key 1 for a long time to have the input set to "1v equals to 4mA output".
If all goes well the user gets a short flashing green led (5 times).
Then the user has the ability to save the new configuration by pressing key3 a long time again.
If the new value is saved the device will reboot itself and starts all over with the new saved values.
I dont think i use the guards right. But i really have no idea how to best draw a state-diagram (i dont even know if this is the best thing to do in my case).
Hope that i've made my problem clear. Any help is really appreciated!
In this picture the
KEYx -L stands for key X is long pressed
KEYx -S stands for key X is short pressed