Skip to content

Commit 0249adc

Browse files
authored
Merge pull request EmbeddedRPC#128 from VERO-Biotech/GDS4-3280-Injection-Pump-set-flow-returning-incorrectly
[GDS4-3280] adding a delay to prevent the UART from getting mixed up between set …
2 parents fcb939a + 9229754 commit 0249adc

14 files changed

+612
-145
lines changed

Bench/InjPump/Inc/InjPump.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class InjPump
1818
virtual ~InjPump() = 0;
1919

2020
virtual void init() = 0;
21-
virtual void injSetFlowRate(float flowrate) = 0;
21+
virtual float injSetFlowRate(float flowrate) = 0;
2222
virtual float injGetFlowRate() = 0;
2323

2424
float m_flowrate;

Bench/InjPump/Inc/InjPumpHw.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class InjPumpHw : public InjPump
9696
InjPumpHw(UART_HandleTypeDef* uartHandle);
9797
~InjPumpHw() override;
9898
void init() override;
99-
void injSetFlowRate(float flowrate) override;
99+
float injSetFlowRate(float flowrate) override;
100100
float injGetFlowRate() override;
101101

102102

Bench/InjPump/Inc/InjPumpSim.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class InjPumpSim : public InjPump
2121

2222
void init();
2323

24-
void injSetFlowRate(float flowrate) override;
24+
float injSetFlowRate(float flowrate) override;
2525

2626
float injGetFlowRate() override;
2727

Bench/InjPump/Src/InjPumpHw.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ void InjPumpHw::init()
2929
}
3030

3131
// Set flow rate
32-
void InjPumpHw::injSetFlowRate(float flowrate)
32+
float InjPumpHw::injSetFlowRate(float flowrate)
3333
{
34+
float retVal = INJ_PUMP_ERROR_VALUE;
3435
//handle out of bounds inputs
3536
if(flowrate > 100)
3637
{
@@ -71,6 +72,14 @@ void InjPumpHw::injSetFlowRate(float flowrate)
7172
{
7273
///TODO: Add error handling here
7374
}
75+
76+
//receive the response
77+
uint8_t buff[PumpUart::DUTY_CYCLE_ACTIVE_SETPOINT_SIZE + 1] = {};
78+
rxMessage(&buff[0], PumpUart::RX_DATA_IDX, PumpUart::DUTY_CYCLE_ACTIVE_SETPOINT_SIZE);
79+
retVal = (float)std::atoi((char*)buff);
80+
return retVal;
81+
82+
7483
}
7584

7685
// Get flow rate

Bench/InjPump/Src/InjPumpSim.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void InjPumpSim::init()
2626
}
2727

2828

29-
void InjPumpSim::injSetFlowRate(float flowrate)
29+
float InjPumpSim::injSetFlowRate(float flowrate)
3030
{
3131
//TODO: Does this set the simFlowrate?
3232
}

Bench/Src/InjectionControl.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ OPENLOOP_CONTROL InjectionControl::get_P01OpenLoopControl()
116116

117117
float InjectionControl::setP01FlowRate(float flow)
118118
{
119-
m_injPump->injSetFlowRate(flow);
120-
return m_injPump->injGetFlowRate();
119+
return m_injPump->injSetFlowRate(flow);
121120
}
122121

123122
float InjectionControl::getP01FlowRate()

Shim/c_verofirmwareapi_server.cpp

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Generated by erpcgen 1.14.0 on Wed Nov 5 12:34:06 2025.
2+
* Generated by erpcgen 1.14.0 on Wed Nov 5 13:19:00 2025.
33
*
44
* AUTOGENERATED - DO NOT EDIT
55
*/
@@ -35,6 +35,7 @@ using namespace erpcShim;
3535

3636

3737

38+
3839

3940

4041
class api_server: public api_interface
@@ -3817,3 +3818,76 @@ void destroy_Diagnostics_service(erpc_service_t service)
38173818
#endif
38183819
}
38193820

3821+
3822+
class AdaptiveSensor_server: public AdaptiveSensor_interface
3823+
{
3824+
public:
3825+
virtual ~AdaptiveSensor_server() {};
3826+
3827+
3828+
AdaptiveSensorInfo * erpcAdaptiveGetInfo(void)
3829+
{
3830+
AdaptiveSensorInfo * result = NULL;
3831+
result = ::erpcAdaptiveGetInfo();
3832+
3833+
return result;
3834+
}
3835+
3836+
int8_t erpcAdaptiveReset(AdaptiveResetType resetType)
3837+
{
3838+
int8_t result;
3839+
result = ::erpcAdaptiveReset(resetType);
3840+
3841+
return result;
3842+
}
3843+
3844+
AdaptiveMeasurement * erpcAdaptiveGetFlowMeasurement(void)
3845+
{
3846+
AdaptiveMeasurement * result = NULL;
3847+
result = ::erpcAdaptiveGetFlowMeasurement();
3848+
3849+
return result;
3850+
}
3851+
};
3852+
3853+
ERPC_MANUALLY_CONSTRUCTED_STATIC(AdaptiveSensor_service, s_AdaptiveSensor_service);
3854+
ERPC_MANUALLY_CONSTRUCTED_STATIC(AdaptiveSensor_server, s_AdaptiveSensor_server);
3855+
3856+
erpc_service_t create_AdaptiveSensor_service(void)
3857+
{
3858+
erpc_service_t service;
3859+
3860+
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
3861+
service = new (nothrow) AdaptiveSensor_service(new (nothrow)AdaptiveSensor_server());
3862+
#else
3863+
if (s_AdaptiveSensor_service.isUsed())
3864+
{
3865+
service = NULL;
3866+
}
3867+
else
3868+
{
3869+
s_AdaptiveSensor_server.construct();
3870+
s_AdaptiveSensor_service.construct(s_AdaptiveSensor_server.get());
3871+
service = s_AdaptiveSensor_service.get();
3872+
}
3873+
#endif
3874+
3875+
return service;
3876+
}
3877+
3878+
void destroy_AdaptiveSensor_service(erpc_service_t service)
3879+
{
3880+
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
3881+
if (service)
3882+
{
3883+
delete (AdaptiveSensor_server *)(((AdaptiveSensor_service *)service)->getHandler());
3884+
delete (AdaptiveSensor_service *)service;
3885+
}
3886+
#else
3887+
(void)service;
3888+
erpc_assert(service == s_AdaptiveSensor_service.get());
3889+
s_AdaptiveSensor_service.destroy();
3890+
s_AdaptiveSensor_server.destroy();
3891+
#endif
3892+
}
3893+

Shim/c_verofirmwareapi_server.h

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Generated by erpcgen 1.14.0 on Wed Nov 5 12:34:06 2025.
2+
* Generated by erpcgen 1.14.0 on Wed Nov 5 13:19:00 2025.
33
*
44
* AUTOGENERATED - DO NOT EDIT
55
*/
@@ -530,6 +530,16 @@ enum _Diagnostics_ids
530530
kDiagnostics_erpcDiagStackSize_id = 6,
531531
};
532532

533+
534+
/*! @brief AdaptiveSensor identifiers */
535+
enum _AdaptiveSensor_ids
536+
{
537+
kAdaptiveSensor_service_id = 24,
538+
kAdaptiveSensor_erpcAdaptiveGetInfo_id = 1,
539+
kAdaptiveSensor_erpcAdaptiveReset_id = 2,
540+
kAdaptiveSensor_erpcAdaptiveGetFlowMeasurement_id = 3,
541+
};
542+
533543
//! @name api
534544
//@{
535545
SysInfoDateStatus * erpcSystemGetInfo(void);
@@ -1297,6 +1307,15 @@ uint16_t erpcDiagHeapSize(void);
12971307
uint16_t erpcDiagStackSize(void);
12981308
//@}
12991309

1310+
//! @name AdaptiveSensor
1311+
//@{
1312+
AdaptiveSensorInfo * erpcAdaptiveGetInfo(void);
1313+
1314+
int8_t erpcAdaptiveReset(AdaptiveResetType resetType);
1315+
1316+
AdaptiveMeasurement * erpcAdaptiveGetFlowMeasurement(void);
1317+
//@}
1318+
13001319

13011320
#endif // ERPC_FUNCTIONS_DEFINITIONS
13021321

@@ -1438,6 +1457,12 @@ erpc_service_t create_Diagnostics_service(void);
14381457
/*! @brief Destroy Diagnostics_service service object. */
14391458
void destroy_Diagnostics_service(erpc_service_t service);
14401459

1460+
/*! @brief Return AdaptiveSensor_service service object. */
1461+
erpc_service_t create_AdaptiveSensor_service(void);
1462+
1463+
/*! @brief Destroy AdaptiveSensor_service service object. */
1464+
void destroy_AdaptiveSensor_service(erpc_service_t service);
1465+
14411466

14421467
#if defined(__cplusplus)
14431468
}

Shim/verofirmwareapi_common.h

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Generated by erpcgen 1.14.0 on Wed Nov 5 12:34:06 2025.
2+
* Generated by erpcgen 1.14.0 on Wed Nov 5 13:19:00 2025.
33
*
44
* AUTOGENERATED - DO NOT EDIT
55
*/
@@ -604,6 +604,13 @@ typedef enum Flowpath
604604
NO_OUTPUT = 3
605605
} Flowpath;
606606

607+
typedef enum AdaptiveResetType
608+
{
609+
BOARD_RESET = 0,
610+
SENSOR_HARD_RESET = 1,
611+
SENSOR_SOFT_RESET = 2
612+
} AdaptiveResetType;
613+
607614
// Aliases data types declarations
608615
typedef struct SysInfoDateStatus SysInfoDateStatus;
609616
typedef struct EepromByte EepromByte;
@@ -657,6 +664,8 @@ typedef struct DosingModuleInfo DosingModuleInfo;
657664
typedef struct MotorPositionString MotorPositionString;
658665
typedef struct FirmwareInfo FirmwareInfo;
659666
typedef struct WaterTrapInfo WaterTrapInfo;
667+
typedef struct AdaptiveSensorInfo AdaptiveSensorInfo;
668+
typedef struct AdaptiveMeasurement AdaptiveMeasurement;
660669

661670
// Structures/unions data types declarations
662671
struct SysInfoDateStatus
@@ -1085,6 +1094,23 @@ struct WaterTrapInfo
10851094
bool TrapFull;
10861095
};
10871096

1097+
struct AdaptiveSensorInfo
1098+
{
1099+
int8_t err;
1100+
char * swVersion;
1101+
char * hwVersion;
1102+
char * article;
1103+
};
1104+
1105+
struct AdaptiveMeasurement
1106+
{
1107+
int8_t err;
1108+
int32_t value;
1109+
};
1110+
1111+
1112+
// Constant variable declarations
1113+
extern const float INJ_PUMP_ERROR_VALUE;
10881114

10891115
#endif // ERPC_TYPE_DEFINITIONS_VEROFIRMWAREAPI
10901116

Shim/verofirmwareapi_common.hpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Generated by erpcgen 1.14.0 on Wed Nov 5 12:34:06 2025.
2+
* Generated by erpcgen 1.14.0 on Wed Nov 5 13:19:00 2025.
33
*
44
* AUTOGENERATED - DO NOT EDIT
55
*/
@@ -599,6 +599,13 @@ typedef enum Flowpath
599599
NO_OUTPUT = 3
600600
} Flowpath;
601601

602+
typedef enum AdaptiveResetType
603+
{
604+
BOARD_RESET = 0,
605+
SENSOR_HARD_RESET = 1,
606+
SENSOR_SOFT_RESET = 2
607+
} AdaptiveResetType;
608+
602609
// Aliases data types declarations
603610
typedef struct SysInfoDateStatus SysInfoDateStatus;
604611
typedef struct EepromByte EepromByte;
@@ -652,6 +659,8 @@ typedef struct DosingModuleInfo DosingModuleInfo;
652659
typedef struct MotorPositionString MotorPositionString;
653660
typedef struct FirmwareInfo FirmwareInfo;
654661
typedef struct WaterTrapInfo WaterTrapInfo;
662+
typedef struct AdaptiveSensorInfo AdaptiveSensorInfo;
663+
typedef struct AdaptiveMeasurement AdaptiveMeasurement;
655664

656665
// Structures/unions data types declarations
657666
struct SysInfoDateStatus
@@ -1080,6 +1089,23 @@ struct WaterTrapInfo
10801089
bool TrapFull;
10811090
};
10821091

1092+
struct AdaptiveSensorInfo
1093+
{
1094+
int8_t err;
1095+
char * swVersion;
1096+
char * hwVersion;
1097+
char * article;
1098+
};
1099+
1100+
struct AdaptiveMeasurement
1101+
{
1102+
int8_t err;
1103+
int32_t value;
1104+
};
1105+
1106+
1107+
// Constant variable declarations
1108+
extern const float INJ_PUMP_ERROR_VALUE;
10831109

10841110
#endif // ERPC_TYPE_DEFINITIONS_VEROFIRMWAREAPI
10851111

0 commit comments

Comments
 (0)