Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix screen artifacts, change start/stop or center/span mode set, remove Mutex use #126

Merged
merged 24 commits into from
Mar 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
77b5d0b
Select CH0 reflect channel before set freq (in some rare cases dsp st…
DiSlord Mar 8, 2020
a2d90a5
Try not lost data on dsp (Less noise on small signals)
DiSlord Mar 8, 2020
5cf86ee
Revert dsp changes, need more research
DiSlord Mar 9, 2020
90407d5
Fix screen artifacts:
DiSlord Mar 9, 2020
a19722c
Reduce last patch fix size (use pointers)
DiSlord Mar 9, 2020
2d273a5
Fix typo
DiSlord Mar 9, 2020
19121b3
Auto determine mark_map mask size from MAX_MARKMAP_X on compilation (…
DiSlord Mar 9, 2020
f907414
Size fixes, use define exept const, typdef index_t for indexes
DiSlord Mar 9, 2020
04fb661
Add flag in config for sweep mode
DiSlord Mar 9, 2020
eebb625
Always update marker info
DiSlord Mar 9, 2020
3714e05
Fix artifacts after marker move
DiSlord Mar 9, 2020
10ae59e
Little cleanup
DiSlord Mar 9, 2020
51b5cce
Fix Random jitters at band 1 and band change on some freq ranges
DiSlord Mar 11, 2020
6f25d0d
Remove Mutex use (CH_CFG_USE_MUTEXES = FALSE), now all Mutex depend f…
DiSlord Mar 12, 2020
8bdb650
Implement color command, allow change color settings in config (enabl…
DiSlord Mar 12, 2020
88617a3
In ili9341.c remove tabs, add palette mode blit function
DiSlord Mar 13, 2020
922b66a
Move offset variable to si5351.c (better use it as independent library)
DiSlord Mar 14, 2020
ec81a01
Not use float in vbat measure (faster, less size), yes get little err…
DiSlord Mar 14, 2020
8a11eaa
Extend scan command, now in have additional input variable (optional)…
DiSlord Mar 14, 2020
45dfd7d
Fix sweep if points < maximum (mot sweep if frequency[i] == 0)
DiSlord Mar 14, 2020
fdb3886
Move define to str macro in nanovna.h (it allow output define valuer …
DiSlord Mar 14, 2020
3eb8a4c
Fix interpolation range if sweep_points!=source calibration points count
DiSlord Mar 14, 2020
23c765b
Fix very strange bug, on band 2
DiSlord Mar 15, 2020
597c2c2
Better solutiom of prev fixes (reload si5351 settings on sweep begin)
DiSlord Mar 15, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,23 @@ uint16_t adc_single_read(uint32_t chsel)

int16_t adc_vbat_read(void)
{
// 13.9 Temperature sensor and internal reference voltage
// VREFINT_CAL calibrated on 3.3V, need get value in mV
#define ADC_FULL_SCALE 3300
#define VREFINT_CAL (*((uint16_t*)0x1FFFF7BA))
adc_stop();
float vbat = 0;
float vrefint = 0;
ADC->CCR |= ADC_CCR_VREFEN | ADC_CCR_VBATEN;
// VREFINT == ADC_IN17
vrefint = adc_single_read(ADC_CHSELR_CHSEL17);
uint32_t vrefint = adc_single_read(ADC_CHSELR_CHSEL17);
// VBAT == ADC_IN18
// VBATEN enables resiter devider circuit. It consume vbat power.
vbat = adc_single_read(ADC_CHSELR_CHSEL18);
uint32_t vbat = adc_single_read(ADC_CHSELR_CHSEL18);
ADC->CCR &= ~(ADC_CCR_VREFEN | ADC_CCR_VBATEN);
touch_start_watchdog();
uint16_t vbat_raw = (ADC_FULL_SCALE * VREFINT_CAL * vbat * 2 / (vrefint * ((1<<12)-1)));
// vbat_raw = (3300 * 2 * vbat / 4095) * (VREFINT_CAL / vrefint)
// uint16_t vbat_raw = (ADC_FULL_SCALE * VREFINT_CAL * (float)vbat * 2 / (vrefint * ((1<<12)-1)));
// For speed divide not on 4095, divide on 4096, get little error, but no matter
uint16_t vbat_raw = ((ADC_FULL_SCALE * 2 * vbat)>>12) * VREFINT_CAL / vrefint;
if (vbat_raw < 100) {
// maybe D2 is not installed
return -1;
Expand Down
2 changes: 1 addition & 1 deletion chconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
*
* @note The default is @p TRUE.
*/
#define CH_CFG_USE_MUTEXES TRUE
#define CH_CFG_USE_MUTEXES FALSE

/**
* @brief Enables recursive behavior on mutexes.
Expand Down
4 changes: 2 additions & 2 deletions fft.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ static void fft256(float array[][2], const uint8_t dir) {
uint16_t j, k;
for (j = i, k = 0; j < i + halfsize; j++, k += tablestep) {
uint16_t l = j + halfsize;
float tpre = array[l][real] * cos(2 * M_PI * k / 256) + array[l][imag] * sin(2 * M_PI * k / 256);
float tpim = -array[l][real] * sin(2 * M_PI * k / 256) + array[l][imag] * cos(2 * M_PI * k / 256);
float tpre = array[l][real] * cos(2 * VNA_PI * k / 256) + array[l][imag] * sin(2 * VNA_PI * k / 256);
float tpim = -array[l][real] * sin(2 * VNA_PI * k / 256) + array[l][imag] * cos(2 * VNA_PI * k / 256);
array[l][real] = array[j][real] - tpre;
array[l][imag] = array[j][imag] - tpim;
array[j][real] += tpre;
Expand Down
Loading