Skip to content

Commit

Permalink
Set periodofcheck to 250 if not parsed from config
Browse files Browse the repository at this point in the history
  • Loading branch information
MSECode committed Dec 27, 2023
1 parent 2603a27 commit 141e34c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ extern "C" {
#define EOMTHEEMSAPPLCFG_VERSION_MAJOR (VERSION_MAJOR_OFFSET+3)
// <o> minor <0-255>
// <o> minor <0-255>
#define EOMTHEEMSAPPLCFG_VERSION_MINOR 83
#define EOMTHEEMSAPPLCFG_VERSION_MINOR 97

// </h>version

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ struct embot::app::eth::theBATservice::Impl {
CANmonitor canmonitor{};
static constexpr CANmonitor::Config defaultcanmonitorconfig{
{}, // the map is left empty
300 * embot::core::time1millisec,
200 * embot::core::time1millisec,
CANmonitor::Report::ALL,
10 * embot::core::time1second,
s_eobj_ownname,
Expand Down Expand Up @@ -474,8 +474,11 @@ eOresult_t embot::app::eth::theBATservice::Impl::Start() {
CANmonitor::Config cfg = defaultcanmonitorconfig;
// use ...
cfg.target.clear();
//cfg.periodofcheck = embot::core::time1millisec * service.servconfig.data.as.battery.canmonitorconfig.periodofcheck;
cfg.periodofcheck = embot::core::time1millisec * (uint8_t)300;
// check if we are not using custom value > 100 for service.servconfig.data.as.battery.canmonitorconfig.periodofcheck
// if not we are setting it to 250 in order to not having error when canmonitor checks for BAT frames
if(service.servconfig.data.as.battery.canmonitorconfig.periodofcheck == 0)
service.servconfig.data.as.battery.canmonitorconfig.periodofcheck = 250;
cfg.periodofcheck = embot::core::time1millisec * service.servconfig.data.as.battery.canmonitorconfig.periodofcheck;
cfg.periodofreport = embot::core::time1millisec * service.servconfig.data.as.battery.canmonitorconfig.periodofreport;
cfg.reportmode = static_cast<CANmonitor::Report>(service.servconfig.data.as.battery.canmonitorconfig.reportmode);
canmonitor.configure(cfg);
Expand Down

0 comments on commit 141e34c

Please sign in to comment.