Skip to content

Commit

Permalink
Fixing type mishandling
Browse files Browse the repository at this point in the history
  • Loading branch information
MaffooClock committed Nov 9, 2023
1 parent fcde099 commit 24393c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/DFR_Radar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ bool DFR_Radar::setLockout( float time )
if( time < 0.1 || time > 255 )
return false;

char _comSetInhibit[15] = {0};
char _comSetInhibit[19] = {0};
sprintf( _comSetInhibit, comSetInhibit, time );

return setConfig( _comSetInhibit );
Expand Down Expand Up @@ -294,7 +294,7 @@ bool DFR_Radar::setTriggerLatency( float confirmationDelay, float disappearanceD
if( disappearanceDelay < 0 || disappearanceDelay > 1500 )
return false;

char _comSetLatency[20] = {0};
char _comSetLatency[28] = {0};
sprintf( _comSetLatency, comSetLatency, confirmationDelay , disappearanceDelay );

return setConfig( _comSetLatency );
Expand All @@ -307,8 +307,8 @@ bool DFR_Radar::setOutputLatency( float triggerDelay, float resetDelay )
return false;

// Convert seconds into 25ms units
uint16_t _triggerDelay = triggerDelay * 1000 / 25;
uint16_t _resetDelay = resetDelay * 1000 / 25;
uint32_t _triggerDelay = triggerDelay * 1000 / 25;
uint32_t _resetDelay = resetDelay * 1000 / 25;

if( _triggerDelay > 65535 || _resetDelay > 65535 )
return false;
Expand All @@ -321,7 +321,7 @@ bool DFR_Radar::setOutputLatency( float triggerDelay, float resetDelay )

bool DFR_Radar::setSensitivity( uint8_t level )
{
if( level < 0 || level > 9 )
if( level > 9 )
return false;

char _comSetSensitivity[17] = {0};
Expand Down
4 changes: 2 additions & 2 deletions src/DFR_Radar.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,10 @@ class DFR_Radar
static constexpr const char *comDetRangeCfg4 = "detRangeCfg -1 %u %u %u %u %u %u %u %u";
static constexpr const char *comSetSensitivity = "setSensitivity %u";
static constexpr const char *comOutputLatency = "outputLatency -1 %u %u";
static constexpr const char *comSetLatency = "setLatency %u %u";
static constexpr const char *comSetLatency = "setLatency %.3f %.3f";
static constexpr const char *comSetGpioMode = "setGpioMode 1 %u";
static constexpr const char *comGetOutput = "getOutput 1";
static constexpr const char *comSetInhibit = "setInhibit %u";
static constexpr const char *comSetInhibit = "setInhibit %.3f";
static constexpr const char *comSetLedMode = "setLedMode 1 %u";
// static constexpr const char *comSetUartOutput = "setUartOutput 1 1 0 1501";
static constexpr const char *comSetEcho = "setEcho 0";
Expand Down

0 comments on commit 24393c9

Please sign in to comment.