View Single Post
Old 04-25-2011, 08:54 AM   #68 (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
Yeah, I'm finding Arduino can be kinda limiting... but for a guy that's never taken a microcontroller class in his life, it's not too bad. That's not to say I don't understand the goals and architecture of them, but I think it helps invite more people in by using modified Arduino as the platform.

Thankfully, I've already worked around the timer0/timer2 issue - I use timer2 as the event handler (and may even be phasing that out if I can find a way around it) and leave timer0 as the millis()/micros() source. I'm down to 6.2kb after removing the duplicate code and moving it over to Arduino, and that's with all the display and 64-bit math stuff too Just trying to build the UI now, though...

I'm having trouble with one thing, though. I want each display-mode (menus, subscreens, main screen, etc) to have "tab indexes", where each "tab index" is a byte in an array. The display routine will cycle through the "current tab index" array until the current cursor position (tab index selection) matches the current loop iteration, OR if it encounters 0xFF in the list (out of bounds, no cursor on display). Problem is, I can't seem to find an efficient way to set up this array so each display-mode-index is associated with a tab-list-index.

For example:
Code:
#define tabRow2 128
#define tabEnd 255
pFunc displayModes = { blah, blah, blah };
char displayTabs[][15] PROGMEM = { {0,2+tabRow1, 8+tabRow2,tabEnd}, {2,0+tabRow1,4+tabRow1,8+tabRow1,tabEnd}, {0,tabEnd} };
memcpy_P(displayTabs[1],currentTabs,15);
... obviously won't compile due to the varying size of the array being assigned to it, and memcpy_P takes a fixed amount (not stopping at null or 255). How can I make this work? :/
  Reply With Quote