mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-14 09:15:22 +00:00
Autoformat
This commit is contained in:
parent
f6c019c948
commit
27a0d03ab6
@ -339,32 +339,34 @@ void ButtonThread::userButtonPressedLongStop()
|
|||||||
|
|
||||||
#if defined(M5STACK_CORE2)
|
#if defined(M5STACK_CORE2)
|
||||||
// Define a constant
|
// Define a constant
|
||||||
const unsigned long LONG_PRESS_THRESHOLD = 5000; // Hold the threshold
|
const unsigned long LONG_PRESS_THRESHOLD = 5000; // Hold the threshold
|
||||||
const unsigned long DOUBLE_CLICK_THRESHOLD = 1000; // Double-click the threshold
|
const unsigned long DOUBLE_CLICK_THRESHOLD = 1000; // Double-click the threshold
|
||||||
const int MAX_CLICKS = 2; // Maximum hits
|
const int MAX_CLICKS = 2; // Maximum hits
|
||||||
// Global variable
|
// Global variable
|
||||||
unsigned long lastClickTime = 0; // The time of the last click
|
unsigned long lastClickTime = 0; // The time of the last click
|
||||||
int clickCount = 0; // Click count
|
int clickCount = 0; // Click count
|
||||||
unsigned long touch_start_time; // Touch start time
|
unsigned long touch_start_time; // Touch start time
|
||||||
bool is_touching = false; // Mark whether you are currently touching
|
bool is_touching = false; // Mark whether you are currently touching
|
||||||
void ScreenTouch(){
|
void ScreenTouch()
|
||||||
|
{
|
||||||
M5.update();
|
M5.update();
|
||||||
auto count = M5.Touch.getCount();
|
auto count = M5.Touch.getCount();
|
||||||
if (count == 0) return;
|
if (count == 0)
|
||||||
|
return;
|
||||||
for (std::size_t i = 0; i < count; ++i) {
|
for (std::size_t i = 0; i < count; ++i) {
|
||||||
auto t = M5.Touch.getDetail(i);
|
auto t = M5.Touch.getDetail(i);
|
||||||
|
|
||||||
// If touch starts
|
// If touch starts
|
||||||
if (t.wasPressed()) {
|
if (t.wasPressed()) {
|
||||||
touch_start_time = millis(); // Record the time when the touch began
|
touch_start_time = millis(); // Record the time when the touch began
|
||||||
is_touching = true; // Set to touch
|
is_touching = true; // Set to touch
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check the current touch status
|
// Check the current touch status
|
||||||
if (is_touching) {
|
if (is_touching) {
|
||||||
unsigned long duration = millis() - touch_start_time;
|
unsigned long duration = millis() - touch_start_time;
|
||||||
if (duration >= LONG_PRESS_THRESHOLD) {
|
if (duration >= LONG_PRESS_THRESHOLD) {
|
||||||
LOG_INFO("Long Press Detected\n");
|
LOG_INFO("Long Press Detected\n");
|
||||||
powerFSM.trigger(EVENT_PRESS);
|
powerFSM.trigger(EVENT_PRESS);
|
||||||
screen->startAlert("Shutting down...");
|
screen->startAlert("Shutting down...");
|
||||||
screen->forceDisplay(true);
|
screen->forceDisplay(true);
|
||||||
@ -386,7 +388,7 @@ void ScreenTouch(){
|
|||||||
if (currentTime - lastClickTime <= DOUBLE_CLICK_THRESHOLD) {
|
if (currentTime - lastClickTime <= DOUBLE_CLICK_THRESHOLD) {
|
||||||
clickCount++;
|
clickCount++;
|
||||||
if (clickCount == MAX_CLICKS) {
|
if (clickCount == MAX_CLICKS) {
|
||||||
LOG_INFO("Double Click Detected\n");
|
LOG_INFO("Double Click Detected\n");
|
||||||
M5.Speaker.tone(2000, 100);
|
M5.Speaker.tone(2000, 100);
|
||||||
service->refreshLocalMeshNode();
|
service->refreshLocalMeshNode();
|
||||||
auto sentPosition = service->trySendPosition(NODENUM_BROADCAST, true);
|
auto sentPosition = service->trySendPosition(NODENUM_BROADCAST, true);
|
||||||
@ -414,7 +416,6 @@ void ScreenTouch(){
|
|||||||
LOG_INFO("Flick Start Detected\n");
|
LOG_INFO("Flick Start Detected\n");
|
||||||
M5.Speaker.tone(1000, 100);
|
M5.Speaker.tone(1000, 100);
|
||||||
powerFSM.trigger(EVENT_PRESS);
|
powerFSM.trigger(EVENT_PRESS);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,8 +71,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define OLED_BLACK OLEDDISPLAY_COLOR::BLACK
|
#define OLED_BLACK OLEDDISPLAY_COLOR::BLACK
|
||||||
#define OLED_WHITE OLEDDISPLAY_COLOR::WHITE
|
#define OLED_WHITE OLEDDISPLAY_COLOR::WHITE
|
||||||
#else
|
#else
|
||||||
#define OLED_BLACK BLACK
|
#define OLED_BLACK BLACK
|
||||||
#define OLED_WHITE WHITE
|
#define OLED_WHITE WHITE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace meshtastic; /** @todo remove */
|
using namespace meshtastic; /** @todo remove */
|
||||||
|
@ -328,9 +328,9 @@ class LGFX : public lgfx::LGFX_Device
|
|||||||
auto cfg = _light_instance.config(); // Gets a structure for backlight settings.
|
auto cfg = _light_instance.config(); // Gets a structure for backlight settings.
|
||||||
|
|
||||||
#if !defined(M5STACK_CORE2)
|
#if !defined(M5STACK_CORE2)
|
||||||
cfg.pin_bl = TFT_BL; // Pin number to which the backlight is connected
|
cfg.pin_bl = TFT_BL; // Pin number to which the backlight is connected
|
||||||
#endif
|
#endif
|
||||||
cfg.invert = false; // true to invert the brightness of the backlight
|
cfg.invert = false; // true to invert the brightness of the backlight
|
||||||
// cfg.freq = 44100; // PWM frequency of backlight
|
// cfg.freq = 44100; // PWM frequency of backlight
|
||||||
// cfg.pwm_channel = 1; // PWM channel number to use
|
// cfg.pwm_channel = 1; // PWM channel number to use
|
||||||
|
|
||||||
@ -732,7 +732,8 @@ void TFTDisplay::sendCommand(uint8_t com)
|
|||||||
unphone.backlight(true); // using unPhone library
|
unphone.backlight(true); // using unPhone library
|
||||||
#endif
|
#endif
|
||||||
#ifdef RAK14014
|
#ifdef RAK14014
|
||||||
#elif !defined(M5STACK) && !defined(ST7789_CS) && !defined(M5STACK_CORE2) // T-Deck gets brightness set in Screen.cpp in the handleSetOn function
|
#elif !defined(M5STACK) && !defined(ST7789_CS) && \
|
||||||
|
!defined(M5STACK_CORE2) // T-Deck gets brightness set in Screen.cpp in the handleSetOn function
|
||||||
tft->setBrightness(172);
|
tft->setBrightness(172);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
// #define BUTTON_NEED_PULLUP // if set we need to turn on the internal CPU pullup during sleep
|
// #define BUTTON_NEED_PULLUP // if set we need to turn on the internal CPU pullup during sleep
|
||||||
|
|
||||||
|
|
||||||
// #define BUTTON_PIN 39 // 38, 37
|
// #define BUTTON_PIN 39 // 38, 37
|
||||||
// #define BUTTON_PIN 0
|
// #define BUTTON_PIN 0
|
||||||
#define BUTTON_NEED_PULLUP
|
#define BUTTON_NEED_PULLUP
|
||||||
// #define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Plugin.
|
// #define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Plugin.
|
||||||
|
|
||||||
//#define BUTTON_PIN
|
// #define BUTTON_PIN
|
||||||
|
|
||||||
//#define PIN_BUZZER 25
|
// #define PIN_BUZZER 25
|
||||||
#undef LORA_SCK
|
#undef LORA_SCK
|
||||||
#undef LORA_MISO
|
#undef LORA_MISO
|
||||||
#undef LORA_MOSI
|
#undef LORA_MOSI
|
||||||
@ -17,10 +16,10 @@
|
|||||||
#define LORA_SCK 18
|
#define LORA_SCK 18
|
||||||
#define LORA_MISO 38
|
#define LORA_MISO 38
|
||||||
#define LORA_MOSI 23
|
#define LORA_MOSI 23
|
||||||
#define LORA_CS 33 //NSS
|
#define LORA_CS 33 // NSS
|
||||||
|
|
||||||
#define USE_RF95
|
#define USE_RF95
|
||||||
#define LORA_DIO0 35 // IRQ
|
#define LORA_DIO0 35 // IRQ
|
||||||
#define LORA_RESET 19
|
#define LORA_RESET 19
|
||||||
#define LORA_DIO1 RADIOLIB_NC // Not really used
|
#define LORA_DIO1 RADIOLIB_NC // Not really used
|
||||||
#define LORA_DIO2 RADIOLIB_NC // Not really used
|
#define LORA_DIO2 RADIOLIB_NC // Not really used
|
||||||
@ -40,5 +39,5 @@
|
|||||||
// LCD screens are slow, so slowdown the wipe so it looks better
|
// LCD screens are slow, so slowdown the wipe so it looks better
|
||||||
#define SCREEN_TRANSITION_FRAMERATE 30 // fps
|
#define SCREEN_TRANSITION_FRAMERATE 30 // fps
|
||||||
// Picomputer gets a white on black display
|
// Picomputer gets a white on black display
|
||||||
#define TFT_MESH COLOR565 (0xA0, 0xFF, 0x00)//(0x94, 0xEA, 0x67)
|
#define TFT_MESH COLOR565(0xA0, 0xFF, 0x00) //(0x94, 0xEA, 0x67)
|
||||||
#define ILI9341_SPI_HOST VSPI_HOST // VSPI_HOST or HSPI_HOST
|
#define ILI9341_SPI_HOST VSPI_HOST // VSPI_HOST or HSPI_HOST
|
Loading…
Reference in New Issue
Block a user