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
6 changes: 5 additions & 1 deletion src/infuse_iot/definitions/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
if _extension_module := _loader("rpc_definitions"):
_globals = globals()
for _name in _extension_module.__all__:
_globals[_name] = getattr(_extension_module, _name)
attr = getattr(_extension_module, _name)
if _name == "id_type_mapping":
_globals[_name].update(attr)
else:
_globals[_name] = attr
23 changes: 23 additions & 0 deletions src/infuse_iot/generated/kv_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ class kv_algorithm_movement_threshold_args(VLACompatLittleEndianStruct):
]
_pack_ = 1

class kv_algorithm_movement_threshold_args_v2(VLACompatLittleEndianStruct):
"""Arguments for 'Shot Triggered' algorithm"""

_fields_ = [
("moving_for", ctypes.c_uint32),
("initial_threshold_ug", ctypes.c_uint32),
("continue_threshold_ug", ctypes.c_uint32),
]
_pack_ = 1


class slots:
class reboots(VLACompatLittleEndianStruct):
Expand Down Expand Up @@ -479,6 +489,18 @@ class alg_movement_threshold_args(VLACompatLittleEndianStruct):
]
_pack_ = 1

class alg_movement_threshold_args_v2(VLACompatLittleEndianStruct):
"""Configuration for the 'Movement Threshold' algorithm"""

NAME = "ALG_MOVEMENT_THRESHOLD_ARGS_V2"
BASE_ID = 203
RANGE = 1
_fields_ = [
("logging", structs.kv_algorithm_logging),
("args", structs.kv_algorithm_movement_threshold_args_v2),
]
_pack_ = 1

class task_schedules_default_id(VLACompatLittleEndianStruct):
"""Unique identifier for default schedule set"""

Expand Down Expand Up @@ -569,6 +591,7 @@ class secure_storage_reserved(VLACompatLittleEndianStruct):
200: alg_stationary_windowed_args,
201: alg_tilt_args,
202: alg_movement_threshold_args,
203: alg_movement_threshold_args_v2,
1000: task_schedules_default_id,
1001: task_schedules,
1002: task_schedules,
Expand Down
21 changes: 21 additions & 0 deletions src/infuse_iot/generated/tdf_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,26 @@ class announce_v2(TdfReadingBase):
"flags": "0x{:02x}",
}

class soc_temperature(TdfReadingBase):
"""SoC die temperature"""

ID = 8
NAME = "SOC_TEMPERATURE"
_fields_ = [
("_temperature", ctypes.c_int16),
]
_pack_ = 1
_postfix_ = {
"temperature": "deg",
}
_display_fmt_ = {
"temperature": "{:.2f}",
}

@property
def temperature(self):
return self._temperature * 0.01

class acc_2g(TdfReadingBase):
"""Accelerometer +-2G"""

Expand Down Expand Up @@ -1683,6 +1703,7 @@ class pcm_16bit_chan_dual(TdfReadingBase):
readings.time_sync.ID: readings.time_sync,
readings.reboot_info.ID: readings.reboot_info,
readings.announce_v2.ID: readings.announce_v2,
readings.soc_temperature.ID: readings.soc_temperature,
readings.acc_2g.ID: readings.acc_2g,
readings.acc_4g.ID: readings.acc_4g,
readings.acc_8g.ID: readings.acc_8g,
Expand Down
18 changes: 9 additions & 9 deletions src/infuse_iot/tools/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ def add_parser(cls, parser):

tool_parser = parser_orgs.add_subparsers(title="commands", metavar="<command>", required=True)

list_parser = tool_parser.add_parser("list")
list_parser = tool_parser.add_parser("list", help="List all organisations")
list_parser.set_defaults(command_fn=cls.list)

create_parser = tool_parser.add_parser("create")
create_parser = tool_parser.add_parser("create", help="Create new organisation")
create_parser.add_argument("--name", "-n", type=str, required=True)
create_parser.set_defaults(command_fn=cls.create)

Expand Down Expand Up @@ -105,10 +105,10 @@ def add_parser(cls, parser):

tool_parser = parser_boards.add_subparsers(title="commands", metavar="<command>", required=True)

list_parser = tool_parser.add_parser("list")
list_parser = tool_parser.add_parser("list", help="List all hardware platforms")
list_parser.set_defaults(command_fn=cls.list)

create_parser = tool_parser.add_parser("create")
create_parser = tool_parser.add_parser("create", help="Create new hardware platform")
create_parser.add_argument("--name", "-n", type=str, required=True, help="New board name")
create_parser.add_argument("--org", "-o", type=str, required=True, help="Organisation ID")
create_parser.add_argument("--soc", "-s", type=str, required=True, help="Board system on chip")
Expand Down Expand Up @@ -166,12 +166,12 @@ def add_parser(cls, parser):

tool_parser = parser_boards.add_subparsers(title="commands", metavar="<command>", required=True)

info_parser = tool_parser.add_parser("info")
info_parser = tool_parser.add_parser("info", help="General device information")
info_parser.set_defaults(command_fn=cls.info)
info_parser.add_argument("--id", type=str, help="Infuse-IoT device ID")
info_parser = tool_parser.add_parser("kv_state")
info_parser.add_argument("--id", type=str, required=True, help="Infuse-IoT device ID")
info_parser = tool_parser.add_parser("kv_state", help="Key-Value device state")
info_parser.set_defaults(command_fn=cls.kv_state)
info_parser.add_argument("--id", type=str, help="Infuse-IoT device ID")
info_parser.add_argument("--id", type=str, required=True, help="Infuse-IoT device ID")

def run(self):
with self.client() as client:
Expand Down Expand Up @@ -261,7 +261,7 @@ def add_parser(cls, parser):

tool_parser = parser_coap.add_subparsers(title="commands", metavar="<command>", required=True)

list_parser = tool_parser.add_parser("list")
list_parser = tool_parser.add_parser("list", help="List all CoAP files")
list_parser.set_defaults(command_fn=cls.list)

def run(self):
Expand Down