FreeEMS-Tuner Development Diary - Don't Post!
- sry_not4sale
- LQFP144 - On Top Of The Game
- Posts: 568
- Joined: Mon Mar 31, 2008 12:47 am
- Location: New Zealand, land of the long white burnout
- Contact:
Re: FreeEMS-Tuner Development Diary - Don't Post!
Ok, done some more last night on the train.
Have set up connect and disconnect to now trigger actions in the comms plugin's threaded loop, which brought up a whole lot of other bugs lol
Fixed the thread shutdown procedure to wait for threads to complete before closing the parent thread, but I am now thinking I might make the controller thread a daemon thread so it will keep running after the gui closes. Because at the moment the gui waits for the threads to finish before closing and giving the terminal back to the user.
Fixing the comms loop to properly handle connect and disconnect actions took most of the trip, so not much to report here.
Have set up connect and disconnect to now trigger actions in the comms plugin's threaded loop, which brought up a whole lot of other bugs lol
Fixed the thread shutdown procedure to wait for threads to complete before closing the parent thread, but I am now thinking I might make the controller thread a daemon thread so it will keep running after the gui closes. Because at the moment the gui waits for the threads to finish before closing and giving the terminal back to the user.
Fixing the comms loop to properly handle connect and disconnect actions took most of the trip, so not much to report here.
Owner / Builder: 1983 Mazda Cosmo 12at (1200cc 2-rotor turbo) coupe [SPASTK]
165hp @ 6psi standard - fastest production car in japan Oct 82
165hp @ 6psi standard - fastest production car in japan Oct 82
- sry_not4sale
- LQFP144 - On Top Of The Game
- Posts: 568
- Joined: Mon Mar 31, 2008 12:47 am
- Location: New Zealand, land of the long white burnout
- Contact:
Re: FreeEMS-Tuner Development Diary - Don't Post!
Ok lots more done late last week on the train...
Added low-priority and blocking actions as well as the normal actions. Low priority actions are only ever performed when no other other actions are queued. Blocking actions will put the calling thread to sleep until they have completed, and take priority in the controller thread over any other actions, but should still be used widely. The only blocking action I use currently is the configuration loading functionality at start up.
Also moved controller action logic into submodules rather than having a monolithic controller file - and all logging is now done using the thread-safe low-priority controller action
Added low-priority and blocking actions as well as the normal actions. Low priority actions are only ever performed when no other other actions are queued. Blocking actions will put the calling thread to sleep until they have completed, and take priority in the controller thread over any other actions, but should still be used widely. The only blocking action I use currently is the configuration loading functionality at start up.
Also moved controller action logic into submodules rather than having a monolithic controller file - and all logging is now done using the thread-safe low-priority controller action

Owner / Builder: 1983 Mazda Cosmo 12at (1200cc 2-rotor turbo) coupe [SPASTK]
165hp @ 6psi standard - fastest production car in japan Oct 82
165hp @ 6psi standard - fastest production car in japan Oct 82
- sry_not4sale
- LQFP144 - On Top Of The Game
- Posts: 568
- Joined: Mon Mar 31, 2008 12:47 am
- Location: New Zealand, land of the long white burnout
- Contact:
Re: FreeEMS-Tuner Development Diary - Don't Post!
Lotsa progress since the last update...
Now have a send thread!! woot! Takes packet objects and adds to queue. Then loops through processing to raw bytes and sending to the master comms thread for sending.
Did a big shuffle of protocol source into multiple files and now part of the comms directory e.g. comms/protocols/IFreeEMS_Vanilla/0_0_1/responses.py - it is also now alot more transparent, and is access through the comms class. This should tidy up the code, and also mean you can have multiple comms connections with different protocols for each (who know what we might need this for but its there in case we do
)
Next milestone is to get the big orange and red buttons actually doing the right thing with the new threads. 90% of the way there, just stuck on an import issue (f*cking import statement!!!!!!!).
When those buttons work I will update the public repo so people can have a play (will create a new branch)
Now have a send thread!! woot! Takes packet objects and adds to queue. Then loops through processing to raw bytes and sending to the master comms thread for sending.
Did a big shuffle of protocol source into multiple files and now part of the comms directory e.g. comms/protocols/IFreeEMS_Vanilla/0_0_1/responses.py - it is also now alot more transparent, and is access through the comms class. This should tidy up the code, and also mean you can have multiple comms connections with different protocols for each (who know what we might need this for but its there in case we do


Next milestone is to get the big orange and red buttons actually doing the right thing with the new threads. 90% of the way there, just stuck on an import issue (f*cking import statement!!!!!!!).
When those buttons work I will update the public repo so people can have a play (will create a new branch)
Owner / Builder: 1983 Mazda Cosmo 12at (1200cc 2-rotor turbo) coupe [SPASTK]
165hp @ 6psi standard - fastest production car in japan Oct 82
165hp @ 6psi standard - fastest production car in japan Oct 82
- sry_not4sale
- LQFP144 - On Top Of The Game
- Posts: 568
- Joined: Mon Mar 31, 2008 12:47 am
- Location: New Zealand, land of the long white burnout
- Contact:
Re: FreeEMS-Tuner Development Diary - Don't Post!
Ok, whole heap of progress.
Started making the new reshuffled protocol code work lol The threaded app now can start up, connect to the Test comms plugin, disconnect, and send a hard reset packet.
Unfortunately the packet only makes it to the send thread but never gets processed into a raw packet.
Also, there is no receive or diagnostics working for the comms connection.
But!! Progress, and now that I am at the stage where one thing pretty much works, it should be easy to refactor the next bits!
To keep track of the code, I now have a devtrunk branch with my latest code.
http://github.com/srynot4sale/freeems-t ... e/devtrunk
PLEASE keep in mind this code probably doesn't work, only a very small amount of the front end code is converted to the new thread model. And the rewrite is such that old code will not work so if you boot it up expect lots of exceptions and lots of crashes (including possibly threads left running etc, etc)!!!!!!!!!!
Started making the new reshuffled protocol code work lol The threaded app now can start up, connect to the Test comms plugin, disconnect, and send a hard reset packet.
Unfortunately the packet only makes it to the send thread but never gets processed into a raw packet.
Also, there is no receive or diagnostics working for the comms connection.
But!! Progress, and now that I am at the stage where one thing pretty much works, it should be easy to refactor the next bits!
To keep track of the code, I now have a devtrunk branch with my latest code.
http://github.com/srynot4sale/freeems-t ... e/devtrunk
PLEASE keep in mind this code probably doesn't work, only a very small amount of the front end code is converted to the new thread model. And the rewrite is such that old code will not work so if you boot it up expect lots of exceptions and lots of crashes (including possibly threads left running etc, etc)!!!!!!!!!!
Owner / Builder: 1983 Mazda Cosmo 12at (1200cc 2-rotor turbo) coupe [SPASTK]
165hp @ 6psi standard - fastest production car in japan Oct 82
165hp @ 6psi standard - fastest production car in japan Oct 82
- sry_not4sale
- LQFP144 - On Top Of The Game
- Posts: 568
- Joined: Mon Mar 31, 2008 12:47 am
- Location: New Zealand, land of the long white burnout
- Contact:
Re: FreeEMS-Tuner Development Diary - Don't Post!
* Fixed a bug stopping send thread starting and added logging to keep track of its status
* Added config option for disabling/enabling logging of controller action queue sizes
* Now sends raw bytes over comms connection! (only with Test plugin so far), and fixed a long standing checksumming bug
* Updated soft reset button to use new code
* Refactored Test comms plugin in preperation of porting Serial comms plugin over to new code
Next to do is get receive thread up and logging, no port in porting the Serial plugin until we can see whats happening!
* Added config option for disabling/enabling logging of controller action queue sizes
* Now sends raw bytes over comms connection! (only with Test plugin so far), and fixed a long standing checksumming bug
* Updated soft reset button to use new code
* Refactored Test comms plugin in preperation of porting Serial comms plugin over to new code
Next to do is get receive thread up and logging, no port in porting the Serial plugin until we can see whats happening!
Owner / Builder: 1983 Mazda Cosmo 12at (1200cc 2-rotor turbo) coupe [SPASTK]
165hp @ 6psi standard - fastest production car in japan Oct 82
165hp @ 6psi standard - fastest production car in japan Oct 82
- sry_not4sale
- LQFP144 - On Top Of The Game
- Posts: 568
- Joined: Mon Mar 31, 2008 12:47 am
- Location: New Zealand, land of the long white burnout
- Contact:
Re: FreeEMS-Tuner Development Diary - Don't Post!
In master branch (old, working but non-threaded code), fixed the escape bugs that have been haunting me for a while...
Ended up some old code was still in there, and received packets were being escaped twice, and the loop that escaped sent packets wasn't incrementing the iteration counting variable (so wasn't being escaped at all). lmao
Also, in the development branch:
* Same escaping fixes
* Added receive thread, that accepts raw bytes and logs them to console ( no packet decoding yet )
* Updated serial comms plugin to use new code, so its ready to be tested by someone with the hardware!
Ended up some old code was still in there, and received packets were being escaped twice, and the loop that escaped sent packets wasn't incrementing the iteration counting variable (so wasn't being escaped at all). lmao
Also, in the development branch:
* Same escaping fixes
* Added receive thread, that accepts raw bytes and logs them to console ( no packet decoding yet )
* Updated serial comms plugin to use new code, so its ready to be tested by someone with the hardware!

Owner / Builder: 1983 Mazda Cosmo 12at (1200cc 2-rotor turbo) coupe [SPASTK]
165hp @ 6psi standard - fastest production car in japan Oct 82
165hp @ 6psi standard - fastest production car in japan Oct 82
- sry_not4sale
- LQFP144 - On Top Of The Game
- Posts: 568
- Joined: Mon Mar 31, 2008 12:47 am
- Location: New Zealand, land of the long white burnout
- Contact:
Re: FreeEMS-Tuner Development Diary - Don't Post!
More done:
commit e57e65d6e0e686f32e7f494de3d923326d210865
Author: Aaron Barnes <aaron.barnes@hbcosmo.com>
Date: Mon Jan 12 19:01:44 2009 +1300
Fixed comms receive watchers
commit e751350be6af4151928a5234bc15b231de41ee50
Author: Aaron Barnes <aaron.barnes@hbcosmo.com>
Date: Mon Jan 12 18:58:48 2009 +1300
Updates diagnostics grid to use new codebase
commit 34ddb39dd5caa1cf737ad99c8f28bc9831e1e197
Author: Aaron Barnes <aaron.barnes@hbcosmo.com>
Date: Mon Jan 12 18:58:25 2009 +1300
Fixed bound watchers methods
commit 07f469912721cdc9748b2a541de9cb82b2ef8f87
Author: Aaron Barnes <aaron.barnes@hbcosmo.com>
Date: Mon Jan 12 18:29:01 2009 +1300
Update debug window to use new code
commit ac792a5b3aea877a2106c83278d2f7f06653371a
Author: Aaron Barnes <aaron.barnes@hbcosmo.com>
Date: Mon Jan 12 18:18:36 2009 +1300
Added support for other utility request packets and tidy up of protocol file
commit 70c3ea30ccb74664a4ce874e2737cc405bfc8d8b
Author: Aaron Barnes <aaron.barnes@hbcosmo.com>
Date: Mon Jan 12 18:01:38 2009 +1300
Updated comms thread name to be based off identified, not type
commit 845187d4327e656c7c9d958eea235187230d2f43
Author: Aaron Barnes <aaron.barnes@hbcosmo.com>
Date: Mon Jan 12 17:54:32 2009 +1300
Porting response processing code
Owner / Builder: 1983 Mazda Cosmo 12at (1200cc 2-rotor turbo) coupe [SPASTK]
165hp @ 6psi standard - fastest production car in japan Oct 82
165hp @ 6psi standard - fastest production car in japan Oct 82
- sry_not4sale
- LQFP144 - On Top Of The Game
- Posts: 568
- Joined: Mon Mar 31, 2008 12:47 am
- Location: New Zealand, land of the long white burnout
- Contact:
Re: FreeEMS-Tuner Development Diary - Don't Post!
Now I am not in a rush, I will just explain that last post a bit more.
The threaded app is usable again!!
I have commented out the memory and other tabs for the time being, but everything in the main tab and menus works again!
The app will send, receive, decode and encode packets, at the moment it logs everything to that diagnostics grid again, and logs raw bytes to console if you have debug logging turned on.
Next job is to bring the logging up to this spec:
http://www.diyefi.org/forum/viewtopic.php?f=43&t=539
Then port the other two tabs, and deprecate the old code!
Then make a custom packet builder for Fred!
The threaded app is usable again!!
I have commented out the memory and other tabs for the time being, but everything in the main tab and menus works again!
The app will send, receive, decode and encode packets, at the moment it logs everything to that diagnostics grid again, and logs raw bytes to console if you have debug logging turned on.
Next job is to bring the logging up to this spec:
http://www.diyefi.org/forum/viewtopic.php?f=43&t=539
Then port the other two tabs, and deprecate the old code!
Then make a custom packet builder for Fred!
Last edited by sry_not4sale on Mon Jan 12, 2009 10:56 pm, edited 1 time in total.
Owner / Builder: 1983 Mazda Cosmo 12at (1200cc 2-rotor turbo) coupe [SPASTK]
165hp @ 6psi standard - fastest production car in japan Oct 82
165hp @ 6psi standard - fastest production car in japan Oct 82
Re: FreeEMS-Tuner Development Diary - Don't Post!
sorry for posting here!
Re: FreeEMS-Tuner Development Diary - Don't Post!
Naughty!! (if you actually want this deleted (either of you) say so!)jbelanger wrote:sorry for posting here!
What was in that post before deprecated?? lol, what did I miss? :-)
Fred. (the grumpy delete everything edit and censor crazy mod ;-) )
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!