-
-
Notifications
You must be signed in to change notification settings - Fork 332
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
Update ganglion decompression #655
Update ganglion decompression #655
Conversation
bd43203
to
3293a2c
Compare
3293a2c
to
4579b82
Compare
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.
looks ok, I wrote some comments but mostly because its alway scary to touch some code for ganglion..
there is a set of tests we need to pass before merging it:
- old compression works for raw data for both boards
- new compression works for raw data for both boards
- impedance checking works for old and new compression for board boards
- text messages sent from ganglion(bytes 200-207) work for both boards and both algorithms
@@ -479,6 +396,138 @@ void Ganglion::read_thread () | |||
delete[] package; | |||
} | |||
|
|||
void Ganglion::decompress_firmware_3 ( | |||
|
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.
strange that clang format does not remote it
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 tried to make it one line, but the clang-format settings move the parameters to the second line. I think it may be because the line is longer than the max line length. Is there a different format you'd like this in?
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 mean empty line between function name and arguments
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.
Oh weird - should be fixed now.
@@ -592,7 +641,22 @@ int Ganglion::call_open () | |||
} | |||
|
|||
safe_logger (spdlog::level::info, "search for {}", params.mac_address.c_str ()); | |||
res = func (const_cast<char *> (params.mac_address.c_str ())); | |||
|
|||
struct ConnectionParameters |
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 dont like strcut definition like this in cpp code and it seems like its duplicated between ganglion.cpp and bglib, can be moved to a common header I think. Also, compiler may align it randomly somewhere(its unlikely)
// Determine the firmware version from the advertised name | ||
if (msg->data.data[0] == 20 && msg->data.data[13] == '3') | ||
{ | ||
GanglionLib::firmware = 3; |
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 think this entire if block should be under the check for expected name pattern
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.
See the note about the serial_number parameter below. If a specific device name is passed to brainflow, the firmware must still be determined. Putting this block outside of the name and serial_number checks prevents duplicating the same logic in both locations.
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 mean that its probably more reliable to check fw after validating the name, some data from other devices can be send and first they should be filtered by the name. Here you will set fw value wo such filtering
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.
or two ganglions in the same place with two different fw versions, wo check for name you can mess up here
@@ -100,7 +107,15 @@ namespace GanglionLib | |||
} | |||
exit_code = (int)CustomExitCodes::SYNC_ERROR; | |||
state = State::OPEN_CALLED; | |||
char *mac_addr = (char *)param; | |||
|
|||
struct ConnectionParameters |
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.
common definition in header will be better
016c66c
to
899f967
Compare
looks ok, I will review and merge PR for freeeg128 and create a new release this weekend |
No description provided.