mirror of
https://github.com/Roslund/sthlm-mesh.git
synced 2026-03-28 17:43:02 +01:00
3.6 KiB
3.6 KiB
title, toc_hide, _build
| title | toc_hide | _build | ||||||
|---|---|---|---|---|---|---|---|---|
| Custom Firmware | true |
|
Binärer
{{% alert title="Varning" color="danger" %}} Att ladda ner firmware från internet medför alltid en risk. Istället bör du själv genomföra kodändringarna nedan och kompilera firmware själv. {{% /alert %}}
Kodändringar
Nedan är de ändringar jag gör på firmwaren för att det ska passa mig.
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
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;
}
}
}
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;
- }