Browse Source

code cleanup

pull/11/head
Rysiek Labus 1 year ago
parent
commit
4a3ac08dd9
  1. 29
      src/TTGO_T-Beam_LoRa_APRS.ino
  2. 4
      src/TTGO_T-Beam_LoRa_APRS_config.h

29
src/TTGO_T-Beam_LoRa_APRS.ino

@ -143,29 +143,15 @@ uint8_t loraReceivedLength = sizeof(lora_RXBUFF);
BG_RF95 rf95(18, 26); // TTGO T-Beam has NSS @ Pin 18 and Interrupt IO @ Pin26
// initialize OLED display
#define OLED_RESET 4 // not used
#define OLED_RESET 16 // not used
Adafruit_SSD1306 display(128, 64, &Wire, OLED_RESET);
#ifdef ENABLE_BLUETOOTH
BluetoothSerial SerialBT;
BluetoothSerial SerialBT;
#endif
// + FUNCTIONS-----------------------------------------------------------+//
// This custom version of delay() ensures that the gps object
// is being "fed".
static void smartDelay(unsigned long ms){
#ifdef KISS_PROTOCOLL
delay(10);
return;
#endif
unsigned long start = millis();
do{
while (gpsSerial.available())
gps.encode(gpsSerial.read());
} while (millis() - start < ms);
}
char *ax25_base91enc(char *s, uint8_t n, uint32_t v){
/* Creates a Base-91 representation of the value in v in the string */
/* pointed to by s, n-characters long. String length should be n+1. */
@ -310,6 +296,8 @@ void batt_read(){
}
void writedisplaytext(String HeaderTxt, String Line1, String Line2, String Line3, String Line4, String Line5, int warten) {
batt_read();
delay(100);
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(2);
@ -327,7 +315,6 @@ void writedisplaytext(String HeaderTxt, String Line1, String Line2, String Line3
display.setCursor(0,56);
display.println(Line5);
display.display();
//smartDelay(warten);
}
// + SETUP --------------------------------------------------------------+//
@ -342,10 +329,10 @@ void setup(){
Serial.begin(115200);
Wire.begin(I2C_SDA, I2C_SCL);
#ifdef T_BEAM_V1_0
#ifdef T_BEAM_V1_0
if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) {
}
axp.setPowerOutPut(AXP192_LDO2, AXP202_ON); // Lora power
axp.setPowerOutPut(AXP192_LDO3, AXP202_ON); // provides power to GPS
axp.setPowerOutPut(AXP192_DCDC2, AXP202_ON);
@ -431,7 +418,7 @@ void loop() {
if (rf95.waitAvailableTimeout(100)) {
#ifdef SHOW_RX_PACKET // only show RX packets when activitated in config
loraReceivedLength = sizeof(lora_RXBUFF); // reset max length before receiving!
loraReceivedLength = sizeof(lora_RXBUFF); // reset max length before receiving!
if (rf95.recvAPRS(lora_RXBUFF, &loraReceivedLength)) {
loraReceivedFrameString = "";
for (int i=0 ; i < loraReceivedLength ; i++) {
@ -501,8 +488,6 @@ void loop() {
old_course = new_course;
}
batt_read();
if (button_ctr==2) {
nextTX = 0;
}

4
src/TTGO_T-Beam_LoRa_APRS_config.h

@ -14,9 +14,9 @@
//#define SHOW_ALT // send Altitude in frame
#define SHOW_BATT // send battery voltage at the end of comment (we need beggining for QSY message format)
#define SHOW_RX_PACKET // uncomment to show received LoRa APS packets for the time given below
#define SHOW_RX_TIME 10000 // show RX packet for milliseconds (5000 = 5secs)
#define SHOW_RX_TIME 30000 // show RX packet for milliseconds (5000 = 5secs)
#define TXFREQ 433.775 // Transmit frequency in MHz
#define TXdbmW 17 // Transmit power in dBm 17-50mW, 18-63mW, 19-80mW, 20-100mW
#define TXdbmW 10 // Transmit power in dBm 17-50mW, 18-63mW, 19-80mW, 20-100mW
//#define SHOW_GPS_DATA // uncomment to show on serial port, received data from GPS and debug information
#define ENABLE_BLUETOOTH
//#define BLUETOOTH_PIN "0000"

Loading…
Cancel
Save