bidir comm works

1.2-legacy
geeksville 2020-02-06 21:26:40 -08:00
rodzic f2d7215fb3
commit ade30ee1ce
7 zmienionych plików z 26 dodań i 10 usunięć

Wyświetl plik

@ -1,5 +1,6 @@
# High priority # High priority
* check in my radiolib fixes
* test raw device access without a manager in the way * test raw device access without a manager in the way
* sim gps data for nodes that don't have hardware * sim gps data for nodes that don't have hardware
* figure out what is busted with rx * figure out what is busted with rx
@ -93,3 +94,4 @@ until the phone pulls those packets. Ever so often power on bluetooth just so w
* have meshservice periodically send location data on mesh (if device has a GPS) * have meshservice periodically send location data on mesh (if device has a GPS)
* implement getCurrentTime() - set based off gps but then updated locally * implement getCurrentTime() - set based off gps but then updated locally
* make default owner record have valid usernames * make default owner record have valid usernames
* message loop between node 0x28 and 0x7c

1
lib/RadioHead 120000
Wyświetl plik

@ -0,0 +1 @@
../../RadioHead

Wyświetl plik

@ -13,6 +13,7 @@
[env:esp32] [env:esp32]
platform = espressif32 platform = espressif32
board = ttgo-t-beam board = ttgo-t-beam
; board = heltec_wifi_lora_32_V2
framework = arduino framework = arduino
; customize the partition table ; customize the partition table
@ -43,7 +44,7 @@ monitor_speed = 115200
# debug_port = /dev/ttyACM0 # debug_port = /dev/ttyACM0
debug_tool = jlink debug_tool = jlink
; upload_protocol = jlink ;upload_protocol = jlink
; debug_tool = olimex-arm-usb-ocd-h ; debug_tool = olimex-arm-usb-ocd-h
; upload_protocol = olimex-arm-usb-ocd-h ; upload_protocol = olimex-arm-usb-ocd-h
@ -54,11 +55,13 @@ debug_tool = jlink
debug_init_break = tbreak setup debug_init_break = tbreak setup
lib_deps = lib_deps =
RadioHead ; RadioHead - I now use a custom build of this library
; file:///home/kevinh/development/meshtastic/RadioHead
TinyGPSPlus TinyGPSPlus
ESP8266_SSD1306 ESP8266_SSD1306
AXP202X_Library AXP202X_Library
SPI SPI
CRC32 ; explicitly needed because dependency is missing in the ble ota update lib
Wire ; explicitly needed here because the AXP202 library forgets to add it Wire ; explicitly needed here because the AXP202 library forgets to add it
;[env:tbeam] ;[env:tbeam]

Wyświetl plik

@ -63,6 +63,7 @@ bool MeshRadio::init()
// FIXME - can we do this? It seems to be in the Heltec board. // FIXME - can we do this? It seems to be in the Heltec board.
rf95.setTxPower(radioConfig.tx_power, false); rf95.setTxPower(radioConfig.tx_power, false);
DEBUG_MSG("LoRa radio init OK!\n"); DEBUG_MSG("LoRa radio init OK!\n");
return true; return true;
@ -77,8 +78,6 @@ ErrorCode MeshRadio::send(MeshPacket *p)
ErrorCode MeshRadio::sendTo(NodeNum dest, const uint8_t *buf, size_t len) ErrorCode MeshRadio::sendTo(NodeNum dest, const uint8_t *buf, size_t len)
{ {
DEBUG_MSG("mesh sendTo %d bytes to 0x%x\n", len, dest); DEBUG_MSG("mesh sendTo %d bytes to 0x%x\n", len, dest);
// FIXME - for now we do all packets as broadcast
dest = NODENUM_BROADCAST;
assert(len <= 255); // Make sure we don't overflow the tiny max packet size assert(len <= 255); // Make sure we don't overflow the tiny max packet size

Wyświetl plik

@ -74,6 +74,13 @@ void MeshService::loop()
} }
fromNum++; fromNum++;
if(toPhoneQueue.numFree() == 0) {
DEBUG_MSG("NOTE: tophone queue is full, discarding oldest\n");
MeshPacket *d = toPhoneQueue.dequeuePtr(0);
if(d)
releaseToPool(d);
}
assert(toPhoneQueue.enqueue(mp, 0) == pdTRUE); // FIXME, instead of failing for full queue, delete the oldest mssages assert(toPhoneQueue.enqueue(mp, 0) == pdTRUE); // FIXME, instead of failing for full queue, delete the oldest mssages
} }
if (oldFromNum != fromNum) // We don't want to generate extra notifies for multiple new packets if (oldFromNum != fromNum) // We don't want to generate extra notifies for multiple new packets

Wyświetl plik

@ -19,6 +19,10 @@ public:
vQueueDelete(h); vQueueDelete(h);
} }
int numFree() {
return uxQueueSpacesAvailable(h);
}
// pdTRUE for success else failure // pdTRUE for success else failure
BaseType_t enqueue(T x, TickType_t maxWait = portMAX_DELAY) { BaseType_t enqueue(T x, TickType_t maxWait = portMAX_DELAY) {
return xQueueSendToBack(h, &x, maxWait); return xQueueSendToBack(h, &x, maxWait);

Wyświetl plik

@ -37,18 +37,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Select which T-Beam board is being used. Only uncomment one. Note: these options now come from platformio standard build file flags // Select which T-Beam board is being used. Only uncomment one. Note: these options now come from platformio standard build file flags
#ifdef ARDUINO_T_Beam //#ifdef ARDUINO_T_Beam
#define T_BEAM_V10 // AKA Rev1 (second board released) #define T_BEAM_V10 // AKA Rev1 (second board released)
#endif //#endif
#ifdef ARDUINO_HELTEC_WIFI_LORA_32_V2 //#ifdef ARDUINO_HELTEC_WIFI_LORA_32_V2
#define HELTEC_LORA32 //#define HELTEC_LORA32
#endif //#endif
// If we are using the JTAG port for debugging, some pins must be left free for that (and things like GPS have to be disabled) // If we are using the JTAG port for debugging, some pins must be left free for that (and things like GPS have to be disabled)
// we don't support jtag on the ttgo - access to gpio 12 is a PITA // we don't support jtag on the ttgo - access to gpio 12 is a PITA
#ifdef HELTEC_LORA32 #ifdef HELTEC_LORA32
#define USE_JTAG //#define USE_JTAG
#endif #endif
#define DEBUG_PORT Serial // Serial debug port #define DEBUG_PORT Serial // Serial debug port