-
-
Notifications
You must be signed in to change notification settings - Fork 896
Add multi-message feature, for handling multiple sensor data in one message #1515
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
Conversation
Nice work! I checked ram and flash usage. This feature does not change flash and ram usage when unused, and lowers flash and ram usage when used.
The build system is out of order. I don't know why, but I have sent a question to the rest of the core team. |
Link to forum thread: https://forum.mysensors.org/topic/11893/multiple-sensor-data-in-one-message |
@cpetra Cool new feature! Thank you for sharing it! I looked into some of your commits and would like to add some comments to minor issues. For this it would be very useful for a code review via the GitHub web UI to squash your 6 commits into a single commit and force push it again. Then I see all your adds and changes to a file at once. And while doing this it would be perfect to give this single commit a descriptive commit message with reference to the associated issue ID e.g. "Add multi message support (#1234)". Please let me know, to create this issue (feature request). |
I agree with this, it's a bit messy. I'm not sure how this is handled by github. I know on gitlab one can "squash commits" and change the commit message for a merge request and I expected this would be done by the one doing the actual merge. |
Have your checked this MySensors Contribution Guideline? Unfortunately squash of multiple commits is not mentioned there. But basically you should squash the commits on your local Git repo and force push it to your MySensors GitHub forked repo. Then your change will go automatically into this MR. Regarding squash by use of the Git CLI I found this helpful: Squash commits into one with Git If this is new to you, I highly recommend to make a copy of your local repository before! |
core/MyBlob.cpp
Outdated
} __attribute__((packed)); | ||
} __attribute__((packed)) blob; | ||
|
||
MyBlob::~MyBlob() |
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.
Perhaps renaming MyBlob to MyMultiMessage, to keep naming more similar to MyMessage?
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.
I was kind of afraid of that :) I am actually quite fond of the "Blob" naming, in my programming history it always meant a conglomerate of different type of data. I also find it fun to use and easy to remember. There is, now, the V_MULTI_MESSAGE sensor type that makes the connection for the unaware.
Thanks for pointing that out! Yes, I have read it, but got side-tracked and forgot about the "Ammending" part. I have now force-pushed again the changes into one commit. |
I don't know why the build bot is unable to post the result automatically, but here is the butler report:
|
|
You're probably right. Here is the new feedback from the build system: Butler report
Documentation
|
Thank you for your patience! I have fixed the doxygen comments now. |
core/MyBlob.h
Outdated
|
||
#ifndef MYBLOB_H | ||
#define MYBLOB_H | ||
#pragma once |
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.
Remove #pragma once
when you use:
#ifndef MYBLOB_H
#define MYBLOB_H
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.
Good point :)
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.
Yes, but the #pragma once
line is still there. I think you can simply remove this line.
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.
And I was sure I did remove it.
@@ -825,7 +826,15 @@ void transportProcessMessage(void) | |||
#endif //defined(MY_OTA_LOG_RECEIVER_FEATURE) | |||
#if defined(MY_GATEWAY_FEATURE) | |||
// Hand over message to controller | |||
(void)gatewayTransportSend(_msg); | |||
if (_msg.getType() == V_MULTI_MESSAGE) { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
Precious info! I have updated it now.
keywords.txt
Outdated
@@ -2,6 +2,7 @@ | |||
# Datatypes (KEYWORD1) | |||
####################################### | |||
MyMessage KEYWORD1 | |||
MyBlob KEYWORD1 |
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.
Between MyBlob
and KEYWORD1
must be a single tab char but not two. Otherwise, highlighting of this keyword in the Arduino IDE will not work.
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.
My Arduino Studio highlights the keword fine though, but I have updated it.
core/MyBlob.cpp
Outdated
* repeater and gateway builds a routing tables in EEPROM which keeps track of the | ||
* network topology allowing messages to be routed to nodes. | ||
* | ||
* Created by Constnatin Petra <constantin.petra@gmail.com> |
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.
Not that I care too much about the copyright, but I was under the impression that it's the file creation that the "Created by" line was about, and not the package. I saw the same approach on "core/MyGatewayTransport.cpp". Anyway, thanks for pointing out that I have mispelled my own name :) I have updated the copyright part now.
core/workspace.code-workspace
Outdated
@@ -0,0 +1,7 @@ | |||
{ |
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.
Yes, it got in by mistake, probably when doing the force push...
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.
All issues approved, but additional change requests will follow...
core/MyTransport.cpp
Outdated
MyMessage msg2; | ||
MyBlob blob(&_msg); | ||
while (blob.getNext(msg2)) { | ||
receive(_msg); |
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.
This is a bug!
Line 845 should read:
receive(msg2);
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.
With this change I was able to use this new MultiMessage N2N feature. Perfect!
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.
OMG, can't quite get into the mood these days and have little time available, I apologize for this.
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.
No problem, and now it is resolved. Thank you!
@mfalkvidd BTW I personally dislike the idea to include this big external PJON library into the MySensors lib repo. May be an other solution by use of an external library reference would be better. But I have no idea how to do this :-( |
The Arduino IDE does not handle dependencies (at least not in an useful way). This has caused a lot of problems for MySensors users. The least bad way we’ve found so far is to include all code in the same repo. But that also means that we in effect fork every dependency, which sucks. I’m not sure how we should handle the pjon case. I’ll think about it and see if there is something I think could work better. Ideas and suggestions are very welcome. |
I see, the issue is difficulty. I think it deserves a separate issue. I will create one... |
@cpetra and @mfalkvidd
I will care for points 2 and 3. Do you agree with this? What about the other points? |
|
I assume you refer to this location: And yes, I agree this should read: |
Renamed MyBlob to MyMultiMessage; Also fixed line 80 in MyMultiMessage.cpp (that was the second update). |
@mfalkvidd @virtual-maker |
Excellent contribution by @cpetra ! Thanks to @virtual-maker for extensive feedback on the PR.
The "blob" feature acts like a special "sensor" type (V_MULTI_MESSAGE). The gateway will reconstruct different messages from this special object and will send them to the controller.
This could be improved by adding the possibility to automatically do a send when the message is full.