Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions software/release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ The repository has the following directory tree.
│ ├── hm3.py
│ ├── icons.py
│ ├── main.py
│ ├── mm1.py
│ ├── networking.py
│ ├── sensors.py
│ ├── servo.py
Expand Down Expand Up @@ -68,6 +69,7 @@ The repository has the following directory tree.
│ ├── boot.py
│ ├── config.py
│ ├── main.py
│ ├── mm1.py
│ ├── networking.py
│ └── ssp_networking.py
├── sl1
Expand Down
2 changes: 2 additions & 0 deletions software/release/all/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The repository has the following directory tree.
├── hm3.py
├── icons.py
├── main.py
├── mm1.py
├── networking.py
├── sensors.py
├── servo.py
Expand All @@ -45,6 +46,7 @@ A short description of the directories can be found below.
| main/boot.py | Smart Module boot.py | Nick |
| main/am1.py | Admin module main program | Nick |
| main/hm3.py | Hive motor module main program | Nick |
| main/mm1.py | Module module main program | Nick |
| main/sl1.py | Smart light module main program | Milan |
| main/sm3.py | Smart motor module main program | Milan |
| main/sp1.py | Smart splat module main program | Nick |
Expand Down
6 changes: 2 additions & 4 deletions software/release/all/boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
except Exception as e:
print(f"Error {e}")

module_name = config.config["configuration"].lower()

import gc

gc.collect()
Expand Down Expand Up @@ -60,8 +58,8 @@ def deinit():
machine.reset()

try:
with open(module_name + ".py") as f:
with open(config.config["configuration"].lower() + ".py") as f:
code = f.read()
exec(code, {"networking": networking, "configuration": configuration, "__name__": "__main__"})
except Exception as e:
print(f"Error running {module_name}: {e}")
print(f"Error running {config.config['configuration']}: {e}")
1 change: 1 addition & 0 deletions software/release/all/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': None, 'sta_channel': 1, 'type': None, 'version': None}
version = {
'mm1.py': 1,
'adxl345.py': 3,
'am1.py': 2,
'hm1.py': 1,
Expand Down
31 changes: 31 additions & 0 deletions software/release/all/mm1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import uasyncio as asyncio
import time

try: # ensure networking is available
networking
except NameError:
from config import networking as networking

from config import hive_config

print("running mm1.py")

async def heartbeat_loop():
while hive_config["hive"]:
print("heartbeat")
if hive_config["recipients"]:
test_data = {
"test": 42,
"time_sent": time.ticks_ms()
}
networking.send_data(hive_config["recipients"], test_data)

recv_sensor_data = networking.return_data()
for mac, data in recv_sensor_data.items():
print(f"Received from {mac}: {data}")

await asyncio.sleep(hive_config["refreshrate"] / 1000)


if hive_config["hive"]:
asyncio.run(heartbeat_loop())
6 changes: 2 additions & 4 deletions software/release/am1/boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
except Exception as e:
print(f"Error {e}")

module_name = config.config["configuration"].lower()

import gc

gc.collect()
Expand Down Expand Up @@ -60,8 +58,8 @@ def deinit():
machine.reset()

try:
with open(module_name + ".py") as f:
with open(config.config["configuration"].lower() + ".py") as f:
code = f.read()
exec(code, {"networking": networking, "configuration": configuration, "__name__": "__main__"})
except Exception as e:
print(f"Error running {module_name}: {e}")
print(f"Error running {config.config['configuration']}: {e}")
3 changes: 2 additions & 1 deletion software/release/am1/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': None, 'sta_channel': 1, 'type': None, 'version': '2025-10-14-133223'}
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': 'AM1', 'sta_channel': 1, 'type': None, 'version': '2025-10-14-161439'}
version = {
'mm1.py': 1,
'adxl345.py': 3,
'am1.py': 2,
'hm1.py': 1,
Expand Down
6 changes: 2 additions & 4 deletions software/release/hm3/boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
except Exception as e:
print(f"Error {e}")

module_name = config.config["configuration"].lower()

import gc

gc.collect()
Expand Down Expand Up @@ -60,8 +58,8 @@ def deinit():
machine.reset()

try:
with open(module_name + ".py") as f:
with open(config.config["configuration"].lower() + ".py") as f:
code = f.read()
exec(code, {"networking": networking, "configuration": configuration, "__name__": "__main__"})
except Exception as e:
print(f"Error running {module_name}: {e}")
print(f"Error running {config.config['configuration']}: {e}")
3 changes: 2 additions & 1 deletion software/release/hm3/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': None, 'sta_channel': 1, 'type': None, 'version': '2025-10-14-133223'}
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': 'HM3', 'sta_channel': 1, 'type': None, 'version': '2025-10-14-161439'}
version = {
'mm1.py': 1,
'adxl345.py': 3,
'am1.py': 2,
'hm1.py': 1,
Expand Down
2 changes: 2 additions & 0 deletions software/release/mm1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The repository has the following directory tree.
├── boot.py
├── config.py
├── main.py
├── mm1.py
├── networking.py
└── ssp_networking.py

Expand All @@ -29,5 +30,6 @@ A short description of the files can be found below.
| config.py | Smart Module Configuration File | Nick |
| boot.py | Smart Module boot.py | Nick |
| main.py | Smart Module main.py | Nick |
| mm1.py | Module module main program | Nick |
| networking.py | This is the main networking code that builds on ESP-NOW. There are many prepared functionalities (and some more that I am working on), such as long message support, sending of various variable types (bytes, bytearray, dicts, lists, int, float, char, string), as well as different types of messages such as ping, echo and more. There are also various features in place to make the networking more robust. | Nick |
| ssp_networking.py | This is the ssp networking module. It needs config.py to function. | Nick |
6 changes: 2 additions & 4 deletions software/release/mm1/boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
except Exception as e:
print(f"Error {e}")

module_name = config.config["configuration"].lower()

import gc

gc.collect()
Expand Down Expand Up @@ -60,8 +58,8 @@ def deinit():
machine.reset()

try:
with open(module_name + ".py") as f:
with open(config.config["configuration"].lower() + ".py") as f:
code = f.read()
exec(code, {"networking": networking, "configuration": configuration, "__name__": "__main__"})
except Exception as e:
print(f"Error running {module_name}: {e}")
print(f"Error running {config.config['configuration']}: {e}")
3 changes: 2 additions & 1 deletion software/release/mm1/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': None, 'sta_channel': 1, 'type': None, 'version': '2025-10-14-133223'}
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': 'MM1', 'sta_channel': 1, 'type': None, 'version': '2025-10-14-161439'}
version = {
'mm1.py': 1,
'adxl345.py': 3,
'am1.py': 2,
'hm1.py': 1,
Expand Down
31 changes: 31 additions & 0 deletions software/release/mm1/mm1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import uasyncio as asyncio
import time

try: # ensure networking is available
networking
except NameError:
from config import networking as networking

from config import hive_config

print("running mm1.py")

async def heartbeat_loop():
while hive_config["hive"]:
print("heartbeat")
if hive_config["recipients"]:
test_data = {
"test": 42,
"time_sent": time.ticks_ms()
}
networking.send_data(hive_config["recipients"], test_data)

recv_sensor_data = networking.return_data()
for mac, data in recv_sensor_data.items():
print(f"Received from {mac}: {data}")

await asyncio.sleep(hive_config["refreshrate"] / 1000)


if hive_config["hive"]:
asyncio.run(heartbeat_loop())
6 changes: 2 additions & 4 deletions software/release/sl1/boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
except Exception as e:
print(f"Error {e}")

module_name = config.config["configuration"].lower()

import gc

gc.collect()
Expand Down Expand Up @@ -60,8 +58,8 @@ def deinit():
machine.reset()

try:
with open(module_name + ".py") as f:
with open(config.config["configuration"].lower() + ".py") as f:
code = f.read()
exec(code, {"networking": networking, "configuration": configuration, "__name__": "__main__"})
except Exception as e:
print(f"Error running {module_name}: {e}")
print(f"Error running {config.config['configuration']}: {e}")
3 changes: 2 additions & 1 deletion software/release/sl1/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': None, 'sta_channel': 1, 'type': None, 'version': '2025-10-14-133223'}
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': 'SL1', 'sta_channel': 1, 'type': None, 'version': '2025-10-14-161439'}
version = {
'mm1.py': 1,
'adxl345.py': 3,
'am1.py': 2,
'hm1.py': 1,
Expand Down
6 changes: 2 additions & 4 deletions software/release/sp1/boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
except Exception as e:
print(f"Error {e}")

module_name = config.config["configuration"].lower()

import gc

gc.collect()
Expand Down Expand Up @@ -60,8 +58,8 @@ def deinit():
machine.reset()

try:
with open(module_name + ".py") as f:
with open(config.config["configuration"].lower() + ".py") as f:
code = f.read()
exec(code, {"networking": networking, "configuration": configuration, "__name__": "__main__"})
except Exception as e:
print(f"Error running {module_name}: {e}")
print(f"Error running {config.config['configuration']}: {e}")
3 changes: 2 additions & 1 deletion software/release/sp1/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': None, 'sta_channel': 1, 'type': None, 'version': '2025-10-14-133223'}
config = {'ap_channel': 1, 'id': None, 'name': 'Nick', 'sta_mac': None, 'ap_mac': None, 'configuration': 'SP1', 'sta_channel': 1, 'type': None, 'version': '2025-10-14-161439'}
version = {
'mm1.py': 1,
'adxl345.py': 3,
'am1.py': 2,
'hm1.py': 1,
Expand Down