View Single Post
Old 04-19-2011, 01:42 AM   #32 (permalink)
FalconFour
EcoModding Lurker
 
FalconFour's Avatar
 
Join Date: Sep 2010
Location: Fresno, CA
Posts: 78

LEAF - '11 Nissan LEAF
Thanks: 4
Thanked 9 Times in 7 Posts
The limitations I'm dealing with right now are that the existing hardware uses unusual pin placement that seems to almost require custom (non-Arduino) AVR code to implement the interrupts properly... whole boatloads of freaky stuff in the setup routine like "EICRA = (EICRA & ~((1 << ISC00) | (1 << ISC01))) | ((parms[injEdgeIdx] == 1 ? RISING : FALLING) << ISC00);". Stuff that could probably be implemented in Arduino language with attachInterrupt() if it were on a different pin. So I'm completely copying over the functions of handling pulse-tracking and basically the whole data-monitoring core of MPGuino, straight from v1 to v2. That ensures the 100% reliability of the existing system carries over to the new code, and leaves UI and computation up to the imagination. It also means we're really limited to what we can change in hardware. Even the difference between delay2() and delay() is huge, since something in the MPGuino code affects usage of delay() (hint: it doesn't delay anymore since timer2 is modified). And that might affect other things. So it becomes a tangled mess of inter-related functionality that just complicates things...

But it can still be done. Last night I was just concentrating on making the existing code work right, and I spent over an hour going over why it wasn't working before I found that the genius decision was made to add a main() loop as WELL as a setup() loop (I had just copied "setup" over), and main() was what initialized the interrupt modifications. Now that it's up and running I can concentrate on changing things to work better and more flexible, implementing Arduino code whereever possible (since it's already being added to the code, why not use those, which are actively developed, and drop the custom utility routines).

Planned features:
- A streamlined, user-friendly UI with much more flexibility and ease-of-understanding than the existing UI (this is the most complicated part)
- A menu system for configuring parameters/settings, and UI preferences
- A software "real time clock" (currently working 100% accurate for weeks on my MPGuino mod), that is used in various places, including in statistics (instant/current/tank)
- Tank save/load to/from EEPROM whenever it goes to "screensaver mode" - no more lost tanks, ever.
- Screensaver mode - idle mode that displays a small graphic, the current time, and various configurable stats like a RSS ticker. (still not 100% sure on how to best implement the stats display, but graphic is a done deal, yes, on the current 16x2 MPGuino display; see "duck" in my mod)
- Flexibility to add more features for anyone that knows how to code
  Reply With Quote