brainflow-dev / brainflow

BrainFlow is a library intended to obtain, parse and analyze EEG, EMG, ECG and other kinds of data from biosensors
https://brainflow.org/
MIT License
1.27k stars 327 forks source link

Updated_Data_Formated_BrainAlive #714

Closed Sarthak031 closed 4 months ago

Andrey1994 commented 5 months ago

looks ok, but need to fix failed ci jobs

Sarthak031 commented 5 months ago

looks ok, but need to fix failed ci jobs

Can you help me to fix these ci jobs?

Andrey1994 commented 5 months ago

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 commented 4 months ago

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 commented 4 months ago

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.