09-30-2013, 08:34 PM
|
#111 (permalink)
|
MPGuino Supporter
Join Date: Oct 2010
Location: Hungary
Posts: 1,808
iNXS - '10 Opel Zafira 111 Anniversary Suzi - '02 Suzuki Swift GL
Thanks: 831
Thanked 709 Times in 457 Posts
|
Quote:
Originally Posted by josemapiro
I've been testing the Multiplexed Analog buttons, and it works but not correctly, the first and third seem to do the same functions
|
Do you mean that pressing the 1st button does the same thing as pressing the 3rd buttton?
Edit: Also, please make sure to check this post - link - This should fix problems with the code not correctly recognizing button presses.
Quote:
Originally Posted by josemapiro
, as the middle button only changes the brightness,
|
The middle button behaves as it should, then. The middle button is supposed to cycle through brightness settings in most modes, and it should cycle through digits when in settings change mode. If you press (precionar?) and hold down the middle button for a second or so, it should display the CPU loading.
Quote:
Originally Posted by josemapiro
and pro comportace times as the first,
|
I do not understand - sorry.
Quote:
Originally Posted by josemapiro
the extra 1 to precionar appears (btn 8 pressed), the extra 2 has not tested because had no 47k resistance.
|
Yah, that's supposed to happen. The "extra 1" and "extra 2" buttons have not yet been defined to do much of anything in the code, other than have the code say "Button xxx pressed". Eventually, I was going to figure out whether to have 4 arrow keys with a center "enter" button, or buttons that were configured such as for the ScanGauge II.
Quote:
Originally Posted by josemapiro
What is the tolerance of the resistors you used? I'm using resistors with 5% tolerance.
|
Mine are 5% tolerance, too.
Quote:
Originally Posted by josemapiro
I think the problem I'm having now, has to do with the values that each sends resistance, which may vary slightly and complicate the whole process, but at least I can see the system moving.
|
That's a start. We can work from there to debug this, if there is a bug.
Last edited by t vago; 09-30-2013 at 08:41 PM..
|
|
|
Today
|
|
|
Other popular topics in this forum...
|
|
|
09-30-2013, 08:52 PM
|
#112 (permalink)
|
EcoModding Apprentice
Join Date: Jun 2010
Location: Virginia
Posts: 114
Thanks: 33
Thanked 56 Times in 38 Posts
|
Quote:
Originally Posted by josemapiro
I think the problem I'm having now, has to do with the values that each sends resistance, which may vary slightly and complicate the whole process, but at least I can see the system moving.
|
You should be able to monitor the values that the Arduino sees by adding something like the following where "X" corresponds to the analog pin being used:
Code:
Serial.print("adcX = ");
Serial.println(adcX);
. . . and then open the Serial Monitor.
|
|
|
09-30-2013, 09:35 PM
|
#113 (permalink)
|
MPGuino Supporter
Join Date: Oct 2010
Location: Hungary
Posts: 1,808
iNXS - '10 Opel Zafira 111 Anniversary Suzi - '02 Suzuki Swift GL
Thanks: 831
Thanked 709 Times in 457 Posts
|
I recommend this:
Code:
//#define useSerialPortDataLogging true // Ability to output 5 basic parameters to a data logger or SD card
//#define useBufferedSerialPort true // Speed up serial output
...
#define useSerialDebugOutput true
...
pushHexWord(analogValue[2]);
pushSerialCharacter(13);
...
then, just re-comment them, once you're done.
|
|
|
10-01-2013, 09:29 AM
|
#114 (permalink)
|
EcoModding Apprentice
Join Date: Jun 2010
Location: Virginia
Posts: 114
Thanks: 33
Thanked 56 Times in 38 Posts
|
I tested the button code change and it doesn't seem to address the glitch I'm seeing.
I have figured out the usage scenario where it crops up and a usage workaround though. - If a different button is pressed, it must be pressed slowly to not register as the same button press.
It is particularly noticed when changing settings. When pressing a different button, a slow (~0.25s) press is required. If just "clicked" the click is registered as the previous button pressed.
To reproduce: - Press LEFT+RIGHT to enter settings.
- Slow click (~0.25s+) the RIGHT button.
- Next, a "quick-click" to either the MIDDLE or LEFT button changes to the next screen that should display by pressing the RIGHT button. This continues indefinitely unless the "click" is slowed to a "press".
|
|
|
The Following User Says Thank You to Ardent For This Useful Post:
|
|
10-01-2013, 03:32 PM
|
#115 (permalink)
|
MPGuino Supporter
Join Date: Oct 2010
Location: Hungary
Posts: 1,808
iNXS - '10 Opel Zafira 111 Anniversary Suzi - '02 Suzuki Swift GL
Thanks: 831
Thanked 709 Times in 457 Posts
|
I duplicated the effects of this bug, according to Ardent's instructions. It appears to be a fairly serious bug with the debouncing code. The bug does not appear to care whether analog or traditional buttons are configured.
I'll take a look at it, either tonight or tomorrow.
|
|
|
The Following User Says Thank You to t vago For This Useful Post:
|
|
10-01-2013, 03:56 PM
|
#116 (permalink)
|
EcoModding Apprentice
Join Date: Dec 2012
Location: Portugal
Posts: 197
Thanks: 93
Thanked 70 Times in 64 Posts
|
Quote:
Originally Posted by t vago
Do you mean that pressing the 1st button does the same thing as pressing the 3rd buttton?
Edit: Also, please make sure to check this post - link - This should fix problems with the code not correctly recognizing button presses.
|
Had already done this fix.
Quote:
The middle button behaves as it should, then. The middle button is supposed to cycle through brightness settings in most modes, and it should cycle through digits when in settings change mode. If you press (precionar?) and hold down the middle button for a second or so, it should display the CPU loading.
I do not understand - sorry.
|
Very rarely when you press the middle button it does not alter the brightness, and showed the same sequence that shows when pressing the left.
Quote:
Yah, that's supposed to happen. The "extra 1" and "extra 2" buttons have not yet been defined to do much of anything in the code, other than have the code say "Button xxx pressed". Eventually, I was going to figure out whether to have 4 arrow keys with a center "enter" button, or buttons that were configured such as for the ScanGauge II.
|
Why not use a system of 3 or 5 buttons, but with a different operation, stop using the buttons on the left, middle and right, and move to using a (top), (bottom), (OK), (yes) and (no).
The operation would be to (top) advance the menu to (bottom) retreat, and (OK) defined the choice, in some menus might be used (yes) and (no) to confirm the choice.
Quote:
then, just re-comment them, once you're done.
|
The results I got were:
Without pressing any button the result was: 03FF
Pressing the left: 02BC and 02BD or 02BE
Pressing the middle button: 034D or 034E and 034F
Precionando right: 03A2 or 03A3 and 03A4
Pressing the extra1: 03D3 or 03D4 and 03D2
Extra 2 still have no results.
Thank you
José Rodrigues
Last edited by josemapiro; 10-01-2013 at 04:07 PM..
|
|
|
10-01-2013, 04:06 PM
|
#117 (permalink)
|
EcoModding Apprentice
Join Date: Dec 2012
Location: Portugal
Posts: 197
Thanks: 93
Thanked 70 Times in 64 Posts
|
Quote:
Originally Posted by Ardent
I tested the button code change and it doesn't seem to address the glitch I'm seeing.
I have figured out the usage scenario where it crops up and a usage workaround though.[LIST][*]If a different button is pressed, it must be pressed slowly to not register as the same button press.
|
Probably is the same mistake that I mentioned with the middle button, causing it to behave as the previous button.
|
|
|
10-01-2013, 04:21 PM
|
#118 (permalink)
|
EcoModding Apprentice
Join Date: Jun 2010
Location: Virginia
Posts: 114
Thanks: 33
Thanked 56 Times in 38 Posts
|
Thanks for checking; hopefully it won't be too onerous to fix.
|
|
|
10-02-2013, 01:32 AM
|
#119 (permalink)
|
MPGuino Supporter
Join Date: Oct 2010
Location: Hungary
Posts: 1,808
iNXS - '10 Opel Zafira 111 Anniversary Suzi - '02 Suzuki Swift GL
Thanks: 831
Thanked 709 Times in 457 Posts
|
I hope so, too. I found what I believe to be the problem, and have substantially re-written the debounce code to correct the problem. I will be testing the fix tonight, when I get back to my test MPGuino hardware setup.
|
|
|
10-02-2013, 06:06 PM
|
#120 (permalink)
|
MPGuino Supporter
Join Date: Oct 2010
Location: Hungary
Posts: 1,808
iNXS - '10 Opel Zafira 111 Anniversary Suzi - '02 Suzuki Swift GL
Thanks: 831
Thanked 709 Times in 457 Posts
|
Got the button press debounce fix working. (current MPGuino code version is at first post of this thread)
Debounce timing adjustments may be made by adjusting the following two lines in the code.
Code:
const unsigned int keyDelay = (unsigned int)(t2CyclesPerSecond / 256ul);
const unsigned int keyShortDelay = keyDelay - (5 * keyDelay / 100); // wait 5/100 of a second before accepting button presses
Last edited by t vago; 05-11-2014 at 03:32 PM..
Reason: current MPGuino code version is at first post of this thread
|
|
|
The Following 2 Users Say Thank You to t vago For This Useful Post:
|
|
|