meas_tasks.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. /*
  2. * meas_tasks.c
  3. *
  4. * Created on: Sep 5, 2024
  5. * Author: jakubski
  6. */
  7. #include <math.h>
  8. #include <stdio.h>
  9. #include "adc_buffers.h"
  10. #include "meas_tasks.h"
  11. #include "measurements.h"
  12. #include "node-red-config.h"
  13. #include "peripherial.h"
  14. #include "arm_math.h"
  15. #include <stdio.h>
  16. #include <stdlib.h>
  17. #include <string.h>
  18. #include "cmsis_os.h"
  19. #include "main.h"
  20. #ifdef PV_BOARD
  21. #define CHANNELS_COUNT 1
  22. #else
  23. #define CHANNELS_COUNT 3
  24. #endif
  25. #define CIRC_BUFF_LEN 10
  26. osThreadId_t adc1MeasTaskHandle = NULL;
  27. osThreadId_t adc2MeasTaskHandle = NULL;
  28. osThreadId_t adc3MeasTaskHandle = NULL;
  29. osThreadId_t limiterSwitchTaskHandle = NULL;
  30. osThreadId_t encoderXTaskHandle = NULL;
  31. osThreadId_t encoderYTaskHandle = NULL;
  32. osMessageQueueId_t adc1MeasDataQueue = NULL;
  33. osMessageQueueId_t adc2MeasDataQueue = NULL;
  34. osMessageQueueId_t adc3MeasDataQueue = NULL;
  35. osMutexId_t vRefmVMutex;
  36. osMutexId_t resMeasurementsMutex;
  37. osMutexId_t sensorsInfoMutex;
  38. osMutexId_t ILxRefMutex;
  39. volatile uint32_t vRefmV = 3000;
  40. #ifdef MOCK_VOLTAGES_AND_CURRENS
  41. #define SAMPLE_BUFFER_LENGTH 1024
  42. #define SAMPLE_BUFFER_LENGTH_HALF (SAMPLE_BUFFER_LENGTH/2)
  43. #define FFT_Length SAMPLE_BUFFER_LENGTH
  44. float32_t voltageWave[3][SAMPLE_BUFFER_LENGTH] = { 0 };
  45. float32_t currentWave[3][SAMPLE_BUFFER_LENGTH] = { 0 };
  46. float fft_output[SAMPLE_BUFFER_LENGTH] = { 0 };
  47. float fft_power_scaled[SAMPLE_BUFFER_LENGTH_HALF] = { 0 };
  48. float fft_power[SAMPLE_BUFFER_LENGTH_HALF] = { 0 };
  49. uint8_t ifftFlag = 0;
  50. #endif
  51. RESMeasurements resMeasurements __attribute__ ((aligned (32))) = { 0 };
  52. SesnorsInfo sensorsInfo __attribute__ ((aligned (32))) = { 0 };
  53. //uint16_t ILxRef[CURRENTS_COUNT] __attribute__ ((aligned (32))) = { 0 };
  54. EncoderTaskArg encoderXTaskArg __attribute__ ((aligned (32))) = { 0 };
  55. EncoderTaskArg encoderYTaskArg __attribute__ ((aligned (32))) = { 0 };
  56. extern TIM_HandleTypeDef htim3;
  57. extern TIM_OC_InitTypeDef motorXYTimerConfigOC;
  58. extern osTimerId_t motorXTimerHandle;
  59. extern osTimerId_t motorYTimerHandle;
  60. void GenenarateWaveSamples(float32_t amplitude, float32_t phase, uint16_t samplesPerPeriod, uint16_t periods, float32_t* outBuff)
  61. {
  62. float32_t arg = 0;
  63. float32_t delta = 2*PI/samplesPerPeriod;
  64. uint32_t samples = samplesPerPeriod * periods;
  65. for(uint32_t i = 0; i < samples; i++)
  66. {
  67. arg = delta*i + phase;
  68. outBuff[i] = amplitude * arm_sin_f32(arg);
  69. }
  70. }
  71. void MeasTasksInit (void) {
  72. vRefmVMutex = osMutexNew (NULL);
  73. resMeasurementsMutex = osMutexNew (NULL);
  74. sensorsInfoMutex = osMutexNew (NULL);
  75. ILxRefMutex = osMutexNew (NULL);
  76. adc1MeasDataQueue = osMessageQueueNew (8, sizeof (ADC1_Data), NULL);
  77. adc2MeasDataQueue = osMessageQueueNew (8, sizeof (ADC2_Data), NULL);
  78. adc3MeasDataQueue = osMessageQueueNew (8, sizeof (ADC3_Data), NULL);
  79. osThreadAttr_t osThreadAttradc1MeasTask = { 0 };
  80. osThreadAttr_t osThreadAttradc3MeasTask = { 0 };
  81. osThreadAttradc1MeasTask.stack_size = configMINIMAL_STACK_SIZE * 2;
  82. osThreadAttradc1MeasTask.priority = (osPriority_t)osPriorityRealtime;
  83. osThreadAttradc3MeasTask.stack_size = configMINIMAL_STACK_SIZE * 2;
  84. osThreadAttradc3MeasTask.priority = (osPriority_t)osPriorityNormal;
  85. adc1MeasTaskHandle = osThreadNew (ADC1MeasTask, NULL, &osThreadAttradc1MeasTask);
  86. adc3MeasTaskHandle = osThreadNew (ADC3MeasTask, NULL, &osThreadAttradc3MeasTask);
  87. osThreadAttr_t osThreadAttradc1LimiterSwitchTask = { 0 };
  88. osThreadAttradc1LimiterSwitchTask.stack_size = configMINIMAL_STACK_SIZE * 2;
  89. osThreadAttradc1LimiterSwitchTask.priority = (osPriority_t)osPriorityNormal;
  90. limiterSwitchTaskHandle = osThreadNew (LimiterSwitchTask, NULL, &osThreadAttradc1LimiterSwitchTask);
  91. encoderXTaskArg.dbgLed = DBG_LED2;
  92. encoderXTaskArg.pvEncoder = &(sensorsInfo.pvEncoderXraw);
  93. encoderXTaskArg.currentPosition = &(sensorsInfo.currentXPosition);
  94. encoderXTaskArg.positionOffset = &(sensorsInfo.positionXOffset);
  95. encoderXTaskArg.impPerTurn = ENCODER_X_IMP_PER_TURN;
  96. osMessageQueueAttr_t encoderMsgQueueAttr = { 0 };
  97. encoderXTaskArg.dataQueue = osMessageQueueNew (16, sizeof (uint32_t), &encoderMsgQueueAttr);
  98. encoderXTaskArg.initPinStates = ((HAL_GPIO_ReadPin (GPIOD, GPIO_PIN_15) << 1) | HAL_GPIO_ReadPin (GPIOD, GPIO_PIN_14)) & 0x3;
  99. encoderYTaskArg.dbgLed = DBG_LED3;
  100. encoderYTaskArg.pvEncoder = &(sensorsInfo.pvEncoderYraw);
  101. encoderYTaskArg.currentPosition = &(sensorsInfo.currentYPosition);
  102. encoderYTaskArg.positionOffset = &(sensorsInfo.positionYOffset);
  103. encoderYTaskArg.impPerTurn = ENCODER_Y_IMP_PER_TURN;
  104. encoderYTaskArg.dataQueue = osMessageQueueNew (16, sizeof (uint32_t), &encoderMsgQueueAttr);
  105. encoderYTaskArg.initPinStates = ((HAL_GPIO_ReadPin (GPIOB, GPIO_PIN_11) << 1) | HAL_GPIO_ReadPin (GPIOB, GPIO_PIN_10)) & 0x3;
  106. osThreadAttr_t osThreadAttrEncoderTask = { 0 };
  107. osThreadAttrEncoderTask.stack_size = configMINIMAL_STACK_SIZE * 2;
  108. osThreadAttrEncoderTask.priority = (osPriority_t)osPriorityRealtime7;
  109. encoderXTaskHandle = osThreadNew (EncoderTask, &encoderXTaskArg, &osThreadAttrEncoderTask);
  110. encoderYTaskHandle = osThreadNew (EncoderTask, &encoderYTaskArg, &osThreadAttrEncoderTask);
  111. #ifdef MOCK_VOLTAGES_AND_CURRENS
  112. GenenarateWaveSamples (325.269, 0, 128, 8, voltageWave[0]);
  113. GenenarateWaveSamples (324.269, 0, 128, 8, voltageWave[1]);
  114. GenenarateWaveSamples (323.269, 0, 128, 8, voltageWave[2]);
  115. GenenarateWaveSamples (1.414213562, 0, 128, 8, currentWave[0]);
  116. GenenarateWaveSamples (1.314213562, 0, 128, 8, currentWave[1]);
  117. GenenarateWaveSamples (1.214213562, 0, 128, 8, currentWave[2]);
  118. #endif
  119. // arm_hanning_f32
  120. // arm_rfft_fast_instance_f32 fft;
  121. // arm_rfft_fast_init_f32(&fft, FFT_Length);
  122. // arm_rfft_fast_f32(&fft, waveOne, fft_output, ifftFlag);
  123. // arm_cmplx_mag_f32(fft_output, fft_power, SAMPLE_BUFFER_LENGTH_HALF);
  124. // float32_t scale = 2.0f/FFT_Length;
  125. // arm_scale_f32(fft_power, scale, fft_power_scaled, SAMPLE_BUFFER_LENGTH_HALF);
  126. // float32_t maxValue;
  127. // uint32_t maxIndex;
  128. // arm_max_f32(fft_power_scaled, SAMPLE_BUFFER_LENGTH_HALF, &maxValue, &maxIndex);
  129. // printf("maxValue %f, index %ld\n", maxValue, maxIndex);
  130. }
  131. void ADC1MeasTask (void* arg) {
  132. float voltageAcc[CHANNELS_COUNT] = { 0 };
  133. float currentAcc[CHANNELS_COUNT] = { 0 };
  134. float powerAcc[CHANNELS_COUNT] = { 0 };
  135. uint32_t samplesCounter = 0;
  136. ADC1_Data adcData = { 0 };
  137. float gainCorrection = 1.0;
  138. while (pdTRUE) {
  139. osMessageQueueGet (adc1MeasDataQueue, &adcData, 0, osWaitForever);
  140. #ifdef GAIN_AUTO_CORRECTION
  141. if (osMutexAcquire (vRefmVMutex, osWaitForever) == osOK) {
  142. gainCorrection = (float)vRefmV;
  143. osMutexRelease (vRefmVMutex);
  144. }
  145. gainCorrection = gainCorrection / EXT_VREF_mV;
  146. #endif
  147. if (osMutexAcquire (resMeasurementsMutex, osWaitForever) == osOK) {
  148. for (uint8_t i = 0; i < CHANNELS_COUNT; i++) {
  149. #ifdef MOCK_VOLTAGES_AND_CURRENS
  150. float voltage = voltageWave[i][samplesCounter % SAMPLE_BUFFER_LENGTH];
  151. float current = currentWave[i][samplesCounter % SAMPLE_BUFFER_LENGTH];
  152. #else
  153. float voltage = (adcData.adcDataBuffer[UL1 + i] & 0xFFFF) * deltaADC * U_CHANNEL_CONST * gainCorrection * U_MeasCorrectionData[i].gain + U_MeasCorrectionData[i].offset;
  154. float ref = (float)(adcData.adcDataBuffer[IL1Ref + i] & 0xFFFF);
  155. float adcVal = (float)(adcData.adcDataBuffer[UL1 + i] >> 16);
  156. float current = (adcVal - ref) * deltaADC * I_CHANNEL_CONST * gainCorrection * I_MeasCorrectionData[i].gain + I_MeasCorrectionData[i].offset;
  157. #endif
  158. voltageAcc[i] += voltage * voltage;
  159. currentAcc[i] += current * current;
  160. powerAcc[i] += voltage * current;
  161. if (fabs (resMeasurements.voltagePeak[i]) < fabs (voltage)) {
  162. resMeasurements.voltagePeak[i] = voltage;
  163. }
  164. if (fabs (resMeasurements.currentPeak[i]) < fabs (current)) {
  165. resMeasurements.currentPeak[i] = current;
  166. }
  167. }
  168. samplesCounter += 1;
  169. if (samplesCounter > 33332)
  170. {
  171. for (uint8_t i = 0; i < CHANNELS_COUNT; i++) {
  172. resMeasurements.voltageRMS[i] = sqrtf(voltageAcc[i] / samplesCounter);
  173. resMeasurements.currentRMS[i] = sqrtf(currentAcc[i] / samplesCounter);
  174. resMeasurements.power[i] = powerAcc[i] / samplesCounter;
  175. voltageAcc[i] = 0;
  176. currentAcc[i] = 0;
  177. powerAcc[i] = 0;
  178. }
  179. samplesCounter = 0;
  180. DbgLEDToggle(DBG_LED3);
  181. }
  182. float fanFBVoltage = (adcData.adcDataBuffer[FanFB] & 0xFFFF) * deltaADC * -4.35 + 12;
  183. sensorsInfo.fanVoltage = fanFBVoltage;
  184. osMutexRelease (resMeasurementsMutex);
  185. }
  186. }
  187. }
  188. void ADC3MeasTask (void* arg) {
  189. float motorXSensCircBuffer[CIRC_BUFF_LEN] = { 0 };
  190. float motorYSensCircBuffer[CIRC_BUFF_LEN] = { 0 };
  191. #ifdef PV_BOARD
  192. float pvT1CircBuffer[CIRC_BUFF_LEN] = { 0 };
  193. float pvT2CircBuffer[CIRC_BUFF_LEN] = { 0 };
  194. #endif
  195. uint32_t circBuffPos = 0;
  196. ADC3_Data adcData = { 0 };
  197. while (pdTRUE) {
  198. osMessageQueueGet (adc3MeasDataQueue, &adcData, 0, osWaitForever);
  199. uint32_t vRef = __LL_ADC_CALC_VREFANALOG_VOLTAGE (adcData.adcDataBuffer[VrefInt], LL_ADC_RESOLUTION_16B);
  200. if (osMutexAcquire (vRefmVMutex, osWaitForever) == osOK) {
  201. vRefmV = vRef;
  202. osMutexRelease (vRefmVMutex);
  203. }
  204. float motorXCurrentSense = adcData.adcDataBuffer[motorXSense] * deltaADC * 10 / 8.33333;
  205. float motorYCurrentSense = adcData.adcDataBuffer[motorYSense] * deltaADC * 10 / 8.33333;
  206. motorXSensCircBuffer[circBuffPos] = motorXCurrentSense;
  207. motorYSensCircBuffer[circBuffPos] = motorYCurrentSense;
  208. #ifdef PV_BOARD
  209. pvT1CircBuffer[circBuffPos] = adcData.adcDataBuffer[pvTemp1] * deltaADC * 45.33333333 - 63;
  210. pvT2CircBuffer[circBuffPos] = adcData.adcDataBuffer[pvTemp2] * deltaADC * 45.33333333 - 63;
  211. #endif
  212. float motorXAveCurrent = 0;
  213. float motorYAveCurrent = 0;
  214. float pvT1AveTemp = 0;
  215. float pvT2AveTemp = 0;
  216. for (uint8_t i = 0; i < CIRC_BUFF_LEN; i++) {
  217. motorXAveCurrent += motorXSensCircBuffer[i];
  218. motorYAveCurrent += motorYSensCircBuffer[i];
  219. #ifdef PV_BOARD
  220. pvT1AveTemp += pvT1CircBuffer[i];
  221. pvT2AveTemp += pvT2CircBuffer[i];
  222. #endif
  223. }
  224. motorXAveCurrent /= CIRC_BUFF_LEN;
  225. motorYAveCurrent /= CIRC_BUFF_LEN;
  226. pvT1AveTemp /= CIRC_BUFF_LEN;
  227. pvT2AveTemp /= CIRC_BUFF_LEN;
  228. if (osMutexAcquire (sensorsInfoMutex, osWaitForever) == osOK) {
  229. if (sensorsInfo.motorXStatus == 1) {
  230. sensorsInfo.motorXAveCurrent = motorXAveCurrent;
  231. if (sensorsInfo.motorXPeakCurrent < motorXCurrentSense) {
  232. sensorsInfo.motorXPeakCurrent = motorXCurrentSense;
  233. }
  234. }
  235. if (sensorsInfo.motorYStatus == 1) {
  236. sensorsInfo.motorYAveCurrent = motorYAveCurrent;
  237. if (sensorsInfo.motorYPeakCurrent < motorYCurrentSense) {
  238. sensorsInfo.motorYPeakCurrent = motorYCurrentSense;
  239. }
  240. }
  241. sensorsInfo.pvTemperature[0] = pvT1AveTemp;
  242. sensorsInfo.pvTemperature[1] = pvT2AveTemp;
  243. osMutexRelease (sensorsInfoMutex);
  244. }
  245. ++circBuffPos;
  246. circBuffPos = circBuffPos % CIRC_BUFF_LEN;
  247. }
  248. }
  249. void LimiterSwitchTask (void* arg) {
  250. uint8_t limitXSwitchDownPrevState = 0;
  251. uint8_t limitXSwitchCenterPrevState = 0;
  252. uint8_t limitXSwitchUpPrevState = 0;
  253. uint8_t limitYSwitchDownPrevState = 0;
  254. uint8_t limitYSwitchCenterPrevState = 0;
  255. uint8_t limitYSwitchUpPrevState = 0;
  256. uint8_t pinStates = 0;
  257. uint8_t limiterXTriggered = 0;
  258. uint8_t limiterYTriggered = 0;
  259. if (osMutexAcquire (sensorsInfoMutex, osWaitForever) == osOK) {
  260. sensorsInfo.positionXWeak = 1;
  261. sensorsInfo.positionYWeak = 1;
  262. osMutexRelease (sensorsInfoMutex);
  263. }
  264. while (pdTRUE) {
  265. osDelay (pdMS_TO_TICKS (100));
  266. if (osMutexAcquire (sensorsInfoMutex, osWaitForever) == osOK) {
  267. sensorsInfo.limitXSwitchDown = HAL_GPIO_ReadPin (GPIOD, GPIO_PIN_12);
  268. pinStates = (limitXSwitchDownPrevState << 1) | sensorsInfo.limitXSwitchDown;
  269. if ((pinStates & 0x3) == 0x1) {
  270. limiterXTriggered = 1;
  271. sensorsInfo.positionXOffset = 0 - sensorsInfo.currentXPosition;
  272. sensorsInfo.positionXWeak = 0;
  273. }
  274. limitXSwitchDownPrevState = sensorsInfo.limitXSwitchDown;
  275. sensorsInfo.limitXSwitchUp = HAL_GPIO_ReadPin (GPIOD, GPIO_PIN_13);
  276. pinStates = (limitXSwitchUpPrevState << 1) | sensorsInfo.limitXSwitchUp;
  277. if ((pinStates & 0x3) == 0x1) {
  278. limiterXTriggered = 1;
  279. sensorsInfo.positionXOffset = 100 - sensorsInfo.currentXPosition;
  280. sensorsInfo.positionXWeak = 0;
  281. }
  282. limitXSwitchUpPrevState = sensorsInfo.limitXSwitchUp;
  283. sensorsInfo.limitXSwitchCenter = HAL_GPIO_ReadPin (GPIOD, GPIO_PIN_10);
  284. pinStates = (limitXSwitchCenterPrevState << 1) | sensorsInfo.limitXSwitchCenter;
  285. if ((pinStates & 0x3) == 0x1) {
  286. sensorsInfo.positionXOffset = AXE_X_MIDDLE_VALUE - sensorsInfo.currentXPosition;
  287. sensorsInfo.positionXWeak = 0;
  288. }
  289. limitXSwitchCenterPrevState = sensorsInfo.limitXSwitchCenter;
  290. sensorsInfo.limitYSwitchDown = HAL_GPIO_ReadPin (GPIOD, GPIO_PIN_11);
  291. pinStates = (limitYSwitchDownPrevState << 1) | sensorsInfo.limitYSwitchDown;
  292. if ((pinStates & 0x3) == 0x1) {
  293. limiterYTriggered = 1;
  294. sensorsInfo.positionYOffset = 0 - sensorsInfo.currentYPosition;
  295. sensorsInfo.positionYWeak = 0;
  296. }
  297. limitYSwitchDownPrevState = sensorsInfo.limitYSwitchDown;
  298. sensorsInfo.limitYSwitchUp = HAL_GPIO_ReadPin (GPIOD, GPIO_PIN_9);
  299. pinStates = (limitYSwitchUpPrevState << 1) | sensorsInfo.limitYSwitchUp;
  300. if ((pinStates & 0x3) == 0x1) {
  301. limiterYTriggered = 1;
  302. sensorsInfo.positionYOffset = 100 - sensorsInfo.currentYPosition;
  303. sensorsInfo.positionYWeak = 0;
  304. }
  305. limitYSwitchUpPrevState = sensorsInfo.limitYSwitchUp;
  306. sensorsInfo.limitYSwitchCenter = HAL_GPIO_ReadPin (GPIOD, GPIO_PIN_8);
  307. pinStates = (limitYSwitchCenterPrevState << 1) | sensorsInfo.limitYSwitchCenter;
  308. if ((pinStates & 0x3) == 0x1) {
  309. sensorsInfo.currentYPosition = AXE_Y_MIDDLE_VALUE - sensorsInfo.currentYPosition;
  310. sensorsInfo.positionYWeak = 0;
  311. }
  312. limitYSwitchCenterPrevState = sensorsInfo.limitYSwitchCenter;
  313. if (((sensorsInfo.limitXSwitchDown == 1) || (sensorsInfo.limitXSwitchUp == 1)) && (limiterXTriggered == 1)) {
  314. sensorsInfo.motorXStatus = MotorControl (&htim3, &motorXYTimerConfigOC, TIM_CHANNEL_1, TIM_CHANNEL_2, motorXTimerHandle, 0, 0, sensorsInfo.limitXSwitchUp, sensorsInfo.limitXSwitchDown);
  315. }
  316. if (((sensorsInfo.limitYSwitchDown == 1) || (sensorsInfo.limitYSwitchUp == 1)) && (limiterYTriggered == 1)) {
  317. sensorsInfo.motorYStatus = MotorControl (&htim3, &motorXYTimerConfigOC, TIM_CHANNEL_3, TIM_CHANNEL_4, motorYTimerHandle, 0, 0, sensorsInfo.limitYSwitchUp, sensorsInfo.limitYSwitchDown);
  318. }
  319. limiterXTriggered = 0;
  320. limiterYTriggered = 0;
  321. osMutexRelease (sensorsInfoMutex);
  322. }
  323. }
  324. }
  325. void EncoderTask (void* arg) {
  326. // 01 11 10 00
  327. const uint32_t encoderStates[4] = { 0x00, 0x01, 0x03, 0x02 };
  328. uint8_t step = 0;
  329. EncoderTaskArg* encoderTaskArg = (EncoderTaskArg*)arg;
  330. uint32_t pinStates = encoderTaskArg->initPinStates;
  331. for (uint8_t i = 0; i < 4; i++) {
  332. if (pinStates == encoderStates[i]) {
  333. step = i;
  334. break;
  335. }
  336. }
  337. while (pdTRUE) {
  338. osMessageQueueGet (encoderTaskArg->dataQueue, &pinStates, 0, osWaitForever);
  339. int32_t encoderValue = *encoderTaskArg->pvEncoder;
  340. if (osMutexAcquire (sensorsInfoMutex, osWaitForever) == osOK) {
  341. if (encoderStates[(step + 1) % 4] == pinStates) {
  342. step++;
  343. encoderValue++;
  344. // printf ("Forward\n");
  345. } else if (encoderStates[(step - 1) % 4] == pinStates) {
  346. encoderValue--;
  347. // printf ("Reverse\n");
  348. step--;
  349. } else {
  350. printf ("Forbidden\n");
  351. }
  352. step = step % 4;
  353. *encoderTaskArg->pvEncoder = encoderValue;
  354. *encoderTaskArg->currentPosition = 100 * (*encoderTaskArg->pvEncoder) / encoderTaskArg->impPerTurn;
  355. osMutexRelease (sensorsInfoMutex);
  356. }
  357. DbgLEDToggle (encoderTaskArg->dbgLed);
  358. }
  359. }