From 1d8f6d6b4fa1446d1823ea9fec55f27fb3fe19d7 Mon Sep 17 00:00:00 2001 From: VineetaGupta Date: Tue, 1 Apr 2025 15:01:30 +0200 Subject: [PATCH] Removed unneccesary comments and variable. --- .../nehemis/enduranceTestBench.c | 14 ++---- EnduranceTestBench/nehemis/processBoard.c | 44 ++++++------------- EnduranceTestBench/scheduler/sdl.c | 5 +-- 3 files changed, 19 insertions(+), 44 deletions(-) diff --git a/EnduranceTestBench/nehemis/enduranceTestBench.c b/EnduranceTestBench/nehemis/enduranceTestBench.c index 9c24d93..cdd7ff6 100644 --- a/EnduranceTestBench/nehemis/enduranceTestBench.c +++ b/EnduranceTestBench/nehemis/enduranceTestBench.c @@ -65,9 +65,8 @@ typedef struct * Global variable declarations ******************************************************************************/ static uint8 currentNode_gu8 = 0u; -static uint8 batchCompleted_u8 = 1u; static uint32 readPosition_gu32 = 0u; -static uint8 targetPositionStoredFlag_u8 = 0u; + static TestBenchData_en testBenchData_en; static SdlTestBenchState_en testBenchState_en = TEST_BENCH_IDLE; @@ -76,7 +75,7 @@ static uint64 writeTime_u64; /****************************************************************************** * Public Function Definitions ******************************************************************************/ -void EnduranceTestBenchRun(bool *testBenchStarted_b) +void EnduranceTestBenchRun(bool *testBenchStarted_pb) { static uint64 startTime_u64 = 0uLL; static uint8 alternate_u8 = 0u; @@ -117,8 +116,6 @@ void EnduranceTestBenchRun(bool *testBenchStarted_b) else { /* After 10 seconds, move to endurance test */ - batchCompleted_u8 = 1u; - // *testBenchStarted_b = true; testBenchState_en = TEST_BENCH_IDLE; } @@ -129,7 +126,7 @@ void EnduranceTestBenchRun(bool *testBenchStarted_b) case TEST_BENCH_IDLE: { - *testBenchStarted_b = true; + *testBenchStarted_pb = true; uint8 max_u8 = NMS_UINT8_MAX; /* Fully open (255) */ uint8 min_u8 = 0u; /* Fully closed (0) */ uint8 currentGroup_u8 = alternate_u8 % 2; /* Alternates between two patterns */ @@ -202,7 +199,6 @@ void EnduranceTestBenchRun(bool *testBenchStarted_b) /* Mark node as skipped and move on */ currentNode_gu8++; retries_u8 = 0u; - targetPositionStoredFlag_u8 = 0u; testBenchState_en = TEST_BENCH_BATCH_WRITE; } } @@ -224,7 +220,6 @@ void EnduranceTestBenchRun(bool *testBenchStarted_b) { /* Move to next node write */ currentNode_gu8++; - targetPositionStoredFlag_u8 = 0u; /* Reset for next node */ testBenchState_en = TEST_BENCH_BATCH_WRITE; } break; @@ -297,7 +292,7 @@ void EnduranceTestBenchRun(bool *testBenchStarted_b) if (testBenchData_en.status_en[currentNode_gu8] != TEST_BENCH_DATA_NODE_SKIPPED) { if (abs(testBenchData_en.targetPositions_gau8[currentNode_gu8] - - testBenchData_en.readPosition_gau8[currentNode_gu8]) <= 5) /* Accepted difference between read and write for successful operation */ + testBenchData_en.readPosition_gau8[currentNode_gu8]) <= 5u) /* Accepted difference between read and write for successful operation */ { testBenchData_en.status_en[currentNode_gu8] = TEST_BENCH_DATA_VERIF_SUCCESS; } @@ -332,7 +327,6 @@ void EnduranceTestBenchRun(bool *testBenchStarted_b) /* Reset everything and Start next cycle */ currentNode_gu8 = 0u; - targetPositionStoredFlag_u8 = 0u; retries_u8 = 0u; testBenchState_en = TEST_BENCH_IDLE; break; diff --git a/EnduranceTestBench/nehemis/processBoard.c b/EnduranceTestBench/nehemis/processBoard.c index c8c0672..87bc756 100644 --- a/EnduranceTestBench/nehemis/processBoard.c +++ b/EnduranceTestBench/nehemis/processBoard.c @@ -37,9 +37,12 @@ #define PU_CANOPEN_MASTER_LINE 1u -#define PU_PUMP_SPEED_CHANGE_INTERVAL 60000uLL -#define PU_PUMP_MAX_SPEED 10u -#define PU_PUMP_MIN_SPEED 0u +#define PU_PUMP_SPEED_CHANGE_INTERVAL 900000uLL +#define PU_PUMP_MAX_SPEED 10u +#define PU_PUMP_MIN_SPEED 0u + +#define PU_PMP_ENABLE 1u +#define PU_PMP_DISABLE 0u /****************************************************************************** * Global variables ******************************************************************************/ @@ -168,29 +171,6 @@ void ProcessBoardRun(void) /****************************************************************************** * Private function definitions ******************************************************************************/ -//static void ProcessBoardGrundfosPumpHandler(void) -//{ -// uint32 pmpSpeed_u32 = 0uL; -// uint8 mode_u8 = 0u; -// uint8 speed_u8 = 0u; -// -// NmsCanGetObj_u8(OD_ENTRY_PU_GRUNDFOS_PUMP_CONTROL_INDEX, OD_ENTRY_PU_GRUNDFOS_PUMP_ENABLE_SUB_INDEX, &mode_u8); -// NmsCanGetObj_u8(OD_ENTRY_PU_GRUNDFOS_PUMP_CONTROL_INDEX, OD_ENTRY_PU_GRUNDFOS_PUMP_SET_SPEED_SUB_INDEX, &speed_u8); -// -// GrundfosPmpEnable(mode_u8); -// if(mode_u8 == 1u) -// { -// GrundfosPmpSetSpeed(speed_u8); -// /* Grundfos Pump feedback speed OUT */ -// pmpSpeed_u32 = GrundfosPmpFeedbackSpeed(PMP_ADC_CHANNEL); -// } -// else -// { -// pmpSpeed_u32 = 0uL; -// } -// ProcessBoardPumpSpeedDataOUT(pmpSpeed_u32); -//} - static void ProcessBoardGrundfosPumpHandler(void) { static uint32 pmpSpeed_u32 = 0uL; @@ -205,9 +185,8 @@ static void ProcessBoardGrundfosPumpHandler(void) HalSystemGetRunTimeMs(&startTime_u64); } - GrundfosPmpEnable(true); + GrundfosPmpEnable(PU_PMP_ENABLE); - // Corrected time comparison if ((currentTimeMs_u64 - startTime_u64) >= PU_PUMP_SPEED_CHANGE_INTERVAL) { // Update speed @@ -222,17 +201,20 @@ static void ProcessBoardGrundfosPumpHandler(void) GrundfosPmpSetSpeed(speed_u8); - // Update last time for next interval startTime_u64 = currentTimeMs_u64; /* Grundfos Pump feedback speed OUT */ pmpSpeed_u32 = GrundfosPmpFeedbackSpeed(PMP_ADC_CHANNEL); + + /* To be verified */ + if (pmpSpeed_u32 > PU_PUMP_MAX_SPEED) + { + GrundfosPmpEnable(PU_PMP_DISABLE); + } } } - - static void ProcessBoardTriggerMvPosCtrl(uint8 motorId_u8, uint8 posData_u8) { diff --git a/EnduranceTestBench/scheduler/sdl.c b/EnduranceTestBench/scheduler/sdl.c index 20be16b..a3417ae 100644 --- a/EnduranceTestBench/scheduler/sdl.c +++ b/EnduranceTestBench/scheduler/sdl.c @@ -72,9 +72,9 @@ typedef struct /****************************************************************************** * Global Declarations ******************************************************************************/ +static bool testBenchStarted_b; SdlLssNodeInfo_t var_gst; -static CO_TIMER_T monitorTimer_gst; /**< application timer */ -static CO_TIMER_T nodeResetTimer_gst; /**< node reset timer */ +static CO_TIMER_T monitorTimer_gst; /**< application timer */ static bool monitorSleep_gb = CO_FALSE; /**< sleep flag */ static bool masterStarted_gb; /**< master started flag */ static const SdlLssNodeInfo_t nodeLookupTable_gast[SDL_LSS_NODE_COUNT] = @@ -122,7 +122,6 @@ static RET_T SdlLssSetSdoCobID(uint8 sdoNr_u8, uint8 nodeId_u8); extern void userOverwriteCobIdSettings(void); static bool SdlAreAllNodesOperational(void); -bool testBenchStarted_b; /****************************************************************************** * Public Function Definitions ******************************************************************************/