From 4d54f228a47bfceeea1fba6115833de40b0f5bb6 Mon Sep 17 00:00:00 2001 From: Jonas Danielsson Date: Wed, 1 Sep 2021 10:46:27 +0200 Subject: [PATCH] Add SYSLINK_SYS_NRF_VERSION message Will reply with the version of the NRF51 firmware. Example: 2021.06 +1* Will mean 1 commit from the 2021.06 tag and the * marks it as "locally modified". --- interface/syslink.h | 3 ++- src/main.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/interface/syslink.h b/interface/syslink.h index a7f3c96b..99d42ee6 100644 --- a/interface/syslink.h +++ b/interface/syslink.h @@ -57,7 +57,6 @@ void syslinkReset(); #define SYSLINK_RADIO_P2P_ACK 0x09 #define SYSLINK_RADIO_P2P_BROADCAST 0x0A - #define SYSLINK_PM_SOURCE 0x10 #define SYSLINK_PM_ONOFF_SWITCHOFF 0x11 @@ -71,4 +70,6 @@ void syslinkReset(); #define SYSLINK_OW_READ 0x22 #define SYSLINK_OW_WRITE 0x23 +#define SYSLINK_SYS_NRF_VERSION 0x30 + #endif diff --git a/src/main.c b/src/main.c index 1bdd5712..349c3e2e 100644 --- a/src/main.c +++ b/src/main.c @@ -41,6 +41,7 @@ #include "systick.h" #include "nrf_sdm.h" #include "nrf_soc.h" +#include "version.h" #include "memory.h" #include "ownet.h" @@ -338,7 +339,21 @@ void mainloop() // Send the P2P packet immediately without buffer esbSendP2PPacket(slRxPacket.data[0],&slRxPacket.data[1],slRxPacket.length-1); break; + case SYSLINK_SYS_NRF_VERSION:{ + size_t len = strlen(V_STAG); + slTxPacket.type = SYSLINK_SYS_NRF_VERSION; + memcpy(&slTxPacket.data[0], V_STAG, len); + + if (V_MODIFIED) { + slTxPacket.data[len] = '*'; + len += 1; + } + + slTxPacket.data[len] = '\0'; + slTxPacket.length = len + 1; + syslinkSend(&slTxPacket); + } break; } }