Go Back   EcoModder Forum > EcoModding > Instrumentation > OpenGauge / MPGuino FE computer
Register Now
 Register Now
 

Reply  Post New Thread
 
Submit Tools LinkBack Thread Tools
Old 07-18-2013, 01:33 AM   #1 (permalink)
MPGuino Supporter
 
t vago's Avatar
 
Join Date: Oct 2010
Location: Cedar Rapids, IA
Posts: 1,766

The Karen-Mobile - '05 Dodge Magnum SXT
Team Dodge
90 day: 26.72 mpg (US)

Fiat Dakota - '00 Dodge Dakota SLT RWD Quad Cab
90 day: 16.67 mpg (US)

The Red Sled - '01 Dodge Durango SLT 4WD
90 day: 16.96 mpg (US)
Thanks: 799
Thanked 681 Times in 437 Posts
Would anybody be interested in an optimized version of the base MPGuino 0.86 code?

As I was going through the MPGuino 0.86 code in order to add my Chrysler fuel adjustment algorithm, I got to thinking that I could tweak the base code to reduce the code size, make the code more robust, and get rid of some nasty and subtle bugs in the code.

I went through the base code again, separate from the code I've been working on, and managed to shrink it by a smidge over 20%. It still retains the same functionality as the base 0.86 code. I added no new features to it.

I am going to test the optimized base code tomorrow to make sure it still works.

SizeRemoved BytesComment
17178.original 0.86 code
16898280Re-wrote microseconds() to more accurately calculate the 'microseconds' (actually clock cycles), and to remove a nasty bug that could cause unwanted nested interrupts. Removed (unsigned long) lastMicroseconds.
1687424Re-wrote elapsedMicroseconds to remove reference to floating point number, and to correct negation error.
16774100Re-wrote setup(). Completed moving displayFuncNames strings into flash memory.
156981076added setupGuino() to handle MPGuino-specific system variable setup and fuel injector interrupt setup. Removed floating point calculations (3.785, 1.609) and replaced with (3785 ul / 1000 ul, 1609ul / 1000ul).
1567424Removed indirect function references to ISR(INT0_vect) and ISR(INT1_vect). Re-wrote fuel injector close event to remove fuel consumption runaway bug. Re-wrote instantmpg() to remove integer division before integer multiplication bug.
15530144Re-wrote bignum(). Added LCD:: printBigNum() function. Moved bignumchar1[] and bignumchar2[] into flash.
15332198Re-wrote 64-bit math section to optimize code and to remove separate conditional functions.
15212120Re-wrote LCD:: print and LCD:: pushNibble, added LCD:: printFlash(), removed getstr(), removed tickleEnable().
137341478Removed instantlkm(). Removed Trip::lkm(). Turned injhius and injhisec into injtime[2]. Turned injIdleHius and injIdleHiSec into injIdleTime[2]. Added private Trip::doMiles() and private Trip::doGallons() functions. Eliminated redundant code in Trip::Miles(), Trip::EOCMiles(), Trip::Gallons, and Trip::IdleGallons().

__________________
The Fiat Dakota


The Karen-mobile


The Red Sled
  Reply With Quote
The Following User Says Thank You to t vago For This Useful Post:
Piwoslaw (07-19-2013)
Alt Today
Popular topics

Other popular topics in this forum...

   
Old 07-22-2013, 04:55 AM   #2 (permalink)
Scandinavian creature
 
Join Date: Jun 2012
Location: Finland
Posts: 146

Golf ball - '94 Volkswagen Golf III
90 day: 28.46 mpg (US)
Thanks: 4
Thanked 25 Times in 21 Posts
Nice. Optimization is always good
__________________

Brrrmm
Now selling preassembled MPGuino's!
http://www.mthtek.net/mpguino/
  Reply With Quote
Old 07-22-2013, 11:04 AM   #3 (permalink)
MPGuino Supporter
 
t vago's Avatar
 
Join Date: Oct 2010
Location: Cedar Rapids, IA
Posts: 1,766

The Karen-Mobile - '05 Dodge Magnum SXT
Team Dodge
90 day: 26.72 mpg (US)

Fiat Dakota - '00 Dodge Dakota SLT RWD Quad Cab
90 day: 16.67 mpg (US)

The Red Sled - '01 Dodge Durango SLT 4WD
90 day: 16.96 mpg (US)
Thanks: 799
Thanked 681 Times in 437 Posts
Yah - I just got to figure out why the optimized code randomly freezes. Might be something to do with how the interrupts are handled.
__________________
The Fiat Dakota


The Karen-mobile


The Red Sled
  Reply With Quote
Old 11-15-2013, 05:36 PM   #4 (permalink)
EcoModding Lurker
 
Join Date: Jun 2008
Location: Canada
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Any news on this project?
  Reply With Quote
Old 11-15-2013, 06:38 PM   #5 (permalink)
EcoModding Apprentice
 
Join Date: Dec 2012
Location: Portugal
Posts: 197
Thanks: 93
Thanked 69 Times in 64 Posts
Quote:
Originally Posted by martinq View Post
Any news on this project?
You can follow this project here http://ecomodder.com/forum/showthrea...ead-26469.html

Josť Rodrigues

  Reply With Quote
Reply  Post New Thread


Thread Tools




Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com