analogRead technically returns an int, but it only can be 0-1023, so practically it's an unsigned int. This matches types for the constants. Also removed cwAdcSTFrom, since the value will always be greater than 0

This commit is contained in:
Reed Nightingale 2020-01-26 10:40:03 -08:00
parent f54320e8cb
commit 6dd4b37d8a

View File

@ -29,7 +29,7 @@
*/
//CW ADC Range
static const unsigned int cwAdcSTFrom = 0;
//static const unsigned int cwAdcSTFrom = 0;
static const unsigned int cwAdcSTTo = 50;
static const unsigned int cwAdcBothFrom = cwAdcSTTo + 1;
static const unsigned int cwAdcBothTo = 300;
@ -79,7 +79,7 @@ uint8_t keyerControl = 0;
char update_PaddleLatch(bool isUpdateKeyState) {
unsigned char tmpKeyerControl = 0;
int paddle = analogRead(ANALOG_KEYER);
unsigned int paddle = analogRead(ANALOG_KEYER);
//use the PTT as the key for tune up, quick QSOs
if (digitalRead(PTT) == 0)
@ -93,7 +93,7 @@ char update_PaddleLatch(bool isUpdateKeyState) {
else{
if (KeyerMode_e::KEYER_STRAIGHT != globalSettings.keyerMode)
tmpKeyerControl = 0 ;
else if (paddle >= cwAdcSTFrom && paddle <= cwAdcSTTo)
else if (paddle <= cwAdcSTTo)
tmpKeyerControl = DIT_L ;
else
tmpKeyerControl = 0 ;