summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usb-i2c-sl018/ajar.c2
-rw-r--r--usb-i2c-sl018/sl018.c14
-rw-r--r--usb-i2c-sl018/statemachine.c8
-rw-r--r--usb-i2c-sl018/tuer-rfid.c9
4 files changed, 18 insertions, 15 deletions
diff --git a/usb-i2c-sl018/ajar.c b/usb-i2c-sl018/ajar.c
index 54bd6fb..78712c2 100644
--- a/usb-i2c-sl018/ajar.c
+++ b/usb-i2c-sl018/ajar.c
@@ -70,7 +70,7 @@ void ajar_task(void)
ajar_t state = ajar_get();
if(last_state != state)
- printf("Door is now: %s\n\r", ajar_to_string(state));
+ printf("Info(ajar): door is now %s\n\r", ajar_to_string(state));
last_state = state;
}
diff --git a/usb-i2c-sl018/sl018.c b/usb-i2c-sl018/sl018.c
index c379fe4..9916e36 100644
--- a/usb-i2c-sl018/sl018.c
+++ b/usb-i2c-sl018/sl018.c
@@ -155,7 +155,7 @@ uint8_t sl018_cmd_raw(const uint8_t* twi_send_buf, bool wait_for_answer)
uint8_t sl018_reset(void)
{
if(sl018_cmd_raw(SL018_CMD_ComReset, 0)) {
- printf("I2C error\n\r");
+ printf("Error(i2c): bus error\n\r");
return 1;
}
return 0;
@@ -164,20 +164,20 @@ uint8_t sl018_reset(void)
uint8_t sl018_cmd(const uint8_t* twi_send_buf)
{
if(sl018_cmd_raw(twi_send_buf, 1)) {
- printf("I2C error\n\r");
+ printf("Error(i2c): bus error\n\r");
return 1;
} else {
if(twi_recv_msg->len < 2) {
- printf("SL018 Cmd,Error: short message received\n\r");
+ printf("Error(SL018): short message received\n\r");
return 1;
}
if(twi_recv_msg->status) {
- printf("SL018 Cmd,Error: '%s','%s'\n\r",SL018_cmd_tostring(twi_recv_msg->command),SL018_status_tostring(twi_recv_msg->status));
+ printf("Error(SL018): '%s','%s'\n\r",SL018_cmd_tostring(twi_recv_msg->command),SL018_status_tostring(twi_recv_msg->status));
return 1;
}
sl018_message_t * twi_send_msg = (sl018_message_t *)twi_send_buf;
if(twi_send_msg->command != twi_recv_msg->command) {
- printf("SL018 Cmd,Error: mismatch of sent and received command code: %02X,%02X\n\r",twi_send_msg->command,twi_recv_msg->command);
+ printf("Error(SL018): mismatch of sent and received command code: %02X,%02X\n\r",twi_send_msg->command,twi_recv_msg->command);
}
}
return 0;
@@ -187,7 +187,7 @@ void sl018_read_card_uid(uid_t * uid)
{
uid->length=0;
uid->buffer=NULL;
- printf( "CARD IN: ");
+ printf( "Info(card): ");
if(!sl018_cmd(SL018_CMD_ComSelectCard))
{
uint8_t uid_len = twi_recv_msg->len - sizeof(twi_recv_msg->command) - sizeof(twi_recv_msg->status) - 1;
@@ -210,7 +210,7 @@ void sl018_read_card_uid(uid_t * uid)
uid->length= uid_len;
uid->buffer=twi_recv_msg->data;
} else {
- printf("Ignoring unknown card type %02x\n\r",type);
+ printf("Info(card): Ignoring unknown card type %02x\n\r",type);
}
}
}
diff --git a/usb-i2c-sl018/statemachine.c b/usb-i2c-sl018/statemachine.c
index b141518..7bbe44f 100644
--- a/usb-i2c-sl018/statemachine.c
+++ b/usb-i2c-sl018/statemachine.c
@@ -52,7 +52,7 @@ void change_state(state_t new_state)
{
if (new_state == state)
return;
- printf("state: %s\n\r", state_to_string(new_state));
+ printf("State: %s\n\r", state_to_string(new_state));
switch(new_state) {
case reset:
break;
@@ -137,12 +137,12 @@ void statemachine_task_event(void)
case move_timeout:
return change_state(state==opening?timeout_after_open:timeout_after_close);
default:
- printf("Error: event %s not allowed in state %s\n\r", event_to_string(event), state_to_string(state));
+ printf("Error(state): event %s not allowed in state %s\n\r", event_to_string(event), state_to_string(state));
return;
}
case reset:
case error:
- printf("Error: Not accepting commands in state %s\n\r", state_to_string(state));
+ printf("Error(state): Not accepting commands in state %s\n\r", state_to_string(state));
break; // Not accepting commands
case manual_movement:
case timeout_after_open:
@@ -166,7 +166,7 @@ void statemachine_task_event(void)
case open_fin:
case close_fin:
case move_timeout:
- printf("Error: event %s not allowed in state %s\n\r", event_to_string(event), state_to_string(state));
+ printf("Error(state): event %s not allowed in state %s\n\r", event_to_string(event), state_to_string(state));
return;
}
}
diff --git a/usb-i2c-sl018/tuer-rfid.c b/usb-i2c-sl018/tuer-rfid.c
index 3e54a5d..28b7772 100644
--- a/usb-i2c-sl018/tuer-rfid.c
+++ b/usb-i2c-sl018/tuer-rfid.c
@@ -70,12 +70,15 @@ void handle_stdio(uint8_t cmd)
break;
case 'o':
eventqueue_push(cmd_open);
+ printf("ok\n\r");
break;
case 'c':
eventqueue_push(cmd_close);
+ printf("ok\n\r");
break;
case 't':
eventqueue_push(cmd_toggle);
+ printf("ok\n\r");
break;
/* case '0': ledmatrix(off); break; */
/* case '1': ledmatrix(red); break; */
@@ -86,7 +89,7 @@ void handle_stdio(uint8_t cmd)
/* case '6': ledmatrix(green_blink); break; */
/* case '7': ledmatrix(rg_moving); break; */
/* case '8': ledmatrix(rg_blink); break; */
- default: printf("error, unknown command %02X '%c'\n\r",cmd, cmd); return;
+ default: printf("Error(handle_stdio): unknown command %02X '%c'\n\r", cmd, cmd); return;
}
}
@@ -97,10 +100,10 @@ void handle_card(void)
if (uid.length)
{
if(keystore_check_card(uid.buffer,uid.length)) {
- printf("Card allowed - opening/closing door\n\r");
+ printf("Info(card): found - opening/closing door\n\r");
eventqueue_push(card);
} else {
- printf("Card not found in Database\n\r");
+ printf("Info(card): card not found in database\n\r");
}
}
}