Custom Firmware

Vi har modifierat den officiella Meshtastic-firmwaren för att bättre möta våra behov och användningssätt. Endast vältestade versioner publiceras här.

I dagsläget stöds följande hårdvaruplattformar: RAK4631, Heltec V3 och LILYGO T-LoRa T3-S3. För ESP32-baserade enheter erbjuder vi en egen webbaserad flasher – observera att denna fortfarande är under testning och kan innehålla buggar.

Kodändringar

Nedan är de ändringars som gjort i den senaste firmwaren. Äldre versioner kan ha andra ändringar.

NeighborInfoModule.cpp

Tillåt sändning av Neighbor info över default kanalen.

int32_t NeighborInfoModule::runOnce()
{
    if (moduleConfig.neighbor_info.transmit_over_lora &&
-       (!channels.isDefaultChannel(channels.getPrimaryIndex()) || !RadioInterface::uses_default_frequency_slot) &&
        airTime->isTxAllowedChannelUtil(true) && airTime->isTxAllowedAirUtil()) {
        sendNeighborInfo(NODENUM_BROADCAST, false);
    } else {
        sendNeighborInfo(NODENUM_BROADCAST_NO_LORA, false);
    }
    return Default::getConfiguredOrDefaultMs(moduleConfig.neighbor_info.update_interval, default_neighbor_info_broadcast_secs);
}

Behåll noder längre i neighbor info databasen. Då noder inte sänder nodinfo om channel utilization är för hög så vill vi låta dom vara kvar lite längre.

void NeighborInfoModule::cleanUpNeighbors()
{
    uint32_t now = getTime();
    NodeNum my_node_id = nodeDB->getNodeNum();
    for (auto it = neighbors.rbegin(); it != neighbors.rend();) {
        // We will remove a neighbor if we haven't heard from them in twice the broadcast interval
        // cannot use isWithinTimespanMs() as it->last_rx_time is seconds since 1970
-        if ((now - it->last_rx_time > it->node_broadcast_interval_secs * 2) && (it->node_id != my_node_id)) {
+        if ((now - it->last_rx_time > it->node_broadcast_interval_secs * 4) && (it->node_id != my_node_id)) {
            LOG_DEBUG("Remove neighbor with node ID 0x%x", it->node_id);
            it = std::vector<meshtastic_Neighbor>::reverse_iterator(
                neighbors.erase(std::next(it).base())); // Erase the element and update the iterator
        } else {
            ++it;
        }
    }
}

Channels.cpp

-    channelSettings.module_settings.position_precision = 13; // default to sending location on the primary channel
+    channelSettings.module_settings.position_precision = 32; // default to sending location on the primary channel

MQTT.h

-    const uint32_t default_map_position_precision = 14;         // defaults to max. offset of ~1459m
+    const uint32_t default_map_position_precision = 32;         // defaults to max. offset of ~1459m

MQTT.c

Respektera inte OK_TO_MQTT flaggan

- // For uplinking other's packets, check if it's not OK to MQTT or if it's an older packet without the bitfield
- bool dontUplink = !mp_decoded.decoded.has_bitfield || !(mp_decoded.decoded.bitfield & BITFIELD_OK_TO_MQTT_MASK);
- // check for the lowest bit of the data bitfield set false, and the use of one of the default keys.
- if (!isFromUs(&mp_decoded) && !isMqttServerAddressPrivate && dontUplink &&
-     (ch.settings.psk.size < 2 || (ch.settings.psk.size == 16 && memcmp(ch.settings.psk.bytes, defaultpsk, 16)) ||
-         (ch.settings.psk.size == 32 && memcmp(ch.settings.psk.bytes, eventpsk, 32)))) {
-     LOG_INFO("MQTT onSend - Not forwarding packet due to DontMqttMeBro flag");
-     return;
- }
Senast ändrad July 31, 2025