Changes from code review.

This commit is contained in:
atomiclama 2016-12-19 07:43:42 +00:00
parent cdf7e43ab1
commit ae5b3ae30c
2 changed files with 14 additions and 16 deletions

View File

@ -214,8 +214,7 @@ static void serializeNames(sbuf_t *dst, const char *s)
static const box_t *findBoxByActiveBoxId(uint8_t activeBoxId) static const box_t *findBoxByActiveBoxId(uint8_t activeBoxId)
{ {
uint8_t boxIndex; for (uint8_t boxIndex = 0; boxIndex < sizeof(boxes) / sizeof(box_t); boxIndex++) {
for (boxIndex = 0; boxIndex < sizeof(boxes) / sizeof(box_t); boxIndex++) {
const box_t *candidate = &boxes[boxIndex]; const box_t *candidate = &boxes[boxIndex];
if (candidate->boxId == activeBoxId) { if (candidate->boxId == activeBoxId) {
return candidate; return candidate;
@ -226,8 +225,7 @@ static const box_t *findBoxByActiveBoxId(uint8_t activeBoxId)
static const box_t *findBoxByPermenantId(uint8_t permenantId) static const box_t *findBoxByPermenantId(uint8_t permenantId)
{ {
uint8_t boxIndex; for (uint8_t boxIndex = 0; boxIndex < sizeof(boxes) / sizeof(box_t); boxIndex++) {
for (boxIndex = 0; boxIndex < sizeof(boxes) / sizeof(box_t); boxIndex++) {
const box_t *candidate = &boxes[boxIndex]; const box_t *candidate = &boxes[boxIndex];
if (candidate->permanentId == permenantId) { if (candidate->permanentId == permenantId) {
return candidate; return candidate;

View File

@ -608,23 +608,23 @@ static void applyLedRssiLayer(bool updateNow, timeUs_t *timer)
if (updateNow) { if (updateNow) {
int state = (rssi * 100) / 1023; int state = (rssi * 100) / 1023;
if (state > 50) { if (state > 50) {
flash = true; flash = true;
timerDelay = HZ_TO_US(1); timerDelay = HZ_TO_US(1);
} else if (state > 20) { } else if (state > 20) {
flash = !flash; flash = !flash;
timerDelay = HZ_TO_US(2); timerDelay = HZ_TO_US(2);
} else { } else {
flash = !flash; flash = !flash;
timerDelay = HZ_TO_US(8); timerDelay = HZ_TO_US(8);
} }
} }
*timer += timerDelay; *timer += timerDelay;
if (!flash) { if (!flash) {
hsvColor_t *bgc = getSC(LED_SCOLOR_BACKGROUND); hsvColor_t *bgc = getSC(LED_SCOLOR_BACKGROUND);
applyLedHsv(LED_MOV_FUNCTION(LED_FUNCTION_RSSI), bgc); applyLedHsv(LED_MOV_FUNCTION(LED_FUNCTION_RSSI), bgc);
} }
} }