Skip to content

Commit f5c19c7

Browse files
Jorge Riveralatchdevel
authored andcommitted
Optimize size of mingaplen from uint32_t to unit16_t
1 parent 0316341 commit f5c19c7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pilight-usb-nano.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545
#ifdef DEFAULT_RX_SETTINGS
4646
uint32_t minrawlen = 20;
4747
uint32_t maxrawlen = 200;
48-
uint32_t mingaplen = 300; // Used and showing multiplied by 10
48+
uint16_t mingaplen = 300; // Minimum length of footer pulse and maximum length of previous pulses. Used and showing multiplied by 10
4949
#else
5050
uint32_t minrawlen = 1000;
5151
uint32_t maxrawlen = 0;
52-
uint32_t mingaplen = 10000; // Used and showing multiplied by 10
52+
uint16_t mingaplen = 10000; // Used and showing multiplied by 10
5353
#endif
5454

5555
uint16_t maxgaplen = 8200; // v2 used and change from 5100 to 8200 (for quigg_gt7000 protocol) set and show multiplied by 10
@@ -91,7 +91,7 @@ void setup() {
9191

9292
#ifdef BOOT_SHOW_SETTINGS
9393
// Show settings at boot, like as: 'v:20,200,3000,82000,2,1,1600@'
94-
sprintf(data, "v:%lu,%lu,%lu,%lu,%d,%d,%d@", minrawlen, maxrawlen, mingaplen*10, uint32_t(maxgaplen)*10, VERSION, MIN_PULSELENGTH/10, MAX_PULSELENGTH/10);
94+
sprintf(data, "v:%lu,%lu,%lu,%lu,%d,%d,%d@", minrawlen, maxrawlen, uint32_t(mingaplen)*10, uint32_t(maxgaplen)*10, VERSION, MIN_PULSELENGTH/10, MAX_PULSELENGTH/10);
9595
#ifdef ADD_LINE_FEED
9696
Serial.println(data);
9797
#else
@@ -144,7 +144,7 @@ void receive() {
144144
maxrawlen = atol(&data[s]);
145145
}
146146
if(x == 2) {
147-
mingaplen = atol(&data[s])/10;
147+
mingaplen = uint16_t(atol(&data[s])/10);
148148
}
149149
x++;
150150
s = i+1;
@@ -156,7 +156,7 @@ void receive() {
156156
/*
157157
* Once we tuned our firmware send back our settings + fw version
158158
*/
159-
sprintf(data, "v:%lu,%lu,%lu,%lu,%d,%d,%d@", minrawlen, maxrawlen, mingaplen*10, uint32_t(maxgaplen)*10, VERSION, MIN_PULSELENGTH/10, MAX_PULSELENGTH/10);
159+
sprintf(data, "v:%lu,%lu,%lu,%lu,%d,%d,%d@", minrawlen, maxrawlen, uint32_t(mingaplen)*10, uint32_t(maxgaplen)*10, VERSION, MIN_PULSELENGTH/10, MAX_PULSELENGTH/10);
160160
#ifdef ADD_LINE_FEED
161161
Serial.println(data);
162162
#else

0 commit comments

Comments
 (0)