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