-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented data sending to the device with send periodic #108
Implemented data sending to the device with send periodic #108
Conversation
@@ -198,6 +198,31 @@ def update_protocols_on_startup(protocols): | |||
session.close() | |||
|
|||
|
|||
def publish_protocol_message_to_can_module(data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the value processing done (multiplire, divisor, offset...)? On Cloud already?
If not, it should be covered on the gateway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved issue in latest commit.
… protocol from the device
src/can_service.py
Outdated
msg = can.Message( | ||
arbitration_id=int(hex_string, 16), data=byte_array, is_extended_id=False, is_remote_frame=False | ||
value += protocol_data_from_db.offset_value | ||
if protocol_data_from_db.divisor > 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should support negative values too.
byte_array = struct.pack('d', value) | ||
extracted_value = extract_bits(byte_array, protocol_data_from_db.start_bit, | ||
protocol_data_from_db.num_bits) | ||
extracted_double_value = extracted_value / 10.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write a comment why there is division by 10.
Define new message type sent from cloud to gateway for can messages.
Parse the message and send it to CAN python app.
Read the message and, based on type and action (if exists), send data to device with new thread, stop data sending from device and terminate the thread or return current values to cloud so cloud page is update with the latest information.