mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-30 21:11:19 +00:00
fix the code format by use trunk
Signed-off-by: imliubo <imliubo@makingfun.xyz>
This commit is contained in:
parent
a981ea5440
commit
3729635ef5
@ -380,10 +380,12 @@ 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);
|
||||||
|
|
||||||
@ -393,7 +395,7 @@ void ScreenTouch(){
|
|||||||
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) {
|
||||||
@ -447,7 +449,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);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,8 +69,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
|
||||||
extern DataInfo DataRegion;
|
extern DataInfo DataRegion;
|
||||||
using namespace meshtastic; /** @todo remove */
|
using namespace meshtastic; /** @todo remove */
|
||||||
@ -956,21 +956,22 @@ bool deltaToTimestamp(uint32_t secondsAgo, uint8_t *hours, uint8_t *minutes, int
|
|||||||
validCached = true;
|
validCached = true;
|
||||||
return validCached;
|
return validCached;
|
||||||
}
|
}
|
||||||
static void drawLoraMessage(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y){
|
static void drawLoraMessage(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
|
{
|
||||||
display->drawString(x + 0, y + 0, myRegion->name);
|
display->drawString(x + 0, y + 0, myRegion->name);
|
||||||
display->setFont(FONT_MEDIUM);
|
display->setFont(FONT_MEDIUM);
|
||||||
display->drawString(x + 10, y + 30,"channel: "+String(DataRegion.lora_channel_num+1));
|
display->drawString(x + 10, y + 30, "channel: " + String(DataRegion.lora_channel_num + 1));
|
||||||
display->drawString(x + 10, y + 60,"bw: "+ String(DataRegion.lora_bw));
|
display->drawString(x + 10, y + 60, "bw: " + String(DataRegion.lora_bw));
|
||||||
display->drawString(x + SCREEN_WIDTH/2+10, y+30,"freq: "+String(DataRegion.lora_freq));
|
display->drawString(x + SCREEN_WIDTH / 2 + 10, y + 30, "freq: " + String(DataRegion.lora_freq));
|
||||||
display->drawString(x + SCREEN_WIDTH/2+10, y+60,"power: "+ String(DataRegion.lora_power_output));
|
display->drawString(x + SCREEN_WIDTH / 2 + 10, y + 60, "power: " + String(DataRegion.lora_power_output));
|
||||||
display->drawString(x + 10, y + 90,"sf: "+String(DataRegion.lora_sf));
|
display->drawString(x + 10, y + 90, "sf: " + String(DataRegion.lora_sf));
|
||||||
display->drawString(x + SCREEN_WIDTH/2+10, y+90,"cr: 4/:"+ String(DataRegion.lora_cr));
|
display->drawString(x + SCREEN_WIDTH / 2 + 10, y + 90, "cr: 4/:" + String(DataRegion.lora_cr));
|
||||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
const char *title = "LoRa";
|
const char *title = "LoRa";
|
||||||
display->drawString(x + SCREEN_WIDTH/2-20, y +0, title);
|
display->drawString(x + SCREEN_WIDTH / 2 - 20, y + 0, title);
|
||||||
display->setFont(FONT_SMALL);
|
display->setFont(FONT_SMALL);
|
||||||
display->setTextAlignment(TEXT_ALIGN_RIGHT);
|
display->setTextAlignment(TEXT_ALIGN_RIGHT);
|
||||||
display->drawString(x + SCREEN_WIDTH, y,String(DataRegion.lora_channel_name));
|
display->drawString(x + SCREEN_WIDTH, y, String(DataRegion.lora_channel_name));
|
||||||
display->setTextAlignment(TEXT_ALIGN_LEFT); // Restore left align, just to be kind to any other unsuspecting code
|
display->setTextAlignment(TEXT_ALIGN_LEFT); // Restore left align, just to be kind to any other unsuspecting code
|
||||||
}
|
}
|
||||||
/// Draw the last text message we received
|
/// Draw the last text message we received
|
||||||
|
@ -747,7 +747,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_COREBASIC) && !defined(M5STACK_CORE2)// T-Deck gets brightness set in Screen.cpp in the handleSetOn function
|
#elif !defined(M5STACK) && !defined(ST7789_CS) && !defined(M5STACK_COREBASIC) && \
|
||||||
|
!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;
|
||||||
|
@ -115,7 +115,6 @@ AccelerometerThread *accelerometerThread = nullptr;
|
|||||||
AudioThread *audioThread = nullptr;
|
AudioThread *audioThread = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(TCXO_OPTIONAL)
|
#if defined(TCXO_OPTIONAL)
|
||||||
float tcxoVoltage = SX126X_DIO3_TCXO_VOLTAGE; // if TCXO is optional, put this here so it can be changed further down.
|
float tcxoVoltage = SX126X_DIO3_TCXO_VOLTAGE; // if TCXO is optional, put this here so it can be changed further down.
|
||||||
#endif
|
#endif
|
||||||
@ -1234,6 +1233,5 @@ void loop()
|
|||||||
#if defined(M5STACK_CORE2)
|
#if defined(M5STACK_CORE2)
|
||||||
ScreenTouch();
|
ScreenTouch();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -39,11 +39,10 @@ extern bool pmu_found;
|
|||||||
extern bool isCharging;
|
extern bool isCharging;
|
||||||
extern bool isUSBPowered;
|
extern bool isUSBPowered;
|
||||||
|
|
||||||
|
|
||||||
struct DataInfo {
|
struct DataInfo {
|
||||||
int lora_channel_num;
|
int lora_channel_num;
|
||||||
double lora_freq;
|
double lora_freq;
|
||||||
const char* lora_channel_name;
|
const char *lora_channel_name;
|
||||||
int lora_power_output;
|
int lora_power_output;
|
||||||
float lora_bw;
|
float lora_bw;
|
||||||
int lora_sf;
|
int lora_sf;
|
||||||
|
@ -213,8 +213,8 @@ uint32_t RadioInterface::getPacketTime(uint32_t pl)
|
|||||||
float tPacket = tPreamble + tPayload;
|
float tPacket = tPreamble + tPayload;
|
||||||
|
|
||||||
uint32_t msecs = tPacket * 1000;
|
uint32_t msecs = tPacket * 1000;
|
||||||
DataRegion.lora_sf=sf;
|
DataRegion.lora_sf = sf;
|
||||||
DataRegion.lora_cr=cr;
|
DataRegion.lora_cr = cr;
|
||||||
LOG_DEBUG("(bw=%d, sf=%d, cr=4/%d) packet symLen=%d ms, payloadSize=%u, time %d ms\n", (int)bw, sf, cr, (int)(tSym * 1000),
|
LOG_DEBUG("(bw=%d, sf=%d, cr=4/%d) packet symLen=%d ms, payloadSize=%u, time %d ms\n", (int)bw, sf, cr, (int)(tSym * 1000),
|
||||||
pl, msecs);
|
pl, msecs);
|
||||||
return msecs;
|
return msecs;
|
||||||
@ -574,11 +574,11 @@ void RadioInterface::applyModemConfig()
|
|||||||
preambleTimeMsec = getPacketTime((uint32_t)0);
|
preambleTimeMsec = getPacketTime((uint32_t)0);
|
||||||
maxPacketTimeMsec = getPacketTime(meshtastic_Constants_DATA_PAYLOAD_LEN + sizeof(PacketHeader));
|
maxPacketTimeMsec = getPacketTime(meshtastic_Constants_DATA_PAYLOAD_LEN + sizeof(PacketHeader));
|
||||||
|
|
||||||
DataRegion.lora_channel_num=channel_num;
|
DataRegion.lora_channel_num = channel_num;
|
||||||
DataRegion.lora_freq=getFreq();
|
DataRegion.lora_freq = getFreq();
|
||||||
DataRegion.lora_channel_name=channelName;
|
DataRegion.lora_channel_name = channelName;
|
||||||
DataRegion.lora_power_output=power;
|
DataRegion.lora_power_output = power;
|
||||||
DataRegion.lora_bw=bw;
|
DataRegion.lora_bw = bw;
|
||||||
LOG_INFO("Radio freq=%.3f, config.lora.frequency_offset=%.3f\n", freq, loraConfig.frequency_offset);
|
LOG_INFO("Radio freq=%.3f, config.lora.frequency_offset=%.3f\n", freq, loraConfig.frequency_offset);
|
||||||
LOG_INFO("Set radio: region=%s, name=%s, config=%u, ch=%d, power=%d\n", myRegion->name, channelName, loraConfig.modem_preset,
|
LOG_INFO("Set radio: region=%s, name=%s, config=%u, ch=%d, power=%d\n", myRegion->name, channelName, loraConfig.modem_preset,
|
||||||
channel_num, power);
|
channel_num, power);
|
||||||
|
@ -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,7 +16,7 @@
|
|||||||
#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 RF95_MAX_POWER 17
|
#define RF95_MAX_POWER 17
|
||||||
@ -41,5 +40,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
|
@ -20,7 +20,7 @@
|
|||||||
#define LORA_SCK 18
|
#define LORA_SCK 18
|
||||||
#define LORA_MISO 19
|
#define LORA_MISO 19
|
||||||
#define LORA_MOSI 23
|
#define LORA_MOSI 23
|
||||||
#define LORA_CS 5 //NSS
|
#define LORA_CS 5 // NSS
|
||||||
|
|
||||||
#define USE_RF95
|
#define USE_RF95
|
||||||
#define RF95_MAX_POWER 17
|
#define RF95_MAX_POWER 17
|
||||||
@ -35,10 +35,9 @@
|
|||||||
#define GPS_RX_PIN 16
|
#define GPS_RX_PIN 16
|
||||||
#define GPS_TX_PIN 17
|
#define GPS_TX_PIN 17
|
||||||
|
|
||||||
|
// Note: If you use corebasic version 2.7 or later,
|
||||||
//Note: If you use corebasic version 2.7 or later,
|
// you need to go to the src>graphics>TFTDisplay.cpp file to change the value of cfg.invert,
|
||||||
//you need to go to the src>graphics>TFTDisplay.cpp file to change the value of cfg.invert,
|
// this one is to set the color inversion
|
||||||
//this one is to set the color inversion
|
|
||||||
#define TFT_HEIGHT 240
|
#define TFT_HEIGHT 240
|
||||||
#define TFT_WIDTH 320
|
#define TFT_WIDTH 320
|
||||||
#define TFT_OFFSET_X 0
|
#define TFT_OFFSET_X 0
|
||||||
|
Loading…
Reference in New Issue
Block a user