Project

General

Profile

Revision 294

Added by Red Robot almost 14 years ago

updated to use TT_GRANT instead of deprecated TT_ON, and also updated test/main.c to use majority and call parse_packet

View differences:

trunk/toolbox/main.c
39 39
 * TMAX  - minutes until power is killed (unless tool is on)
40 40
 */
41 41
#define TWAIT   1
42
#define TWARN   1
43
#define TMAX    2
42
#define TWARN   5
43
#define TMAX    7
44 44

  
45 45
uint8_t sec;
46 46
uint8_t min;
trunk/swipe/manualtron.py
41 41
    print "cardnum:",card
42 42
    return True
43 43

  
44
def tool(t):
45
    common.sendMessage(t, common.TT_GRANT, "")
46
    if common.checkAck(t):
47
        print "got ACK"
48
    else:
49
        print "NO ACK"
44 50

  
45 51
def ping(t):
46 52
    common.sendMessage(t, common.TT_PING, "")
trunk/common/common.py
43 43
TT_PROGD = 'd'
44 44

  
45 45
#depricated
46
TT_ON = 'o'
46
#TT_ON = 'o'
47 47

  
48 48
TT_MAX_RETRY = 3
49 49

  
......
112 112
def sendTool(t):
113 113
    tn = t
114 114
    print "sending power to tool ID",tn
115
    sendMessage(tn, TT_ON, "") #TT_GRANT, "")
115
    sendMessage(tn, TT_GRANT, "")
116 116

  
117 117
def sendGrant():
118 118
    print "seding grant to cardbox (",CARDBOX_ID,")"
......
163 163
    start = bus.read(1)
164 164
    if start == '^':
165 165
        src = bus.read(1)
166
        if src == chr(1): #reflection
167
            print "(reflection)"
168
            flushPacket('^' + src)
169
            return readMessage()
166
        # if src == chr(1): #reflection
167
        #     print "(reflection)"
168
        #     flushPacket('^' + src)
169
        #     return readMessage()
170 170

  
171 171
        dest = bus.read(1)
172 172
        cmd = bus.read(1)
trunk/programmer/test/main.c
42 42
/* #define OFF     0x00 */
43 43

  
44 44
/***** change ADDR ****/
45
#define ADDR 14
45
#define ADDR 12
46 46
#define DELIM '^'
47 47
#define SERVER 1
48 48
#define TURNON 'O'
......
76 76

  
77 77
void init_pins(void) {
78 78
    DDRB = 0x00;
79
    DDRB = _BV(DDB0) | _BV(DDB1) | _BV(DDB2) | _BV(DDB5);
79
    DDRB = LED_GREEN | LED_YELLOW | LED_RED;  // Set the LED pins as outputs
80 80
    DDRD = _BV(DDB4);
81 81
    PORTB = 0x00;
82 82
}
......
120 120

  
121 121
    correct = (a == ADDR) + (b == ADDR) + (c == ADDR);
122 122

  
123
    if ( correct == 3 ) {
124
      PORTB |= LED_GREEN;
123
    if (correct == 3) {
124
      PORTB &= ~LED_GREEN;
125 125
    }
126 126
    else if(correct == 0){
127
      PORTB |= LED_RED;
127
      PORTB &= ~LED_RED;
128 128
    }
129 129
    else {
130
      PORTB |= LED_YELLOW;
130
      PORTB &= ~LED_YELLOW;
131 131
    }
132 132

  
133 133

  

Also available in: Unified diff