It is currently Tue Sep 25, 2018 3:29 am



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 72 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: User Configurable outputs
PostPosted: Mon Aug 12, 2013 10:42 am 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
We're off and running.

The TS portion of the config outputs is done and working and the variables added to the FW ready for Paul to pull into the FW. This is the piece needed to get the SIU and etpu setup correctly to allow optional outputs, so step 1.


While Paul works on that, I'll get going on step 2 which is to setup TS with the stuff the FW will need to actually control the optional outputs.


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Tue Aug 13, 2013 2:01 pm 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
I broke something and TS doesn't want to burn page 1 anymore :oops:

I need to get this sorted before anything else can happen.


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Tue Aug 13, 2013 3:07 pm 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
mk e wrote:
I broke something and TS doesn't want to burn page 1 anymore :oops:

I need to get this sorted before anything else can happen.


ok.....I can define
NPAGES = 18 with no problem

But the here
uint16_t const pageSize[NPAGES] = { ....., ...., .....


I can only enter 15 numbers....that's not helpful. I'll cut the project back to 15 pages so we can keep moving on the user config stuff that try to figure out what's going on with the pages separately.


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Fri Aug 16, 2013 7:52 am 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
I let myself get distracted the last couple days now I need to try to remember where the heck I was.

I stumbled on another issue Tuesday afternoon related to the way TS passes info to the ecu. TS has a nice feature that lets me display drop-down menus for the user to pick from then sends the FW a numeric value that is the position in the list of the selection. Great!

The issue is these are called "bits" class variables and work as the name implies, bit by bit. Each byte can hold up to 8 separate variables or 1 variable with a drop-down list 256 selections long. It was setup this way to conserve memory, but that is not an issue for o5e and we don't assign more than 1 variable per byte. The issue is TS does not make the unused bits "0" so while the bits I'm actually using are sent correctly, the bits I don't need might be anything so we can just read the byte and act, it needs post processing...which we have, but it doesn't work if I access the variable as an array like I need to do for this whole thing to work.

I really don't want to fill the FW with post-processing at point of use stuff because that will be impossible to maintain so that means I need to get TS to fill the whole byte with the correct info not just specific bits.....which I can do a couple ways I think but......I need to play with it to see which is the least painful.


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Fri Aug 16, 2013 8:25 am 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
mk e wrote:

I really don't want to fill the FW with post-processing at point of use stuff because that will be impossible to maintain so that means I need to get TS to fill the whole byte with the correct info not just specific bits.....which I can do a couple ways I think but......I need to play with it to see which is the least painful.


wow....I think I got it on my 1st try with a pretty painless method. I just create a dummy variable in the ini and assign it to the bits that the real variable isn't using....and TS appears to set it's default value to 0 and sends 0+ real variable to flash and the FW reads the correct value. Nice.


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Fri Aug 16, 2013 8:52 am 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
mk e wrote:
wow....I think I got it on my 1st try with a pretty painless method. I just create a dummy variable in the ini and assign it to the bits that the real variable isn't using....and TS appears to set it's default value to 0 and sends 0+ real variable to flash and the FW reads the correct value. Nice.


Spoke too soon....TS doesn't ALWAYS send a default 0 it seems :(


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Fri Aug 16, 2013 9:48 am 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
The next best thing seems to be brute force in the ini where I assign the variable to the entire byte then for a a simple on/off I add "INVALID" 254 times to kill options 2-255.

Lot's of room for mistakes in the ini this way but it works.

The other option is I use the dummy variables then go in the set them o zero by setectign and saving the 0 option.....but that makes creating a brand new project even more challenging than it already is so......brute force it is unless I can get some relief from Phil in the form of a new option.


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Mon Aug 26, 2013 9:14 am 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
A quick update.

I have been very to completely pre-occupied with work work the last week or so leaving very little band-width left for o5e stuff....but I think things are getting sorted and I should be back to having o5e time in the coming days.

Paul now has a 5634 board in his hands and running and it ready to dig in and help.

So patience for a couple more days and you should start to see progress again :)


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Tue Sep 03, 2013 9:28 am 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
I've allowed myself to remain distracted but Paul is working away and about ready to start testing the generic switch function part of the generic outputs control.

Now I need to get back into the ini this week and get caught up......


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Tue Sep 10, 2013 7:50 am 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
update.

I've been quite busy but did get an ini/TS project/variables.h to Paul that will allow him to test his switching function on ignition 2. It's got all the variables for all the channels but UI only on ign2 until I know it's right.

Progress....slow....but progress....I've just got WAY to much going on at the moment.


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Mon Sep 16, 2013 9:46 am 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
Time has been an enemy and so it turns out I lied when I said we'd get this wrapped up last week.

I was kind of waiting on Paul but then realized he'd told me he would be off-line for a couple weeks starting last week so waiting was a mistake :oops:

Now I need to figure out what I was doing and get back to it.


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Mon Oct 28, 2013 10:21 am 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
mk e wrote:

Now I need to figure out what I was doing and get back to it.


I've continued to let myself be distracted (but my frankenferrari engine is coming along nicely now!)....and now I need to figure out what I was doing all over again.

Paul's out of town again but he send me a snippet of code before he left that I need to cut in I guess.


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Thu Oct 31, 2013 1:49 pm 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
mk e wrote:
mk e wrote:

Now I need to figure out what I was doing and get back to it.


I've continued to let myself be distracted (but my frankenferrari engine is coming along nicely now!)....and now I need to figure out what I was doing all over again.

Paul's out of town again but he send me a snippet of code before he left that I need to cut in I guess.


Wow....I just looked and couldn't even remember what folder I was working in...... :oops:


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Fri Nov 15, 2013 3:51 pm 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
mk e wrote:
The next best thing seems to be brute force in the ini where I assign the variable to the entire byte then for a a simple on/off I add "INVALID" 254 times to kill options 2-255.

Lot's of room for mistakes in the ini this way but it works.

The other option is I use the dummy variables then go in the set them o zero by setectign and saving the 0 option.....but that makes creating a brand new project even more challenging than it already is so......brute force it is unless I can get some relief from Phil in the form of a new option.


Brute force in the ini didn't work.....TS got very unhappy.

planB, dummy variables it looks like.


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Tue Nov 19, 2013 8:34 pm 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
mk e wrote:

planB, dummy variables it looks like.


I messed with this today and it appears to work fine. I settled on breaking each 8 bit byte into 2 4 bit chucks, [0:3] & [4:7] thinking 16 levels is plenty for most everything and about the easiest to manage......nothing magic about it though so if something comes along wanting more 32 for that one is easy.

There is some other bug in somewhere I guess left from whatever it was I was doing when I last set it down that I'll need to sort before I finish converting all the bit class tuner stuff


I know....you're all shocked to see actual progress I'll bet :)


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Wed Nov 20, 2013 11:59 am 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
mk e wrote:

There is some other bug in somewhere I guess left from whatever it was I was doing when I last set it down that I'll need to sort before I finish converting all the bit class tuner stuff


Just a messed up TS project. TS never forget so when I remove stuff I need to make a clean project....preferably not one tha't incomplete and wrong :oops:

....moving on


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Wed Nov 20, 2013 6:47 pm 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
Good progress on the ini stuff today.....hopefully I'll get it ready to try tomorow


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Thu Nov 21, 2013 1:41 pm 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
mk e wrote:
Good progress on the ini stuff today.....hopefully I'll get it ready to try tomorrow


TS open with no erros or warnings and now seems to be handling the "bits" class stuff the way I need them handled. excellent.


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Thu Nov 21, 2013 5:04 pm 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
I started cutting in Paul's switching code.....closer


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Fri Nov 22, 2013 7:48 pm 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
mk e wrote:
I started cutting in Paul's switching code.....closer


i got it all keyed in...only 81 errors! pretty good for me :lol:

Hopefully I'll get it sorted Monday.

Questoin for you actual programmers.

What is the RIGHT way to to this:
Code:
                if (Output_Link_1_Array[i] == 1)
                   Ref= RPM;
                else if (Output_Link_1_Array[i] == 2)
                   Ref= Reference_VE;
                else if (Output_Link_1_Array[i] == 3)
                   Ref= IAT;
                else if (Output_Link_1_Array[i] == 4)
                   Ref= CLT;
                else if (Output_Link_1_Array[i] == 5)
                   Ref= TPS;
                else if (Output_Link_1_Array[i] == 6)
                   Ref= MAP[0];
                else if (Output_Link_1_Array[i] == 7)
                   Ref= MAP[1];
                else if (Output_Link_1_Array[i] == 8)
                   Ref= MAF[0];
                else if (Output_Link_1_Array[i] == 9)
                   Ref= Lambda[0];
                else if (Output_Link_1_Array[i] == 10)
                   Ref= V_Batt;
                else if (Output_Link_1_Array[i] == 11)
                   Ref= V_P[0];
                else if (Output_Link_1_Array[i] == 12)
                   Ref= V_P[1];
                else if (Output_Link_1_Array[i] == 13)
                   Ref= V_P[2];
                else  (Output_Link_1_Array[i] == 14)
                   Ref= V_P[3];


I know this can't possibly bit it


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Fri Nov 22, 2013 9:14 pm 
Offline
User avatar

Joined: Sat May 11, 2013 9:52 am
Posts: 304
Location: Over here, doing 'over here' things.
mk e wrote:
mk e wrote:
I started cutting in Paul's switching code.....closer


i got it all keyed in...only 81 errors! pretty good for me :lol:

Hopefully I'll get it sorted Monday.

Questoin for you actual programmers.

What is the RIGHT way to to this:
Code:
                if (Output_Link_1_Array[i] == 1)
                   Ref= RPM;
                else if (Output_Link_1_Array[i] == 2)
                   Ref= Reference_VE;
                else if (Output_Link_1_Array[i] == 3)
                   Ref= IAT;
                else if (Output_Link_1_Array[i] == 4)
                   Ref= CLT;
                else if (Output_Link_1_Array[i] == 5)
                   Ref= TPS;
                else if (Output_Link_1_Array[i] == 6)
                   Ref= MAP[0];
                else if (Output_Link_1_Array[i] == 7)
                   Ref= MAP[1];
                else if (Output_Link_1_Array[i] == 8)
                   Ref= MAF[0];
                else if (Output_Link_1_Array[i] == 9)
                   Ref= Lambda[0];
                else if (Output_Link_1_Array[i] == 10)
                   Ref= V_Batt;
                else if (Output_Link_1_Array[i] == 11)
                   Ref= V_P[0];
                else if (Output_Link_1_Array[i] == 12)
                   Ref= V_P[1];
                else if (Output_Link_1_Array[i] == 13)
                   Ref= V_P[2];
                else  (Output_Link_1_Array[i] == 14)
                   Ref= V_P[3];


I know this can't possibly bit it

On one hand, you don't need the 'else' options, a simple set of "if..." would work.
Alternatively, switch... case statements would work too.
Code:
switch (Output_Link_1_Array[i]) {
  case 1: Ref = RPM;
  case 2: Ref = Reference_VE;
  ....
  case 13: Ref = V_P[2];
  case 14: Ref = V_P[3];
  default: break;
}

_________________
/me goes off to the corner feeling like Jerry Springer with a mullet.

My O5E candidate: 1982 Honda CX500TC motorcycle.


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Sat Nov 23, 2013 6:37 am 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
i was told to avoid switch/case like the plague! (don't know why)

But I don't think that's right either

I think I want an array

Like create
# defien Array[16]

then at the start of my code I upgrade it:
Array[0] = x;
Array[1] = y;
etc
.
.
.
.

Then I should be able to say:
Ref = Array[i]

I think.....and I think I know how to do it.......I think.....


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Sun Nov 24, 2013 5:44 am 
Offline
User avatar

Joined: Sat May 11, 2013 9:52 am
Posts: 304
Location: Over here, doing 'over here' things.
mk e wrote:
i was told to avoid switch/case like the plague! (don't know why)
I don't know why either.

I've spent the last day searching for comparisons between nested if / else and switch / case and justifications for one over the other and the majority said it would depend on the compiler but in general switch / case will be at least as fast as nested if / else and could be more efficient than if / else with a large number of conditions. And the consensus was switch / case were more readable and easier to debug.

Quote:
But I don't think that's right either

I think I want an array

No, you don't.
Given what you posted, an array of 14 discrete "on / off" values can be represented by an unsigned integer, with each bit representing a function. That would cover most of your 'flags', if you consider a bit set == function enabled. And save you memory by not needing 16 INT's.

You would still need "X" comparisons, I suppose, to figure out what each input was doing, but you'd reduce the memory footprint requirement for each input in kind... 16 arrays of byte, char or... versus one integer.

If you have 16 GPIO and dedicate a 16 entry array of INT to each, you've gobbled up a fair amount of memory for no particular purpose.

Unless I'm wrong of course. :D

_________________
/me goes off to the corner feeling like Jerry Springer with a mullet.

My O5E candidate: 1982 Honda CX500TC motorcycle.


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Sun Nov 24, 2013 7:33 am 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
abecedarian wrote:
was told to avoid switch/case like the plague! (don't know why)
I don't know why either.[/quote]

I was told it's a stability thing....with if/ else you can be certain the code will do this or that. With switch case it my go nowhere.....or so I was told.


abecedarian wrote:
mk e wrote:
I think I want an array




No, you don't.
Given what you posted, an array of 14 discrete "on / off" values can be represented by an unsigned integer, with each bit representing a function. That would cover most of your 'flags', if you consider a bit set == function enabled. And save you memory by not needing 16 INT's.

You would still need "X" comparisons, I suppose, to figure out what each input was doing, but you'd reduce the memory footprint requirement for each input in kind... 16 arrays of byte, char or... versus one integer.

If you have 16 GPIO and dedicate a 16 entry array of INT to each, you've gobbled up a fair amount of memory for no particular purpose.

Unless I'm wrong of course. :D


16 floats so even more memory.....that we have plenty of :)

These numbers are already in the output structure in ram......I just don't how to read them other than copy them into a new array.

The user sets the condition of the "flag" and the code just needs to need it and grab the correct value. If I grab all 16 (or 14) options right at the start they are available for use in the control of all 4 links on all 16 channels.....one and done I'm thinking and no logic needed which makes it very easy to read.


Top
 Profile  
 
 Post subject: Re: User Configurable outputs
PostPosted: Sun Nov 24, 2013 12:13 pm 
Offline
User avatar

Joined: Sat May 11, 2013 9:52 am
Posts: 304
Location: Over here, doing 'over here' things.
mk e wrote:
abecedarian wrote:
was told to avoid switch/case like the plague! (don't know why)
I don't know why either.

I was told it's a stability thing....with if/ else you can be certain the code will do this or that. With switch case it my go nowhere.....or so I was told.

If ... else may go nowhere if none of the conditions are met, just like a switch ... case that doesn't have a case or 'default' to match the switch, I suppose. ;)

Quote:
abecedarian wrote:
mk e wrote:
I think I want an array


No, you don't.
Given what you posted, an array of 14 discrete "on / off" values can be represented by an unsigned integer, with each bit representing a function. That would cover most of your 'flags', if you consider a bit set == function enabled. And save you memory by not needing 16 INT's.

You would still need "X" comparisons, I suppose, to figure out what each input was doing, but you'd reduce the memory footprint requirement for each input in kind... 16 arrays of byte, char or... versus one integer.

If you have 16 GPIO and dedicate a 16 entry array of INT to each, you've gobbled up a fair amount of memory for no particular purpose.

Unless I'm wrong of course. :D


16 floats so even more memory.....that we have plenty of :)

These numbers are already in the output structure in ram......I just don't how to read them other than copy them into a new array.

The user sets the condition of the "flag" and the code just needs to need it and grab the correct value. If I grab all 16 (or 14) options right at the start they are available for use in the control of all 4 links on all 16 channels.....one and done I'm thinking and no logic needed which makes it very easy to read.

I think what I wrote may have become lost in translation.

I don't know where you get 16 floats?

If you have arrays of 16 integer options, i.e. "output1_option[]", "output2_option[]", et cetera, that's 16 integers for each output. My 'option' was one integer for each output, not one integer for each option for each output. Think like "status register", where each bit in the register has a meaning.
Code:
/* bit = 1 = enabled / bit = 0 = not enabled
Maybe a little more difficult to read, but saves some memory
bit 0 = ref = RPM;
bit 1 = ref = Reference_VE;
bit 2 = ref =  IAT;
bit 3 = ref = CLT;
bit 4 = ref = TPS;
bit 5 = ref = MAP[0];
bit 6 = ref = MAP[1];
bit 7 = ref = MAF[0];
bit 8 = ref = Lambda[0];
bit 9 = ref = V_Batt;
bit 10 = ref = V_P[0];
bit 11 = ref = V_P[1];
bit 12 = ref = V_P[2];
bit 13 = ref = V_P[3];
bit 14 = reserved for future;
bit 15 = reserved for future;
Issues could be multiple bits set, which is not allowed since Ref cannot take two values at once.
*/
unsigned int output1_option = 1;
unsigned int output2_option = 1;
...


You'll still need comparisons at runtime so it wouldn't save much memory / program space there but they could be done with some logic:

Code:
switch (output1_option) {
  case 0: {        // no bits set therefore output not enabled, nothing to do
    break;
  }
  case 1: {
    Ref = RPM;
    break;
  }
  case 3: {
    Ref = Reference_VE;
    break;
  }
  case 5: {
    Ref = IAT;
    break;
  }
...
  case 16383: {
    // undefined, nothing to do so break
    break;
  }
  case 32767 {
    // undefined, nothing to do so break
    break;
  }
  default: {   // option is not power of 2, thus misconfigured: cannot be two references at once, halt processing
    while (1) {
        // do nothing while human debugger figures out what to do
    }
    break;
  }
}


So, no floats involved. ;)

_________________
/me goes off to the corner feeling like Jerry Springer with a mullet.

My O5E candidate: 1982 Honda CX500TC motorcycle.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 72 posts ]  Go to page Previous  1, 2, 3  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Theme designed by stylerbb.net © 2008
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All times are UTC - 5 hours [ DST ]