Commit graph

173 commits

Author SHA1 Message Date
DiSlord 080e623a14 Small code fixes 2020-07-13 06:56:49 +03:00
DiSlord 17b229d90f Fix unix path 2020-07-11 23:26:03 +03:00
DiSlord 0a09763cbb Small definition update 2020-07-11 18:40:35 +03:00
DiSlord fdf88ae289 Move some definitions too nanovna.h 2020-07-11 18:05:44 +03:00
DiSlord 3522c05375 Comment 2020-07-09 20:43:48 +03:00
DiSlord c9e512fe9c Multiline text output and align 2020-07-09 20:42:45 +03:00
DiSlord 8894110423 Full screen keyboard
Custom buttons draw support
2020-07-03 22:03:54 +03:00
DiSlord 61b3989c28 Add part of SD card code (need some cleanup), disabled (not added diskio part!) 2020-07-01 12:29:25 +03:00
DiSlord 3213a8022c Fix MAX_TRACE_TYPE to 13
Increase digit for show Q factor (use %.3f format)
2020-06-21 08:00:01 +03:00
DiSlord 76223f5e25 Merge branch 'master' of https://github.com/ttrftech/NanoVNA 2020-06-20 12:31:35 +03:00
DiSlord a8f36a4c5d Add compact RTC library (only 500 bytes for all, default RTC lib req ~ 2kB)
For enable use external (LSE) clock generator need un comment in Makefile
#UDEFS+= -DVNA_USE_LSE
By default use internal (LSI) clock generator, but it stop then VNA power off
For enable use external (LSE) clock generator, need install 32.768kHz clock quartz on PC14 and PC15 pins, it allow clock run while power off

For enable use RTC in code uncomment in nanovna.h
#define __USE_RTC__
This enable command 'time'
usage: time [y|m|d|h|min|sec] 0-99
Example set 2020 year run 'time y 20'

Add show current time in version screen
Better use font size constants for all screen size
2020-06-20 12:07:38 +03:00
TT bc1b57c3f0 feat: add format quality factor 2020-06-20 08:08:21 +09:00
DiSlord 66a8a84082 Revert use 8MHz clock for AIC 2020-06-13 19:49:37 +03:00
DiSlord 237a329226 Add sin_cos table for 6 or 12kHz offset for dsp
Add support direct clock for AIC3204 from si5351
Now possible made calibration and not reset old calibration data, just made another calibration (not need reset or disable correction).
  Open - Short calibration depend from self, need recalibrate it together.
  Load calibration possible made alone
  Isoln, Thru also depend from self, need recalibrate it together.
2020-06-04 20:26:06 +03:00
DiSlord 881e46e122 Move ADC channel touch definition to nanovna.h 2020-05-17 23:47:15 +03:00
DiSlord 04a8820192 Remove variable, lost in last merge 2020-05-14 18:24:54 +03:00
DiSlord dedae1ea82
Merge branch 'master' into master 2020-05-14 18:08:30 +03:00
TT fe7a1ac4de fix: keep freq mode in each save slot 2020-05-14 06:53:52 +09:00
DiSlord e6450aa3ea Update header file for future fixes:
Variable sweep_points support
Increase ADC from 48kHz to 96kHz
Some in code definitions for easy compile and platform change
2020-04-29 13:40:53 +03:00
DiSlord 49b52213cf Change config and properties flash address definitions
Show BW settings at bottom of screen
2020-04-04 08:43:32 +03:00
DiSlord e09ee19646 Move bandwidth option from properties to config
Little fixes
2020-04-02 16:36:59 +03:00
DiSlord 20649012df Little speedup and less size fft
Better support other size LCD and font
Fix CH1 unstable at begin sweep
2020-03-30 20:01:51 +03:00
DiSlord 2ed2f96f4a Size fixes
- bandwidth count stored in menu (less error on add new values)
- allow set any bandwidth count from command
- bandwidth command print bandwidth freq on apply
2020-03-21 21:58:51 +03:00
DiSlord ddf51987eb On calibration use max bandwidth setting 2020-03-21 20:23:59 +03:00
DiSlord 22e4df1577 Little rework bandwidth:
- Not reset sweep on request
- Better menu response
- little DSP optimization

Faster i2c bus (now 600kHz, allow more faster add settings)
Add i2c command (disabled by default)
Little fix stat command
2020-03-21 16:15:03 +03:00
TT 1656342eeb feat: add bandwidth setting of detector 2020-03-21 21:03:08 +09:00
TT 0d407577f8 style: uniform code style and untabify 2020-03-21 09:33:33 +09:00
DiSlord fdb3886b0f Move define to str macro in nanovna.h (it allow output define valuer in error messages) 2020-03-14 16:50:35 +03:00
DiSlord 922b66abdb Move offset variable to si5351.c (better use it as independent library)
Define and move constants in nanovna.h, and use it
Fix command 'marker' - display marker freq (not current freq)
2020-03-14 15:18:14 +03:00
DiSlord 88617a31fe In ili9341.c remove tabs, add palette mode blit function
In plot.c prepare for 8bit/pixel mode (test, allow increase cell buffer size by use 4 or 8bit/pixel mode, but not need for now)
main.c little change wait execute shell command in sweep thread
2020-03-13 22:42:28 +03:00
DiSlord 3714e05395 Fix artifacts after marker move
(For faster screen update on marker move, all old area update info invalidate after use draw_all_cells(TRUE) on page switch)
Force redraw all cells after end marker move
2020-03-09 22:47:35 +03:00
DiSlord eebb625b9d Always update marker info 2020-03-09 22:28:05 +03:00
DiSlord 04fb661b1a Add flag in config for sweep mode
#define FREQ_MODE_START_STOP    0x0
#define FREQ_MODE_CENTER_SPAN   0x1
Now sweep mode not defined from frequency0 > frequency1 or frequency0 < frequency1
frequency0 always < frequency1

All freq must get by use get_sweep_frequency(mode)

Revert Select CH0 reflect channel before set freq, add additional delay on 0 sweep point
2020-03-09 18:24:31 +03:00
DiSlord 45f04420cb Implement info command, move info_about[] to main.c
Command enabled by default: ENABLE_INFO_COMMAND
This feature not increase flash size
2020-03-08 08:32:38 +03:00
DiSlord fc6e090595 Add vbat_offset to config
Implement vbat_offset command (if defined ENABLE_VBAT_OFFSET_COMMAND)
Reduce code size
2020-03-07 23:37:39 +03:00
DiSlord bb7127fdd0 Remove variable, use speep_mode flag 2020-03-07 22:21:02 +03:00
DiSlord 12d53738bc Revert some changes:
Start/stop generation feature (unstable on segment scan from CPU)
 Calibration on paused sweep (need more stack, need find better solution)
 Variable use optimization
2020-03-07 17:19:43 +03:00
DiSlord a43b6e3acc si5351.c and si5351.h
Cleanup and optimize  code
Add comments, fix definitions
Fix rounding errors
Fix band 1 stability

mcuconf.h
Set I2C bus clock to SYSCLK (more fast)
Apply 400kHz bus I2C clock timings for 8MHz and 48Mhz clock

main.c
Remove and reset some variables
Add separate sweep for calibration (allow calibrate if sweep paused)

Increase main thread stack (need for run calibrate, possibly need execute some commands in sweep threads for reduce stack usage)
2020-03-07 14:54:51 +03:00
DiSlord b77e1d6680 Big work around si5351 generator
Improve sweep speed about 60%
Stop generation on pause sweep
Remove all hack for si5351
Reduce code size
Fix integer overflow on big freq values

Additional
Change I2C

Others:
 move marker_tracking variable to ui config
 move some definition to correct place
 reduce tlv320aic3204 code size
 Speedup marker move from lever (BUTTON_REPEAT_TICKS = 625)

Need test stability
2020-03-05 22:36:44 +03:00
TT f1cc60e99e feat: add lever mode for electrical delay 2020-03-01 09:29:28 +09:00
TT 18c5ca9157 feat: add lever operation of electrical delay 2020-03-01 08:50:46 +09:00
TT 7f5948c4b8 chore: add scope name onto struct and enum 2020-03-01 08:18:12 +09:00
DiSlord 153585ff1f Move more address constants to nanovna.h 2020-02-28 23:52:01 +03:00
DiSlord ccb3693516 Huge reduce flash usage (about 5k), remove cal_data and _frequencies properties from data section
Use void loadDefaultProps() for load default properties (default loaded also on error load from flash)
Move some constants to nanovna.h
2020-02-28 23:15:38 +03:00
DiSlord d386b0823c Write clearScreen and use it in code
More hard coded values fixes
2020-02-26 23:55:06 +03:00
DiSlord b7934745ca Restore main thread stack size (stack usage code optimization give good result)
Decrease sweep thread stack size from 640 to 512 (also stack usage code optimization give good result)
Little change 16x22 font

ui.c
Use definition for some hard coded values
Fix button "Correction" not reset after use "reset"
Define menu button and input num size

#define MENU_BUTTON_WIDTH  60
#define MENU_BUTTON_HEIGHT 30
#define NUM_INPUT_HEIGHT   30

Reduce button height from 32 to 30 pixels (fix in stimulus menu "<back" button overwrite by input num field)
Little code change
2020-02-26 23:30:50 +03:00
DiSlord d2431f0cdc Increase screen render (in some cases up to 2x speedup), decrease stack usage (code size less on 1500 bytes)
Write simple profiling definitions
 START_PROFILE
 STOP_PROFILE
Use it for detect sys tick amount and output to screen

main.c
 Reduce VNA_SHELL_MAX_LENGTH to 48, and made shell_line as static (reduce stack usage)
 Remove BaseSequentialStream *chp from command calls (use static shell_stream), it reduce code size and stack usage
 Use VNA_SHELL_FUNCTION definition for all commands
 Remove chMtxLock(&mutex);chMtxUnlock(&mutex); from commands, and define command flag for use it in calls
 Apply default scale from trace_info on trace change
 Led blink outside from main sweep cycle (better look, and less noise)
 Some size fixes

chprintf.c
 Implement small memory stream object, only put function and plot_printf(char *str, int size, const char *fmt, ...)
 Use it in all code (little increase speed, and huge decrease size)

 Restore USE_EXCEPTIONS_STACKSIZE = 0x180 (possible not need, but not good tested)

plot.c
 Made huge screen render profile (add some comments)
 Not use cell clipping on draw cell data (use constants increase speed, decrease stack usage (not need put it to stack))
 Clip cell if need only on screen flush
 Use new plot_printf, remove chsnprintf usage

Apply code style
============================================================================================================
Interesting fact
Usage memset(spi_buffer, DEFAULT_BG_COLOR, (h*CELLWIDTH)*sizeof(uint16_t)); dramatically decrease render speed
possibly it fill buffer by 8 bit data, so slow
Usage
  uint32_t *p = (uint32_t *)spi_buffer;
  while (count--) {
    p[0] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
    p[1] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
    p[2] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
    p[3] = DEFAULT_BG_COLOR|(DEFAULT_BG_COLOR<<16);
    p+=4;
  }
gives x10 speed perfomance

Draw polar and smit grid very slow (but i don`t know how increase it except use bitmaps, but it need about 5-8k flash size and file prepare)
On long lines render slow down, but clipping use more calculation, and not give good result
Need made stack usage check
2020-02-24 22:47:52 +03:00
DiSlord 5ee23be06f Add definition of spi_buffer size
Add check cell and spi_buffer size
2020-02-23 17:13:52 +03:00
DiSlord 1177d87498 Increase main thread stack size (if used as shell, if run some commands get stack limit, example "trace 0 x" command)
Decrease interrupt stack size

Use __ROR instruction in flash.c for checksum rotate
Fix erase background for frequencies string in plot.c

Implement getStringIndex function for parse string arguments, now Usage show correct information about used arg, and more easy use strings definitions
Example:
 Need check if string "on"  in avaible arguments list "load|open|short|thru|isoln|done|on|off|reset|data|in"
 getStringIndex("on", "load|open|short|thru|isoln|done|on|off|reset|data|in") return 6
 If not found return -1
Not need use if (strcmp() == ...) else ....
This usage save some amount of size
2020-02-23 15:45:37 +03:00
TT 7d2708afce feat: paramterize number of y-grid, revert to 8 2020-02-23 11:37:41 +09:00