Merge branch 'master' into mqtt

This commit is contained in:
Jonathan Naylor 2024-08-01 12:55:06 +01:00
commit 65c51bf849
3 changed files with 14 additions and 12 deletions

View File

@ -100,6 +100,9 @@
// Use the modem as a serial repeater for Nextion displays // Use the modem as a serial repeater for Nextion displays
#define SERIAL_REPEATER #define SERIAL_REPEATER
// Set the baud rate of the modem serial repeater for Nextion displays
#define SERIAL_REPEATER_BAUD_RATE 9600
// Use the modem as an I2C repeater for OLED displays // Use the modem as an I2C repeater for OLED displays
// #define I2C_REPEATER // #define I2C_REPEATER

View File

@ -42,8 +42,7 @@ class CFMDirectFormI
public: public:
// convenience function which takes the a0 argument but ignores it! // convenience function which takes the a0 argument but ignores it!
CFMDirectFormI(const q31_t b0, const q31_t b1, const q31_t b2, CFMDirectFormI(const q31_t b0, const q31_t b1, const q31_t b2, const q31_t, const q31_t a1, const q31_t a2)
const q31_t, const q31_t a1, const q31_t a2)
{ {
// FIR coefficients // FIR coefficients
c_b0 = b0; c_b0 = b0;
@ -57,21 +56,21 @@ public:
CFMDirectFormI(const CFMDirectFormI &my) CFMDirectFormI(const CFMDirectFormI &my)
{ {
// delay line // delay line
m_x2 = my.m_x2; // x[n-2] m_x2 = my.m_x2; // x[n-2]
m_y2 = my.m_y2; // y[n-2] m_y2 = my.m_y2; // y[n-2]
m_x1 = my.m_x1; // x[n-1] m_x1 = my.m_x1; // x[n-1]
m_y1 = my.m_y1; // y[n-1] m_y1 = my.m_y1; // y[n-1]
// coefficients // coefficients
c_b0 = my.c_b0; c_b0 = my.c_b0;
c_b1 = my.c_b1; c_b1 = my.c_b1;
c_b2 = my.c_b2; // FIR c_b2 = my.c_b2; // FIR
c_a1 = my.c_a1; c_a1 = my.c_a1;
c_a2 = my.c_a2; // IIR c_a2 = my.c_a2; // IIR
} }
void reset () void reset()
{ {
m_x1 = 0; m_x1 = 0;
m_x2 = 0; m_x2 = 0;
@ -83,11 +82,7 @@ public:
inline q15_t filter(const q15_t in) inline q15_t filter(const q15_t in)
{ {
// calculate the output // calculate the output
register q31_t out_upscaled = c_b0 * in q31_t out_upscaled = c_b0 * in + c_b1 * m_x1 + c_b2 * m_x2 - c_a1 * m_y1 - c_a2 * m_y2;
+ c_b1 * m_x1
+ c_b2 * m_x2
- c_a1 * m_y1
- c_a2 * m_y2;
q15_t out = __SSAT(out_upscaled >> 15, 15); q15_t out = __SSAT(out_upscaled >> 15, 15);

View File

@ -896,7 +896,11 @@ void CSerialPort::start()
beginInt(1U, SERIAL_SPEED); beginInt(1U, SERIAL_SPEED);
#if defined(SERIAL_REPEATER) #if defined(SERIAL_REPEATER)
beginInt(3U, 9600); #if defined(SERIAL_REPEATER_BAUD_RATE)
beginInt(3U, SERIAL_REPEATER_BAUD_RATE);
#else
beginInt(3U, 9600);
#endif
#endif #endif
#if defined(I2C_REPEATER) #if defined(I2C_REPEATER)
beginInt(10U, 9600); beginInt(10U, 9600);