MCPcopy Create free account
hub / github.com/cifertech/nRFBox / analyzerLoop

Function analyzerLoop

nRFBox_V2/analyzer.cpp:159–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159void analyzerLoop(){
160
161 ScanChannels();
162
163 memset(values, 0, sizeof(values));
164
165 int n = 50;
166 while (n--) {
167 int i = N;
168 while (i--) {
169 setChannel(i);
170 startListening();
171 delayMicroseconds(128);
172 stopListening();
173 if (carrierDetected()) {
174 ++values[i];
175 }
176 }
177 }
178
179 u8g2.clearBuffer();
180 int barWidth = SCREEN_WIDTH / N;
181 int x = 0;
182 for (int i = 0; i < N; ++i) {
183 int v = 63 - values[i] * 3;
184 if (v < 0) {
185 v = 0;
186 }
187 u8g2.drawVLine(x, v - 10, 64 - v);
188 x += barWidth;
189 }
190
191 u8g2.setFont(u8g2_font_ncenB08_tr);
192 u8g2.setCursor(0, 64);
193 u8g2.print("1...5...10...25..50...80...128");
194 u8g2.sendBuffer();
195
196 //delay(50);
197
198}

Callers

nothing calls this directly

Calls 5

ScanChannelsFunction · 0.70
setChannelFunction · 0.70
startListeningFunction · 0.70
stopListeningFunction · 0.70
carrierDetectedFunction · 0.70

Tested by

no test coverage detected