Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions EPD/EPD_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,19 @@ static void dispatch_command(ble_epd_t* p_epd, uint16_t command_16bit,
case CMD_FIRMWARE_VERSION:
handle_firmware_version(p_epd);
break;
case CMD_DIRECT_WRITE_PARTIAL_START:
case CMD_BUZZER_ACTIVATE:
// Commands the client sends and blocks on, but this firmware does
// not implement. Reply with the standard 4-byte NACK frame
// {0xFF, cmd, error, 0x00} so the client fails fast instead of
// waiting for an ACK that never comes and timing out.
{
NRF_LOG_WARNING("Unsupported command 0x%04X; sending NACK", command_16bit);
uint8_t nack[] = {0xFF, (uint8_t)(command_16bit & 0xFF),
RESP_ERR_UNSUPPORTED_CMD, 0x00};
(void)send_response(p_epd, nack, sizeof(nack));
}
break;
default:
NRF_LOG_DEBUG("Unknown command: 0x%04X", command_16bit);
break;
Expand Down
4 changes: 4 additions & 0 deletions EPD/EPD_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ void ble_epd_evt_handler(ble_evt_t const* p_ble_evt, void* p_context);

#define CMD_LED_ACTIVATE 0x0073

#define CMD_DIRECT_WRITE_PARTIAL_START 0x0076 // Not implemented on nRF; client waits for a response
#define CMD_BUZZER_ACTIVATE 0x0077 // Not implemented on nRF; client waits for a response

#define CMD_REBOOT 0x000F
#define CMD_FIRMWARE_VERSION 0x0043
#define CMD_READ_MSD 0x0044
Expand Down Expand Up @@ -101,6 +104,7 @@ void ble_epd_evt_handler(ble_evt_t const* p_ble_evt, void* p_context);
#define RESP_DIRECT_WRITE_REFRESH_SUCCESS 0x73
#define RESP_DIRECT_WRITE_REFRESH_TIMEOUT 0x74
#define RESP_DIRECT_WRITE_ERROR 0xFF
#define RESP_ERR_UNSUPPORTED_CMD 0x01 // NACK error code for commands this firmware does not implement
#define RESP_LED_ACTIVATE_ACK 0x73
#define RESP_FIRMWARE_VERSION 0x43
#define RESP_MSD_READ 0x44
Expand Down