mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-15 01:22:04 +00:00
better debug output
This commit is contained in:
parent
5af122b39d
commit
0096f54ae9
@ -5,7 +5,7 @@
|
|||||||
Minimum items needed to make sure hardware is good.
|
Minimum items needed to make sure hardware is good.
|
||||||
|
|
||||||
- add a hard fault handler
|
- add a hard fault handler
|
||||||
- at boot we are starting our message IDs at 1, rather we should start them at a random number. also, seed random based on timer. this could be the cause of our first message not seen bug. keep packet sequence number in **attribute** ((section (".noinit")))
|
- at boot we are starting our message IDs at 1, rather we should start them at a random number. also, seed random based on timer. this could be the cause of our first message not seen bug.
|
||||||
- use "variants" to get all gpio bindings
|
- use "variants" to get all gpio bindings
|
||||||
- plug in correct variants for the real board
|
- plug in correct variants for the real board
|
||||||
- Use the PMU driver on real hardware
|
- Use the PMU driver on real hardware
|
||||||
|
@ -61,7 +61,8 @@ static Periodic sendOwnerPeriod(sendOwnerCb);
|
|||||||
// FIXME, move this someplace better
|
// FIXME, move this someplace better
|
||||||
PacketId generatePacketId()
|
PacketId generatePacketId()
|
||||||
{
|
{
|
||||||
static uint32_t i;
|
static uint32_t i __attribute__((
|
||||||
|
section(".noinit"))); // We try to keep this in noinit so that hopefully it keeps increasing even across reboots
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
return (i % NUM_PACKET_ID) + 1; // return number between 1 and 255
|
return (i % NUM_PACKET_ID) + 1; // return number between 1 and 255
|
||||||
|
@ -89,8 +89,8 @@ void RF95Interface::setStandby()
|
|||||||
assert(err == ERR_NONE);
|
assert(err == ERR_NONE);
|
||||||
|
|
||||||
isReceiving = false; // If we were receiving, not any more
|
isReceiving = false; // If we were receiving, not any more
|
||||||
completeSending(); // If we were sending, not anymore
|
|
||||||
disableInterrupt();
|
disableInterrupt();
|
||||||
|
completeSending(); // If we were sending, not anymore
|
||||||
}
|
}
|
||||||
|
|
||||||
void RF95Interface::startReceive()
|
void RF95Interface::startReceive()
|
||||||
|
@ -101,8 +101,8 @@ bool RadioLibInterface::canSleep()
|
|||||||
|
|
||||||
void RadioLibInterface::loop()
|
void RadioLibInterface::loop()
|
||||||
{
|
{
|
||||||
PendingISR wasPending = pending; // atomic read
|
PendingISR wasPending;
|
||||||
if (wasPending) {
|
while ((wasPending = pending) != 0) { // atomic read
|
||||||
pending = ISR_NONE; // If the flag was set, it is _guaranteed_ the ISR won't be running, because it masked itself
|
pending = ISR_NONE; // If the flag was set, it is _guaranteed_ the ISR won't be running, because it masked itself
|
||||||
|
|
||||||
if (wasPending == ISR_TX)
|
if (wasPending == ISR_TX)
|
||||||
@ -130,8 +130,8 @@ void RadioLibInterface::startNextWork()
|
|||||||
|
|
||||||
void RadioLibInterface::handleTransmitInterrupt()
|
void RadioLibInterface::handleTransmitInterrupt()
|
||||||
{
|
{
|
||||||
DEBUG_MSG("handling lora TX interrupt\n");
|
// DEBUG_MSG("handling lora TX interrupt\n");
|
||||||
assert(sendingPacket); // Were we sending?
|
assert(sendingPacket); // Were we sending? - FIXME, this was null coming out of light sleep due to RF95 ISR!
|
||||||
|
|
||||||
completeSending();
|
completeSending();
|
||||||
}
|
}
|
||||||
@ -140,6 +140,7 @@ void RadioLibInterface::completeSending()
|
|||||||
{
|
{
|
||||||
if (sendingPacket) {
|
if (sendingPacket) {
|
||||||
txGood++;
|
txGood++;
|
||||||
|
DEBUG_MSG("Completed sending to=0x%x, id=%u\n", sendingPacket->to, sendingPacket->id);
|
||||||
|
|
||||||
// We are done sending that packet, release it
|
// We are done sending that packet, release it
|
||||||
packetPool.release(sendingPacket);
|
packetPool.release(sendingPacket);
|
||||||
@ -153,8 +154,6 @@ void RadioLibInterface::handleReceiveInterrupt()
|
|||||||
assert(isReceiving);
|
assert(isReceiving);
|
||||||
isReceiving = false;
|
isReceiving = false;
|
||||||
|
|
||||||
DEBUG_MSG("handling lora RX interrupt\n");
|
|
||||||
|
|
||||||
// read the number of actually received bytes
|
// read the number of actually received bytes
|
||||||
size_t length = iface->getPacketLength();
|
size_t length = iface->getPacketLength();
|
||||||
|
|
||||||
@ -195,6 +194,7 @@ void RadioLibInterface::handleReceiveInterrupt()
|
|||||||
// parsing was successful, queue for our recipient
|
// parsing was successful, queue for our recipient
|
||||||
mp->has_payload = true;
|
mp->has_payload = true;
|
||||||
rxGood++;
|
rxGood++;
|
||||||
|
DEBUG_MSG("Lora RX interrupt from=0x%x, id=%u\n", mp->from, mp->id);
|
||||||
|
|
||||||
deliverToReceiver(mp);
|
deliverToReceiver(mp);
|
||||||
}
|
}
|
||||||
|
@ -75,14 +75,15 @@ void SX1262Interface::setStandby()
|
|||||||
assert(err == ERR_NONE);
|
assert(err == ERR_NONE);
|
||||||
|
|
||||||
isReceiving = false; // If we were receiving, not any more
|
isReceiving = false; // If we were receiving, not any more
|
||||||
completeSending(); // If we were sending, not anymore
|
|
||||||
disableInterrupt();
|
disableInterrupt();
|
||||||
|
completeSending(); // If we were sending, not anymore
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add SNR data to received messages
|
* Add SNR data to received messages
|
||||||
*/
|
*/
|
||||||
void SX1262Interface::addReceiveMetadata(MeshPacket *mp) {
|
void SX1262Interface::addReceiveMetadata(MeshPacket *mp)
|
||||||
|
{
|
||||||
mp->rx_snr = lora.getSNR();
|
mp->rx_snr = lora.getSNR();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user