mirror of
https://codeberg.org/mclemens/ubitxv6.git
synced 2024-11-19 04:56:04 -05:00
Update to use new touch functions
This commit is contained in:
parent
26c670ce14
commit
a92fdc7793
32
ubitx_ui.cpp
32
ubitx_ui.cpp
@ -5,6 +5,7 @@
|
||||
#include "nano_gui.h"
|
||||
#include "settings.h"
|
||||
#include "setup.h"
|
||||
#include "touch.h"
|
||||
#include "ubitx.h"
|
||||
#include "version.h"
|
||||
|
||||
@ -395,6 +396,8 @@ void enterFreq(){
|
||||
//force the display to refresh everything
|
||||
//display all the buttons
|
||||
|
||||
Point ts_point;
|
||||
|
||||
for (int i = 0; i < KEYS_TOTAL; i++){
|
||||
Button button;
|
||||
memcpy_P(&button, &(keypad[i]), sizeof(Button));
|
||||
@ -811,35 +814,6 @@ void doCommand(Button* button){
|
||||
}
|
||||
}
|
||||
|
||||
#include "menu.h"
|
||||
static const uint8_t DEBOUNCE_DELAY_MS = 50;
|
||||
static const uint16_t LONG_PRESS_TIME_MS = 3000;
|
||||
static const uint8_t LONG_PRESS_POLL_TIME_MS = 10;
|
||||
ButtonPress_e checkTouch(Point *const touch_point_out){
|
||||
if (!readTouch(touch_point_out)){
|
||||
return ButtonPress_e::NotPressed;
|
||||
}
|
||||
delay(DEBOUNCE_DELAY_MS);
|
||||
if (!readTouch(touch_point_out)){//debounce
|
||||
return ButtonPress_e::NotPressed;
|
||||
}
|
||||
|
||||
uint16_t down_time = 0;
|
||||
while(readTouch(touch_point_out) && (down_time < LONG_PRESS_TIME_MS)){
|
||||
delay(LONG_PRESS_POLL_TIME_MS);
|
||||
down_time += LONG_PRESS_POLL_TIME_MS;
|
||||
}
|
||||
|
||||
scaleTouch(touch_point_out);
|
||||
|
||||
if(down_time < LONG_PRESS_TIME_MS){
|
||||
return ButtonPress_e::ShortPress;
|
||||
}
|
||||
else{
|
||||
return ButtonPress_e::LongPress;
|
||||
}
|
||||
}
|
||||
|
||||
//returns true if the button is pressed
|
||||
int btnDown(){
|
||||
if (digitalRead(FBUTTON) == HIGH)
|
||||
|
@ -30,12 +30,14 @@
|
||||
* Si5351 object to control the clocks.
|
||||
*/
|
||||
#include <Wire.h>
|
||||
#include "button_timing.h"
|
||||
#include "menu.h"
|
||||
#include "menu_main.h"
|
||||
#include "morse.h"
|
||||
#include "nano_gui.h"
|
||||
#include "settings.h"
|
||||
#include "setup.h"
|
||||
#include "touch.h"
|
||||
#include "ubitx.h"
|
||||
|
||||
/**
|
||||
@ -304,9 +306,6 @@ void checkPTT(){
|
||||
}
|
||||
|
||||
//check if the encoder button was pressed
|
||||
static const uint8_t DEBOUNCE_DELAY_MS = 50;
|
||||
static const uint16_t LONG_PRESS_TIME_MS = 3000;
|
||||
static const uint8_t LONG_PRESS_POLL_TIME_MS = 10;
|
||||
ButtonPress_e checkButton(){
|
||||
if (!btnDown()){
|
||||
return ButtonPress_e::NotPressed;
|
||||
@ -462,6 +461,7 @@ void setup()
|
||||
|
||||
initSettings();
|
||||
displayInit();
|
||||
initTouch();
|
||||
initPorts();
|
||||
initOscillators();
|
||||
setFrequency(globalSettings.vfoA.frequency);
|
||||
|
Loading…
Reference in New Issue
Block a user