⁉ three level visibility setting
This commit is contained in:
parent
722be35737
commit
d861c43a0e
@ -53,8 +53,13 @@ typedef struct {
|
|||||||
|
|
||||||
Raindrop raindrops[PANEL_WIDTH];
|
Raindrop raindrops[PANEL_WIDTH];
|
||||||
|
|
||||||
bool stealth_mode = false;
|
enum Mode {
|
||||||
|
Stealth,
|
||||||
|
LowVis,
|
||||||
|
HighVis
|
||||||
|
};
|
||||||
|
|
||||||
|
Mode mode = Stealth;
|
||||||
void setup(){
|
void setup(){
|
||||||
Serial.begin(BAUD_RATE);
|
Serial.begin(BAUD_RATE);
|
||||||
pinMode(ONBOARD_LED, OUTPUT);
|
pinMode(ONBOARD_LED, OUTPUT);
|
||||||
@ -93,7 +98,17 @@ void loop() {
|
|||||||
delay(25);
|
delay(25);
|
||||||
|
|
||||||
if(!digitalRead(BACK_BUTTON)) {
|
if(!digitalRead(BACK_BUTTON)) {
|
||||||
stealth_mode = !stealth_mode;
|
switch(mode) {
|
||||||
|
case Stealth:
|
||||||
|
mode = LowVis;
|
||||||
|
break;
|
||||||
|
case LowVis:
|
||||||
|
mode = HighVis;
|
||||||
|
break;
|
||||||
|
case HighVis:
|
||||||
|
mode = Stealth;
|
||||||
|
break;
|
||||||
|
}
|
||||||
while(!digitalRead(BACK_BUTTON)); // Wait for release
|
while(!digitalRead(BACK_BUTTON)); // Wait for release
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,16 +132,33 @@ void loop() {
|
|||||||
int trail_y = raindrops[x].y - trail_offset;
|
int trail_y = raindrops[x].y - trail_offset;
|
||||||
if (trail_y >= 0) {
|
if (trail_y >= 0) {
|
||||||
int pixel_num = (trail_y * PANEL_WIDTH) + x;
|
int pixel_num = (trail_y * PANEL_WIDTH) + x;
|
||||||
if (overlay[ pixel_num / 8 ] & (1 << (7 - (pixel_num % 8)) ) and !stealth_mode) {
|
if (overlay[ pixel_num / 8 ] & (1 << (7 - (pixel_num % 8)) ) and mode != Stealth) {
|
||||||
|
if (mode == HighVis) {
|
||||||
matrix->drawPixel(x, trail_y, matrix->color565(128, 255, 128));
|
matrix->drawPixel(x, trail_y, matrix->color565(128, 255, 128));
|
||||||
|
} else {
|
||||||
|
matrix->drawPixel(x, trail_y, matrix->color565(
|
||||||
|
(128 / raindrops[x].length) * (raindrops[x].length - trail_offset),
|
||||||
|
(255 / raindrops[x].length) * (raindrops[x].length - trail_offset),
|
||||||
|
(128 / raindrops[x].length) * (raindrops[x].length - trail_offset))
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
matrix->drawPixel(x, trail_y, matrix->color565(0, (255 / raindrops[x].length) * (raindrops[x].length - trail_offset), 0));
|
matrix->drawPixel(x, trail_y, matrix->color565(0, (255 / raindrops[x].length) * (raindrops[x].length - trail_offset), 0));
|
||||||
}
|
}
|
||||||
} else if (raindrops[x].reached_bottom) {
|
} else if (raindrops[x].reached_bottom) {
|
||||||
int pixel_num = ((PANEL_HEIGHT + trail_y) * PANEL_WIDTH) + x;
|
int pixel_num = ((PANEL_HEIGHT + trail_y) * PANEL_WIDTH) + x;
|
||||||
if (line_pos[x] >= 0) {
|
if (line_pos[x] >= 0) {
|
||||||
if (overlay[ pixel_num / 8 ] & (1 << (7 - (pixel_num % 8)) ) and !stealth_mode) {
|
|
||||||
|
if (overlay[ pixel_num / 8 ] & (1 << (7 - (pixel_num % 8)) ) and mode != Stealth) {
|
||||||
|
if (mode == HighVis) {
|
||||||
matrix->drawPixel(x, PANEL_HEIGHT + trail_y, matrix->color565(128, 255, 128));
|
matrix->drawPixel(x, PANEL_HEIGHT + trail_y, matrix->color565(128, 255, 128));
|
||||||
|
} else {
|
||||||
|
matrix->drawPixel(x, PANEL_HEIGHT + trail_y, matrix->color565(
|
||||||
|
(128 / raindrops[x].length) * (raindrops[x].length - trail_offset),
|
||||||
|
(255 / raindrops[x].length) * (raindrops[x].length - trail_offset),
|
||||||
|
(128 / raindrops[x].length) * (raindrops[x].length - trail_offset))
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
matrix->drawPixel(x, PANEL_HEIGHT + trail_y, matrix->color565(0,(255 / raindrops[x].length) * (raindrops[x].length - trail_offset), 0));
|
matrix->drawPixel(x, PANEL_HEIGHT + trail_y, matrix->color565(0,(255 / raindrops[x].length) * (raindrops[x].length - trail_offset), 0));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user