Skip to content

Commit

Permalink
updating can lib
Browse files Browse the repository at this point in the history
  • Loading branch information
RCMast3r committed Mar 10, 2024
1 parent 1913d82 commit e75349a
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 8 deletions.
8 changes: 4 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
mcap.url = "github:RCMast3r/py_mcap_nix";
foxglove-websocket.url = "github:RCMast3r/py_foxglove_webserver_nix";
asyncudp.url = "github:RCMast3r/asyncudp_nix";
ht_can_pkg_flake.url = "github:hytech-racing/ht_can/TPMS_add";
ht_can_pkg_flake.url = "github:hytech-racing/ht_can/23";
nix-proto = { url = "github:notalltim/nix-proto"; };
};

Expand Down
151 changes: 151 additions & 0 deletions hytech_inverter_layout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"configById": {
"RawMessages!os6rgs": {
"diffEnabled": false,
"diffMethod": "custom",
"diffTopicPath": "",
"showFullMessageForDiff": false,
"topicPath": "mc1_setpoints_command_data",
"fontSize": 16
},
"RawMessages!3t8gf6y": {
"diffEnabled": false,
"diffMethod": "custom",
"diffTopicPath": "",
"showFullMessageForDiff": false,
"topicPath": "mc2_setpoints_command_data",
"fontSize": 16
},
"RawMessages!3bagjoh": {
"diffEnabled": false,
"diffMethod": "custom",
"diffTopicPath": "",
"showFullMessageForDiff": false,
"topicPath": "mc3_setpoints_command_data",
"fontSize": 16
},
"RawMessages!3qiztsf": {
"diffEnabled": false,
"diffMethod": "custom",
"diffTopicPath": "",
"showFullMessageForDiff": false,
"topicPath": "mc4_setpoints_command_data",
"fontSize": 16
},
"RawMessages!1jstiqt": {
"diffEnabled": false,
"diffMethod": "custom",
"diffTopicPath": "",
"showFullMessageForDiff": false,
"topicPath": "mc3_status_data",
"fontSize": 16
},
"RawMessages!3xx9a3k": {
"diffEnabled": false,
"diffMethod": "custom",
"diffTopicPath": "",
"showFullMessageForDiff": false,
"topicPath": "mc3_status_data",
"fontSize": 16
},
"RawMessages!q935an": {
"diffEnabled": false,
"diffMethod": "custom",
"diffTopicPath": "",
"showFullMessageForDiff": false,
"topicPath": "mc3_status_data",
"fontSize": 16
},
"RawMessages!2ljcpda": {
"diffEnabled": false,
"diffMethod": "custom",
"diffTopicPath": "",
"showFullMessageForDiff": false,
"topicPath": "mc3_status_data",
"fontSize": 16
},
"RawMessages!2xjbgv4": {
"diffEnabled": false,
"diffMethod": "custom",
"diffTopicPath": "",
"showFullMessageForDiff": false,
"topicPath": "mc1_temps_data",
"fontSize": 16
},
"RawMessages!39c521h": {
"diffEnabled": false,
"diffMethod": "custom",
"diffTopicPath": "",
"showFullMessageForDiff": false,
"topicPath": "mc2_temps_data",
"fontSize": 16
},
"RawMessages!4fikvti": {
"diffEnabled": false,
"diffMethod": "custom",
"diffTopicPath": "",
"showFullMessageForDiff": false,
"topicPath": "mc3_temps_data",
"fontSize": 16
},
"RawMessages!3mfe4gm": {
"diffEnabled": false,
"diffMethod": "custom",
"diffTopicPath": "",
"showFullMessageForDiff": false,
"topicPath": "mc4_temps_data",
"fontSize": 16
}
},
"globalVariables": {},
"userNodes": {},
"playbackConfig": {
"speed": 1
},
"layout": {
"first": {
"first": {
"first": {
"first": "RawMessages!os6rgs",
"second": "RawMessages!3t8gf6y",
"direction": "row"
},
"second": {
"first": "RawMessages!3bagjoh",
"second": "RawMessages!3qiztsf",
"direction": "row"
},
"direction": "row"
},
"second": {
"first": {
"first": "RawMessages!1jstiqt",
"second": "RawMessages!3xx9a3k",
"direction": "row"
},
"second": {
"first": "RawMessages!q935an",
"second": "RawMessages!2ljcpda",
"direction": "row"
},
"direction": "row"
},
"direction": "column"
},
"second": {
"first": {
"first": "RawMessages!2xjbgv4",
"second": "RawMessages!39c521h",
"direction": "column"
},
"second": {
"first": "RawMessages!4fikvti",
"second": "RawMessages!3mfe4gm",
"direction": "column"
},
"direction": "column"
},
"direction": "row",
"splitPercentage": 62.82696177062375
}
}
2 changes: 1 addition & 1 deletion py_data_acq/py_data_acq/common/protobuf_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def pack_protobuf_msg(cantools_dict: dict, msg_name: str, message_classes):
pb_msg = message_classes[msg_name]()
for key in cantools_dict.keys():
if(type(cantools_dict[key]) is namedsignalvalue.NamedSignalValue):
setattr(pb_msg, key, cantools_dict[key].value)
setattr(pb_msg, key, str(cantools_dict[key].value))
else:
setattr(pb_msg, key, cantools_dict[key])
return pb_msg
11 changes: 9 additions & 2 deletions py_data_acq/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,22 @@ async def continuous_can_receiver(can_msg_decoder: cantools.db.Database, message
while True:
# Wait for the next message from the buffer
msg = await reader.get_message()

# print("got msg")
id = msg.arbitration_id
try:
decoded_msg = can_msg_decoder.decode_message(msg.arbitration_id, msg.data, decode_containers=True)
# print("decoded msg")
msg = can_msg_decoder.get_message_by_frame_id(msg.arbitration_id)
# print("got msg by id")
msg = pb_helpers.pack_protobuf_msg(decoded_msg, msg.name.lower(), message_classes)
# print("created pb msg successfully")
data = QueueData(msg.DESCRIPTOR.name, msg)
# await asyncio.sleep(1)
await queue.put(data)
await q2.put(data)
except:
except Exception as e:
# print(id)
# print(e)
pass

# Don't forget to stop the notifier to clean up resources.
Expand Down

0 comments on commit e75349a

Please sign in to comment.