MCPcopy Create free account
hub / github.com/LowPowerLab/RFM69 / getCoefForResolution

Function getCoefForResolution

RFM69.cpp:1107–1116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1105}
1106
1107static uint32_t getCoefForResolution(uint8_t resolution, uint32_t duration) {
1108 uint32_t resolDuration = getUsForResolution(resolution);
1109 uint32_t result = duration / resolDuration;
1110
1111 // If the next-higher coefficient is closer, use that
1112 if (abs(duration - ((result + 1) * resolDuration)) < abs(duration - (result * resolDuration)))
1113 return result + 1;
1114
1115 return result;
1116}
1117
1118static bool chooseResolutionAndCoef(uint8_t *resolutions, uint32_t duration, uint8_t& resolOut, uint8_t& coefOut) {
1119 for (int i = 0; resolutions[i]; i++) {

Callers 1

chooseResolutionAndCoefFunction · 0.85

Calls 1

getUsForResolutionFunction · 0.85

Tested by

no test coverage detected