mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-04 09:02:21 +00:00
Replaced all of the logging with proper log levels
This commit is contained in:
@@ -47,7 +47,7 @@ void FloodingRouter::sniffReceived(const MeshPacket *p, const Routing *c)
|
||||
traceRouteModule->updateRoute(tosend);
|
||||
}
|
||||
|
||||
printPacket("Rebroadcasting received floodmsg to neighbors", p);
|
||||
LOG_INFO("Rebroadcasting received floodmsg to neighbors", p);
|
||||
// Note: we are careful to resend using the original senders node id
|
||||
// We are careful not to call our hooked version of send() - because we don't want to check this again
|
||||
Router::send(tosend);
|
||||
|
||||
@@ -52,7 +52,7 @@ MeshPacket *MeshModule::allocAckNak(Routing_Error err, NodeNum to, PacketId idFr
|
||||
p->to = to;
|
||||
p->decoded.request_id = idFrom;
|
||||
p->channel = chIndex;
|
||||
LOG_DEBUG("Alloc an err=%d,to=0x%x,idFrom=0x%x,id=0x%x\n", err, to, idFrom, p->id);
|
||||
LOG_ERROR("Alloc an err=%d,to=0x%x,idFrom=0x%x,id=0x%x\n", err, to, idFrom, p->id);
|
||||
|
||||
return p;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ void MeshModule::callPlugins(const MeshPacket &mp, RxSource src)
|
||||
// any other node.
|
||||
if (mp.decoded.want_response && toUs && (getFrom(&mp) != ourNodeNum || mp.to == ourNodeNum) && !currentReply) {
|
||||
pi.sendResponse(mp);
|
||||
LOG_DEBUG("Module '%s' sent a response\n", pi.name);
|
||||
LOG_INFO("Module '%s' sent a response\n", pi.name);
|
||||
} else {
|
||||
LOG_DEBUG("Module '%s' considered\n", pi.name);
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ void MeshService::handleToRadio(MeshPacket &p)
|
||||
// Switch the port from PortNum_SIMULATOR_APP back to the original PortNum
|
||||
p.decoded.portnum = decoded->portnum;
|
||||
} else
|
||||
LOG_DEBUG("Error decoding protobuf for simulator message!\n");
|
||||
LOG_ERROR("Error decoding protobuf for simulator message!\n");
|
||||
}
|
||||
// Let SimRadio receive as if it did via its LoRa chip
|
||||
SimRadio::instance->startReceive(&p);
|
||||
@@ -198,12 +198,12 @@ void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies)
|
||||
|
||||
if (node->has_position && (node->position.latitude_i != 0 || node->position.longitude_i != 0)) {
|
||||
if (positionModule) {
|
||||
LOG_DEBUG("Sending position ping to 0x%x, wantReplies=%d\n", dest, wantReplies);
|
||||
LOG_INFO("Sending position ping to 0x%x, wantReplies=%d\n", dest, wantReplies);
|
||||
positionModule->sendOurPosition(dest, wantReplies);
|
||||
}
|
||||
} else {
|
||||
if (nodeInfoModule) {
|
||||
LOG_DEBUG("Sending nodeinfo ping to 0x%x, wantReplies=%d\n", dest, wantReplies);
|
||||
LOG_INFO("Sending nodeinfo ping to 0x%x, wantReplies=%d\n", dest, wantReplies);
|
||||
nodeInfoModule->sendOurNodeInfo(dest, wantReplies);
|
||||
}
|
||||
}
|
||||
@@ -212,7 +212,7 @@ void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies)
|
||||
void MeshService::sendToPhone(MeshPacket *p)
|
||||
{
|
||||
if (toPhoneQueue.numFree() == 0) {
|
||||
LOG_DEBUG("NOTE: tophone queue is full, discarding oldest\n");
|
||||
LOG_WARN("ToPhone queue is full, discarding oldest\n");
|
||||
MeshPacket *d = toPhoneQueue.dequeuePtr(0);
|
||||
if (d)
|
||||
releaseToPool(d);
|
||||
|
||||
@@ -86,7 +86,7 @@ bool NodeDB::resetRadioConfig(bool factory_reset)
|
||||
}
|
||||
|
||||
if (channelFile.channels_count != MAX_NUM_CHANNELS) {
|
||||
LOG_DEBUG("Setting default channel and radio preferences!\n");
|
||||
LOG_INFO("Setting default channel and radio preferences!\n");
|
||||
|
||||
channels.initDefaults();
|
||||
}
|
||||
@@ -114,7 +114,7 @@ bool NodeDB::resetRadioConfig(bool factory_reset)
|
||||
initRegion();
|
||||
|
||||
if (didFactoryReset) {
|
||||
LOG_DEBUG("Rebooting due to factory reset");
|
||||
LOG_INFO("Rebooting due to factory reset");
|
||||
screen->startRebootScreen();
|
||||
rebootAtMsec = millis() + (5 * 1000);
|
||||
}
|
||||
@@ -124,7 +124,7 @@ bool NodeDB::resetRadioConfig(bool factory_reset)
|
||||
|
||||
bool NodeDB::factoryReset()
|
||||
{
|
||||
LOG_DEBUG("Performing factory reset!\n");
|
||||
LOG_INFO("Performing factory reset!\n");
|
||||
// first, remove the "/prefs" (this removes most prefs)
|
||||
rmDir("/prefs");
|
||||
// second, install default state (this will deal with the duplicate mac address issue)
|
||||
@@ -140,7 +140,7 @@ bool NodeDB::factoryReset()
|
||||
#endif
|
||||
#ifdef ARCH_NRF52
|
||||
Bluefruit.begin();
|
||||
LOG_DEBUG("Clearing bluetooth bonds!\n");
|
||||
LOG_INFO("Clearing bluetooth bonds!\n");
|
||||
bond_print_list(BLE_GAP_ROLE_PERIPH);
|
||||
bond_print_list(BLE_GAP_ROLE_CENTRAL);
|
||||
Bluefruit.Periph.clearBonds();
|
||||
@@ -151,7 +151,7 @@ bool NodeDB::factoryReset()
|
||||
|
||||
void NodeDB::installDefaultConfig()
|
||||
{
|
||||
LOG_DEBUG("Installing default LocalConfig\n");
|
||||
LOG_INFO("Installing default LocalConfig\n");
|
||||
memset(&config, 0, sizeof(LocalConfig));
|
||||
config.version = DEVICESTATE_CUR_VER;
|
||||
config.has_device = true;
|
||||
@@ -376,7 +376,7 @@ bool NodeDB::loadProto(const char *filename, size_t protoSize, size_t objSize, c
|
||||
auto f = FSCom.open(filename, FILE_O_READ);
|
||||
|
||||
if (f) {
|
||||
LOG_DEBUG("Loading %s\n", filename);
|
||||
LOG_INFO("Loading %s\n", filename);
|
||||
pb_istream_t stream = {&readcb, &f, protoSize};
|
||||
|
||||
// LOG_DEBUG("Preload channel name=%s\n", channelSettings.name);
|
||||
@@ -390,7 +390,7 @@ bool NodeDB::loadProto(const char *filename, size_t protoSize, size_t objSize, c
|
||||
|
||||
f.close();
|
||||
} else {
|
||||
LOG_DEBUG("No %s preferences found\n", filename);
|
||||
LOG_INFO("No %s preferences found\n", filename);
|
||||
}
|
||||
#else
|
||||
LOG_ERROR("ERROR: Filesystem not implemented\n");
|
||||
@@ -408,7 +408,7 @@ void NodeDB::loadFromDisk()
|
||||
LOG_WARN("Devicestate %d is old, discarding\n", devicestate.version);
|
||||
factoryReset();
|
||||
} else {
|
||||
LOG_DEBUG("Loaded saved devicestate version %d\n", devicestate.version);
|
||||
LOG_INFO("Loaded saved devicestate version %d\n", devicestate.version);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,7 +419,7 @@ void NodeDB::loadFromDisk()
|
||||
LOG_WARN("config %d is old, discarding\n", config.version);
|
||||
installDefaultConfig();
|
||||
} else {
|
||||
LOG_DEBUG("Loaded saved config version %d\n", config.version);
|
||||
LOG_INFO("Loaded saved config version %d\n", config.version);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,7 +430,7 @@ void NodeDB::loadFromDisk()
|
||||
LOG_WARN("moduleConfig %d is old, discarding\n", moduleConfig.version);
|
||||
installDefaultModuleConfig();
|
||||
} else {
|
||||
LOG_DEBUG("Loaded saved moduleConfig version %d\n", moduleConfig.version);
|
||||
LOG_INFO("Loaded saved moduleConfig version %d\n", moduleConfig.version);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,12 +441,12 @@ void NodeDB::loadFromDisk()
|
||||
LOG_WARN("channelFile %d is old, discarding\n", channelFile.version);
|
||||
installDefaultChannels();
|
||||
} else {
|
||||
LOG_DEBUG("Loaded saved channelFile version %d\n", channelFile.version);
|
||||
LOG_INFO("Loaded saved channelFile version %d\n", channelFile.version);
|
||||
}
|
||||
}
|
||||
|
||||
if (loadProto(oemConfigFile, OEMStore_size, sizeof(OEMStore), &OEMStore_msg, &oemStore))
|
||||
LOG_DEBUG("Loaded OEMStore\n");
|
||||
LOG_INFO("Loaded OEMStore\n");
|
||||
}
|
||||
|
||||
/** Save a protobuf from a file, return true for success */
|
||||
@@ -459,11 +459,11 @@ bool NodeDB::saveProto(const char *filename, size_t protoSize, const pb_msgdesc_
|
||||
filenameTmp += ".tmp";
|
||||
auto f = FSCom.open(filenameTmp.c_str(), FILE_O_WRITE);
|
||||
if (f) {
|
||||
LOG_DEBUG("Saving %s\n", filename);
|
||||
LOG_INFO("Saving %s\n", filename);
|
||||
pb_ostream_t stream = {&writecb, &f, protoSize};
|
||||
|
||||
if (!pb_encode(&stream, fields, dest_struct)) {
|
||||
LOG_DEBUG("Error: can't encode protobuf %s\n", PB_GET_ERROR(&stream));
|
||||
LOG_ERROR("Error: can't encode protobuf %s\n", PB_GET_ERROR(&stream));
|
||||
} else {
|
||||
okay = true;
|
||||
}
|
||||
@@ -473,9 +473,9 @@ bool NodeDB::saveProto(const char *filename, size_t protoSize, const pb_msgdesc_
|
||||
if (FSCom.exists(filename) && !FSCom.remove(filename))
|
||||
LOG_WARN("Can't remove old pref file\n");
|
||||
if (!renameFile(filenameTmp.c_str(), filename))
|
||||
LOG_DEBUG("Error: can't rename new pref file\n");
|
||||
LOG_ERROR("Error: can't rename new pref file\n");
|
||||
} else {
|
||||
LOG_DEBUG("Can't write prefs\n");
|
||||
LOG_ERROR("Can't write prefs\n");
|
||||
#ifdef ARCH_NRF52
|
||||
static uint8_t failedCounter = 0;
|
||||
failedCounter++;
|
||||
@@ -487,7 +487,7 @@ bool NodeDB::saveProto(const char *filename, size_t protoSize, const pb_msgdesc_
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
LOG_DEBUG("ERROR: Filesystem not implemented\n");
|
||||
LOG_ERROR("ERROR: Filesystem not implemented\n");
|
||||
#endif
|
||||
return okay;
|
||||
}
|
||||
@@ -599,7 +599,7 @@ void NodeDB::updatePosition(uint32_t nodeId, const Position &p, RxSource src)
|
||||
|
||||
if (src == RX_SRC_LOCAL) {
|
||||
// Local packet, fully authoritative
|
||||
LOG_DEBUG("updatePosition LOCAL pos@%x, time=%u, latI=%d, lonI=%d, alt=%d\n", p.timestamp, p.time, p.latitude_i,
|
||||
LOG_INFO("updatePosition LOCAL pos@%x, time=%u, latI=%d, lonI=%d, alt=%d\n", p.timestamp, p.time, p.latitude_i,
|
||||
p.longitude_i, p.altitude);
|
||||
info->position = p;
|
||||
|
||||
@@ -615,7 +615,7 @@ void NodeDB::updatePosition(uint32_t nodeId, const Position &p, RxSource src)
|
||||
// recorded based on the packet rxTime
|
||||
//
|
||||
// FIXME perhaps handle RX_SRC_USER separately?
|
||||
LOG_DEBUG("updatePosition REMOTE node=0x%x time=%u, latI=%d, lonI=%d\n", nodeId, p.time, p.latitude_i, p.longitude_i);
|
||||
LOG_INFO("updatePosition REMOTE node=0x%x time=%u, latI=%d, lonI=%d\n", nodeId, p.time, p.latitude_i, p.longitude_i);
|
||||
|
||||
// First, back up fields that we want to protect from overwrite
|
||||
uint32_t tmp_time = info->position.time;
|
||||
@@ -756,9 +756,9 @@ void recordCriticalError(CriticalErrorCode code, uint32_t address, const char *f
|
||||
String lcd = String("Critical error ") + code + "!\n";
|
||||
screen->print(lcd.c_str());
|
||||
if (filename)
|
||||
LOG_DEBUG("NOTE! Recording critical error %d at %s:%lu\n", code, filename, address);
|
||||
LOG_ERROR("NOTE! Recording critical error %d at %s:%lu\n", code, filename, address);
|
||||
else
|
||||
LOG_DEBUG("NOTE! Recording critical error %d, address=0x%lx\n", code, address);
|
||||
LOG_ERROR("NOTE! Recording critical error %d, address=0x%lx\n", code, address);
|
||||
|
||||
// Record error to DB
|
||||
myNodeInfo.error_code = code;
|
||||
@@ -767,7 +767,7 @@ void recordCriticalError(CriticalErrorCode code, uint32_t address, const char *f
|
||||
|
||||
// Currently portuino is mostly used for simulation. Make sue the user notices something really bad happend
|
||||
#ifdef ARCH_PORTDUINO
|
||||
LOG_DEBUG("A critical failure occurred, portduino is exiting...");
|
||||
LOG_ERROR("A critical failure occurred, portduino is exiting...");
|
||||
exit(2);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ void PhoneAPI::handleStartConfig()
|
||||
// even if we were already connected - restart our state machine
|
||||
state = STATE_SEND_MY_INFO;
|
||||
|
||||
LOG_DEBUG("Starting API client config\n");
|
||||
LOG_INFO("Starting API client config\n");
|
||||
nodeInfoForPhone = NULL; // Don't keep returning old nodeinfos
|
||||
nodeDB.resetReadPointer(); // FIXME, this read pointer should be moved out of nodeDB and into this class - because
|
||||
// this will break once we have multiple instances of PhoneAPI running independently
|
||||
@@ -60,7 +60,7 @@ void PhoneAPI::checkConnectionTimeout()
|
||||
if (isConnected()) {
|
||||
bool newContact = checkIsConnected();
|
||||
if (!newContact) {
|
||||
LOG_DEBUG("Lost phone connection\n");
|
||||
LOG_INFO("Lost phone connection\n");
|
||||
close();
|
||||
}
|
||||
}
|
||||
@@ -83,11 +83,11 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
|
||||
return handleToRadioPacket(toRadioScratch.packet);
|
||||
case ToRadio_want_config_id_tag:
|
||||
config_nonce = toRadioScratch.want_config_id;
|
||||
LOG_DEBUG("Client wants config, nonce=%u\n", config_nonce);
|
||||
LOG_INFO("Client wants config, nonce=%u\n", config_nonce);
|
||||
handleStartConfig();
|
||||
break;
|
||||
case ToRadio_disconnect_tag:
|
||||
LOG_DEBUG("Disconnecting from phone\n");
|
||||
LOG_INFO("Disconnecting from phone\n");
|
||||
close();
|
||||
break;
|
||||
default:
|
||||
@@ -96,7 +96,7 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
LOG_DEBUG("Error: ignoring malformed toradio\n");
|
||||
LOG_ERROR("Error: ignoring malformed toradio\n");
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -128,11 +128,11 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
// Advance states as needed
|
||||
switch (state) {
|
||||
case STATE_SEND_NOTHING:
|
||||
LOG_DEBUG("getFromRadio=STATE_SEND_NOTHING\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_NOTHING\n");
|
||||
break;
|
||||
|
||||
case STATE_SEND_MY_INFO:
|
||||
LOG_DEBUG("getFromRadio=STATE_SEND_MY_INFO\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_MY_INFO\n");
|
||||
// If the user has specified they don't want our node to share its location, make sure to tell the phone
|
||||
// app not to send locations on our behalf.
|
||||
myNodeInfo.has_gps = gps && gps->isConnected(); // Update with latest GPS connect info
|
||||
@@ -144,18 +144,18 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
break;
|
||||
|
||||
case STATE_SEND_NODEINFO: {
|
||||
LOG_DEBUG("getFromRadio=STATE_SEND_NODEINFO\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_NODEINFO\n");
|
||||
const NodeInfo *info = nodeInfoForPhone;
|
||||
nodeInfoForPhone = NULL; // We just consumed a nodeinfo, will need a new one next time
|
||||
|
||||
if (info) {
|
||||
LOG_DEBUG("Sending nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s\n", info->num, info->last_heard, info->user.id,
|
||||
LOG_INFO("Sending nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s\n", info->num, info->last_heard, info->user.id,
|
||||
info->user.long_name);
|
||||
fromRadioScratch.which_payload_variant = FromRadio_node_info_tag;
|
||||
fromRadioScratch.node_info = *info;
|
||||
// Stay in current state until done sending nodeinfos
|
||||
} else {
|
||||
LOG_DEBUG("Done sending nodeinfos\n");
|
||||
LOG_INFO("Done sending nodeinfos\n");
|
||||
state = STATE_SEND_CHANNELS;
|
||||
// Go ahead and send that ID right now
|
||||
return getFromRadio(buf);
|
||||
@@ -164,7 +164,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
}
|
||||
|
||||
case STATE_SEND_CHANNELS:
|
||||
LOG_DEBUG("getFromRadio=STATE_SEND_CHANNELS\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_CHANNELS\n");
|
||||
fromRadioScratch.which_payload_variant = FromRadio_channel_tag;
|
||||
fromRadioScratch.channel = channels.getByIndex(config_state);
|
||||
config_state++;
|
||||
@@ -176,7 +176,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
break;
|
||||
|
||||
case STATE_SEND_CONFIG:
|
||||
LOG_DEBUG("getFromRadio=STATE_SEND_CONFIG\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_CONFIG\n");
|
||||
fromRadioScratch.which_payload_variant = FromRadio_config_tag;
|
||||
switch (config_state) {
|
||||
case Config_device_tag:
|
||||
@@ -222,7 +222,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
break;
|
||||
|
||||
case STATE_SEND_MODULECONFIG:
|
||||
LOG_DEBUG("getFromRadio=STATE_SEND_MODULECONFIG\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_MODULECONFIG\n");
|
||||
fromRadioScratch.which_payload_variant = FromRadio_moduleConfig_tag;
|
||||
switch (config_state) {
|
||||
case ModuleConfig_mqtt_tag:
|
||||
@@ -272,7 +272,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
break;
|
||||
|
||||
case STATE_SEND_COMPLETE_ID:
|
||||
LOG_DEBUG("getFromRadio=STATE_SEND_COMPLETE_ID\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_COMPLETE_ID\n");
|
||||
fromRadioScratch.which_payload_variant = FromRadio_config_complete_id_tag;
|
||||
fromRadioScratch.config_complete_id = config_nonce;
|
||||
config_nonce = 0;
|
||||
@@ -281,7 +281,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
|
||||
case STATE_SEND_PACKETS:
|
||||
// Do we have a message from the mesh?
|
||||
LOG_DEBUG("getFromRadio=STATE_SEND_PACKETS\n");
|
||||
LOG_INFO("getFromRadio=STATE_SEND_PACKETS\n");
|
||||
if (packetForPhone) {
|
||||
printPacket("phone downloaded packet", packetForPhone);
|
||||
|
||||
@@ -311,7 +311,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
|
||||
void PhoneAPI::handleDisconnect()
|
||||
{
|
||||
LOG_DEBUG("PhoneAPI disconnect\n");
|
||||
LOG_INFO("PhoneAPI disconnect\n");
|
||||
}
|
||||
|
||||
void PhoneAPI::releasePhonePacket()
|
||||
@@ -373,7 +373,7 @@ int PhoneAPI::onNotify(uint32_t newValue)
|
||||
// from idle)
|
||||
|
||||
if (state == STATE_SEND_PACKETS) {
|
||||
LOG_DEBUG("Telling client we have new packets %u\n", newValue);
|
||||
LOG_INFO("Telling client we have new packets %u\n", newValue);
|
||||
onNowHasData(newValue);
|
||||
} else
|
||||
LOG_DEBUG("(Client not yet interested in packets)\n");
|
||||
|
||||
@@ -70,7 +70,7 @@ template <class T> class ProtobufModule : protected SinglePortModule
|
||||
// it would be better to update even if the message was destined to others.
|
||||
|
||||
auto &p = mp.decoded;
|
||||
LOG_DEBUG("Received %s from=0x%0x, id=0x%x, portnum=%d, payloadlen=%d\n", name, mp.from, mp.id, p.portnum,
|
||||
LOG_INFO("Received %s from=0x%0x, id=0x%x, portnum=%d, payloadlen=%d\n", name, mp.from, mp.id, p.portnum,
|
||||
p.payload.size);
|
||||
|
||||
T scratch;
|
||||
@@ -80,7 +80,7 @@ template <class T> class ProtobufModule : protected SinglePortModule
|
||||
if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, fields, &scratch)) {
|
||||
decoded = &scratch;
|
||||
} else {
|
||||
LOG_DEBUG("Error decoding protobuf module!\n");
|
||||
LOG_ERROR("Error decoding protobuf module!\n");
|
||||
// if we can't decode it, nobody can process it!
|
||||
return ProcessMessage::STOP;
|
||||
}
|
||||
|
||||
@@ -68,11 +68,11 @@ bool RF95Interface::init()
|
||||
setTransmitEnable(false);
|
||||
|
||||
int res = lora->begin(getFreq(), bw, sf, cr, syncWord, power, currentLimit, preambleLength);
|
||||
LOG_DEBUG("RF95 init result %d\n", res);
|
||||
LOG_INFO("RF95 init result %d\n", res);
|
||||
|
||||
LOG_DEBUG("Frequency set to %f\n", getFreq());
|
||||
LOG_DEBUG("Bandwidth set to %f\n", bw);
|
||||
LOG_DEBUG("Power output set to %d\n", power);
|
||||
LOG_INFO("Frequency set to %f\n", getFreq());
|
||||
LOG_INFO("Bandwidth set to %f\n", bw);
|
||||
LOG_INFO("Power output set to %d\n", power);
|
||||
|
||||
// current limit was removed from module' ctor
|
||||
// override default value (60 mA)
|
||||
|
||||
@@ -117,7 +117,7 @@ void initRegion()
|
||||
for (; r->code != Config_LoRaConfig_RegionCode_UNSET && r->code != config.lora.region; r++)
|
||||
;
|
||||
myRegion = r;
|
||||
LOG_DEBUG("Wanted region %d, using %s\n", config.lora.region, r->name);
|
||||
LOG_INFO("Wanted region %d, using %s\n", config.lora.region, r->name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -284,7 +284,7 @@ bool RadioInterface::reconfigure()
|
||||
|
||||
bool RadioInterface::init()
|
||||
{
|
||||
LOG_DEBUG("Starting meshradio init...\n");
|
||||
LOG_INFO("Starting meshradio init...\n");
|
||||
|
||||
configChangedObserver.observe(&service.configChanged);
|
||||
preflightSleepObserver.observe(&preflightSleep);
|
||||
@@ -449,13 +449,13 @@ void RadioInterface::applyModemConfig()
|
||||
saveChannelNum(channel_num);
|
||||
saveFreq(freq + config.lora.frequency_offset);
|
||||
|
||||
LOG_DEBUG("Radio freq=%.3f, config.lora.frequency_offset=%.3f\n", freq, config.lora.frequency_offset);
|
||||
LOG_DEBUG("Set radio: region=%s, name=%s, config=%u, ch=%d, power=%d\n", myRegion->name, channelName, loraConfig.modem_preset, channel_num, power);
|
||||
LOG_DEBUG("Radio myRegion->freqStart -> myRegion->freqEnd: %f -> %f (%f mhz)\n", myRegion->freqStart, myRegion->freqEnd, myRegion->freqEnd - myRegion->freqStart);
|
||||
LOG_DEBUG("Radio myRegion->numChannels: %d x %.3fkHz\n", numChannels, bw);
|
||||
LOG_DEBUG("Radio channel_num: %d\n", channel_num);
|
||||
LOG_DEBUG("Radio frequency: %f\n", getFreq());
|
||||
LOG_DEBUG("Slot time: %u msec\n", slotTimeMsec);
|
||||
LOG_INFO("Radio freq=%.3f, config.lora.frequency_offset=%.3f\n", freq, config.lora.frequency_offset);
|
||||
LOG_INFO("Set radio: region=%s, name=%s, config=%u, ch=%d, power=%d\n", myRegion->name, channelName, loraConfig.modem_preset, channel_num, power);
|
||||
LOG_INFO("Radio myRegion->freqStart -> myRegion->freqEnd: %f -> %f (%f mhz)\n", myRegion->freqStart, myRegion->freqEnd, myRegion->freqEnd - myRegion->freqStart);
|
||||
LOG_INFO("Radio myRegion->numChannels: %d x %.3fkHz\n", numChannels, bw);
|
||||
LOG_INFO("Radio channel_num: %d\n", channel_num);
|
||||
LOG_INFO("Radio frequency: %f\n", getFreq());
|
||||
LOG_INFO("Slot time: %u msec\n", slotTimeMsec);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -470,11 +470,11 @@ void RadioInterface::limitPower()
|
||||
maxPower = myRegion->powerLimit;
|
||||
|
||||
if ((power > maxPower) && !devicestate.owner.is_licensed) {
|
||||
LOG_DEBUG("Lowering transmit power because of regulatory limits\n");
|
||||
LOG_INFO("Lowering transmit power because of regulatory limits\n");
|
||||
power = maxPower;
|
||||
}
|
||||
|
||||
LOG_DEBUG("Set radio: final power level=%d\n", power);
|
||||
LOG_INFO("Set radio: final power level=%d\n", power);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -82,17 +82,17 @@ bool RadioLibInterface::canSendImmediately()
|
||||
|
||||
if (busyTx || busyRx) {
|
||||
if (busyTx)
|
||||
LOG_DEBUG("Can not send yet, busyTx\n");
|
||||
LOG_WARN("Can not send yet, busyTx\n");
|
||||
// If we've been trying to send the same packet more than one minute and we haven't gotten a
|
||||
// TX IRQ from the radio, the radio is probably broken.
|
||||
if (busyTx && (millis() - lastTxStart > 60000)) {
|
||||
LOG_DEBUG("Hardware Failure! busyTx for more than 60s\n");
|
||||
LOG_ERROR("Hardware Failure! busyTx for more than 60s\n");
|
||||
RECORD_CRITICALERROR(CriticalErrorCode_TRANSMIT_FAILED);
|
||||
// reboot in 5 seconds when this condition occurs.
|
||||
rebootAtMsec = lastTxStart + 65000;
|
||||
}
|
||||
if (busyRx)
|
||||
LOG_DEBUG("Can not send yet, busyRx\n");
|
||||
LOG_WARN("Can not send yet, busyRx\n");
|
||||
return false;
|
||||
} else
|
||||
return true;
|
||||
@@ -111,13 +111,13 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
|
||||
|
||||
if (config.lora.region != Config_LoRaConfig_RegionCode_UNSET) {
|
||||
if (disabled || !config.lora.tx_enabled) {
|
||||
LOG_DEBUG("send - !config.lora.tx_enabled\n");
|
||||
LOG_WARN("send - !config.lora.tx_enabled\n");
|
||||
packetPool.release(p);
|
||||
return ERRNO_DISABLED;
|
||||
}
|
||||
|
||||
} else {
|
||||
LOG_DEBUG("send - lora tx disable because RegionCode_Unset\n");
|
||||
LOG_WARN("send - lora tx disable because RegionCode_Unset\n");
|
||||
packetPool.release(p);
|
||||
return ERRNO_DISABLED;
|
||||
}
|
||||
@@ -127,7 +127,7 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
|
||||
#else
|
||||
|
||||
if (disabled || !config.lora.tx_enabled) {
|
||||
LOG_DEBUG("send - !config.lora.tx_enabled\n");
|
||||
LOG_WARN("send - !config.lora.tx_enabled\n");
|
||||
packetPool.release(p);
|
||||
return ERRNO_DISABLED;
|
||||
}
|
||||
@@ -319,7 +319,7 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
|
||||
|
||||
int state = iface->readData(radiobuf, length);
|
||||
if (state != RADIOLIB_ERR_NONE) {
|
||||
LOG_DEBUG("ignoring received packet due to error=%d\n", state);
|
||||
LOG_ERROR("ignoring received packet due to error=%d\n", state);
|
||||
rxBad++;
|
||||
|
||||
airTime->logAirtime(RX_ALL_LOG, xmitMsec);
|
||||
@@ -331,7 +331,7 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
|
||||
|
||||
// check for short packets
|
||||
if (payloadLen < 0) {
|
||||
LOG_DEBUG("ignoring received packet too short\n");
|
||||
LOG_WARN("ignoring received packet too short\n");
|
||||
rxBad++;
|
||||
airTime->logAirtime(RX_ALL_LOG, xmitMsec);
|
||||
} else {
|
||||
@@ -374,7 +374,7 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
|
||||
{
|
||||
printPacket("Starting low level send", txp);
|
||||
if (disabled || !config.lora.tx_enabled) {
|
||||
LOG_DEBUG("startSend is dropping tx packet because we are disabled\n");
|
||||
LOG_WARN("startSend is dropping tx packet because we are disabled\n");
|
||||
packetPool.release(txp);
|
||||
} else {
|
||||
setStandby(); // Cancel any already in process receives
|
||||
@@ -385,7 +385,7 @@ ErrorCode RadioLibInterface::send(MeshPacket *p)
|
||||
|
||||
int res = iface->startTransmit(radiobuf, numbytes);
|
||||
if (res != RADIOLIB_ERR_NONE) {
|
||||
LOG_DEBUG("startTransmit failed, error=%d\n", res);
|
||||
LOG_ERROR("startTransmit failed, error=%d\n", res);
|
||||
RECORD_CRITICALERROR(CriticalErrorCode_RADIO_SPI_BUG);
|
||||
|
||||
// This send failed, but make sure to 'complete' it properly
|
||||
|
||||
@@ -136,7 +136,7 @@ void Router::sendAckNak(Routing_Error err, NodeNum to, PacketId idFrom, ChannelI
|
||||
|
||||
void Router::abortSendAndNak(Routing_Error err, MeshPacket *p)
|
||||
{
|
||||
LOG_DEBUG("Error=%d, returning NAK and dropping packet.\n", err);
|
||||
LOG_ERROR("Error=%d, returning NAK and dropping packet.\n", err);
|
||||
sendAckNak(Routing_Error_NO_INTERFACE, getFrom(p), p->id, p->channel);
|
||||
packetPool.release(p);
|
||||
}
|
||||
@@ -239,7 +239,7 @@ ErrorCode Router::send(MeshPacket *p)
|
||||
shouldActuallyEncrypt = false;
|
||||
}
|
||||
|
||||
LOG_DEBUG("Should encrypt MQTT?: %d\n", shouldActuallyEncrypt);
|
||||
LOG_INFO("Should encrypt MQTT?: %d\n", shouldActuallyEncrypt);
|
||||
|
||||
// the packet is currently in a decrypted state. send it now if they want decrypted packets
|
||||
if (mqtt && !shouldActuallyEncrypt)
|
||||
@@ -307,9 +307,9 @@ bool perhapsDecode(MeshPacket *p)
|
||||
// Take those raw bytes and convert them back into a well structured protobuf we can understand
|
||||
memset(&p->decoded, 0, sizeof(p->decoded));
|
||||
if (!pb_decode_from_bytes(bytes, rawSize, &Data_msg, &p->decoded)) {
|
||||
LOG_DEBUG("Invalid protobufs in received mesh packet (bad psk?)!\n");
|
||||
LOG_ERROR("Invalid protobufs in received mesh packet (bad psk?)!\n");
|
||||
} else if (p->decoded.portnum == PortNum_UNKNOWN_APP) {
|
||||
LOG_DEBUG("Invalid portnum (bad psk?)!\n");
|
||||
LOG_ERROR("Invalid portnum (bad psk?)!\n");
|
||||
} else {
|
||||
// parsing was successful
|
||||
p->which_payload_variant = MeshPacket_decoded_tag; // change type to decoded
|
||||
@@ -348,7 +348,7 @@ bool perhapsDecode(MeshPacket *p)
|
||||
}
|
||||
}
|
||||
|
||||
LOG_DEBUG("No suitable channel found for decoding, hash was 0x%x!\n", p->channel);
|
||||
LOG_WARN("No suitable channel found for decoding, hash was 0x%x!\n", p->channel);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ SX126xInterface<T>::SX126xInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq,
|
||||
SPIClass &spi)
|
||||
: RadioLibInterface(cs, irq, rst, busy, spi, &lora), lora(&module)
|
||||
{
|
||||
LOG_DEBUG("SX126xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy);
|
||||
LOG_WARN("SX126xInterface(cs=%d, irq=%d, rst=%d, busy=%d)\n", cs, irq, rst, busy);
|
||||
}
|
||||
|
||||
/// Initialise the Driver transport hardware and software.
|
||||
@@ -55,11 +55,11 @@ bool SX126xInterface<T>::init()
|
||||
|
||||
int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage, useRegulatorLDO);
|
||||
// \todo Display actual typename of the adapter, not just `SX126x`
|
||||
LOG_DEBUG("SX126x init result %d\n", res);
|
||||
LOG_INFO("SX126x init result %d\n", res);
|
||||
|
||||
LOG_DEBUG("Frequency set to %f\n", getFreq());
|
||||
LOG_DEBUG("Bandwidth set to %f\n", bw);
|
||||
LOG_DEBUG("Power output set to %d\n", power);
|
||||
LOG_INFO("Frequency set to %f\n", getFreq());
|
||||
LOG_INFO("Bandwidth set to %f\n", bw);
|
||||
LOG_INFO("Power output set to %d\n", power);
|
||||
|
||||
// current limit was removed from module' ctor
|
||||
// override default value (60 mA)
|
||||
|
||||
@@ -49,7 +49,7 @@ bool SX128xInterface<T>::init()
|
||||
|
||||
int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength);
|
||||
// \todo Display actual typename of the adapter, not just `SX128x`
|
||||
LOG_DEBUG("SX128x init result %d\n", res);
|
||||
LOG_INFO("SX128x init result %d\n", res);
|
||||
|
||||
if((config.lora.region != Config_LoRaConfig_RegionCode_LORA_24) && (res == RADIOLIB_ERR_INVALID_FREQUENCY)) {
|
||||
LOG_WARN("Radio chip only supports 2.4GHz LoRa. Adjusting Region and rebooting.\n");
|
||||
@@ -61,13 +61,13 @@ bool SX128xInterface<T>::init()
|
||||
#elif defined(ARCH_NRF52)
|
||||
NVIC_SystemReset();
|
||||
#else
|
||||
LOG_DEBUG("FIXME implement reboot for this platform. Skipping for now.\n");
|
||||
LOG_ERROR("FIXME implement reboot for this platform. Skipping for now.\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
LOG_DEBUG("Frequency set to %f\n", getFreq());
|
||||
LOG_DEBUG("Bandwidth set to %f\n", bw);
|
||||
LOG_DEBUG("Power output set to %d\n", power);
|
||||
LOG_INFO("Frequency set to %f\n", getFreq());
|
||||
LOG_INFO("Bandwidth set to %f\n", bw);
|
||||
LOG_INFO("Power output set to %d\n", power);
|
||||
|
||||
if (res == RADIOLIB_ERR_NONE)
|
||||
res = lora.setCRC(2);
|
||||
@@ -145,7 +145,7 @@ void SX128xInterface<T>::setStandby()
|
||||
int err = lora.standby();
|
||||
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
LOG_DEBUG("SX128x standby failed with error %d\n", err);
|
||||
LOG_ERROR("SX128x standby failed with error %d\n", err);
|
||||
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
|
||||
@@ -29,10 +29,10 @@ static int32_t reconnectETH()
|
||||
Ethernet.maintain();
|
||||
if (!ethStartupComplete) {
|
||||
// Start web server
|
||||
LOG_DEBUG("... Starting network services\n");
|
||||
LOG_INFO("... Starting network services\n");
|
||||
|
||||
#ifndef DISABLE_NTP
|
||||
LOG_DEBUG("Starting NTP time client\n");
|
||||
LOG_INFO("Starting NTP time client\n");
|
||||
timeClient.begin();
|
||||
timeClient.setUpdateInterval(60 * 60); // Update once an hour
|
||||
#endif
|
||||
@@ -51,7 +51,7 @@ static int32_t reconnectETH()
|
||||
#ifndef DISABLE_NTP
|
||||
if (isEthernetAvailable() && (ntp_renew < millis())) {
|
||||
|
||||
LOG_DEBUG("Updating NTP time from %s\n", config.network.ntp_server);
|
||||
LOG_INFO("Updating NTP time from %s\n", config.network.ntp_server);
|
||||
if (timeClient.update()) {
|
||||
LOG_DEBUG("NTP Request Success - Setting RTCQualityNTP if needed\n");
|
||||
|
||||
@@ -64,7 +64,7 @@ static int32_t reconnectETH()
|
||||
ntp_renew = millis() + 43200 * 1000; // success, refresh every 12 hours
|
||||
|
||||
} else {
|
||||
LOG_DEBUG("NTP Update failed\n");
|
||||
LOG_ERROR("NTP Update failed\n");
|
||||
ntp_renew = millis() + 300 * 1000; // failure, retry every 5 minutes
|
||||
}
|
||||
}
|
||||
@@ -96,32 +96,32 @@ bool initEthernet()
|
||||
getMacAddr(mac); // FIXME use the BLE MAC for now...
|
||||
|
||||
if (config.network.eth_mode == Config_NetworkConfig_EthMode_DHCP) {
|
||||
LOG_DEBUG("starting Ethernet DHCP\n");
|
||||
LOG_INFO("starting Ethernet DHCP\n");
|
||||
status = Ethernet.begin(mac);
|
||||
} else if (config.network.eth_mode == Config_NetworkConfig_EthMode_STATIC) {
|
||||
LOG_DEBUG("starting Ethernet Static\n");
|
||||
LOG_INFO("starting Ethernet Static\n");
|
||||
Ethernet.begin(mac, config.network.ipv4_config.ip, config.network.ipv4_config.dns, config.network.ipv4_config.subnet);
|
||||
} else {
|
||||
LOG_DEBUG("Ethernet Disabled\n");
|
||||
LOG_INFO("Ethernet Disabled\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (status == 0) {
|
||||
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
|
||||
LOG_DEBUG("Ethernet shield was not found.\n");
|
||||
LOG_ERROR("Ethernet shield was not found.\n");
|
||||
return false;
|
||||
} else if (Ethernet.linkStatus() == LinkOFF) {
|
||||
LOG_DEBUG("Ethernet cable is not connected.\n");
|
||||
LOG_ERROR("Ethernet cable is not connected.\n");
|
||||
return false;
|
||||
} else{
|
||||
LOG_DEBUG("Unknown Ethernet error.\n");
|
||||
LOG_ERROR("Unknown Ethernet error.\n");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
LOG_DEBUG("Local IP %u.%u.%u.%u\n",Ethernet.localIP()[0], Ethernet.localIP()[1], Ethernet.localIP()[2], Ethernet.localIP()[3]);
|
||||
LOG_DEBUG("Subnet Mask %u.%u.%u.%u\n",Ethernet.subnetMask()[0], Ethernet.subnetMask()[1], Ethernet.subnetMask()[2], Ethernet.subnetMask()[3]);
|
||||
LOG_DEBUG("Gateway IP %u.%u.%u.%u\n",Ethernet.gatewayIP()[0], Ethernet.gatewayIP()[1], Ethernet.gatewayIP()[2], Ethernet.gatewayIP()[3]);
|
||||
LOG_DEBUG("DNS Server IP %u.%u.%u.%u\n",Ethernet.dnsServerIP()[0], Ethernet.dnsServerIP()[1], Ethernet.dnsServerIP()[2], Ethernet.dnsServerIP()[3]);
|
||||
LOG_INFO("Local IP %u.%u.%u.%u\n",Ethernet.localIP()[0], Ethernet.localIP()[1], Ethernet.localIP()[2], Ethernet.localIP()[3]);
|
||||
LOG_INFO("Subnet Mask %u.%u.%u.%u\n",Ethernet.subnetMask()[0], Ethernet.subnetMask()[1], Ethernet.subnetMask()[2], Ethernet.subnetMask()[3]);
|
||||
LOG_INFO("Gateway IP %u.%u.%u.%u\n",Ethernet.gatewayIP()[0], Ethernet.gatewayIP()[1], Ethernet.gatewayIP()[2], Ethernet.gatewayIP()[3]);
|
||||
LOG_INFO("DNS Server IP %u.%u.%u.%u\n",Ethernet.dnsServerIP()[0], Ethernet.dnsServerIP()[1], Ethernet.dnsServerIP()[2], Ethernet.dnsServerIP()[3]);
|
||||
}
|
||||
|
||||
ethEvent = new Periodic("ethConnect", reconnectETH);
|
||||
@@ -129,7 +129,7 @@ bool initEthernet()
|
||||
return true;
|
||||
|
||||
} else {
|
||||
LOG_DEBUG("Not using Ethernet\n");
|
||||
LOG_INFO("Not using Ethernet\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,14 +9,14 @@ void initApiServer(int port)
|
||||
// Start API server on port 4403
|
||||
if (!apiPort) {
|
||||
apiPort = new ethServerPort(port);
|
||||
LOG_DEBUG("API server listening on TCP port %d\n", port);
|
||||
LOG_INFO("API server listening on TCP port %d\n", port);
|
||||
apiPort->init();
|
||||
}
|
||||
}
|
||||
|
||||
ethServerAPI::ethServerAPI(EthernetClient &_client) : StreamAPI(&client), concurrency::OSThread("ethServerAPI"), client(_client)
|
||||
{
|
||||
LOG_DEBUG("Incoming ethernet connection\n");
|
||||
LOG_INFO("Incoming ethernet connection\n");
|
||||
}
|
||||
|
||||
ethServerAPI::~ethServerAPI()
|
||||
@@ -44,7 +44,7 @@ int32_t ethServerAPI::runOnce()
|
||||
if (client.connected()) {
|
||||
return StreamAPI::runOncePart();
|
||||
} else {
|
||||
LOG_DEBUG("Client dropped connection, suspending API service\n");
|
||||
LOG_INFO("Client dropped connection, suspending API service\n");
|
||||
enabled = false; // we no longer need to run
|
||||
return 0;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ int32_t ethServerPort::runOnce()
|
||||
if (client) {
|
||||
// Close any previous connection (see FIXME in header file)
|
||||
if (openAPI) {
|
||||
LOG_DEBUG("Force closing previous TCP connection\n");
|
||||
LOG_WARN("Force closing previous TCP connection\n");
|
||||
delete openAPI;
|
||||
}
|
||||
|
||||
|
||||
@@ -335,7 +335,7 @@ void handleFsDeleteStatic(HTTPRequest *req, HTTPResponse *res)
|
||||
if (params->getQueryParameter("delete", paramValDelete)) {
|
||||
std::string pathDelete = "/" + paramValDelete;
|
||||
if (FSCom.remove(pathDelete.c_str())) {
|
||||
Serial.println(pathDelete.c_str());
|
||||
LOG_INFO("%s\n", pathDelete.c_str());
|
||||
JSONObject jsonObjOuter;
|
||||
jsonObjOuter["status"] = new JSONValue("ok");
|
||||
JSONValue *value = new JSONValue(jsonObjOuter);
|
||||
@@ -343,7 +343,7 @@ void handleFsDeleteStatic(HTTPRequest *req, HTTPResponse *res)
|
||||
delete value;
|
||||
return;
|
||||
} else {
|
||||
Serial.println(pathDelete.c_str());
|
||||
LOG_INFO("%s\n", pathDelete.c_str());
|
||||
JSONObject jsonObjOuter;
|
||||
jsonObjOuter["status"] = new JSONValue("Error");
|
||||
JSONValue *value = new JSONValue(jsonObjOuter);
|
||||
@@ -379,13 +379,13 @@ void handleStatic(HTTPRequest *req, HTTPResponse *res)
|
||||
if (FSCom.exists(filename.c_str())) {
|
||||
file = FSCom.open(filename.c_str());
|
||||
if (!file.available()) {
|
||||
LOG_DEBUG("File not available - %s\n", filename.c_str());
|
||||
LOG_WARN("File not available - %s\n", filename.c_str());
|
||||
}
|
||||
} else if (FSCom.exists(filenameGzip.c_str())) {
|
||||
file = FSCom.open(filenameGzip.c_str());
|
||||
res->setHeader("Content-Encoding", "gzip");
|
||||
if (!file.available()) {
|
||||
LOG_DEBUG("File not available - %s\n", filenameGzip.c_str());
|
||||
LOG_WARN("File not available - %s\n", filenameGzip.c_str());
|
||||
}
|
||||
} else {
|
||||
has_set_content_type = true;
|
||||
@@ -393,7 +393,7 @@ void handleStatic(HTTPRequest *req, HTTPResponse *res)
|
||||
file = FSCom.open(filenameGzip.c_str());
|
||||
res->setHeader("Content-Type", "text/html");
|
||||
if (!file.available()) {
|
||||
LOG_DEBUG("File not available - %s\n", filenameGzip.c_str());
|
||||
LOG_WARN("File not available - %s\n", filenameGzip.c_str());
|
||||
res->println("Web server is running.<br><br>The content you are looking for can't be found. Please see: <a "
|
||||
"href=https://meshtastic.org/docs/getting-started/faq#wifi--web-browser>FAQ</a>.<br><br><a "
|
||||
"href=/admin>admin</a>");
|
||||
@@ -437,7 +437,7 @@ void handleStatic(HTTPRequest *req, HTTPResponse *res)
|
||||
return;
|
||||
|
||||
} else {
|
||||
LOG_DEBUG("ERROR: This should not have happened...\n");
|
||||
LOG_ERROR("This should not have happened...\n");
|
||||
res->println("ERROR: This should not have happened...");
|
||||
}
|
||||
}
|
||||
@@ -472,7 +472,7 @@ void handleFormUpload(HTTPRequest *req, HTTPResponse *res)
|
||||
LOG_DEBUG("Form Upload - multipart/form-data\n");
|
||||
parser = new HTTPMultipartBodyParser(req);
|
||||
} else {
|
||||
Serial.printf("Unknown POST Content-Type: %s\n", contentType.c_str());
|
||||
LOG_DEBUG("Unknown POST Content-Type: %s\n", contentType.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -671,7 +671,7 @@ void handleReport(HTTPRequest *req, HTTPResponse *res)
|
||||
*/
|
||||
void handleHotspot(HTTPRequest *req, HTTPResponse *res)
|
||||
{
|
||||
LOG_DEBUG("Hotspot Request\n");
|
||||
LOG_INFO("Hotspot Request\n");
|
||||
|
||||
/*
|
||||
If we don't do a redirect, be sure to return a "Success" message
|
||||
@@ -697,7 +697,7 @@ void handleDeleteFsContent(HTTPRequest *req, HTTPResponse *res)
|
||||
res->println("<h1>Meshtastic</h1>\n");
|
||||
res->println("Deleting Content in /static/*");
|
||||
|
||||
LOG_DEBUG("Deleting files from /static/* : \n");
|
||||
LOG_INFO("Deleting files from /static/* : \n");
|
||||
|
||||
htmlDeleteDir("/static");
|
||||
|
||||
|
||||
@@ -74,13 +74,13 @@ static void taskCreateCert(void *parameter)
|
||||
prefs.remove("cert");
|
||||
#endif
|
||||
|
||||
LOG_DEBUG("Checking if we have a previously saved SSL Certificate.\n");
|
||||
LOG_INFO("Checking if we have a previously saved SSL Certificate.\n");
|
||||
|
||||
size_t pkLen = prefs.getBytesLength("PK");
|
||||
size_t certLen = prefs.getBytesLength("cert");
|
||||
|
||||
if (pkLen && certLen) {
|
||||
LOG_DEBUG("Existing SSL Certificate found!\n");
|
||||
LOG_INFO("Existing SSL Certificate found!\n");
|
||||
|
||||
uint8_t *pkBuffer = new uint8_t[pkLen];
|
||||
prefs.getBytes("PK", pkBuffer, pkLen);
|
||||
@@ -95,7 +95,7 @@ static void taskCreateCert(void *parameter)
|
||||
|
||||
} else {
|
||||
|
||||
LOG_DEBUG("Creating the certificate. This may take a while. Please wait...\n");
|
||||
LOG_INFO("Creating the certificate. This may take a while. Please wait...\n");
|
||||
yield();
|
||||
cert = new SSLCert();
|
||||
yield();
|
||||
@@ -104,10 +104,10 @@ static void taskCreateCert(void *parameter)
|
||||
yield();
|
||||
|
||||
if (createCertResult != 0) {
|
||||
LOG_DEBUG("Creating the certificate failed\n");
|
||||
LOG_ERROR("Creating the certificate failed\n");
|
||||
|
||||
} else {
|
||||
LOG_DEBUG("Creating the certificate was successful\n");
|
||||
LOG_INFO("Creating the certificate was successful\n");
|
||||
|
||||
LOG_DEBUG("Created Private Key: %d Bytes\n", cert->getPKLength());
|
||||
|
||||
@@ -159,7 +159,7 @@ void createSSLCert()
|
||||
runLoop = true;
|
||||
}
|
||||
}
|
||||
LOG_DEBUG("SSL Cert Ready!\n");
|
||||
LOG_INFO("SSL Cert Ready!\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,15 +191,15 @@ void initWebServer()
|
||||
registerHandlers(insecureServer, secureServer);
|
||||
|
||||
if (secureServer) {
|
||||
LOG_DEBUG("Starting Secure Web Server...\n");
|
||||
LOG_INFO("Starting Secure Web Server...\n");
|
||||
secureServer->start();
|
||||
}
|
||||
LOG_DEBUG("Starting Insecure Web Server...\n");
|
||||
LOG_INFO("Starting Insecure Web Server...\n");
|
||||
insecureServer->start();
|
||||
if (insecureServer->isRunning()) {
|
||||
LOG_DEBUG("Web Servers Ready! :-) \n");
|
||||
LOG_INFO("Web Servers Ready! :-) \n");
|
||||
isWebServerReady = true;
|
||||
} else {
|
||||
LOG_DEBUG("Web Servers Failed! ;-( \n");
|
||||
LOG_ERROR("Web Servers Failed! ;-( \n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ static int32_t reconnectWiFi()
|
||||
// Make sure we clear old connection credentials
|
||||
WiFi.disconnect(false, true);
|
||||
|
||||
LOG_DEBUG("Reconnecting to WiFi access point %s\n",wifiName);
|
||||
LOG_INFO("Reconnecting to WiFi access point %s\n",wifiName);
|
||||
|
||||
WiFi.mode(WIFI_MODE_STA);
|
||||
WiFi.begin(wifiName, wifiPsw);
|
||||
@@ -101,12 +101,12 @@ bool isWifiAvailable()
|
||||
// Disable WiFi
|
||||
void deinitWifi()
|
||||
{
|
||||
LOG_DEBUG("WiFi deinit\n");
|
||||
LOG_INFO("WiFi deinit\n");
|
||||
|
||||
if (isWifiAvailable()) {
|
||||
WiFi.disconnect(true);
|
||||
WiFi.mode(WIFI_MODE_NULL);
|
||||
LOG_DEBUG("WiFi Turned Off\n");
|
||||
LOG_INFO("WiFi Turned Off\n");
|
||||
// WiFi.printDiag(Serial);
|
||||
}
|
||||
}
|
||||
@@ -115,20 +115,20 @@ static void onNetworkConnected()
|
||||
{
|
||||
if (!APStartupComplete) {
|
||||
// Start web server
|
||||
LOG_DEBUG("Starting network services\n");
|
||||
LOG_INFO("Starting network services\n");
|
||||
|
||||
// start mdns
|
||||
if (!MDNS.begin("Meshtastic")) {
|
||||
LOG_DEBUG("Error setting up MDNS responder!\n");
|
||||
LOG_ERROR("Error setting up MDNS responder!\n");
|
||||
} else {
|
||||
LOG_DEBUG("mDNS responder started\n");
|
||||
LOG_DEBUG("mDNS Host: Meshtastic.local\n");
|
||||
LOG_INFO("mDNS responder started\n");
|
||||
LOG_INFO("mDNS Host: Meshtastic.local\n");
|
||||
MDNS.addService("http", "tcp", 80);
|
||||
MDNS.addService("https", "tcp", 443);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_NTP
|
||||
LOG_DEBUG("Starting NTP time client\n");
|
||||
LOG_INFO("Starting NTP time client\n");
|
||||
timeClient.begin();
|
||||
timeClient.setUpdateInterval(60 * 60); // Update once an hour
|
||||
#endif
|
||||
@@ -182,8 +182,7 @@ bool initWifi()
|
||||
|
||||
WiFi.onEvent(
|
||||
[](WiFiEvent_t event, WiFiEventInfo_t info) {
|
||||
Serial.print("WiFi lost connection. Reason: ");
|
||||
Serial.println(info.wifi_sta_disconnected.reason);
|
||||
LOG_WARN("WiFi lost connection. Reason: %s", info.wifi_sta_disconnected.reason);
|
||||
|
||||
/*
|
||||
If we are disconnected from the AP for some reason,
|
||||
@@ -201,7 +200,7 @@ bool initWifi()
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
LOG_DEBUG("Not using WIFI\n");
|
||||
LOG_INFO("Not using WIFI\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -213,133 +212,131 @@ static void WiFiEvent(WiFiEvent_t event)
|
||||
|
||||
switch (event) {
|
||||
case ARDUINO_EVENT_WIFI_READY:
|
||||
LOG_DEBUG("WiFi interface ready\n");
|
||||
LOG_INFO("WiFi interface ready\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_SCAN_DONE:
|
||||
LOG_DEBUG("Completed scan for access points\n");
|
||||
LOG_INFO("Completed scan for access points\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_START:
|
||||
LOG_DEBUG("WiFi station started\n");
|
||||
LOG_INFO("WiFi station started\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_STOP:
|
||||
LOG_DEBUG("WiFi station stopped\n");
|
||||
LOG_INFO("WiFi station stopped\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_CONNECTED:
|
||||
LOG_DEBUG("Connected to access point\n");
|
||||
LOG_INFO("Connected to access point\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_DISCONNECTED:
|
||||
LOG_DEBUG("Disconnected from WiFi access point\n");
|
||||
LOG_INFO("Disconnected from WiFi access point\n");
|
||||
WiFi.disconnect(false, true);
|
||||
needReconnect = true;
|
||||
wifiReconnect->setIntervalFromNow(1000);
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_AUTHMODE_CHANGE:
|
||||
LOG_DEBUG("Authentication mode of access point has changed\n");
|
||||
LOG_INFO("Authentication mode of access point has changed\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_GOT_IP:
|
||||
LOG_DEBUG("Obtained IP address: ");
|
||||
Serial.println(WiFi.localIP());
|
||||
LOG_INFO("Obtained IP address: ", WiFi.localIPv6());
|
||||
onNetworkConnected();
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_GOT_IP6:
|
||||
LOG_DEBUG("Obtained IP6 address: ");
|
||||
Serial.println(WiFi.localIPv6());
|
||||
LOG_INFO("Obtained IP6 address: %s", WiFi.localIPv6());
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_LOST_IP:
|
||||
LOG_DEBUG("Lost IP address and IP address is reset to 0\n");
|
||||
LOG_INFO("Lost IP address and IP address is reset to 0\n");
|
||||
WiFi.disconnect(false, true);
|
||||
needReconnect = true;
|
||||
wifiReconnect->setIntervalFromNow(1000);
|
||||
break;
|
||||
case ARDUINO_EVENT_WPS_ER_SUCCESS:
|
||||
LOG_DEBUG("WiFi Protected Setup (WPS): succeeded in enrollee mode\n");
|
||||
LOG_INFO("WiFi Protected Setup (WPS): succeeded in enrollee mode\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WPS_ER_FAILED:
|
||||
LOG_DEBUG("WiFi Protected Setup (WPS): failed in enrollee mode\n");
|
||||
LOG_INFO("WiFi Protected Setup (WPS): failed in enrollee mode\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WPS_ER_TIMEOUT:
|
||||
LOG_DEBUG("WiFi Protected Setup (WPS): timeout in enrollee mode\n");
|
||||
LOG_INFO("WiFi Protected Setup (WPS): timeout in enrollee mode\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WPS_ER_PIN:
|
||||
LOG_DEBUG("WiFi Protected Setup (WPS): pin code in enrollee mode\n");
|
||||
LOG_INFO("WiFi Protected Setup (WPS): pin code in enrollee mode\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WPS_ER_PBC_OVERLAP:
|
||||
LOG_DEBUG("WiFi Protected Setup (WPS): push button overlap in enrollee mode\n");
|
||||
LOG_INFO("WiFi Protected Setup (WPS): push button overlap in enrollee mode\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_AP_START:
|
||||
LOG_DEBUG("WiFi access point started\n");
|
||||
LOG_INFO("WiFi access point started\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_AP_STOP:
|
||||
LOG_DEBUG("WiFi access point stopped\n");
|
||||
LOG_INFO("WiFi access point stopped\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_AP_STACONNECTED:
|
||||
LOG_DEBUG("Client connected\n");
|
||||
LOG_INFO("Client connected\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_AP_STADISCONNECTED:
|
||||
LOG_DEBUG("Client disconnected\n");
|
||||
LOG_INFO("Client disconnected\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_AP_STAIPASSIGNED:
|
||||
LOG_DEBUG("Assigned IP address to client\n");
|
||||
LOG_INFO("Assigned IP address to client\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_AP_PROBEREQRECVED:
|
||||
LOG_DEBUG("Received probe request\n");
|
||||
LOG_INFO("Received probe request\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_AP_GOT_IP6:
|
||||
LOG_DEBUG("IPv6 is preferred\n");
|
||||
LOG_INFO("IPv6 is preferred\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_FTM_REPORT:
|
||||
LOG_DEBUG("Fast Transition Management report\n");
|
||||
LOG_INFO("Fast Transition Management report\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_START:
|
||||
LOG_DEBUG("Ethernet started\n");
|
||||
LOG_INFO("Ethernet started\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_STOP:
|
||||
LOG_DEBUG("Ethernet stopped\n");
|
||||
LOG_INFO("Ethernet stopped\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_CONNECTED:
|
||||
LOG_DEBUG("Ethernet connected\n");
|
||||
LOG_INFO("Ethernet connected\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_DISCONNECTED:
|
||||
LOG_DEBUG("Ethernet disconnected\n");
|
||||
LOG_INFO("Ethernet disconnected\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_GOT_IP:
|
||||
LOG_DEBUG("Obtained IP address (ARDUINO_EVENT_ETH_GOT_IP)\n");
|
||||
LOG_INFO("Obtained IP address (ARDUINO_EVENT_ETH_GOT_IP)\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_GOT_IP6:
|
||||
LOG_DEBUG("Obtained IP6 address (ARDUINO_EVENT_ETH_GOT_IP6)\n");
|
||||
LOG_INFO("Obtained IP6 address (ARDUINO_EVENT_ETH_GOT_IP6)\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_SC_SCAN_DONE:
|
||||
LOG_DEBUG("SmartConfig: Scan done\n");
|
||||
LOG_INFO("SmartConfig: Scan done\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_SC_FOUND_CHANNEL:
|
||||
LOG_DEBUG("SmartConfig: Found channel\n");
|
||||
LOG_INFO("SmartConfig: Found channel\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_SC_GOT_SSID_PSWD:
|
||||
LOG_DEBUG("SmartConfig: Got SSID and password\n");
|
||||
LOG_INFO("SmartConfig: Got SSID and password\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_SC_SEND_ACK_DONE:
|
||||
LOG_DEBUG("SmartConfig: Send ACK done\n");
|
||||
LOG_INFO("SmartConfig: Send ACK done\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_PROV_INIT:
|
||||
LOG_DEBUG("Provisioning: Init\n");
|
||||
LOG_INFO("Provisioning: Init\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_PROV_DEINIT:
|
||||
LOG_DEBUG("Provisioning: Stopped\n");
|
||||
LOG_INFO("Provisioning: Stopped\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_PROV_START:
|
||||
LOG_DEBUG("Provisioning: Started\n");
|
||||
LOG_INFO("Provisioning: Started\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_PROV_END:
|
||||
LOG_DEBUG("Provisioning: End\n");
|
||||
LOG_INFO("Provisioning: End\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_PROV_CRED_RECV:
|
||||
LOG_DEBUG("Provisioning: Credentials received\n");
|
||||
LOG_INFO("Provisioning: Credentials received\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_PROV_CRED_FAIL:
|
||||
LOG_DEBUG("Provisioning: Credentials failed\n");
|
||||
LOG_INFO("Provisioning: Credentials failed\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_PROV_CRED_SUCCESS:
|
||||
LOG_DEBUG("Provisioning: Credentials success\n");
|
||||
LOG_INFO("Provisioning: Credentials success\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -12,7 +12,7 @@ size_t pb_encode_to_bytes(uint8_t *destbuf, size_t destbufsize, const pb_msgdesc
|
||||
{
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(destbuf, destbufsize);
|
||||
if (!pb_encode(&stream, fields, src_struct)) {
|
||||
LOG_DEBUG("Panic: can't encode protobuf reason='%s'\n", PB_GET_ERROR(&stream));
|
||||
LOG_ERROR("Panic: can't encode protobuf reason='%s'\n", PB_GET_ERROR(&stream));
|
||||
assert(0); // If this asser fails it probably means you made a field too large for the max limits specified in mesh.options
|
||||
} else {
|
||||
return stream.bytes_written;
|
||||
@@ -24,7 +24,7 @@ bool pb_decode_from_bytes(const uint8_t *srcbuf, size_t srcbufsize, const pb_msg
|
||||
{
|
||||
pb_istream_t stream = pb_istream_from_buffer(srcbuf, srcbufsize);
|
||||
if (!pb_decode(&stream, fields, dest_struct)) {
|
||||
LOG_DEBUG("Error: can't decode protobuf reason='%s', pb_msgdesc 0x%p\n", PB_GET_ERROR(&stream), fields);
|
||||
LOG_ERROR("Can't decode protobuf reason='%s', pb_msgdesc 0x%p\n", PB_GET_ERROR(&stream), fields);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
||||
@@ -9,14 +9,14 @@ void initApiServer(int port)
|
||||
// Start API server on port 4403
|
||||
if (!apiPort) {
|
||||
apiPort = new WiFiServerPort(port);
|
||||
LOG_DEBUG("API server listening on TCP port %d\n", port);
|
||||
LOG_INFO("API server listening on TCP port %d\n", port);
|
||||
apiPort->init();
|
||||
}
|
||||
}
|
||||
|
||||
WiFiServerAPI::WiFiServerAPI(WiFiClient &_client) : StreamAPI(&client), concurrency::OSThread("WiFiServerAPI"), client(_client)
|
||||
{
|
||||
LOG_DEBUG("Incoming wifi connection\n");
|
||||
LOG_INFO("Incoming wifi connection\n");
|
||||
}
|
||||
|
||||
WiFiServerAPI::~WiFiServerAPI()
|
||||
@@ -44,7 +44,7 @@ int32_t WiFiServerAPI::runOnce()
|
||||
if (client.connected()) {
|
||||
return StreamAPI::runOncePart();
|
||||
} else {
|
||||
LOG_DEBUG("Client dropped connection, suspending API service\n");
|
||||
LOG_INFO("Client dropped connection, suspending API service\n");
|
||||
enabled = false; // we no longer need to run
|
||||
return 0;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ int32_t WiFiServerPort::runOnce()
|
||||
if (client) {
|
||||
// Close any previous connection (see FIXME in header file)
|
||||
if (openAPI) {
|
||||
LOG_DEBUG("Force closing previous TCP connection\n");
|
||||
LOG_INFO("Force closing previous TCP connection\n");
|
||||
delete openAPI;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user