a bit better autodetect
This commit is contained in:
parent
f8206b645a
commit
0a79f1a850
|
|
@ -1031,6 +1031,7 @@ int getKeyPressEvent() {
|
||||||
return p; /* map KP_x to EVT_KEY1_x / EVT_KEY2_x*/
|
return p; /* map KP_x to EVT_KEY1_x / EVT_KEY2_x*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int initlevels[40];
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
char buf[12];
|
char buf[12];
|
||||||
|
|
@ -1041,6 +1042,11 @@ void setup()
|
||||||
Serial.printf("%d:%d ", i, v);
|
Serial.printf("%d:%d ", i, v);
|
||||||
}
|
}
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
|
|
||||||
|
for (int i = 0; i < 39; i++) {
|
||||||
|
Serial.printf("%d:%d ", i, initlevels[i]);
|
||||||
|
}
|
||||||
|
Serial.println(" (before setup)");
|
||||||
pinMode(LORA_LED, OUTPUT);
|
pinMode(LORA_LED, OUTPUT);
|
||||||
|
|
||||||
aprs_gencrctab();
|
aprs_gencrctab();
|
||||||
|
|
@ -1255,7 +1261,7 @@ void loopDecoder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((res&0xff) == 0 && connected) {
|
if ((res & 0xff) == 0 && connected) {
|
||||||
//Send a packet with position information
|
//Send a packet with position information
|
||||||
// first check if ID and position lat+lonis ok
|
// first check if ID and position lat+lonis ok
|
||||||
SondeInfo *s = &sonde.sondeList[rxtask.receiveSonde];
|
SondeInfo *s = &sonde.sondeList[rxtask.receiveSonde];
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,11 @@
|
||||||
# Hardware depending settings
|
# Hardware depending settings
|
||||||
#-------------------------------#
|
#-------------------------------#
|
||||||
# pin: 255=disabled; x=button x+128=touch button
|
# pin: 255=disabled; x=button x+128=touch button
|
||||||
button_pin=130
|
#button_pin=130
|
||||||
button2_pin=142
|
#button2_pin=142
|
||||||
|
# No specification in config file: try autodetection (gpio4 pin level at startup)
|
||||||
|
#button_pin=0
|
||||||
|
#button2_pin=255
|
||||||
# LED port
|
# LED port
|
||||||
led_pout=9
|
led_pout=9
|
||||||
# OLED Setup is depending on hardware of LoRa board
|
# OLED Setup is depending on hardware of LoRa board
|
||||||
|
|
@ -13,6 +16,8 @@ led_pout=9
|
||||||
#oled_sda=21
|
#oled_sda=21
|
||||||
#oled_scl=22
|
#oled_scl=22
|
||||||
oled_rst=16
|
oled_rst=16
|
||||||
|
#gps_rxd=-1
|
||||||
|
gps_txd=-1
|
||||||
#-------------------------------#
|
#-------------------------------#
|
||||||
# General config settings
|
# General config settings
|
||||||
#-------------------------------#
|
#-------------------------------#
|
||||||
|
|
|
||||||
|
|
@ -34,18 +34,24 @@ int getKeyPressEvent(); /* in RX_FSK.ino */
|
||||||
* value of receiveResult (or timeout, if receiveResult was not set within 1s). It
|
* value of receiveResult (or timeout, if receiveResult was not set within 1s). It
|
||||||
* should also return immediately if there is some keyboard input.
|
* should also return immediately if there is some keyboard input.
|
||||||
*/
|
*/
|
||||||
|
int initlevels[40];
|
||||||
|
|
||||||
Sonde::Sonde() {
|
Sonde::Sonde() {
|
||||||
|
for (int i = 0; i < 39; i++) {
|
||||||
|
initlevels[i] = gpio_get_level((gpio_num_t)i);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 39*3; i++) {
|
||||||
|
initlevels[i%39] += gpio_get_level((gpio_num_t)(i%39));
|
||||||
|
}
|
||||||
sondeList = (SondeInfo *)malloc((MAXSONDE+1)*sizeof(SondeInfo));
|
sondeList = (SondeInfo *)malloc((MAXSONDE+1)*sizeof(SondeInfo));
|
||||||
memset(sondeList, 0, (MAXSONDE+1)*sizeof(SondeInfo));
|
memset(sondeList, 0, (MAXSONDE+1)*sizeof(SondeInfo));
|
||||||
config.touch_thresh = 70;
|
config.touch_thresh = 70;
|
||||||
config.led_pout = 9;
|
config.led_pout = 9;
|
||||||
// Try autodetecting board type
|
// Try autodetecting board type
|
||||||
// Seems like on startup, GPIO4 is 1 on v1 boards, 0 on v2.1 boards?
|
// Seems like on startup, GPIO4 is 1 on v1 boards, 0 on v2.1 boards?
|
||||||
int autodetect = gpio_get_level((gpio_num_t)16);
|
|
||||||
config.gps_rxd = -1;
|
config.gps_rxd = -1;
|
||||||
config.gps_txd = -1;
|
config.gps_txd = -1;
|
||||||
if(autodetect==0) {
|
if(initlevels[16]==0) {
|
||||||
config.oled_sda = 4;
|
config.oled_sda = 4;
|
||||||
config.oled_scl = 15;
|
config.oled_scl = 15;
|
||||||
config.button_pin = 0;
|
config.button_pin = 0;
|
||||||
|
|
@ -53,8 +59,7 @@ Sonde::Sonde() {
|
||||||
} else {
|
} else {
|
||||||
config.oled_sda = 21;
|
config.oled_sda = 21;
|
||||||
config.oled_scl = 22;
|
config.oled_scl = 22;
|
||||||
autodetect = gpio_get_level((gpio_num_t)17);
|
if(initlevels[17]==0) { // T-Beam
|
||||||
if(autodetect==0) { // T-Beam
|
|
||||||
config.button_pin = 39;
|
config.button_pin = 39;
|
||||||
config.button2_pin = T4 + 128; // T4 == GPIO13
|
config.button2_pin = T4 + 128; // T4 == GPIO13
|
||||||
config.gps_rxd = 12;
|
config.gps_rxd = 12;
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,18 @@ Heltec board
|
||||||
|
|
||||||
TTGO LORA32 v2.1_1.6 (button1: touch gpio 2 => 130; button2: touch gpio14 => 142)
|
TTGO LORA32 v2.1_1.6 (button1: touch gpio 2 => 130; button2: touch gpio14 => 142)
|
||||||
(sda,scl: 21,22)
|
(sda,scl: 21,22)
|
||||||
0:1 1:0 2:0 3:1 4:0 5:1 6:0 7:1 8:0 9:1 10:1 11:1 12:0 13:0 14:1 15*1 16*1 17*1 18:0 19:0 20:0 21:1 22*1 23*1 24:0 25:0 26:0 27:0 28:0 29:0 30:0 31:0 32:0 33:0 34:0 35:0 36:0 37:0 38:0
|
0:1 1:0 2:0 3:1 4:0 5:1 6:0 7:1 8:0 9:1 10:1 11:1 12:0 13:0 14:1 15:1 16:1 17:1 18:0 19:0 20:0 21:1 22:1 23:1 24:0 25:0 26:0 27:0 28:0 29:0 30:0 31:0 32:0 33:0 34:0 35:0 36:0 37:0 38:0
|
||||||
|
0:4 1:4 2:0 3:4 4:0 5:4 6:0 7:4 8:0 9:4 10:4 11:4 12:0 13:0 14:4 15:4 16:4 17:4 18:0 19:0 20:0 21:4 22:4 23:4 24:0 25:0 26:0 27:0 28:0 29:0 30:0 31:0 32:0 33:0 34:0 35:0 36:0 37:0 38:0 (in Sonde())
|
||||||
|
|
||||||
TTGO LORA v1.0
|
TTGO LORA v1.0
|
||||||
(sda,scl: 4,15) (button1: 0) (button2: touch gpio13 = 141)
|
(sda,scl: 4,15) (button1: 0) (button2: touch gpio13 = 141)
|
||||||
0:1 1:0 2:0 3:1 4*1 5:1 6:0 7:1 8:0 9:1 10:1 11:1 12:0 13:0 14:1 15*1 16*0 17*0 18:0 19:0 20:0 21:0 22*0 23*0 24:0 25:0 26:0 27:0 28:0 29:0 30:0 31:0 32:0 33:0 34:0 35:0 36:0 37:0 38:0
|
0:1 1:0 2:0 3:1 4:1 5:1 6:0 7:1 8:0 9:1 10:1 11:1 12:0 13:0 14:1 15:1 16:0 17:0 18:0 19:0 20:0 21:0 22:0 23:0 24:0 25:0 26:0 27:0 28:0 29:0 30:0 31:0 32:0 33:0 34:0 35:0 36:0 37:0 38:0
|
||||||
|
0:4 1:4 2:0 3:4 4:4 5:4 6:0 7:4 8:0 9:4 10:4 11:4 12:0 13:0 14:4 15:4 16:0 17:0 18:0 19:0 20:0 21:0 22:0 23:0 24:0 25:0 26:0 27:0 28:0 29:0 30:0 31:0 32:0 33:0 34:0 35:0 36:0 37:0 38:0 (in Sonde())
|
||||||
|
|
||||||
TTGO T-Beam
|
TTGO T-Beam
|
||||||
(sda,scl: 21,22) (button1: 39) (button2: touch gpio13 = 141) (gps rx: 12)
|
(sda,scl: 21,22) (button1: 39) (button2: touch gpio13 = 141) (gps rx: 12)
|
||||||
0:1 1:0 2:0 3:1 4:0 5:1 6:0 7:1 8:0 9:1 10:1 11:1 12:0 13:0 14:1 15:1 16:1 17:0 18:0 19:0 20:0 21:1 22:1 23:1 24:0 25:0 26:0 27:0 28:0 29:0 30:0 31:0 32:0 33:0 34:0 35:0 36:0 37:0 38:0
|
0:1 1:0 2:0 3:1 4:0 5:1 6:0 7:1 8:0 9:1 10:1 11:1 12:1 13:0 14:1 15:1 16:1 17:0 18:0 19:0 20:0 21:1 22:1 23:1 24:0 25:0 26:0 27:0 28:0 29:0 30:0 31:0 32:0 33:0 34:0 35:0 36:0 37:0 38:0
|
||||||
|
0:4 1:4 2:0 3:4 4:0 5:4 6:0 7:4 8:0 9:4 10:4 11:4 12:4 13:0 14:4 15:4 16:4 17:0 18:0 19:0 20:0 21:4 22:4 23:4 24:0 25:0 26:0 27:0 28:0 29:0 30:0 31:0 32:0 33:0 34:0 35:0 36:0 37:0 38:0 (before setup)
|
||||||
|
|
||||||
|
|
||||||
Current autodetect strategy:
|
Current autodetect strategy:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue