Skip to content

Commit

Permalink
Pump depend on CAN
Browse files Browse the repository at this point in the history
  • Loading branch information
dnakhooda committed Jan 31, 2025
1 parent 33009f6 commit f2a8e68
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Core/Inc/control.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "can.h"

#define CONTROL_CANID_FANBATTBOX 0x4A1
#define CONTROL_CANID_PUMP0 0x4A0
#define CONTROL_CANID_PUMP 0x4A0

extern osThreadId_t control_handle;
extern const osThreadAttr_t control_attributes;
Expand All @@ -14,6 +14,6 @@ void vControl(void *param);

void control_fanbattbox_record(can_msg_t args);

void control_pump0_record(can_msg_t msg);
void control_pump_record(can_msg_t msg);

#endif
4 changes: 2 additions & 2 deletions Core/Src/can_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ void vCanReceive(void *pv_params)
case CONTROL_CANID_FANBATTBOX:
control_fanbattbox_record(msg);
break;
case CONTROL_CANID_PUMP0:
control_pump0_record(msg);
case CONTROL_CANID_PUMP:
control_pump_record(msg);
default:
break;
}
Expand Down
11 changes: 6 additions & 5 deletions Core/Src/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const osThreadAttr_t control_attributes = {

static int fanBattBoxState = 0;

static int pump0State = 0;
static int pumpState = 0;

void vControl(void *param)
{
Expand All @@ -19,7 +19,8 @@ void vControl(void *param)
for (;;) {
write_fan_battbox(pdu, fanBattBoxState);

write_pump(pdu, pump0State);
write_pump_0(pdu, pumpState);
write_pump_1(pdu, pumpState);

osDelay(1000);
}
Expand All @@ -34,11 +35,11 @@ void control_fanbattbox_record(can_msg_t msg)
}
}

void control_pump0_record(can_msg_t msg)
void control_pump_record(can_msg_t msg)
{
if (msg.data[0] > 0) {
pump0State = 1;
pumpState = 1;
} else {
pump0State = 0;
pumpState = 0;
}
}

0 comments on commit f2a8e68

Please sign in to comment.