mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-28 02:32:09 +00:00
Merge pull request #56 from mc-hamster/master
update serial from master
This commit is contained in:
commit
57ffe6622d
@ -188,7 +188,7 @@ build_flags =
|
|||||||
-Isdk-nrfxlib/crypto/nrf_oberon/include -Lsdk-nrfxlib/crypto/nrf_oberon/lib/cortex-m4/hard-float/ -lliboberon_3.0.3
|
-Isdk-nrfxlib/crypto/nrf_oberon/include -Lsdk-nrfxlib/crypto/nrf_oberon/lib/cortex-m4/hard-float/ -lliboberon_3.0.3
|
||||||
;-DCFG_DEBUG=3
|
;-DCFG_DEBUG=3
|
||||||
src_filter =
|
src_filter =
|
||||||
${arduino_base.src_filter} -<esp32/> -<nimble/> -<meshwifi/> -<mesh/wifi/>
|
${arduino_base.src_filter} -<esp32/> -<nimble/> -<mesh/wifi/> -<mesh/http/>
|
||||||
lib_ignore =
|
lib_ignore =
|
||||||
BluetoothOTA
|
BluetoothOTA
|
||||||
monitor_port = /dev/ttyACM1
|
monitor_port = /dev/ttyACM1
|
||||||
@ -315,7 +315,7 @@ lib_deps =
|
|||||||
; The Portduino based sim environment on top of linux
|
; The Portduino based sim environment on top of linux
|
||||||
[env:linux]
|
[env:linux]
|
||||||
platform = https://github.com/geeksville/platform-portduino.git
|
platform = https://github.com/geeksville/platform-portduino.git
|
||||||
src_filter = ${env.src_filter} -<esp32/> -<nimble/> -<nrf52/> -<meshwifi/>
|
src_filter = ${env.src_filter} -<esp32/> -<nimble/> -<nrf52/> -<mesh/http/>
|
||||||
build_flags = ${arduino_base.build_flags} -O0
|
build_flags = ${arduino_base.build_flags} -O0
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board = linux_x86_64
|
board = linux_x86_64
|
||||||
|
@ -11,7 +11,7 @@ namespace meshtastic
|
|||||||
*/
|
*/
|
||||||
enum OptionalBool { OptFalse = 0, OptTrue = 1, OptUnknown = 2 };
|
enum OptionalBool { OptFalse = 0, OptTrue = 1, OptUnknown = 2 };
|
||||||
|
|
||||||
/// Describes the state of the GPS system.
|
/// Describes the state of the Power system.
|
||||||
class PowerStatus : public Status
|
class PowerStatus : public Status
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include "EInkDisplay.h"
|
#include "EInkDisplay.h"
|
||||||
#include "SPILock.h"
|
#include "SPILock.h"
|
||||||
#include "epd1in54.h" // Screen specific library
|
#include "epd1in54.h" // Screen specific library
|
||||||
#include "graphics/configs.h"
|
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include <TFT_eSPI.h> // Graphics library and Sprite class
|
#include <TFT_eSPI.h> // Graphics library and Sprite class
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifndef NO_ESP32
|
||||||
#include "mesh/wifi/WiFiAPClient.h"
|
#include "mesh/http/WiFiAPClient.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace meshtastic; /** @todo remove */
|
using namespace meshtastic; /** @todo remove */
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
// #include <driver/rtc_io.h>
|
// #include <driver/rtc_io.h>
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifndef NO_ESP32
|
||||||
#include "mesh/wifi/WebServer.h"
|
#include "mesh/http/WebServer.h"
|
||||||
#include "mesh/wifi/WiFiAPClient.h"
|
#include "mesh/http/WiFiAPClient.h"
|
||||||
#include "nimble/BluetoothUtil.h"
|
#include "nimble/BluetoothUtil.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include <pb_encode.h>
|
#include <pb_encode.h>
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifndef NO_ESP32
|
||||||
#include "mesh/wifi/WiFiAPClient.h"
|
#include "mesh/http/WiFiAPClient.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NodeDB nodeDB;
|
NodeDB nodeDB;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "mesh/wifi/ContentHelper.h"
|
#include "mesh/http/ContentHelper.h"
|
||||||
//#include <Arduino.h>
|
//#include <Arduino.h>
|
||||||
//#include "main.h"
|
//#include "main.h"
|
||||||
|
|
@ -1,11 +1,11 @@
|
|||||||
#include "mesh/wifi/WebServer.h"
|
#include "mesh/http/WebServer.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
#include "airtime.h"
|
#include "airtime.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "mesh/wifi/ContentHelper.h"
|
#include "mesh/http/ContentHelper.h"
|
||||||
#include "mesh/wifi/ContentStatic.h"
|
#include "mesh/http/ContentStatic.h"
|
||||||
#include "mesh/wifi/WiFiAPClient.h"
|
#include "mesh/http/WiFiAPClient.h"
|
||||||
#include "sleep.h"
|
#include "sleep.h"
|
||||||
#include <HTTPBodyParser.hpp>
|
#include <HTTPBodyParser.hpp>
|
||||||
#include <HTTPMultipartBodyParser.hpp>
|
#include <HTTPMultipartBodyParser.hpp>
|
||||||
@ -1110,13 +1110,13 @@ void handleReport(HTTPRequest *req, HTTPResponse *res)
|
|||||||
|
|
||||||
res->println("\"airtime\": {");
|
res->println("\"airtime\": {");
|
||||||
|
|
||||||
uint16_t *logArray;
|
uint32_t *logArray;
|
||||||
|
|
||||||
res->print("\"tx_log\": [");
|
res->print("\"tx_log\": [");
|
||||||
|
|
||||||
logArray = airtimeReport(TX_LOG);
|
logArray = airtimeReport(TX_LOG);
|
||||||
for (int i = 0; i < getPeriodsToLog(); i++) {
|
for (int i = 0; i < getPeriodsToLog(); i++) {
|
||||||
uint16_t tmp;
|
uint32_t tmp;
|
||||||
tmp = *(logArray + i);
|
tmp = *(logArray + i);
|
||||||
res->printf("%d", tmp);
|
res->printf("%d", tmp);
|
||||||
if (i != getPeriodsToLog() - 1) {
|
if (i != getPeriodsToLog() - 1) {
|
||||||
@ -1129,7 +1129,7 @@ void handleReport(HTTPRequest *req, HTTPResponse *res)
|
|||||||
|
|
||||||
logArray = airtimeReport(RX_LOG);
|
logArray = airtimeReport(RX_LOG);
|
||||||
for (int i = 0; i < getPeriodsToLog(); i++) {
|
for (int i = 0; i < getPeriodsToLog(); i++) {
|
||||||
uint16_t tmp;
|
uint32_t tmp;
|
||||||
tmp = *(logArray + i);
|
tmp = *(logArray + i);
|
||||||
res->printf("%d", tmp);
|
res->printf("%d", tmp);
|
||||||
if (i != getPeriodsToLog() - 1) {
|
if (i != getPeriodsToLog() - 1) {
|
||||||
@ -1142,7 +1142,7 @@ void handleReport(HTTPRequest *req, HTTPResponse *res)
|
|||||||
|
|
||||||
logArray = airtimeReport(RX_ALL_LOG);
|
logArray = airtimeReport(RX_ALL_LOG);
|
||||||
for (int i = 0; i < getPeriodsToLog(); i++) {
|
for (int i = 0; i < getPeriodsToLog(); i++) {
|
||||||
uint16_t tmp;
|
uint32_t tmp;
|
||||||
tmp = *(logArray + i);
|
tmp = *(logArray + i);
|
||||||
res->printf("%d", tmp);
|
res->printf("%d", tmp);
|
||||||
if (i != getPeriodsToLog() - 1) {
|
if (i != getPeriodsToLog() - 1) {
|
||||||
@ -1169,7 +1169,14 @@ void handleReport(HTTPRequest *req, HTTPResponse *res)
|
|||||||
|
|
||||||
res->println("},");
|
res->println("},");
|
||||||
|
|
||||||
res->println("\"test\": 123");
|
res->println("\"power\": {");
|
||||||
|
#define BoolToString(x) ((x)?"true":"false")
|
||||||
|
res->printf("\"battery_percent\": %u,\n", powerStatus->getBatteryChargePercent());
|
||||||
|
res->printf("\"battery_voltage_mv\": %u,\n", powerStatus->getBatteryVoltageMv());
|
||||||
|
res->printf("\"has_battery\": %s,\n", BoolToString(powerStatus->getHasBattery()));
|
||||||
|
res->printf("\"has_usb\": %s,\n", BoolToString(powerStatus->getHasUSB()));
|
||||||
|
res->printf("\"is_charging\": %s\n", BoolToString(powerStatus->getIsCharging()));
|
||||||
|
res->println("}");
|
||||||
|
|
||||||
res->println("},");
|
res->println("},");
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
#include "mesh/wifi/WiFiAPClient.h"
|
#include "mesh/http/WiFiAPClient.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "mesh/wifi/WiFiServerAPI.h"
|
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "mesh/wifi/WebServer.h"
|
#include "mesh/http/WebServer.h"
|
||||||
|
#include "mesh/wifi/WiFiServerAPI.h"
|
||||||
#include "target_specific.h"
|
#include "target_specific.h"
|
||||||
#include <DNSServer.h>
|
#include <DNSServer.h>
|
||||||
#include <ESPmDNS.h>
|
#include <ESPmDNS.h>
|
@ -14,7 +14,7 @@
|
|||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifndef NO_ESP32
|
||||||
#include "mesh/wifi/WiFiAPClient.h"
|
#include "mesh/http/WiFiAPClient.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool pinShowing;
|
static bool pinShowing;
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
to your device.
|
to your device.
|
||||||
|
|
||||||
TODO (in this order):
|
TODO (in this order):
|
||||||
|
* Add check for esp32 and only build code sections for esp32.
|
||||||
* Once protobufs regenerated with the new port, update SerialPlugin.h
|
* Once protobufs regenerated with the new port, update SerialPlugin.h
|
||||||
* Ensure this works on a tbeam
|
* Ensure this works on a tbeam
|
||||||
* Define a verbose RX mode to report on mesh and packet infomration.
|
* Define a verbose RX mode to report on mesh and packet infomration.
|
||||||
@ -45,6 +46,7 @@
|
|||||||
KNOWN PROBLEMS
|
KNOWN PROBLEMS
|
||||||
* Until the plugin is initilized by the startup sequence, the TX pin is in a floating
|
* Until the plugin is initilized by the startup sequence, the TX pin is in a floating
|
||||||
state. Device connected to that pin may see this as "noise".
|
state. Device connected to that pin may see this as "noise".
|
||||||
|
* This will not work on the NRF or Linux target.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@ -55,7 +57,7 @@
|
|||||||
#define SERIALPLUGIN_STRING_MAX Constants_DATA_PAYLOAD_LEN
|
#define SERIALPLUGIN_STRING_MAX Constants_DATA_PAYLOAD_LEN
|
||||||
#define SERIALPLUGIN_TIMEOUT 250
|
#define SERIALPLUGIN_TIMEOUT 250
|
||||||
#define SERIALPLUGIN_BAUD 38400
|
#define SERIALPLUGIN_BAUD 38400
|
||||||
#define SERIALPLUGIN_ENABLED 1
|
#define SERIALPLUGIN_ENABLED 0
|
||||||
#define SERIALPLUGIN_ECHO 0
|
#define SERIALPLUGIN_ECHO 0
|
||||||
#define SERIALPLUGIN_ACK 0
|
#define SERIALPLUGIN_ACK 0
|
||||||
|
|
||||||
@ -68,6 +70,7 @@ char serialStringChar[Constants_DATA_PAYLOAD_LEN];
|
|||||||
|
|
||||||
int32_t SerialPlugin::runOnce()
|
int32_t SerialPlugin::runOnce()
|
||||||
{
|
{
|
||||||
|
#ifdef NO_ESP32
|
||||||
|
|
||||||
#if SERIALPLUGIN_ENABLED == 1
|
#if SERIALPLUGIN_ENABLED == 1
|
||||||
|
|
||||||
@ -103,6 +106,8 @@ int32_t SerialPlugin::runOnce()
|
|||||||
|
|
||||||
return (INT32_MAX);
|
return (INT32_MAX);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
MeshPacket *SerialPluginRadio::allocReply()
|
MeshPacket *SerialPluginRadio::allocReply()
|
||||||
@ -129,6 +134,11 @@ void SerialPluginRadio::sendPayload(NodeNum dest, bool wantReplies)
|
|||||||
|
|
||||||
bool SerialPluginRadio::handleReceived(const MeshPacket &mp)
|
bool SerialPluginRadio::handleReceived(const MeshPacket &mp)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#ifdef NO_ESP32
|
||||||
|
|
||||||
|
#if SERIALPLUGIN_ENABLED == 1
|
||||||
|
|
||||||
auto &p = mp.decoded.data;
|
auto &p = mp.decoded.data;
|
||||||
// DEBUG_MSG("Received text msg self=0x%0x, from=0x%0x, to=0x%0x, id=%d, msg=%.*s\n", nodeDB.getNodeNum(),
|
// DEBUG_MSG("Received text msg self=0x%0x, from=0x%0x, to=0x%0x, id=%d, msg=%.*s\n", nodeDB.getNodeNum(),
|
||||||
// mp.from, mp.to, mp.id, p.payload.size, p.payload.bytes);
|
// mp.from, mp.to, mp.id, p.payload.size, p.payload.bytes);
|
||||||
@ -157,5 +167,12 @@ bool SerialPluginRadio::handleReceived(const MeshPacket &mp)
|
|||||||
Serial2.printf("%s", p.payload.bytes);
|
Serial2.printf("%s", p.payload.bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
DEBUG_MSG("Serial Plugin Disabled\n");
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
return true; // Let others look at this message also if they want
|
return true; // Let others look at this message also if they want
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user