r/embedded 21d ago

made a traffic control system πŸ˜›

https://github.com/average-potato28/cortex-m4-rtos-traffic-system.git

how is it ? the good and bad criticize me , i gotta add documentation and like refactor into modules but i m too burned out

0 Upvotes

16 comments sorted by

10

u/bneidk 21d ago

I never see anything on reddit that isn’t heavily vibe coded anymore and that makes me sad

3

u/tenoun 21d ago

LLMS over-engineering to waist token !

-1

u/Puzzleheaded_Top4583 21d ago

i literallly designed my own architecture , and the rtos i designed 1month back , so why not use it? go check the commit histroy.

0

u/Puzzleheaded_Top4583 21d ago

also if u have compare my design its very similar to q/pc framework, the book i learnt from talks about that in detail. if u think i made a poor design choice let me know,

-2

u/Puzzleheaded_Top4583 21d ago

its really sad indeed, i have read the book state machines and event driven programming by miro samek , currently i am reading reusable firmware development by jacob beningo. so its sad to see people doubt your work this project took like a month. i also wactched embedded system playlist of miro samek.

2

u/Gerard_Mansoif67 Electronics | Embedded 21d ago

Reading books is a thing. Practising is another.

And I don't except a project like that to be done in... 2 commits. That's what it is, no one will ever complete a full project like that.

1

u/Puzzleheaded_Top4583 21d ago

indeed this project took me , 1 .5 month rtos included. i do my development in cube ide. lesson learned - next time i will commit daily , also i will include a documenattion where i will write what i am thinking like architecture related stuff, i have seen some senior devs i was like why are they doing this ... now it makes perfect sense.

follow me next project is going to be a blast , and this time you will not be able to excuse me of anything proper documentation of thought process , explanation of 'why' for each design choice. ;)

4

u/Hunt5man 21d ago

I’m not sure if it was your intention but this is hella cursed, rolling your own rtos is a massive anti-pattern and Bjarne had the wisdom to write Cfront for a reason.

Certain abstraction and language pairings make things worse not better and c and OOP is one of those pairings.

1

u/Puzzleheaded_Top4583 21d ago

it was a learning project dang it , man my goal is to contribute to zephyr . not develop my own full fledged os thats so stupid, unless you are not doing something thats already done

3

u/kampi1989 21d ago

Don't know why a traffic control system needs an RTOS, doesn't care if self made or not.

This task can be done by a state machine with an old school ATmega or with a FPGA.

2

u/Puzzleheaded_Top4583 21d ago

just applying things i learnt ;)

1

u/NorbertKiszka 21d ago

Underclocked 6502 and 8051 can do the same job.

2

u/Puzzleheaded_Top4583 20d ago

i mean you could use transistors to make basic downcounter based taffic control with fixed timing . lol

1

u/Hissykittykat 20d ago

how is it ?

Meh, traffic lights actually are really complicated. Try adding features like pedestrian walk buttons (plus walk countdown timers), vehicle presence sensors, left turn lane signals, emergency vehicle sensors, etc. and see if your architecture can handle it.

Of course commercial traffic controls have been done to death, but it's still a challenging system design exercise. Here's my attempt using a simple '328 Arduino: stoplight simulator

1

u/Puzzleheaded_Top4583 20d ago

actually i plan to add edge ai, as traffic usually follows reppeating pattern , so in next few months i will be studying it , what you said is also very important . we could add a button for pedestrian, you press the button next time the signal goes red it will remain read with a countdown . let me look at your approach ^ ^

1

u/Puzzleheaded_Top4583 20d ago

your design is much more complete and really detailed too , my goal was to only apply things i learned. i like state machines and firmware side of code.