Skip to content

Commit

Permalink
Change 2 command codes for uniformity
Browse files Browse the repository at this point in the history
  • Loading branch information
realA10001986 authored Sep 13, 2024
1 parent d850df3 commit 5ff77ca
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
5 changes: 5 additions & 0 deletions sid-A10001986/sid-A10001986.ino
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@

/* Changelog
*
* 2024/09/13 (A10001986)
* - Command *50 is now *60, command *51 is now *61
* (Changed for uniformity with other props)
* 2024/09/11 (A10001986)
* - Fix C99-compliance
* 2024/09/09 (A10001986)
* - Tune BTTFN poll interval
* 2024/08/28 (A10001986)
Expand Down
4 changes: 2 additions & 2 deletions sid-A10001986/sid_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#define _SID_GLOBAL_H

// Version strings
#define SID_VERSION "V1.24"
#define SID_VERSION_EXTRA "SEP092024"
#define SID_VERSION "V1.3"
#define SID_VERSION_EXTRA "SEP132024"

//#define SID_DBG // debug output on Serial

Expand Down
29 changes: 24 additions & 5 deletions sid-A10001986/sid_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,19 @@ static uint32_t commandQueue[16] = { 0 };
static uint8_t bttfnDateBuf[8] = { 0xff };
static unsigned long bttfnDateNow = 0;

#define GET32(a,b) \
(((a)[b]) | \
(((a)[(b)+1]) << 8) | \
(((a)[(b)+2]) << 16) | \
(((a)[(b)+3]) << 24))
//#define GET32(a,b) *((uint32_t *)((a) + (b)))
#define SET32(a,b,c) \
(a)[b] = ((uint32_t)(c)) & 0xff; \
((a)[(b)+1]) = ((uint32_t)(c)) >> 8; \
((a)[(b)+2]) = ((uint32_t)(c)) >> 16; \
((a)[(b)+3]) = ((uint32_t)(c)) >> 24;
//#define SET32(a,b,c) *((uint32_t *)((a) + (b))) = c

// Forward declarations ------

static void startIRLearn();
Expand Down Expand Up @@ -2191,12 +2204,14 @@ static bool execute(bool isIR)
snake_start();
}
break;
case 50: // *50 enable/disable strict mode
case 50: // *50(deprecated)
case 60: // *60 enable/disable strict mode
if(!TTrunning && !isIRLocked) {
toggleStrictMode();
}
break;
case 51: // *51 enable/disable "peaks" in Spectrum Analyzer
case 51: // *51(deprecated))
case 61: // *61 enable/disable "peaks" in Spectrum Analyzer
if(!TTrunning && !isIRLocked) {
doPeaks = !doPeaks;
}
Expand Down Expand Up @@ -2761,7 +2776,8 @@ static void BTTFNCheckPacket()

// (Possibly) a response packet

if(*((uint32_t *)(BTTFUDPBuf + 6)) != BTTFUDPID)
//if(*((uint32_t *)(BTTFUDPBuf + 6)) != BTTFUDPID)
if(GET32(BTTFUDPBuf, 6) != BTTFUDPID)
return;

// Response marker missing or wrong version, bail
Expand Down Expand Up @@ -2841,7 +2857,9 @@ static void BTTFNSendPacket()
memcpy(BTTFUDPBuf, BTTFUDPHD, 4);

// Serial
*((uint32_t *)(BTTFUDPBuf + 6)) = BTTFUDPID = (uint32_t)millis();
BTTFUDPID = (uint32_t)millis();
SET32(BTTFUDPBuf, 6, BTTFUDPID);
//*((uint32_t *)(BTTFUDPBuf + 6)) =

// Tell the TCD about our hostname (0-term., 13 bytes total)
strncpy((char *)BTTFUDPBuf + 10, settings.hostName, 12);
Expand All @@ -2855,7 +2873,8 @@ static void BTTFNSendPacket()
#ifdef BTTFN_MC
if(!haveTCDIP) {
BTTFUDPBuf[5] |= 0x80;
memcpy(BTTFUDPBuf + 31, (void *)&tcdHostNameHash, 4);
//memcpy(BTTFUDPBuf + 31, (void *)&tcdHostNameHash, 4);
SET32(BTTFUDPBuf, 31, tcdHostNameHash);
}
#endif

Expand Down

0 comments on commit 5ff77ca

Please sign in to comment.