projects
/
Arduino
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added restore output for current state
[Arduino]
/
Diseq_c
/
Diseq_c.ino
diff --git
a/Diseq_c/Diseq_c.ino
b/Diseq_c/Diseq_c.ino
index
f6587f0
..
8536985
100644
(file)
--- a/
Diseq_c/Diseq_c.ino
+++ b/
Diseq_c/Diseq_c.ino
@@
-48,27
+48,38
@@
void setup(){
#endif
}
#endif
}
+char restore[10] = "";
+char len = 0;
+
int receiver_selection( int nr ) {
#ifdef DEBUG
Serial.print("<");
#endif
int receiver_selection( int nr ) {
#ifdef DEBUG
Serial.print("<");
#endif
+ if ( nr == 0 ) len = 0;
+
int active = 0;
int selected = -1;
int active = 0;
int selected = -1;
+
for(int i=0; i<4; i++) {
int a = analogRead( receiver[nr][i] );
int on_off = a > 512 ? 1 : 0;
active += on_off;
for(int i=0; i<4; i++) {
int a = analogRead( receiver[nr][i] );
int on_off = a > 512 ? 1 : 0;
active += on_off;
- if ( on_off ) selected = i+1;
+ if ( on_off ) {
+ selected = i+1;
+ restore[len++] = char('1' + (nr * 4) + i);
+ }
//Serial.print(a);
//Serial.print("~");
Serial.print(on_off);
//Serial.print(" ");
}
//Serial.print(a);
//Serial.print("~");
Serial.print(on_off);
//Serial.print(" ");
}
+ restore[len] = 0;
Serial.print(">");
Serial.print(">");
+ Serial.print(" selected:");
Serial.print(selected);
if ( active == 0 ) { // no inputs active
Serial.print(selected);
if ( active == 0 ) { // no inputs active
@@
-206,6
+217,8
@@
void loop(){
Serial.print(current_sat);
Serial.print(" from:");
Serial.print(last_changed_nr);
Serial.print(current_sat);
Serial.print(" from:");
Serial.print(last_changed_nr);
+ Serial.print(" restore>");
+ Serial.print(restore);
Serial.print(" blink=");
Serial.println(blink_interval);
#endif
Serial.print(" blink=");
Serial.println(blink_interval);
#endif