gpstar81 / GPStar-proton-pack

GPStar Proton Pack and Neutrona Wand
https://www.gpstartechnologies.com
GNU General Public License v3.0
38 stars 9 forks source link

Minor Wand changes #189

Closed nomakewan closed 1 year ago

nomakewan commented 1 year ago

This changes the gpstar build code to use digitalRead for the Barrel Wing Button and Barrel Safety Switch as a Mega 2560 has digital buffers on A6 and A7, unlike the Nano. Additionally this change disables both serial read and serial write if b_gpstar_benchtest is enabled, which should prevent any synchronization errors from the pack if a standalone-configured Wand is connected for some reason.

DustinGrau commented 1 year ago

What about other instances of analogRead(switch_mode) outside of the switchMode() function? Is this something that should be a global change, and remove the i_switch_mode_value and i_switch_barrel_value variables?

nomakewan commented 1 year ago

What about other instances of analogRead(switch_mode) outside of the switchMode() function? Is this something that should be a global change, and remove the i_switch_mode_value and i_switch_barrel_value variables?

Those variables must remain because Nano builds require them. The Nano does not have digital buffers on A6 or A7, which is why this code existed in the first place. The Mega 2560 that the gpstar board is built around however has digital buffers on all its analog pins, and so can use digitalRead instead.

I did miss a few gpstar bits of code elsewhere though, and have pushed a commit just now to add them in. Good catch!