From fbc15b4bd2a82d2f2f726834a14c144548c47c6e Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Wed, 16 Jan 2019 05:24:37 -0800 Subject: [PATCH] const (#675) --- firmware/controllers/core/interpolation.cpp | 2 +- firmware/controllers/core/interpolation.h | 2 +- firmware/controllers/system/efiGpio.cpp | 4 ++-- firmware/controllers/system/efiGpio.h | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/firmware/controllers/core/interpolation.cpp b/firmware/controllers/core/interpolation.cpp index c016efdcbc..5984481a28 100644 --- a/firmware/controllers/core/interpolation.cpp +++ b/firmware/controllers/core/interpolation.cpp @@ -238,7 +238,7 @@ int findIndex(const float array[], int size, float value) { /** * @brief One-dimensional table lookup with linear interpolation */ -float interpolate2d(const char *msg, float value, float bin[], float values[], int size) { +float interpolate2d(const char *msg, float value, const float bin[], const float values[], int size) { if (isnan(value)) { firmwareError(CUSTOM_INTERPOLATE_NAN, "NaN in interpolate2d %s", msg); return NAN; diff --git a/firmware/controllers/core/interpolation.h b/firmware/controllers/core/interpolation.h index c09e334e62..1d6f85b626 100644 --- a/firmware/controllers/core/interpolation.h +++ b/firmware/controllers/core/interpolation.h @@ -26,7 +26,7 @@ void ensureArrayIsAscending(const char *msg, const float array[], int size); int findIndex2(const float array[], unsigned size, float value); float interpolateClamped(float x1, float y1, float x2, float y2, float x); float interpolateMsg(const char *msg, float x1, float y1, float x2, float y2, float x); -float interpolate2d(const char *msg, float value, float bin[], float values[], int size); +float interpolate2d(const char *msg, float value, const float bin[], const float values[], int size); int needInterpolationLogging(void); diff --git a/firmware/controllers/system/efiGpio.cpp b/firmware/controllers/system/efiGpio.cpp index cb02c7915a..60a7c1ffa5 100644 --- a/firmware/controllers/system/efiGpio.cpp +++ b/firmware/controllers/system/efiGpio.cpp @@ -305,7 +305,7 @@ bool OutputPin::getLogicValue() { return currentLogicValue; } -void OutputPin::setDefaultPinState(pin_output_mode_e *outputMode) { +void OutputPin::setDefaultPinState(const pin_output_mode_e *outputMode) { pin_output_mode_e mode = *outputMode; assertOMode(mode); this->modePtr = outputMode; @@ -369,7 +369,7 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin) { initPin(msg, brainPin, &DEFAULT_OUTPUT); } -void OutputPin::initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e *outputMode) { +void OutputPin::initPin(const char *msg, brain_pin_e brainPin, const pin_output_mode_e *outputMode) { #if EFI_GPIO_HARDWARE || defined(__DOXYGEN__) if (brainPin == GPIO_UNASSIGNED) return; diff --git a/firmware/controllers/system/efiGpio.h b/firmware/controllers/system/efiGpio.h index 5a3483641c..165cd2b5d2 100644 --- a/firmware/controllers/system/efiGpio.h +++ b/firmware/controllers/system/efiGpio.h @@ -30,7 +30,7 @@ public: /** * initializes pin & registers it in pin repository */ - void initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e *outputMode); + void initPin(const char *msg, brain_pin_e brainPin, const pin_output_mode_e *outputMode); /** * same as above, with DEFAULT_OUTPUT mode */ @@ -58,10 +58,10 @@ public: */ private: // todo: inline this method? - void setDefaultPinState(pin_output_mode_e *defaultState); + void setDefaultPinState(const pin_output_mode_e *defaultState); // 4 byte pointer is a bit of a memory waste here - pin_output_mode_e *modePtr; + const pin_output_mode_e *modePtr; };