Revision a96c5547

View differences:

toolbox/Makefile
9 9
		freemodbus/modbus/ascii/mbascii.c \
10 10
		freemodbus/modbus/functions/*.c
11 11
HDR=../tooltron_mb.h *.h freemodbus/port/*.h
12
TOOL_ADDRESS?=-1
12 13

  
13 14
FLAGS=-Os -Wall -mmcu=$(MCU) -DF_CPU=$(F_CPU) -I.. \
14
			-DRTS_ENABLE \
15
			-DRTS_ENABLE -DTOOL_ADDRESS=$(TOOL_ADDRESS) \
15 16
			-Ifreemodbus/port \
16 17
			-Ifreemodbus/modbus/rtu \
17 18
			-Ifreemodbus/modbus/ascii \
toolbox/main.c
10 10
#include "current.h"
11 11
#include "time.h"
12 12

  
13
#if TOOL_ADDRESS < 0
14
#error Please define TOOL_ADDRESS
15
#endif
16

  
13 17
enum toolstate_t {
14 18
  TS_INIT,
15 19
  TS_OFF,
......
25 29
static uint8_t latest_reading[RFID_SERNO_SIZE];
26 30
static uint8_t current_user[RFID_SERNO_SIZE];
27 31
static uint16_t current;
32
static uint16_t current_max_warn, current_max_hard;
28 33

  
29 34
static inline void set_coil(char coil, char bit) {
30 35
  coils = (coils & ~(1 << coil)) | (bit << coil);
......
269 274
  rfid_init();
270 275
  current_init();
271 276

  
272
  eMBInit(MB_RTU, SLAVE_ADDR, 0, MB_BAUD, MB_PAR_NONE);
277
  eMBInit(MB_RTU, TOOL_ADDRESS, 0, MB_BAUD, MB_PAR_NONE);
273 278
  eMBEnable();
274 279

  
275 280
  sei();
tooltron_mb.h
40 40
/*
41 41
 * Other things
42 42
 */
43
#define SLAVE_ADDR 4 // TODO move to makefile?
43

  
44 44
#define MB_BAUD 9600
45 45

  
46 46
#endif

Also available in: Unified diff