Go Back   EcoModder Forum > EcoModding > Instrumentation > OpenGauge / MPGuino FE computer
Register Now
 Register Now
 

Reply  Post New Thread
 
Submit Tools LinkBack Thread Tools
Old 09-17-2013, 10:55 AM   #11 (permalink)
MPGuino Supporter
 
t vago's Avatar
 
Join Date: Oct 2010
Location: Hungary
Posts: 1,807

iNXS - '10 Opel Zafira 111 Anniversary

Suzi - '02 Suzuki Swift GL
Thanks: 828
Thanked 708 Times in 456 Posts
I'm working on integrating your code into the 1.86tav MPGuino software. Currently, I'm having issues with getting the software to immediately recognize a keypress. (I am trying to retain long-button-press functionality).

  Reply With Quote
Alt Today
Popular topics

Other popular topics in this forum...

   
Old 09-17-2013, 03:44 PM   #12 (permalink)
EcoModding Apprentice
 
Join Date: Aug 2009
Location: terra firma
Posts: 138
Thanks: 4
Thanked 24 Times in 22 Posts
The keypress should be recognized when the key is released, and returns to "buttonsUp" -- provided it has passed the debounce period (nominally 29ms in the posted code, but a lower value might work too), For a quick keypress, this should appear to be instant, since the timer2 ISR is firing every 1msec. You could probably also trigger it, after passing the LongPress threshold, and not wait for buttonsUp.

The one difference i can think of, is that an extra variable, buttonGood, is now required. It wasn't needed before, because PCINT_vect was detecting pin changes on that port.
  Reply With Quote
Old 09-23-2013, 01:09 PM   #13 (permalink)
MPGuino Supporter
 
t vago's Avatar
 
Join Date: Oct 2010
Location: Hungary
Posts: 1,807

iNXS - '10 Opel Zafira 111 Anniversary

Suzi - '02 Suzuki Swift GL
Thanks: 828
Thanked 708 Times in 456 Posts
My code has the button detection in the ADC interrupt handler, operating as you had described, nickdigger. My FIR filtering routine and my analog pin channel switching routine were not playing very nicely with each other, which interfered with the analog button signal timing, which caused the software to recognize all keypresses as long keypresses. I stripped out the FIR filter for now. Currently working on reintegrating FIR filtering.

In the meantime, both short- and long-button press functionality is retained.

I got the code to work with a 5 button configuration. This should allow for adding something along the lines of a Parallax 5-position switch.



I also changed the code to more easily accommodate recognizing more than 3 different buttons.
  Reply With Quote
Old 09-23-2013, 04:40 PM   #14 (permalink)
EcoModding Apprentice
 
Join Date: Aug 2009
Location: terra firma
Posts: 138
Thanks: 4
Thanked 24 Times in 22 Posts
Maybe you can selectively turn the filter on/off for different ADC channels?
Also, the Arduino code for that Parallax switch indicates they are using 5 digital inputs, not one analog. I haven't taken a closer look at the specs to see if analog output is an option, but their page only mentions "a 10k resistor", which doesn't sound promising.
  Reply With Quote
Old 09-23-2013, 05:03 PM   #15 (permalink)
MPGuino Supporter
 
t vago's Avatar
 
Join Date: Oct 2010
Location: Hungary
Posts: 1,807

iNXS - '10 Opel Zafira 111 Anniversary

Suzi - '02 Suzuki Swift GL
Thanks: 828
Thanked 708 Times in 456 Posts
Quote:
Originally Posted by nickdigger View Post
Maybe you can selectively turn the filter on/off for different ADC channels?
Thought about doing that - that'd introduce more complexity, and I'm not sure if that's such a good thing for an interrupt handler that must fire off fairly quickly. Might do it anyhow, though.

Edit: On second thought, after reviewing the AtMega128/168/328 datasheet, might just abandon the FIR filter altogether.

Quote:
Originally Posted by nickdigger View Post
Also, the Arduino code for that Parallax switch indicates they are using 5 digital inputs, not one analog. I haven't taken a closer look at the specs to see if analog output is an option, but their page only mentions "a 10k resistor", which doesn't sound promising.
Looking at the switch hardware in my hands (yes, I bought one from RadioShack), I notice that it has just a bunch of SMT 10k pullup resistors. That's your digital signalling. Remove them, and you have something that is usable. Heck, you might even be able to use the switch without removing the resistors - it'd just be a matter of doing some signal analysis with the pullup resistors added into the analysis.

Last edited by t vago; 09-23-2013 at 05:41 PM..
  Reply With Quote
Old 09-24-2013, 10:04 PM   #16 (permalink)
MPGuino Supporter
 
t vago's Avatar
 
Join Date: Oct 2010
Location: Hungary
Posts: 1,807

iNXS - '10 Opel Zafira 111 Anniversary

Suzi - '02 Suzuki Swift GL
Thanks: 828
Thanked 708 Times in 456 Posts
Added Parallax 5-position switch support. Since the Parallax 5-position switch does not do simultaneous left + right button presses, I've defined the up position as left + right.
  Reply With Quote
Old 09-25-2013, 04:47 PM   #17 (permalink)
EcoModding Apprentice
 
Join Date: Aug 2009
Location: terra firma
Posts: 138
Thanks: 4
Thanked 24 Times in 22 Posts
So the Parallax does have analog output, as well as the 5 digitals? Too bad it costs so much.
  Reply With Quote
Old 09-28-2013, 10:02 AM   #18 (permalink)
EcoModding Apprentice
 
Join Date: Dec 2012
Location: Portugal
Posts: 197
Thanks: 93
Thanked 70 Times in 64 Posts
Quote:
Originally Posted by nickdigger View Post
So the Parallax does have analog output, as well as the 5 digitals? Too bad it costs so much.
This here is different but cheaper, operation must be same.

5-Way Tactile Breakout Board Jaycon Systems LLC

José Rodrigues
  Reply With Quote
The Following User Says Thank You to josemapiro For This Useful Post:
t vago (10-04-2013)
Old 09-28-2013, 11:58 AM   #19 (permalink)
MPGuino Supporter
 
t vago's Avatar
 
Join Date: Oct 2010
Location: Hungary
Posts: 1,807

iNXS - '10 Opel Zafira 111 Anniversary

Suzi - '02 Suzuki Swift GL
Thanks: 828
Thanked 708 Times in 456 Posts
Quote:
Originally Posted by josemapiro View Post
This here is different but cheaper, operation must be same.

5-Way Tactile Breakout Board Jaycon Systems LLC

José Rodrigues
And the schematic appears to show exactly the same pull-up resistor configuration as with the Parallax switch. This should work with v1.86tav, with no code modifications.
  Reply With Quote
Old 09-08-2014, 11:43 PM   #20 (permalink)
EcoModding Lurker
 
OldSubi's Avatar
 
Join Date: Sep 2014
Location: Brishane
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Hi Just wondering if this thread is still going and if I can ask a question about my car MPGuino Project? ....When I understand things a bit more!
Its about using 5 switches to replace old trip computer in my 1984 car.
current functions are Clock, Range, Trip, Timer, & Reset I'll post a Photo if I'm not Hijacking your thread.
Thanks

  Reply With Quote
Reply  Post New Thread






Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com