Members | Sign In
Chippernut Forums > Shift Light v1
avatar

Changing shift RPM limits

posted Apr 20, 2015 23:39:24 by AlexHoltzman
First of all, thanks for this code and schematic! I have modified it to also display separate color patterns at lower rpm's and as my first arduino project I am thrilled that it is working great! I have it up and running on my bench and it's working, but the shift rpm is constrained to be under 7650rpm but my car red lines at 8600rpm, how can I adjust the code to allow for higher shift rpm settings? I feel like it's something super simple I'm overlooking but I cant find where the maximum for the shift rpm is defined. Thanks!

Edit:
So I found where the variable is set in the menu for shift rpm:
r2 = constrain(r2, 0, 255);
and if I change the 255 to 290 it allows me to display the rpm range I want (290*30=8700 which is right around where I want the shift rpm) but it wont save any value over 255 (displayed as 7650) and just saves a really low value like 29 (displayed as 870). How can I fix this issue? again, thanks for the help!
[Last edited Apr 21, 2015 05:58:42]
page   1
1 reply
avatar
Jonduino said Apr 21, 2015 16:05:11
Hi Alex,

Thanks for your interest in my shift light! Also, NICE WORK on your first Arduino project! Sounds like you're really getting the hang of it.

You're really close. Try this instead.

The r2 variable is only meant to store up to 255 -- this is a system constraint. So instead, change the multiplier. Make sure to change those constraints all back to 255.

"r2*30" try "r2*35" This will give you a max RPM of 8,925 (255*35)

Also increase the RPM constrain function to meet your needs (it'll probably be helpful to do it in multiples of 35 or whatever you chose for above)

//Write the BarGraph Display
// Translate our stored RPM values into meaningful RPM values (incriments of 30 rpm)
activation_rpm = r1*30;
shift_rpm = r2*30;

//Let's keep this RPM value under control, between 0 and 8000
rpm = constrain (rpm, 0, 8000);

// given the nature of the RPM interrupt reader, a zero reading will produce a max result
// this fixes this quirk
if (rpm==8000){rpm=0;}




That code adjusts the variable for EEPROM and logic, you also should adjust it where it writes to the display.


case 3: // SHIFT RPM

...
...
...

matrix.println(r2*30);
matrix.writeDisplay();





Try this out and let me know how it goes. You may need to edit it in a few other places... This is really good feedback too, I'm wrapping up the V2 code and I'll make sure there's consideration for these circumstances.

Thanks again for stopping by!
- jon
[Last edited Apr 21, 2015 16:08:11]
Login below to reply: