@@ -64,7 +64,7 option(FSW_debug_tch "?" OFF) | |||
|
64 | 64 | set(SW_VERSION_N1 "3" CACHE STRING "Choose N1 FSW Version." FORCE) |
|
65 | 65 | set(SW_VERSION_N2 "2" CACHE STRING "Choose N2 FSW Version." FORCE) |
|
66 | 66 | set(SW_VERSION_N3 "0" CACHE STRING "Choose N3 FSW Version." FORCE) |
|
67 |
set(SW_VERSION_N4 " |
|
|
67 | set(SW_VERSION_N4 "7" CACHE STRING "Choose N4 FSW Version." FORCE) | |
|
68 | 68 | |
|
69 | 69 | if(FSW_verbose) |
|
70 | 70 | add_definitions(-DPRINT_MESSAGES_ON_CONSOLE) |
@@ -372,6 +372,12 rtems_task avgv_task(rtems_task_argument | |||
|
372 | 372 | static int32_t v[MOVING_AVERAGE] = {0}; |
|
373 | 373 | static int32_t e1[MOVING_AVERAGE] = {0}; |
|
374 | 374 | static int32_t e2[MOVING_AVERAGE] = {0}; |
|
375 | static int old_v = 0; | |
|
376 | static int old_e1 = 0; | |
|
377 | static int old_e2 = 0; | |
|
378 | int current_v; | |
|
379 | int current_e1; | |
|
380 | int current_e2; | |
|
375 | 381 | int32_t average_v; |
|
376 | 382 | int32_t average_e1; |
|
377 | 383 | int32_t average_e2; |
@@ -400,6 +406,9 rtems_task avgv_task(rtems_task_argument | |||
|
400 | 406 | |
|
401 | 407 | // initialize values |
|
402 | 408 | indexOfOldValue = MOVING_AVERAGE - 1; |
|
409 | current_v = 0; | |
|
410 | current_e1 = 0; | |
|
411 | current_e2 = 0; | |
|
403 | 412 | average_v = 0; |
|
404 | 413 | average_e1 = 0; |
|
405 | 414 | average_e2 = 0; |
@@ -418,33 +427,45 rtems_task avgv_task(rtems_task_argument | |||
|
418 | 427 | } |
|
419 | 428 | else |
|
420 | 429 | { |
|
421 | // get new values | |
|
422 |
|
|
|
423 |
|
|
|
424 | newValue_e2 = getIntFromShort( waveform_picker_regs->e2 ); | |
|
430 | current_v = waveform_picker_regs->v; | |
|
431 | current_e1 = waveform_picker_regs->e1; | |
|
432 | current_e2 = waveform_picker_regs->e2; | |
|
433 | if ( (current_v != old_v) | |
|
434 | && (current_e1 != old_e1) | |
|
435 | && (current_e2 != old_e2)) | |
|
436 | { | |
|
437 | // get new values | |
|
438 | newValue_v = getIntFromShort( current_v ); | |
|
439 | newValue_e1 = getIntFromShort( current_e1 ); | |
|
440 | newValue_e2 = getIntFromShort( current_e2 ); | |
|
425 | 441 | |
|
426 | // compute the moving average | |
|
427 | average_v = average_v + newValue_v - v[k]; | |
|
428 | average_e1 = average_e1 + newValue_e1 - e1[k]; | |
|
429 | average_e2 = average_e2 + newValue_e2 - e2[k]; | |
|
442 | // compute the moving average | |
|
443 | average_v = average_v + newValue_v - v[k]; | |
|
444 | average_e1 = average_e1 + newValue_e1 - e1[k]; | |
|
445 | average_e2 = average_e2 + newValue_e2 - e2[k]; | |
|
430 | 446 | |
|
431 | // store new values in buffers | |
|
432 | v[k] = newValue_v; | |
|
433 | e1[k] = newValue_e1; | |
|
434 | e2[k] = newValue_e2; | |
|
435 | } | |
|
436 | if (k == (MOVING_AVERAGE-1)) | |
|
437 | { | |
|
438 | k = 0; | |
|
447 | // store new values in buffers | |
|
448 | v[k] = newValue_v; | |
|
449 | e1[k] = newValue_e1; | |
|
450 | e2[k] = newValue_e2; | |
|
451 | ||
|
452 | if (k == (MOVING_AVERAGE-1)) | |
|
453 | { | |
|
454 | k = 0; | |
|
455 | } | |
|
456 | else | |
|
457 | { | |
|
458 | k++; | |
|
459 | } | |
|
460 | //update int16 values | |
|
461 | hk_lfr_sc_v_f3_as_int16 = (int16_t) (average_v / MOVING_AVERAGE ); | |
|
462 | hk_lfr_sc_e1_f3_as_int16 = (int16_t) (average_e1 / MOVING_AVERAGE ); | |
|
463 | hk_lfr_sc_e2_f3_as_int16 = (int16_t) (average_e2 / MOVING_AVERAGE ); | |
|
464 | } | |
|
465 | old_v = current_v; | |
|
466 | old_e1 = current_e1; | |
|
467 | old_e2 = current_e2; | |
|
439 | 468 | } |
|
440 | else | |
|
441 | { | |
|
442 | k++; | |
|
443 | } | |
|
444 | //update int16 values | |
|
445 | hk_lfr_sc_v_f3_as_int16 = (int16_t) (average_v / MOVING_AVERAGE ); | |
|
446 | hk_lfr_sc_e1_f3_as_int16 = (int16_t) (average_e1 / MOVING_AVERAGE ); | |
|
447 | hk_lfr_sc_e2_f3_as_int16 = (int16_t) (average_e2 / MOVING_AVERAGE ); | |
|
448 | 469 | } |
|
449 | 470 | |
|
450 | 471 | PRINTF("in AVGV *** deleting task\n"); |
General Comments 0
You need to be logged in to leave comments.
Login now