mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-22 21:50:18 +00:00
Compare commits
10 Commits
2e79b71381
...
b0d5de5853
Author | SHA1 | Date | |
---|---|---|---|
|
b0d5de5853 | ||
|
4524a17e67 | ||
|
8a82d6bfeb | ||
|
971f5ffadd | ||
|
b4ac3df2d0 | ||
|
8193f3621c | ||
|
5166596375 | ||
|
625db2622d | ||
|
65a40aefb6 | ||
|
a840bd4aaf |
2
Makefile
2
Makefile
@ -2,7 +2,7 @@ all: release
|
|||||||
|
|
||||||
test:
|
test:
|
||||||
@echo Running tests...
|
@echo Running tests...
|
||||||
python -m tests.all
|
python3 -m tests.all
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo Cleaning...
|
@echo Cleaning...
|
||||||
|
@ -249,7 +249,7 @@ class Identity:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _remember_ratchet(destination_hash, ratchet):
|
def _remember_ratchet(destination_hash, ratchet):
|
||||||
# TODO: Remove at some point
|
# TODO: Remove at some point, and only log new ratchets
|
||||||
RNS.log(f"Remembering ratchet {RNS.prettyhexrep(Identity.truncated_hash(ratchet))} for {RNS.prettyhexrep(destination_hash)}", RNS.LOG_EXTREME)
|
RNS.log(f"Remembering ratchet {RNS.prettyhexrep(Identity.truncated_hash(ratchet))} for {RNS.prettyhexrep(destination_hash)}", RNS.LOG_EXTREME)
|
||||||
try:
|
try:
|
||||||
Identity.known_ratchets[destination_hash] = ratchet
|
Identity.known_ratchets[destination_hash] = ratchet
|
||||||
@ -286,6 +286,7 @@ class Identity:
|
|||||||
try:
|
try:
|
||||||
now = time.time()
|
now = time.time()
|
||||||
ratchetdir = RNS.Reticulum.storagepath+"/ratchets"
|
ratchetdir = RNS.Reticulum.storagepath+"/ratchets"
|
||||||
|
if os.path.isdir(ratchetdir):
|
||||||
for filename in os.listdir(ratchetdir):
|
for filename in os.listdir(ratchetdir):
|
||||||
try:
|
try:
|
||||||
expired = False
|
expired = False
|
||||||
|
@ -622,7 +622,7 @@ class RNodeInterface(Interface):
|
|||||||
self.r_state = byte
|
self.r_state = byte
|
||||||
if self.r_state:
|
if self.r_state:
|
||||||
pass
|
pass
|
||||||
#RNS.log(str(self)+" Radio reporting state is online", RNS.LOG_DEBUG)
|
RNS.log(str(self)+" Radio reporting state is online", RNS.LOG_DEBUG)
|
||||||
else:
|
else:
|
||||||
RNS.log(str(self)+" Radio reporting state is offline", RNS.LOG_DEBUG)
|
RNS.log(str(self)+" Radio reporting state is offline", RNS.LOG_DEBUG)
|
||||||
|
|
||||||
|
@ -1677,7 +1677,6 @@ class Transport:
|
|||||||
|
|
||||||
# Call externally registered callbacks from apps
|
# Call externally registered callbacks from apps
|
||||||
# wanting to know when an announce arrives
|
# wanting to know when an announce arrives
|
||||||
if packet.context != RNS.Packet.PATH_RESPONSE:
|
|
||||||
for handler in Transport.announce_handlers:
|
for handler in Transport.announce_handlers:
|
||||||
try:
|
try:
|
||||||
# Check that the announced destination matches
|
# Check that the announced destination matches
|
||||||
@ -1692,6 +1691,15 @@ class Transport:
|
|||||||
handler_expected_hash = RNS.Destination.hash_from_name_and_identity(handler.aspect_filter, announce_identity)
|
handler_expected_hash = RNS.Destination.hash_from_name_and_identity(handler.aspect_filter, announce_identity)
|
||||||
if packet.destination_hash == handler_expected_hash:
|
if packet.destination_hash == handler_expected_hash:
|
||||||
execute_callback = True
|
execute_callback = True
|
||||||
|
|
||||||
|
# If this is a path response, check whether the
|
||||||
|
# handler wants to receive it.
|
||||||
|
if packet.context == RNS.Packet.PATH_RESPONSE:
|
||||||
|
if hasattr(handler, "receive_path_responses") and handler.receive_path_responses == True:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
execute_callback = False
|
||||||
|
|
||||||
if execute_callback:
|
if execute_callback:
|
||||||
handler.received_announce(
|
handler.received_announce(
|
||||||
destination_hash=packet.destination_hash,
|
destination_hash=packet.destination_hash,
|
||||||
@ -1979,7 +1987,9 @@ class Transport:
|
|||||||
"""
|
"""
|
||||||
Registers an announce handler.
|
Registers an announce handler.
|
||||||
|
|
||||||
:param handler: Must be an object with an *aspect_filter* attribute and a *received_announce(destination_hash, announced_identity, app_data)* callable. See the :ref:`Announce Example<example-announce>` for more info.
|
:param handler: Must be an object with an *aspect_filter* attribute and a *received_announce(destination_hash, announced_identity, app_data)*
|
||||||
|
callable. Can optionally have a *receive_path_responses* attribute set to ``True``, to also receive all path responses, in addition to live
|
||||||
|
announces. See the :ref:`Announce Example<example-announce>` for more info.
|
||||||
"""
|
"""
|
||||||
if hasattr(handler, "received_announce") and callable(handler.received_announce):
|
if hasattr(handler, "received_announce") and callable(handler.received_announce):
|
||||||
if hasattr(handler, "aspect_filter"):
|
if hasattr(handler, "aspect_filter"):
|
||||||
|
@ -131,6 +131,7 @@ class ROM():
|
|||||||
PRODUCT_RAK4631 = 0x10
|
PRODUCT_RAK4631 = 0x10
|
||||||
MODEL_11 = 0x11
|
MODEL_11 = 0x11
|
||||||
MODEL_12 = 0x12
|
MODEL_12 = 0x12
|
||||||
|
PRODUCT_TECHO = 0x43
|
||||||
|
|
||||||
PRODUCT_RNODE = 0x03
|
PRODUCT_RNODE = 0x03
|
||||||
MODEL_A1 = 0xA1
|
MODEL_A1 = 0xA1
|
||||||
@ -200,6 +201,7 @@ class ROM():
|
|||||||
BOARD_GENERIC_ESP32 = 0x35
|
BOARD_GENERIC_ESP32 = 0x35
|
||||||
BOARD_LORA32_V2_0 = 0x36
|
BOARD_LORA32_V2_0 = 0x36
|
||||||
BOARD_LORA32_V2_1 = 0x37
|
BOARD_LORA32_V2_1 = 0x37
|
||||||
|
BOARD_TECHO = 0x43
|
||||||
BOARD_RAK4631 = 0x51
|
BOARD_RAK4631 = 0x51
|
||||||
|
|
||||||
MANUAL_FLASH_MODELS = [MODEL_A1, MODEL_A6]
|
MANUAL_FLASH_MODELS = [MODEL_A1, MODEL_A6]
|
||||||
@ -214,6 +216,7 @@ products = {
|
|||||||
ROM.PRODUCT_T32_21: "LilyGO LoRa32 v2.1",
|
ROM.PRODUCT_T32_21: "LilyGO LoRa32 v2.1",
|
||||||
ROM.PRODUCT_H32_V2: "Heltec LoRa32 v2",
|
ROM.PRODUCT_H32_V2: "Heltec LoRa32 v2",
|
||||||
ROM.PRODUCT_H32_V3: "Heltec LoRa32 v3",
|
ROM.PRODUCT_H32_V3: "Heltec LoRa32 v3",
|
||||||
|
ROM.PRODUCT_TECHO: "LilyGO T-Echo",
|
||||||
ROM.PRODUCT_RAK4631: "RAK4631",
|
ROM.PRODUCT_RAK4631: "RAK4631",
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,6 +236,7 @@ mcus = {
|
|||||||
models = {
|
models = {
|
||||||
0x11: [430000000, 510000000, 22, "430 - 510 MHz", "rnode_firmware_rak4631.zip", "SX1262"],
|
0x11: [430000000, 510000000, 22, "430 - 510 MHz", "rnode_firmware_rak4631.zip", "SX1262"],
|
||||||
0x12: [779000000, 928000000, 22, "779 - 928 MHz", "rnode_firmware_rak4631.zip", "SX1262"],
|
0x12: [779000000, 928000000, 22, "779 - 928 MHz", "rnode_firmware_rak4631.zip", "SX1262"],
|
||||||
|
0x43: [779000000, 928000000, 22, "779 - 928 Mhz", "rnode_firmware_techo.zip", "SX1262"],
|
||||||
0xA4: [410000000, 525000000, 14, "410 - 525 MHz", "rnode_firmware.hex", "SX1278"],
|
0xA4: [410000000, 525000000, 14, "410 - 525 MHz", "rnode_firmware.hex", "SX1278"],
|
||||||
0xA9: [820000000, 1020000000, 17, "820 - 1020 MHz", "rnode_firmware.hex", "SX1276"],
|
0xA9: [820000000, 1020000000, 17, "820 - 1020 MHz", "rnode_firmware.hex", "SX1276"],
|
||||||
0xA1: [410000000, 525000000, 22, "410 - 525 MHz", "rnode_firmware_t3s3.zip", "SX1268"],
|
0xA1: [410000000, 525000000, 22, "410 - 525 MHz", "rnode_firmware_t3s3.zip", "SX1268"],
|
||||||
@ -1603,6 +1607,8 @@ def main():
|
|||||||
print("[8] Heltec LoRa32 v3")
|
print("[8] Heltec LoRa32 v3")
|
||||||
print("[9] LilyGO LoRa T3S3")
|
print("[9] LilyGO LoRa T3S3")
|
||||||
print("[10] RAK4631")
|
print("[10] RAK4631")
|
||||||
|
#TODO: Implement T-Echo
|
||||||
|
#print("[11] LilyGo T-Echo")
|
||||||
print(" .")
|
print(" .")
|
||||||
print(" / \\ Select one of these options if you want to easily turn")
|
print(" / \\ Select one of these options if you want to easily turn")
|
||||||
print(" | a supported development board into an RNode.")
|
print(" | a supported development board into an RNode.")
|
||||||
@ -1756,6 +1762,23 @@ def main():
|
|||||||
print("who would like to experiment with it. Hit enter to continue.")
|
print("who would like to experiment with it. Hit enter to continue.")
|
||||||
print("---------------------------------------------------------------------------")
|
print("---------------------------------------------------------------------------")
|
||||||
input()
|
input()
|
||||||
|
elif c_dev == 11:
|
||||||
|
#TODO: Implement T-Echo
|
||||||
|
print("That device type does not exist, exiting now.")
|
||||||
|
graceful_exit()
|
||||||
|
#The code below will never execute until the exit is removed from the line above when T-Echo is implemented:
|
||||||
|
selected_product = ROM.PRODUCT_TECHO
|
||||||
|
clear()
|
||||||
|
print("")
|
||||||
|
print("---------------------------------------------------------------------------")
|
||||||
|
print(" LilyGo T-Echo RNode Installer")
|
||||||
|
print("")
|
||||||
|
print("Important! Using RNode firmware on LilyGo T-Echo devices should currently be")
|
||||||
|
print("considered experimental. It is not intended for production or critical use.")
|
||||||
|
print("The currently supplied firmware is provided AS-IS as a courtesey to those")
|
||||||
|
print("who would like to experiment with it. Hit enter to continue.")
|
||||||
|
print("---------------------------------------------------------------------------")
|
||||||
|
input()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("That device type does not exist, exiting now.")
|
print("That device type does not exist, exiting now.")
|
||||||
graceful_exit()
|
graceful_exit()
|
||||||
@ -2042,6 +2065,21 @@ def main():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("That band does not exist, exiting now.")
|
print("That band does not exist, exiting now.")
|
||||||
graceful_exit()
|
graceful_exit()
|
||||||
|
elif selected_product == ROM.PRODUCT_TECHO:
|
||||||
|
selected_mcu = ROM.MCU_NRF52
|
||||||
|
print("\nWhat band is this T-Echo for?\n")
|
||||||
|
print("[1] 915 MHz")
|
||||||
|
print("\n? ", end="")
|
||||||
|
try:
|
||||||
|
c_model = int(input())
|
||||||
|
if c_model < 1 or c_model > 1:
|
||||||
|
raise ValueError()
|
||||||
|
elif c_model == 1:
|
||||||
|
selected_model = ROM.PRODUCT_TECHO
|
||||||
|
selected_platform = ROM.PLATFORM_NRF52
|
||||||
|
except Exception as e:
|
||||||
|
print("That band does not exist, exiting now.")
|
||||||
|
graceful_exit()
|
||||||
|
|
||||||
if selected_model != ROM.MODEL_FF and selected_model != ROM.MODEL_FE:
|
if selected_model != ROM.MODEL_FF and selected_model != ROM.MODEL_FE:
|
||||||
fw_filename = models[selected_model][4]
|
fw_filename = models[selected_model][4]
|
||||||
|
@ -1898,7 +1898,9 @@ Transport system of Reticulum.</p>
|
|||||||
<dd><p>Registers an announce handler.</p>
|
<dd><p>Registers an announce handler.</p>
|
||||||
<dl class="field-list simple">
|
<dl class="field-list simple">
|
||||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||||
<dd class="field-odd"><p><strong>handler</strong> – Must be an object with an <em>aspect_filter</em> attribute and a <em>received_announce(destination_hash, announced_identity, app_data)</em> callable. See the <a class="reference internal" href="examples.html#example-announce"><span class="std std-ref">Announce Example</span></a> for more info.</p>
|
<dd class="field-odd"><p><strong>handler</strong> – Must be an object with an <em>aspect_filter</em> attribute and a <em>received_announce(destination_hash, announced_identity, app_data)</em>
|
||||||
|
callable. Can optionally have a <em>receive_path_responses</em> attribute set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, to also receive all path responses, in addition to live
|
||||||
|
announces. See the <a class="reference internal" href="examples.html#example-announce"><span class="std std-ref">Announce Example</span></a> for more info.</p>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</dd></dl>
|
</dd></dl>
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user