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

Function AnalyzerLoop

nRFBox/Analyzer.cpp:37–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35
36
37void AnalyzerLoop(){
38
39 memset(value, 0, sizeof(value));
40
41 int n = 50;
42 while (n--) {
43 pixels.setPixelColor(0, pixels.Color(2, 0, 2));
44 pixels.show();
45 int i = N;
46 while (i--) {
47 radio.setChannel(i);
48 radio.startListening();
49 delayMicroseconds(128);
50 radio.stopListening();
51 if(radio.testCarrier()) {
52 ++value[i];
53
54 pixels.setPixelColor(0, pixels.Color(0, 2, 2));
55 pixels.show();
56
57 };
58 }
59 }
60
61 display.clearDisplay();
62 int barWidth = SCREEN_WIDTH / N;
63 int x = xOffset;
64 for (int i = 0; i < N; ++i) {
65 int v = 31 - value[i] * 3 + yOffset; // Adjusted the y value
66 if(v < 0) {
67 v = 0;
68 }
69 display.drawFastVLine(x, v - 10, 32 - v, WHITE);
70 x += barWidth;
71 }
72 display.setTextSize(1);
73 display.setTextColor(WHITE);
74 display.setCursor(0, SCREEN_HEIGHT - 8);
75 display.println("1..10...50...80...128"); // Print the range values
76 display.display();
77
78 delay(50);
79}

Callers 1

displaymenuFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected