20 return value ?
"Yes" :
"No";
36 float a = round(value / precision);
37 return fixNegativeZero(a * precision);
41 while (
param[0] ==
' ') {
44 int len = std::strlen(
param);
45 while (len > 0 &&
param[len - 1] ==
' ') {
53 constexpr int bufferLength = 10;
57 size_t idx = bufferLength - 1;
63 auto digit = num % radix;
74 }
while ((num /= radix) != 0);
79 while (idx < bufferLength)
136 unsigned long hash = 5381;
139 while ( (c = *str++) ) {
141 hash = ((hash << 5) + hash) + c;
151#if EFI_HISTOGRAMS && ! EFI_UNIT_TEST
153 int len =
hsReport(histogram, report);
156 logging.append(PROTOCOL_MSG LOG_DELIMITER);
158 for (
int i = 0; i < len; i++)
161 logging.append(LOG_DELIMITER);
170float limitRateOfChange(
float newValue,
float oldValue,
float incrLimitPerSec,
float decrLimitPerSec,
float secsPassed) {
171 if (newValue >= oldValue)
172 return (incrLimitPerSec <= 0.0f) ? newValue : oldValue + std::min(newValue - oldValue, incrLimitPerSec * secsPassed);
173 return (decrLimitPerSec <= 0.0f) ? newValue : oldValue - std::min(oldValue - newValue, decrLimitPerSec * secsPassed);
177 bool afterCurrent =
test >= current;
178 bool beforeNext =
test < next;
180 if (next > current) {
184 return afterCurrent && beforeNext;
191 return afterCurrent || beforeNext;
195static int getBitRangeCommon(
const uint8_t data[],
int bitIndex,
int bitWidth,
int secondByteOffset) {
196 int byteIndex = bitIndex >> 3;
197 int shift = bitIndex - byteIndex * 8;
198 int value = data[byteIndex];
199 if (shift + bitWidth > 8) {
200 value = value + data[secondByteOffset + byteIndex] * 256;
202 int mask = (1 << bitWidth) - 1;
203 return (value >> shift) & mask;
216void setBitRangeMsb(uint8_t data[],
const int totalBitIndex,
const int bitWidth,
const int value) {
217 int leftBitWidh = bitWidth;
218 const int byteIndex = totalBitIndex >> 3;
219 const int bitInByteIndex = totalBitIndex - byteIndex * 8;
220 if (bitInByteIndex + leftBitWidh > 8) {
221 const int bitsToHandleNow = 8 - bitInByteIndex;
222 setBitRangeMsb(data, (byteIndex - 1) * 8, leftBitWidh - bitsToHandleNow, value >> bitsToHandleNow);
223 leftBitWidh = bitsToHandleNow;
225 const int mask = (1 << leftBitWidh) - 1;
226 data[byteIndex] = data[byteIndex] & (~(mask << bitInByteIndex));
227 const int maskedValue = value & mask;
228 const int shiftedValue = maskedValue << bitInByteIndex;
229 data[byteIndex] = data[byteIndex] | shiftedValue;
235 b = b - (b % 8) + 7 - (b % 8);
239 b = b - (b % 8) + 7 - (b % 8);
248void setBitRangeMoto(uint8_t data[],
const int totalBitIndex,
const int bitWidth,
const int value) {
void appendPrintf(const char *fmt,...) __attribute__((format(printf
Buffered console output stream header.
int getBitRangeMoto(const uint8_t data[], int bitIndex, int bitWidth)
void setBitRangeMoto(uint8_t data[], const int totalBitIndex, const int bitWidth, const int value)
void setBitRangeMsb(uint8_t data[], const int totalBitIndex, const int bitWidth, const int value)
float limitRateOfChange(float newValue, float oldValue, float incrLimitPerSec, float decrLimitPerSec, float secsPassed)
int djb2lowerCase(const char *str)
int motorolaMagicFromDbc(int b, int length)
const char * boolToString(bool value)
static int getBitRangeCommon(const uint8_t data[], int bitIndex, int bitWidth, int secondByteOffset)
bool isPhaseInRange(float test, float current, float next)
float efiRound(float value, float precision)
void printHistogram(Logging *logging, histogram_s *histogram)
This function knows how to print a histogram_s summary.
static char * ltoa_internal(char *p, uint32_t num, unsigned radix)
static char * itoa_signed(char *p, int num, unsigned radix)
char * efiTrim(char *param)
int getBitRangeLsb(const uint8_t data[], int bitIndex, int bitWidth)
char * itoa10(char *p, int num)
int getBitRangeMsb(const uint8_t data[], int bitIndex, int bitWidth)
int hsReport(histogram_s *h, int *report)
Prepare histogram report.
This data structure is used to analyze CPU performance.
UNUSED(samplingTimeSeconds)
void scheduleLogging(Logging *logging)
static BigBufferHandle buffer
static tstrWifiInitParam param