fix warnings (#4840)

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
Matthew Kennedy 2022-11-27 10:11:14 -05:00 committed by GitHub
parent efdb9d57af
commit 9e60b52ed4
10 changed files with 30 additions and 33 deletions

View File

@ -6,7 +6,7 @@
#include <cstdint>
struct TsChannelBase;
class TsChannelBase;
typedef enum {
TS_PLAIN = 0,

View File

@ -52,7 +52,7 @@ public:
/**
* Returns true if the engine is not spinning (RPM==0)
*/
bool isStopped() const;
bool isStopped() const override;
/**
* Returns true if the engine is spinning up
*/
@ -60,7 +60,7 @@ public:
/**
* Returns true if the engine is cranking OR spinning up
*/
bool isCranking() const;
bool isCranking() const override;
/**
* Returns true if the engine is running and not cranking
*/
@ -118,7 +118,7 @@ public:
* This is a performance optimization: let's pre-calculate this each time RPM changes
* NaN while engine is not spinning
*/
volatile floatus_t oneDegreeUs = NAN;
floatus_t oneDegreeUs = NAN;
floatus_t getOneDegreeUs() override {
return oneDegreeUs;
@ -150,11 +150,11 @@ private:
* This counter is incremented with each revolution of one of the shafts. Could be
* crankshaft could be camshaft.
*/
volatile uint32_t revolutionCounterSinceBoot = 0;
uint32_t revolutionCounterSinceBoot = 0;
/**
* Same as the above, but since the engine started spinning
*/
volatile uint32_t revolutionCounterSinceStart = 0;
uint32_t revolutionCounterSinceStart = 0;
spinning_state_e state = STOPPED;

View File

@ -436,7 +436,11 @@ struct LuaSensor final : public StoredValueSensor {
StoredValueSensor::invalidate();
}
void showInfo(const char*) const {}
void showInfo(const char* sensorName) const override {
const auto value = get();
efiPrintf("Sensor \"%s\": Lua sensor: Valid: %s Converted value %.2f", sensorName, boolToString(value.Valid), value.Value);
}
private:
bool m_isRedundant = false;
};

View File

@ -27,9 +27,9 @@ struct plain_get_float_s {
float *value;
};
template<typename T>
T* findPair(const char *name, T array[], size_t count) {
for (int i = 0;i<count;i++) {
template<typename T, size_t TCount>
T* findPair(const char *name, T array[TCount], size_t count) {
for (size_t i = 0; i < TCount; i++) {
T *current = &array[i];
if (strEqualCaseInsensitive(name, current->token)) {
return current;

View File

@ -252,7 +252,7 @@ public:
return cjReadRegister(reg);
}
void WriteRegister(uint8_t regAddr, uint8_t regValue) {
void WriteRegister(uint8_t regAddr, uint8_t regValue) override {
cjWriteRegister(regAddr, regValue);
}
};

View File

@ -59,7 +59,7 @@ public:
SimplePwm wboHeaterControl;
// Chip diagnostics register contents
volatile int diag = 0;
int diag = 0;
efitick_t startHeatingNt;
efitick_t prevNt;
@ -68,32 +68,32 @@ public:
pid_s heaterPidConfig;
Pid heaterPid;
volatile cj125_mode_e mode = CJ125_MODE_NONE;
cj125_mode_e mode = CJ125_MODE_NONE;
// Amplification coefficient, needed by cjGetAfr()
volatile float amplCoeff = 0.0f;
float amplCoeff = 0.0f;
// Calculated Lambda-value
volatile float lambda = 1.0f;
float lambda = 1.0f;
// Current values
// lambda
volatile float vUa = 0.0f;
float vUa = 0.0f;
// heater
volatile float vUr = 0.0f;
float vUr = 0.0f;
// Calibration values
// lambda
volatile float vUaCal = 0.0f;
float vUaCal = 0.0f;
// header
volatile float vUrCal = 0.0f;
float vUrCal = 0.0f;
OutputPin wboHeaterPin;
OutputPin cj125Cs;
// Used by CJ125 driver state machine
volatile cj125_state_e state = CJ125_INIT;
cj125_state_e state = CJ125_INIT;
// Last Error code
volatile cj125_error_e errorCode = CJ125_NO_ERROR;
cj125_error_e errorCode = CJ125_NO_ERROR;
void setError(cj125_error_e errCode);
bool isWorkingState(void) const;

View File

@ -36,15 +36,15 @@ class cyclic_buffer
int getSize() const;
int getCount() const;
void clear();
volatile T elements[maxSize];
volatile uint16_t currentIndex;
T elements[maxSize];
uint16_t currentIndex;
protected:
uint16_t size;
/**
* number of elements added into this buffer, would be eventually bigger then size
*/
volatile size_t count;
size_t count;
};
template<typename T, size_t maxSize>

View File

@ -58,7 +58,7 @@ public:
}
public:
volatile int currentIndexRead; // FIFO "tail"
int currentIndexRead; // FIFO "tail"
};
template<typename T, size_t maxSize>

View File

@ -78,12 +78,6 @@ void Logging::appendFast(const char *text) {
}
void Logging::appendPrintf(const char *fmt, ...) {
#if EFI_UNIT_TEST
va_list ap;
va_start(ap, fmt);
vsprintf(buffer, fmt, ap);
va_end(ap);
#else
efiAssertVoid(CUSTOM_APPEND_STACK, getCurrentRemainingStack() > 128, "lowstck#4");
size_t available = remainingSize();
@ -98,8 +92,6 @@ void Logging::appendPrintf(const char *fmt, ...) {
linePointer += (written > available) ? available : written;
// ensure buffer is always null terminated
buffer[bufferSize - 1] = '\0';
#endif // EFI_UNIT_TEST
}
void Logging::appendFloat(float value, int precision) {

View File

@ -76,3 +76,4 @@ namespace chibios_rt {
#define UNIT_TEST_BUSY_WAIT_CALLBACK() { timeNowUs++; }
#define chsnprintf snprintf
#define chvsnprintf vsnprintf