jrsteensen / OpenHornet-Software

Repo for all the software that brings OpenHornet to life!
Other
23 stars 9 forks source link

Bug fix 5A6A1-INTR_LT_PANEL #111

Closed Arribe closed 3 months ago

Arribe commented 3 months ago

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

Bug fix for console and flood pots on 5A6A1-INTR_LT_PANEL. Updated defines to use A# values vs digital pin numbers.

Closes #110

Dependencies

Type of change

Checklist:

How Has This Been Tested?

Description of Testing

Loaded the sketch and validated the dcsbios messages.

Test Configuration

kbastronomics commented 3 months ago

Yes, these are POTS they must go to Analog inputs not digital ones. Interconnect calls out D6_A7 which is what the connection point is and is correct. do we need a note on the interconnect to point out that all POTS must be programmed as a Analog input maybe though I do not know that the interconnect is appropriate for a software note since its the hardware connection diagram?

Arribe commented 3 months ago

Seems to depend on the analog pin, but I haven't played with it much. The lower numbered ones (A0 - A3) on the sparkfun define match the digital numbers shown in the reference pic posted in the software channel today. The higher number ones are defined as much higher numbers. But regardless looks like the analog pins used for pots should use the A# to let the library sort it out.

kbastronomics commented 3 months ago

Yes. always use the Analog pins with a POT, digital pins will not work. they are on/off. so when the voltage on the pot is below the threshold voltage (usually around 2v) it returns a 0, above that it returns a 1.

only the analog pins can read a pot correctly.

Arribe commented 3 months ago

Tracking on the electrical hook up of pots vs digital pins for switches. This is a case of learning something new about programming differences between the A0 - A3 PINs vs the higher ones like A7. Too complicated for me to list out in these small comments. But I got it now.

kbastronomics commented 3 months ago

Do you think we need to point this out, I know your fix here was for your code itself and that's fine. i'm just wondering do we need to point this out and if so, where? i'm not sure the interconnect is the right place since it's physical hookup and we're only naming variables/defines using the same name to make lookup easier for coders.

Arribe commented 3 months ago

Good question, and I think this is where the complication comes in. For pins like A3 it’s defined as 21 in sparkfun’s pin_arduino.h file. Coding the pin as analog reads using 21 works fine. What I ran into is for A7 it’s defined as 25 on the header, not 6. But a digital read of the same physical pin coded using 6 works. So it’s probably a matter of saying analog pots should use A# where digital just the number. The ALE silkscreen only list A0, A1, A2, A3… but that is the range where the define is the same as the digital PIN number on the reference pic.

Arribe commented 3 months ago

To answer the question…perhaps best listed as a coding standard?