Skip to content

Commit 8d1c79f

Browse files
committed
fix
1 parent 7e56077 commit 8d1c79f

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

Distr/nrf24batch/Kitchen Vent Dimmer.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,18 @@ W: _PORTA=,0x3B,,WRAM
8787
R: _PORTB=0x36,,RAM
8888
W: _PORTB=,0x38,WRAM
8989

90-
R: _Fanspeed=0x75,,RAM
90+
R: _LED_Warning=0x6B,,RAM
91+
W: _LED_Warning=,0x6B,WRAM
92+
R: _IRHashLast*2=0x7C,,RAM2#
93+
R: _SleepTimer=0x84,,RAM
9194
R: _FanOn=0x76,,RAM
9295
R: _FanOnNext=0x74,,RAM
9396
R: _FanOnNextCnt=0x72,,RAM
9497
R: _FanOnLast=0x73,,RAM
95-
R: _IRHashLast*2=0x7C,,RAM2#
96-
R: _SleepTimer=0x84,,RAM
9798

9899
R: _OutSpeedMax=0x87,,RAM
99100
W: _OutSpeedMax=,0x87,WRAM
100-
R: _LED_Warning=0x6B,,RAM
101-
W: _LED_Warning=,0x6B,WRAM
101+
R: _Fanspeed=0x75,,RAM
102102
R: _ZeroCrossDelay*2=0x8E,,RAM2
103103
W: _ZeroCrossDelay=,0x8E,WRAM2
104104
R: _PulseDelayAfterZero*2=0x9A,,RAM2
@@ -142,5 +142,5 @@ WBatch: LED Warning: _LED Warning=0x10
142142
WBatch: OSCCAL: _OSCCAL=146
143143
WBatch: CO2 Level: CO2 level={750,850,1000}
144144
WBatch: Zero cross EEPROM: ZeroCrossLag,us=30;SSR_PulseWidth,us=200;Reset
145-
WBatch: Zero cross RAM: _ZeroCrossDelay=1225;_PulseDelayAfterZero=0001;_PulseWidth=1249
145+
WBatch: Zero cross RAM: _ZeroCrossDelay=1246;_PulseDelayAfterZero=0001;_PulseWidth=1249
146146
WBatch: Reset: Reset

nrf24batch.c

+19-3
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,22 @@ static void add_to_str_hex_bytes(char *out, uint8_t *arr, int bytes)
226226
} while(--bytes);
227227
}
228228

229+
// skip leading zeros
230+
static void add_to_str_hex_variable(char *out, uint8_t *arr, int size)
231+
{
232+
if(size <= 0) return;
233+
out += strlen(out);
234+
arr += size - 1;
235+
while(*arr == 0 && size > 1) {
236+
arr--;
237+
size--;
238+
}
239+
do {
240+
snprintf(out, 3, "%02X", *arr--);
241+
out += 2;
242+
} while(--size);
243+
}
244+
229245
void Edit_insert_digit(char new)
230246
{
231247
if(*Edit_pos == '-') return;
@@ -482,7 +498,7 @@ bool nrf24_read_newpacket() {
482498
else {
483499
char hex[9];
484500
hex[0] = '\0';
485-
add_to_str_hex_bytes(hex, (uint8_t*)&var, size);
501+
add_to_str_hex_variable(hex, (uint8_t*)&var, size);
486502
if((cmd_array && cmd_array_hex) || furi_string_end_with_str(str, "0x")) furi_string_cat_str(str, hex);
487503
else {
488504
if(var >= 0 && var <= 9) furi_string_cat_printf(str, "%ld", var);
@@ -1173,12 +1189,12 @@ static void render_callback(Canvas* const canvas, void* ctx) {
11731189
int32_t n = get_payload_receive_field(pld, len);
11741190
if(hex) {
11751191
strcat(screen_buf, "0x");
1176-
add_to_str_hex_bytes(screen_buf, pld, len);
1192+
add_to_str_hex_variable(screen_buf, pld, len);
11771193
} else {
11781194
snprintf(screen_buf + strlen(screen_buf), 20, "%ld", n);
11791195
if(n > 9) {
11801196
strcat(screen_buf, " (");
1181-
add_to_str_hex_bytes(screen_buf, pld, len);
1197+
add_to_str_hex_variable(screen_buf, pld, len);
11821198
strcat(screen_buf, ")");
11831199
}
11841200
}

0 commit comments

Comments
 (0)