| 87 | } |
| 88 | |
| 89 | void outputChannels(void) { |
| 90 | int norm = 0; |
| 91 | |
| 92 | for (int i = 0; i < CHANNELS; i++) |
| 93 | if (channel[i] > norm) norm = channel[i]; |
| 94 | |
| 95 | Serial.print('|'); |
| 96 | for (int i = 0; i < CHANNELS; i++) { |
| 97 | int pos; |
| 98 | if (norm != 0) pos = (channel[i] * 10) / norm; |
| 99 | else pos = 0; |
| 100 | if (pos == 0 && channel[i] > 0) pos++; |
| 101 | if (pos > 9) pos = 9; |
| 102 | Serial.print(grey[pos]); |
| 103 | channel[i] = 0; |
| 104 | } |
| 105 | |
| 106 | Serial.print("| "); |
| 107 | Serial.println(norm); |
| 108 | |
| 109 | u8g2.clearBuffer(); |
| 110 | |
| 111 | u8g2.drawLine(0, 0, 0, 63); |
| 112 | u8g2.drawLine(127, 0, 127, 63); |
| 113 | |
| 114 | for (byte count = 0; count < 64; count += 10) { |
| 115 | u8g2.drawLine(127, count, 122, count); |
| 116 | u8g2.drawLine(0, count, 5, count); |
| 117 | } |
| 118 | |
| 119 | for (byte count = 10; count < 127; count += 10) { |
| 120 | u8g2.drawPixel(count, 0); |
| 121 | u8g2.drawPixel(count, 63); |
| 122 | } |
| 123 | |
| 124 | if (norm < 10){ |
| 125 | byte drawHeight = map(norm, 0, 20, 0, 64); |
| 126 | sensorArray[0] = drawHeight; |
| 127 | } |
| 128 | if (norm > 10){ |
| 129 | byte drawHeight = map(norm, 0, 40, 0, 64); |
| 130 | sensorArray[0] = drawHeight; |
| 131 | } |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | for (byte count = 1; count <= 127; count++) { |
| 137 | if (filled == 'D' || filled == 'd') { |
| 138 | if (drawDirection == 'L' || drawDirection == 'l') { |
| 139 | u8g2.drawPixel(count, 63 - sensorArray[count - 1]); |
| 140 | } else { |
| 141 | u8g2.drawPixel(127 - count, 63 - sensorArray[count - 1]); |
| 142 | } |
| 143 | } else { |
| 144 | if (drawDirection == 'L' || drawDirection == 'l') { |
| 145 | if (slope == 'W' || slope == 'w') { |
| 146 | u8g2.drawLine(count, 63, count, 63 - sensorArray[count - 1]); |