Commit graph

128 commits

Author SHA1 Message Date
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
TT 8e8bc6924e fix: update checksum 2020-02-23 02:00:50 +09:00
TT 10e5578c8c Merge branch 'levermode' into DiSlord-master 2020-02-23 00:05:47 +09:00
TT 93d1233d8b feat: change the operations to select lever mode 2020-02-22 22:41:50 +09:00
DiSlord 02a5715bb4 Big code redisign (increase CELL draw size, more faster screen render), also save about 4-5kB flash size
Try remove all hardcoded values from code (use definition if set)
Some error fix

main.c:
Rewrite Shell, now it run on main thread and require less RAM (not need stack)
 (possible run it as thread if define VNA_SHELL_THREAD
Remove not used trace_info[].scale_unit in set_trace_scale/get_trace_scale (it just divede on set and multiple on get, better use it for default scale set)

Replace some hardcoded values
 MARKERS_MAX
 SAVEAREA_MAX
 TRACES_MAX

plot.c
Rewrite CELLWIDTH and CELLHEIGHT use, now possible set any CELL width and height (CELLWIDTH * CELLHEIGHT <= spi_buffer size)
Free RAM from shell stack use fore increase spi_buffer size now it have 2048 pixel (64x32)
Rewrite cell index and markmap use (now correct use cell size, and more faster), correct use CELLWIDTH and CELLHEIGHT in calculation
Fore set update area use invalidateRect (still need use some hardcoded values :( )
Rewrite cell_draw_line
Rewrite many hardcoded size definitions
Refrence point now draw as bitmap (less size, more costumable)
Fix drag marker (now correct search closest index in search_nearest_index)
Rewrite plot_into_index, now correct use size definitions, moe

ui.c
Small rewrite keyboard definitions, for use less flash size
Define KP_WIDTH, KP_HEIGHT for set key size
Better look some big font symvols

All:
use static fore some local functions (use less space on calls)
replace tabs on spaces (code style)
Use M_PI from math.h fore define pi value

Fix printf on print HEX values
2020-02-22 10:50:54 +03:00
DiSlord e9f65b1426 Huge rework chsnprintf function (basic functional more compact and faster):
I can`t upload my version chprintf.c to ChibiOS\os\hal\lib\streams upload it to root :(
 now support print float and Suffix if use example %.1F on 1.234e-3 print 1.234m, %F print 1.23m
 now support + flag %+d on 8 print +8, %+d on -8 print -8
 now support freq output if use %q example %q on 1234567890 print 1.234 567 890 GHz, %.8q print 1.234567GHz
 fix rounding errors on print float example if print use %.2f on 2.199 print 2.20 (before 2.19)
Use it in code - made more compact (save about 2k bytes) and easy display values (set output more digits after . for some values)
Made some font glyph more compact, allow 3px glyph

More correct create frequencies table on big span (not use float operations), also produce more compact code
Use double value input from keyboard (not lost Hz on input)
Set sweep_points as uint Optimize set_sweep_frequency size

Fix freq commands broken after freq set as uint32 (add str to uint32 functions for freq bigger then 2 147 483 647):
 cmd_freq
 cmd_offset
 cmd_threshold
 cmd_scan
 cmd_sweep

Define _isdigit macro (replace isdigit() function, its too big)

Rewrite std universal atoi() to more compact my_atoi and write new unsigned variant my_atoui
2020-02-11 11:54:05 +03:00
TT ae38c9794d view: pack smith marker value 2020-02-01 00:24:28 +09:00
TT 14dfe97557 fix: revert color of traces to the original 2020-02-01 00:18:38 +09:00
DiSlord a46a20028f Remove unused global variable (fgrid)
Set areasize as int16
2020-01-30 21:43:49 +03:00
ВшЫдщкв 5a4d02208f define POINTS_COUNT in nanovna.h
fix 'micro' char in font
fix draw STOP distance in frequency field
fix x position calc in plot_into_index
fix frequencies delta defined as int in plot.c
fix frequencies defined as int in ui.c
2020-01-25 20:54:03 +03:00
ВшЫдщкв df5a655cd0 Remove comment, fix last add 2020-01-21 20:47:53 +03:00
DiSlord e7bdead77a
Merge branch 'master' into master 2020-01-21 20:45:02 +03:00
TT 066027f5b5 fix: prototype mismatch 2020-01-21 21:43:58 +09:00
ВшЫдщкв 6f666cf31b Change Font size (more readable)
Rework display spi driver:
 use DMA for read, write
 add blitBitmap functions
 Use DMA for color fill
 More correct SPI bus control
Move color definitions to nanovna.h
Some code optimization for speed and size (save about 3k bytes)
Change grid Y resolution to 10
Fix convert from float to int (fix some rounding errors on plot)
Disable unused HAL serial
Change battery icon
2020-01-19 11:16:18 +03:00
TT 18a1ca4e6e feat: add marker tracking 2020-01-18 22:27:56 +09:00
TT e1ba0c77f0 chore: store velocity factor in float 2020-01-18 13:03:38 +09:00
TT c4495b6d58 chore: add reserved room in properties and config 2020-01-18 12:34:59 +09:00
TT fcb0be6def fix: remove upper limit of signed int32 for frequency setting 2020-01-18 12:07:21 +09:00
TT 75ea464c91 chore: delta symbol 2019-11-30 13:47:34 +09:00
TT 0bfa2c073e feat: add marker smith value format menu 2019-11-30 10:17:14 +09:00
TT a534a89c89 feat: add marker delta mode 2019-11-29 21:53:07 +09:00
TT 1422e5fd49 feat: show each markers when multiple markers are active 2019-11-23 17:47:14 +09:00
TT a3eb29ea04 feat: add marker operation groupdelay->edelay 2019-11-23 11:04:45 +09:00
TT c7af840f53 feat: add feedback of lever mode 2019-11-17 11:00:07 +09:00
TT 3f209e4986 feat: add marker search 2019-10-22 14:00:25 +09:00
TT 47fec0b024 remove buffer used only in dump command 2019-10-22 09:36:41 +09:00
TT 0124e1b32d chore: update codec control 2019-10-21 20:25:44 +09:00
TT 7adba06333 chore: reduce foot-print of numfont20x24 2019-10-21 20:25:44 +09:00
TT dcbcfe162c chore: shrink 5x7 font 2019-10-21 20:25:44 +09:00
TT 3fc17e18f9 fix: break sweep loop on frequency change 2019-10-07 22:24:32 +09:00
TT f7e712798a chore: remove warnings 2019-10-06 07:56:25 +09:00
TT bfd45c715d fix: fix digit loss of sweep frequency 2019-10-05 21:48:00 +09:00
TT 94659a22ba feat: add threshold command 2019-10-05 19:56:38 +09:00
TT 516319b354 fix: plot only if sweep completed 2019-09-28 13:08:03 +09:00
TT 47f48d83e4 fix: omit drawing screen from usb thread 2019-09-26 09:06:43 +09:00
cho45 1120d5c33b Fix timedomain transform (based on acd944d5fa by @erikkaashoek ) 2019-09-21 22:20:08 +09:00
cho45 aa4faa5a6e rename TDR -> TD 2019-09-11 23:05:01 +09:00
cho45 6bad9de606 change menu name to 'TRANSFORM' 2019-09-11 20:47:17 +09:00
cho45 8f0bfacf3d setting velocity factor 2019-09-11 00:24:06 +09:00
cho45 95ab399567 save domain mode 2019-09-10 23:49:08 +09:00
cho45 889d675836 TDR feature 2019-09-10 22:39:20 +09:00
cho45 a9457dbd0a show battery indicator (requires implementing D2 on board) 2019-09-10 01:01:24 +09:00
cho45 5e9756e4e0 append reset dfu command and CONFIG -> ENTER DFU 2019-09-06 21:11:33 +09:00
cho45 39b7fdf95e append version info screen to UI 2019-09-05 23:58:30 +09:00
TT 3e841920fb refactor: introduce trace_info 2019-08-26 23:58:47 +09:00
cho45 f9a5d2e3ef Add REAL IMAG R X trace format 2019-08-24 07:45:53 +09:00