Skip to content

Commit

Permalink
UDID is now optional (disabled in some boards to save flash memory)
Browse files Browse the repository at this point in the history
  • Loading branch information
juribeparada committed Dec 2, 2019
1 parent 146e6fb commit 1210748
Show file tree
Hide file tree
Showing 19 changed files with 59 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@
// Disable frequency restrictions (satellite, ISS, etc)
// #define DISABLE_FREQ_BAN

// Enable UDID feature
// #define ENABLE_UDID

#endif
4 changes: 4 additions & 0 deletions SerialPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U;

const uint8_t PROTOCOL_VERSION = 1U;

#if defined(ENABLE_UDID)
char UDID[] = "00000000000000000000000000000000";
#endif

CSerialPort::CSerialPort() :
m_buffer(),
Expand Down Expand Up @@ -211,9 +213,11 @@ void CSerialPort::getVersion()
for (uint8_t i = 0U; HARDWARE[i] != 0x00U; i++, count++)
reply[count] = HARDWARE[i];

#if defined(ENABLE_UDID)
reply[count++] = '\0';
for (uint8_t i = 0U; UDID[i] != 0x00U; i++, count++)
reply[count] = UDID[i];
#endif

reply[1U] = count;

Expand Down
4 changes: 4 additions & 0 deletions SerialSTM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,13 +433,16 @@ void WriteUSART2(const uint8_t* data, uint16_t length)
#endif

/////////////////////////////////////////////////////////////////
#if defined(ENABLE_UDID)
extern char UDID[];
extern "C" {
#include <stdio.h>
}
#endif

void CSerialPort::beginInt(uint8_t n, int speed)
{
#if defined(ENABLE_UDID)
#if defined(STM32F4XX)
uint32_t *id0 = (uint32_t *) (0x1FFF7A10);
uint32_t *id1 = (uint32_t *) (0x1FFF7A10 + 0x04);
Expand All @@ -458,6 +461,7 @@ void CSerialPort::beginInt(uint8_t n, int speed)
uint32_t *id1 = (uint32_t *) (0x1FFFF7E8 + 0x04);
uint32_t *id2 = (uint32_t *) (0x1FFFF7E8 + 0x08);
::sprintf(UDID, "%04X%04X%08X%08X", *id00, *id01, *(unsigned int *)id1, *(unsigned int *)id2);
#endif
#endif

switch (n) {
Expand Down
3 changes: 3 additions & 0 deletions configs/D2RG_MMDVM_HS.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@
// Disable frequency restrictions (satellite, ISS, etc)
// #define DISABLE_FREQ_BAN

// Enable UDID feature
// #define ENABLE_UDID

#endif
3 changes: 3 additions & 0 deletions configs/MMDVM_HS_Dual_Hat-12mhz.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@
// Disable frequency restrictions (satellite, ISS, etc)
// #define DISABLE_FREQ_BAN

// Enable UDID feature
#define ENABLE_UDID

#endif
3 changes: 3 additions & 0 deletions configs/MMDVM_HS_Dual_Hat.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@
// Disable frequency restrictions (satellite, ISS, etc)
// #define DISABLE_FREQ_BAN

// Enable UDID feature
#define ENABLE_UDID

#endif
3 changes: 3 additions & 0 deletions configs/MMDVM_HS_Hat-12mhz.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@
// Disable frequency restrictions (satellite, ISS, etc)
// #define DISABLE_FREQ_BAN

// Enable UDID feature
#define ENABLE_UDID

#endif
3 changes: 3 additions & 0 deletions configs/MMDVM_HS_Hat.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@
// Disable frequency restrictions (satellite, ISS, etc)
// #define DISABLE_FREQ_BAN

// Enable UDID feature
#define ENABLE_UDID

#endif
3 changes: 3 additions & 0 deletions configs/NanoDV_NPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@
// Disable frequency restrictions (satellite, ISS, etc)
// #define DISABLE_FREQ_BAN

// Enable UDID feature
#define ENABLE_UDID

#endif
3 changes: 3 additions & 0 deletions configs/NanoDV_USB.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@
// Disable frequency restrictions (satellite, ISS, etc)
// #define DISABLE_FREQ_BAN

// Enable UDID feature
// #define ENABLE_UDID

#endif
3 changes: 3 additions & 0 deletions configs/Nano_hotSPOT.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@
// Disable frequency restrictions (satellite, ISS, etc)
// #define DISABLE_FREQ_BAN

// Enable UDID feature
#define ENABLE_UDID

#endif
3 changes: 3 additions & 0 deletions configs/ZUMspot_Libre.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@
// Disable frequency restrictions (satellite, ISS, etc)
// #define DISABLE_FREQ_BAN

// Enable UDID feature
// #define ENABLE_UDID

#endif
3 changes: 3 additions & 0 deletions configs/ZUMspot_RPi.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@
// Disable frequency restrictions (satellite, ISS, etc)
// #define DISABLE_FREQ_BAN

// Enable UDID feature
#define ENABLE_UDID

#endif
3 changes: 3 additions & 0 deletions configs/ZUMspot_USB.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,7 @@
// Disable frequency restrictions (satellite, ISS, etc)
// #define DISABLE_FREQ_BAN

// Enable UDID feature
// #define ENABLE_UDID

#endif
3 changes: 3 additions & 0 deletions configs/ZUMspot_dualband.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,7 @@
// Disable frequency restrictions (satellite, ISS, etc)
// #define DISABLE_FREQ_BAN

// Enable UDID feature
#define ENABLE_UDID

#endif
3 changes: 3 additions & 0 deletions configs/ZUMspot_duplex.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@
// Disable frequency restrictions (satellite, ISS, etc)
// #define DISABLE_FREQ_BAN

// Enable UDID feature
// #define ENABLE_UDID

#endif
3 changes: 3 additions & 0 deletions configs/generic_duplex_gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@
// Disable frequency restrictions (satellite, ISS, etc)
// #define DISABLE_FREQ_BAN

// Enable UDID feature
#define ENABLE_UDID

#endif
3 changes: 3 additions & 0 deletions configs/generic_duplex_usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@
// Disable frequency restrictions (satellite, ISS, etc)
// #define DISABLE_FREQ_BAN

// Enable UDID feature
// #define ENABLE_UDID

#endif
3 changes: 3 additions & 0 deletions configs/generic_gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@
// Disable frequency restrictions (satellite, ISS, etc)
// #define DISABLE_FREQ_BAN

// Enable UDID feature
#define ENABLE_UDID

#endif

0 comments on commit 1210748

Please sign in to comment.