mirror of
https://codeberg.org/mclemens/ubitxv6.git
synced 2024-11-18 17:06:00 -05:00
Fixed 255/-256 encoder bug.
This commit is contained in:
parent
228b5d9589
commit
858205b4cd
15
ubitx_ui.cpp
15
ubitx_ui.cpp
@ -635,7 +635,7 @@ int enc_read(void) {
|
|||||||
/*
|
/*
|
||||||
* SmittyHalibut's encoder handling, using interrupts. Should be quicker, smoother handling.
|
* SmittyHalibut's encoder handling, using interrupts. Should be quicker, smoother handling.
|
||||||
*/
|
*/
|
||||||
int enc_count;
|
int8_t enc_count;
|
||||||
uint8_t prev_enc;
|
uint8_t prev_enc;
|
||||||
|
|
||||||
uint8_t enc_state (void) {
|
uint8_t enc_state (void) {
|
||||||
@ -699,18 +699,9 @@ ISR (PCINT1_vect) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int enc_read(void) {
|
int enc_read(void) {
|
||||||
int ret = enc_count;
|
int8_t ret = enc_count;
|
||||||
enc_count = 0;
|
enc_count = 0;
|
||||||
if (ret == 255 || ret == -256) {
|
return int(ret);
|
||||||
// FIXME I (@SmittyHalibut) can't figure out why we occasionally get
|
|
||||||
// either a 255 or -256 return value here. It's like it's occasionally
|
|
||||||
// treating an int as an unsigned value while incrementing or decrementing.
|
|
||||||
// I can't figure out why, but I can detect it and skip it. So that's
|
|
||||||
// what we're doing.
|
|
||||||
//Serial.println("255 error in encoder.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -526,7 +526,7 @@ void doTuning(){
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Serial.print(s);
|
//Serial.println(s);
|
||||||
|
|
||||||
doingCAT = 0; // go back to manual mode if you were doing CAT
|
doingCAT = 0; // go back to manual mode if you were doing CAT
|
||||||
prev_freq = frequency;
|
prev_freq = frequency;
|
||||||
|
Loading…
Reference in New Issue
Block a user