Skip to content

Commit 658e88a

Browse files
committed
Respond to robogotchi id command
1 parent 3cbfe9a commit 658e88a

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

command_interface.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,14 @@ void command_interface_process_byte(char incoming)
369369
NRF_LOG_FLUSH();
370370
melody_snooze_seconds = atoi(command_input_buffer+7);
371371
}
372+
else if(strncmp(command_input_buffer, "roboid", 6) == 0)
373+
{
374+
// Return robogotchi unique ID
375+
NRF_LOG_INFO("robogotchi ID command received");
376+
NRF_LOG_FLUSH();
377+
sprintf((char *)command_response_buffer, "roboid,%02x%02x", NRF_FICR->DEVICEID[0], NRF_FICR->DEVICEID[1]);
378+
m_ble_tx_logbuffer(command_response_buffer, strlen((const char *)command_response_buffer));
379+
}
372380

373381
memset(command_input_buffer, 0, sizeof(command_input_buffer));
374382
command_input_index = 0;

main.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ uint32_t millis(void)
204204

205205
void melody_play(int index, bool interrupt_melody)
206206
{
207-
if (is_melody_playing && !interrupt_melody || melody_snooze_seconds > 0)
207+
if ((is_melody_playing && !interrupt_melody) || melody_snooze_seconds > 0)
208208
{
209209
return;
210210
}
@@ -2450,8 +2450,12 @@ int main(void) {
24502450
}
24512451
#endif
24522452

2453+
// Robogotchi Unique ID
2454+
NRF_LOG_INFO("Robogotchi ID: %02x%02x", NRF_FICR->DEVICEID[0], NRF_FICR->DEVICEID[1]);
2455+
NRF_LOG_FLUSH();
2456+
24532457
// GotchiNet Registration Code
2454-
NRF_LOG_INFO("GotchiNet: %d", abs(NRF_FICR->DEVICEID[1] ^ NRF_FICR->DEVICEADDR[1]));
2458+
NRF_LOG_INFO("GotchiNet Registration: %d", abs(NRF_FICR->DEVICEID[1] ^ NRF_FICR->DEVICEADDR[1]));
24552459
NRF_LOG_FLUSH();
24562460

24572461
// BLE PIN CODE
@@ -2461,7 +2465,7 @@ int main(void) {
24612465
NRF_LOG_WARNING("Computed PIN was 5 digits");
24622466
ble_bondage_safe_word += 100000;
24632467
}
2464-
NRF_LOG_INFO("PIN CODE %d", ble_bondage_safe_word);
2468+
NRF_LOG_INFO("BLE PIN: %d", ble_bondage_safe_word);
24652469
NRF_LOG_FLUSH();
24662470
// Store PIN for Display
24672471
itoa(ble_bondage_safe_word, ble_pin, 10);

0 commit comments

Comments
 (0)