Comments (1)
Hi DisLord,
Ok,
to fix the glitches at the band change points do as follow.
Substitute the IS_HARMONIC_MODE(f) macro with the function
int8_t IS_HARMONIC_MODE(uint32_t freq) here below
int8_t IS_HARMONIC_MODE(uint32_t freq){
if (freq > FREQ_HARMONICS * 5 ) {
return 3;
}
else{
if (freq > FREQ_HARMONICS * 3) {
return 2;
}
else{
if (freq > FREQ_HARMONICS) {
return 1;
}
else{
return 0;
}
}
}
}
And change the code into static void cal_interpolate(int s) this way:
#if __NewBandChangeInterpolation__ == 1
float k1 = (float)(f - src->_frequencies[j])
/ (src->_frequencies[j+1] - src->_frequencies[j]);
// avoid glitch between freqs in different harmonics mode
if (IS_HARMONIC_MODE(src->_frequencies[j]) != IS_HARMONIC_MODE(src->_frequencies[j+1])) {
int m;
if (IS_HARMONIC_MODE(f)==IS_HARMONIC_MODE(src->_frequencies[j+1])){
float k0 = 2 - k1;
k1 = k1 - 1;
for (eterm = 0; eterm < 5; eterm++) {
cal_data[eterm][i][0] = src->_cal_data[eterm][j+1][0] * k0 + src->_cal_data[eterm][j+2][0] * k1;
cal_data[eterm][i][1] = src->_cal_data[eterm][j+1][1] * k0 + src->_cal_data[eterm][j+2][1] * k1;
}
}
else{
float k0 = - k1;
k1 = k1 + 1;
if (j == 0){
m = j;
}
else{
m = j - 1;
}
for (eterm = 0; eterm < 5; eterm++) {
cal_data[eterm][i][0] = src->_cal_data[eterm][m][0] * k0 + src->_cal_data[eterm][j][0] * k1;
cal_data[eterm][i][1] = src->_cal_data[eterm][m][1] * k0 + src->_cal_data[eterm][j][1] * k1;
}
}
}
else{
float k0 = 1.0 - k1;
for (eterm = 0; eterm < 5; eterm++) {
cal_data[eterm][i][0] = src->_cal_data[eterm][j][0] * k0 + src->_cal_data[eterm][j+1][0] * k1;
cal_data[eterm][i][1] = src->_cal_data[eterm][j][1] * k0 + src->_cal_data[eterm][j+1][1] * k1;
}
}
break;
#else
float k1 = (float)(f - src->_frequencies[j])
/ (src->_frequencies[j+1] - src->_frequencies[j]);
// avoid glitch between freqs in different harmonics mode
if (IS_HARMONIC_MODE(src->_frequencies[j]) != IS_HARMONIC_MODE(src->_frequencies[j+1])) {
// assume f[j] < f[j+1]
k1 = IS_HARMONIC_MODE(f) ? 1.0 : 0.0;
}
float k0 = 1.0 - k1;
for (eterm = 0; eterm < 5; eterm++) {
cal_data[eterm][i][0] = src->_cal_data[eterm][j][0] * k0 + src->_cal_data[eterm][j+1][0] * k1;
cal_data[eterm][i][1] = src->_cal_data[eterm][j][1] * k0 + src->_cal_data[eterm][j+1][1] * k1;
}
break;
#endif
Substantially the only line changed respect my previous message is this:
if (IS_HARMONIC_MODE(f)){
Which turned to:
if (IS_HARMONIC_MODE(f)==IS_HARMONIC_MODE(src->_frequencies[j+1])){
After that, the glitches at the band change points are fixed.
Have a great day,
Massimo - IK1IZA
from nanovna-h.
Related Issues (20)
- firmware make error HOT 7
- New Function request: Quickly zoom and move frequency range HOT 4
- Open calibration corrupts S21 measurements using 401 points at 315MHz center with 30MHz span HOT 1
- Connect NanoVNA-H to Windows 7 Machine and Assign COM Port HOT 1
- could not open the screenshot bmp file. HOT 2
- 1.1.01 : Toggling to mode SI5351 does not stay set between reboots. HOT 2
- Marker Search Values are incorrectly saved to calibration when Tracking is ON
- Can't compile for target F072 (cannot move location counter backwards) HOT 14
- Enhancement Calibrate, Power in dBm
- Avoid releasing non-x.x.x versions
- How to calculate the values of resistive return loss bridge?
- Add a mode to measure Common Mode Current Chokes
- Black screen on boot and failure to save anything to SD with 1.2.14 code HOT 2
- which file HOT 1
- Not proceed.
- NanoVNA-H4 Hanging on scan
- Can someone confirm 1.2.14 COM port comms is working? HOT 1
- NanoVNA-H v 1.2.14 - SWR scan freezes for a second or two every so often. HOT 4
- NanoVNA H4 does not starts HOT 1
- New version no longer has AA like in 2020 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nanovna-h.