Interesting point Patrick about the 12v inputs/outputs on your new tuner design.
I must admit I'd forgotten those extra features.
1. Are the 12v compatible inputs ADC or normal inputs? Or are they switchable between ADC and normal inputs?
2 Has the PIC chip software in the Tuner been extended to allow reading/writing these inputs/outputs? [I'd assume so].
3. Is there any code space left in the PIC chip code space and Flash RAM area itself for a extra functionality?
My idea/suggestion is this [if possible/worthwhile to implement].
Extend the PIC software in the Tuner a little to allow one of the 4 inputs to be designated as the 'speedo input'
Have the Empeg/Tuner serial protocol extended to allow the input pin 'pulses per Unit of distance' to be settable from the Empeg [e.g. by user input in Hijack or in config.ini or similar].
These 2 values (speedo input pin and pulses per whatever) are saved in Flash RAM on the PIC - assuming there is room - and are reloaded at each restart of the Tuner module
In reply to:
Sidebar on easily calculating pulses per whatever for your car:
The correct pulses per whatever value for your car would have to be determined by each user for their type of vehicle as all speedos and cars are different.
It could be determined simply by having an [as yet unwritten] Speedo control/display Userland App, be able to show the reported pulse count when pulses per whatever is set to 1.
Then by driving to a safe, known & steady speed e.g. 50mph, you can determine the value for pulses per m p.h. by dividing the shown value by your current speed.
This value after the division will give you the number of pulses per mph for your cars speedo.
If you read the value at 50 kph (or 100 kph), then the value after division is pulses per kph for your cars speedo.
This could be a Hijack menu option to show this pulse count value similar to the Hijack Button Codes display (e.g. report each new value and scroll older values off the display) to allow quick and easy reporting of the pulse count from the Tuner.
[we want Hijack modified anyway so thats something else in the to-do list].
The Tuner PIC Chip meanwhile, using the [last set / remembered] 'pulses per whatever' value, continuously counts all pulses on the speedo input pin and reports (asyncronously, no more than once a second, or every n seconds - where n is possibly settable ala the Speedo input pin number and pulses per whatever values are) the "current speed" of the vehicle as a integer value over the serial wire using the Empeg/Tuner serial protocol.
Where the "current speed" value is the number of pulses received since the last measurement, divided by the number of seconds since the last measurement [or since the Tuner was powered on if no last measurement since power on], divided by the current pulse count to whatever 'conversion factor'.
Thus this would be giving an averaged speed value to the nearest mph or kph as appropriate [with the averaging time specified as the value of 'n' seconds or at least to 1 second].
We then extend Hijack to report the received speed value sent to the Empeg over the Tuner interface via a /proc/empeg_speed special file [which should be simple to do since Hijack already speaks the Empeg/Tuner serial protocol].
So that all and any Userland apps can read the current speed value and take whatever appropriate action to e.g. Ramp up/down the Volume according to your personal preferences or Turn the Radar detector on/off as specified by the user according the their rules.
the userland app could also calculate (average) acceleration using the change in velocity and could also calculate distances by summing the (current speed * time) values etc.
This would also allow the speedo input to be used for Dead Reckoning when your GPS is offline.
If the Pulses per whatever was set to zero [the initial/default 'out of the box' setting], then all this functionality would be disabled in the Tuner, and hijack should be able report this fact, so that UserLand apps can distringuish if needed between really being stopped (e.g. 0mph) and the feature not actually being enabled and/or Tuner not present.
I think this idea would be a useful addition to the new Tuner, and might be done with only a few additional lines of code in the PIC chip and some minor code in Hijack.
I'd suggest it might even be implemented as a optional 'add on' chip for those folks that want this feature.
i.e. chip your Tuner for more performance (info) :-)))
I figure this feature on its own might make those folks who want a Speed controlled Empeg even more likely to buy your new tuner.
Now I don't know if the current Tuner PIC chip could handle all this or not, but if it could it might \become the new Tuners killer feature [other than providing Radio and Stalk support of course].
If not then that was why I commented about a add-on board for the Tuner to do all this and report the speed back over the same Tuner/Empeg serial link.
This would be useful as it would not need to tie up your existing Serial port if you had a dedicated device, and all the power and other stuff like control and signal wires are all there in the tuner already so no need to reinvent most of the wheel.
Note this device/idea of using speedo pulses would onlybe able to measure/report "speed" and not "velocity".
"speed" in a strict technical/physics sense is a "one dimensional vector" value, velocity has both "speed" and "direction" - we don't/can't know the direction so we can only report the "speed".
So, If you drive your car backwards the pulses won't report this fact, so the speed value will always be 0 or a positive value - never a negative value.