first_beta2
This commit is contained in:
parent
ad0203e106
commit
7ed8e76e4a
|
|
@ -2,17 +2,7 @@
|
||||||
#include <LoRa.h>
|
#include <LoRa.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include "iGate_config.h"
|
#include "iGate_config.h"
|
||||||
|
#include "pins_config.h"
|
||||||
|
|
||||||
#define DBM 20 //20 serian 100mW # con otro mas potente serian 8=100mA y 20=1000W(1W)
|
|
||||||
|
|
||||||
// SPI LoRa Radio
|
|
||||||
#define LORA_SCK 5 // GPIO5 - SX1276 SCK
|
|
||||||
#define LORA_MISO 19 // GPIO19 - SX1276 MISO
|
|
||||||
#define LORA_MOSI 27 // GPIO27 - SX1276 MOSI
|
|
||||||
#define LORA_CS 18 // GPIO18 - SX1276 CS ---> NSS
|
|
||||||
#define LORA_RST 14 // GPIO14 - SX1276 RST
|
|
||||||
#define LORA_IRQ 26 // GPIO26 - SX1276 IRQ ---->DIO0
|
|
||||||
|
|
||||||
|
|
||||||
WiFiClient espClient;
|
WiFiClient espClient;
|
||||||
|
|
@ -36,7 +26,7 @@ void setup_lora() {
|
||||||
LoRa.setCodingRate4(5);
|
LoRa.setCodingRate4(5);
|
||||||
LoRa.enableCrc();
|
LoRa.enableCrc();
|
||||||
LoRa.setTxPower(20);
|
LoRa.setTxPower(20);
|
||||||
Serial.println("LoRa init done!");
|
Serial.println("LoRa init done!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_wifi() {
|
void setup_wifi() {
|
||||||
|
|
@ -58,8 +48,6 @@ void setup() {
|
||||||
setup_wifi();
|
setup_wifi();
|
||||||
btStop();
|
btStop();
|
||||||
setup_lora();
|
setup_lora();
|
||||||
|
|
||||||
Serial.println("");
|
|
||||||
Serial.println("Starting iGate\n");
|
Serial.println("Starting iGate\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,9 +60,8 @@ void procesa_y_sube_APRS_IS(String mensaje) {
|
||||||
callsign_y_path_tracker = mensaje.substring(3, posicion_dos_puntos);
|
callsign_y_path_tracker = mensaje.substring(3, posicion_dos_puntos);
|
||||||
gps_info_tracker = mensaje.substring(posicion_dos_puntos);
|
gps_info_tracker = mensaje.substring(posicion_dos_puntos);
|
||||||
packet_para_APRS_IS = callsign_y_path_tracker + ",qAO," + callsign_igate + gps_info_tracker + "\n";
|
packet_para_APRS_IS = callsign_y_path_tracker + ",qAO," + callsign_igate + gps_info_tracker + "\n";
|
||||||
//Serial.print("Mensaje APRS_IS : ");
|
//Serial.print("Mensaje APRS_IS : "); Serial.println(packet_para_APRS_IS);
|
||||||
//Serial.println(packet_para_APRS_IS);
|
//packet = "CD2RXU-9>APLT00,qAO,CD2RXU-10:=" + LAT + "/" + LON + ">" + "\n"; // ejemplo!!!
|
||||||
//packet = "CD2RXU-9>APLT00,qAO,CD2RXU-10:=" + LAT + "/" + LON + ">" + "\n";
|
|
||||||
|
|
||||||
delay(200);
|
delay(200);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
@ -96,21 +83,14 @@ void procesa_y_sube_APRS_IS(String mensaje) {
|
||||||
Serial.println("Connected with server: " + String(SERVER) + " APRSPORT: " + String(APRSPORT));
|
Serial.println("Connected with server: " + String(SERVER) + " APRSPORT: " + String(APRSPORT));
|
||||||
while (espClient.connected()) {
|
while (espClient.connected()) {
|
||||||
delay(1000);
|
delay(1000);
|
||||||
//Serial.println("Run client.connected()");
|
|
||||||
|
|
||||||
//aprsauth = "user " + USER + " pass " + PAS + "\n";
|
|
||||||
aprsauth = "user " + callsign_igate + " pass " + passcode_igate + "\n"; //info igate
|
aprsauth = "user " + callsign_igate + " pass " + passcode_igate + "\n"; //info igate
|
||||||
espClient.write(aprsauth.c_str());
|
espClient.write(aprsauth.c_str()); //Serial.println("Run client.connected()");
|
||||||
delay(500);
|
delay(500);
|
||||||
//Serial.println("Send client.write=" + aprsauth);
|
espClient.write(packet_para_APRS_IS.c_str()); //Serial.println("Send client.write=" + aprsauth);
|
||||||
|
delay(500); //Serial.println("Send espClient.write = " + packet_para_APRS_IS);
|
||||||
espClient.write(packet_para_APRS_IS.c_str());
|
|
||||||
delay(500);
|
|
||||||
//Serial.println("Send espClient.write = " + packet_para_APRS_IS);
|
|
||||||
Serial.println("Packet uploaded =)\n");
|
Serial.println("Packet uploaded =)\n");
|
||||||
espClient.stop();
|
espClient.stop();
|
||||||
espClient.flush();
|
espClient.flush(); //Serial.println("(Telnet client disconnect)\n");
|
||||||
//Serial.println("(Telnet client disconnect)\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -137,7 +117,7 @@ void loop() {
|
||||||
int inChar = LoRa.read();
|
int inChar = LoRa.read();
|
||||||
mensaje_recibido += (char)inChar;
|
mensaje_recibido += (char)inChar;
|
||||||
}
|
}
|
||||||
//Serial.println("Mensaje Recibido : " + String(mensaje_recibido));
|
|
||||||
valida_y_procesa_packet(mensaje_recibido);
|
valida_y_procesa_packet(mensaje_recibido); //Serial.println("Mensaje Recibido : " + String(mensaje_recibido));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
#ifndef PINS_CONFIG_H_
|
||||||
|
#define PINS_CONFIG_H_
|
||||||
|
|
||||||
|
|
||||||
|
// SPI LoRa Radio
|
||||||
|
#define LORA_SCK 5 // GPIO5 - SX1276 SCK
|
||||||
|
#define LORA_MISO 19 // GPIO19 - SX1276 MISO
|
||||||
|
#define LORA_MOSI 27 // GPIO27 - SX1276 MOSI
|
||||||
|
#define LORA_CS 18 // GPIO18 - SX1276 CS ---> NSS
|
||||||
|
#define LORA_RST 14 // GPIO14 - SX1276 RST
|
||||||
|
#define LORA_IRQ 26 // GPIO26 - SX1276 IRQ ---->DIO0
|
||||||
|
|
||||||
|
/*
|
||||||
|
SX1278-------------------> ESP32
|
||||||
|
GND GND
|
||||||
|
DIO1 -
|
||||||
|
DIO2 -
|
||||||
|
DIO3 -
|
||||||
|
VCC 3.3V
|
||||||
|
MISO 19
|
||||||
|
MOSI 27
|
||||||
|
SCLK 5
|
||||||
|
NSS 18
|
||||||
|
DIO0 26
|
||||||
|
REST 14
|
||||||
|
GND -
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue