Revision 532ba0bd toolbox/main.c

View differences:

toolbox/main.c
6 6
#include "mbport.h"
7 7
#include "tooltron_mb.h"
8 8
#include "rfid.h"
9
#include "led.h"
9 10

  
10 11
enum toolstate_t {
11 12
  TS_INIT,
......
108 109
eMBErrorCode eMBRegCoilsCB(UCHAR *reg_buf, USHORT addr, USHORT n_coils,
109 110
    eMBRegisterMode mode) {
110 111

  
111
  if (addr > N_COILS || n_coils >= N_COILS-addr) {
112
  if (addr+n_coils > N_COILS) {
112 113
    return MB_ENOREG;
113 114
  }
114 115

  
......
211 212

  
212 213
int main() {
213 214

  
215
  led_init();
214 216
  tool_init();
215 217
  rfid_init();
216 218

  
......
219 221

  
220 222
  sei();
221 223

  
224
  rfid_start_read();
222 225
  while (1) {
223
    rfid_read();
224
    tool_main();
226
    if (rfid_poll()) {
227
      rfid_start_read();
228
    }
229
    rfid_get_serno(current_user);
230
    //tool_main();
225 231
    eMBPoll();
226
    _delay_ms(100);
232
    _delay_ms(50);
227 233
  }
228 234

  
229 235
  return 0;

Also available in: Unified diff