Skip to content
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

Updated_Data_Formated_BrainAlive #714

Merged
merged 15 commits into from
Apr 23, 2024

Conversation

Sarthak031
Copy link
Contributor

No description provided.

@Andrey1994
Copy link
Member

looks ok, but need to fix failed ci jobs

@Sarthak031
Copy link
Contributor Author

looks ok, but need to fix failed ci jobs

Can you help me to fix these ci jobs?

@Andrey1994
Copy link
Member

Yes, CI builds with warnings as errors flag, there is an option in cmake to enable it and there is --warnings-as-errors flag in build.py

Msvc compiler thinks that comparison in for loop with signed and unsigned is a warning, so you can add manual type cast(check other for loops in code). Check the output from the job to see all these places or build it locally with this flag on

Clang format is a code style checker and formatter, you can install it as a part of llvm https://brainflow.readthedocs.io/en/stable/BrainFlowDev.html#code-style just ensure that you install the same version as in CI job

@Andrey1994
Copy link
Member

I dont have permissions to push to your branch, so you will need to fix these errors, patch is pretty simple smth like

-
+
     if (res == (int)BrainFlowExitCodes::STATUS_OK)
     {
         res = config_board ("0a8100000d");
@@ -376,16 +376,15 @@ void BrainAlive::read_data (simpleble_uuid_t service, simpleble_uuid_t character
         safe_logger (spdlog::level::warn, "unknown size of BrainAlive Data {}", size);
         return;
     }
-    for(int i =0; i< size; i+=32)
-    {
+    for (int i = 0; i < (int)size; i += 32)
+    {
         double eeg_data[9] = {0};
-        for(int j = i+4 ,k =0; j<i+28; j += 3,k++)
+        for (int j = i + 4, k = 0; j < i + 28; j += 3, k++)
         {
             eeg_data[k] = (((data[j] << 16 | data[j + 1] << 8 | data[j + 2]) << 8) >> 8) *
                 BRAINALIVE_EEG_SCALE_FACTOR / BRAINALIVE_EEG_GAIN_VALUE;
         }
-        eeg_data[8] = data[i+29];
+        eeg_data[8] = data[i + 29];
         push_package (&eeg_data[0]);
-
     }
 }

If you configure everything properly will code will be automatically formated

@Sarthak031
Copy link
Contributor Author

I dont have permissions to push to your branch, so you will need to fix these errors, patch is pretty simple smth like

-
+
     if (res == (int)BrainFlowExitCodes::STATUS_OK)
     {
         res = config_board ("0a8100000d");
@@ -376,16 +376,15 @@ void BrainAlive::read_data (simpleble_uuid_t service, simpleble_uuid_t character
         safe_logger (spdlog::level::warn, "unknown size of BrainAlive Data {}", size);
         return;
     }
-    for(int i =0; i< size; i+=32)
-    {
+    for (int i = 0; i < (int)size; i += 32)
+    {
         double eeg_data[9] = {0};
-        for(int j = i+4 ,k =0; j<i+28; j += 3,k++)
+        for (int j = i + 4, k = 0; j < i + 28; j += 3, k++)
         {
             eeg_data[k] = (((data[j] << 16 | data[j + 1] << 8 | data[j + 2]) << 8) >> 8) *
                 BRAINALIVE_EEG_SCALE_FACTOR / BRAINALIVE_EEG_GAIN_VALUE;
         }
-        eeg_data[8] = data[i+29];
+        eeg_data[8] = data[i + 29];
         push_package (&eeg_data[0]);
-
     }
 }

If you configure everything properly will code will be automatically formated

I have changed the files according to your suggestion.

@Andrey1994 Andrey1994 merged commit 1117602 into brainflow-dev:master Apr 23, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants