Commit graph

410 commits

Author SHA1 Message Date
DiSlord 10ae59e786 Little cleanup 2020-03-09 23:57:03 +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 f9074149bb Size fixes, use define exept const, typdef index_t for indexes 2020-03-09 16:18:29 +03:00
DiSlord 19121b3371 Auto determine mark_map mask size from MAX_MARKMAP_X on compilation (up to MAX_MARKMAP_X = 32) 2020-03-09 14:40:17 +03:00
DiSlord 2d273a5548 Fix typo 2020-03-09 14:22:59 +03:00
DiSlord a19722cdc3 Reduce last patch fix size (use pointers) 2020-03-09 14:08:06 +03:00
DiSlord 90407d5730 Fix screen artifacts:
In mark_cells_from_index(void) mark all rectangle (in most cases this not decrease render speed, and more fast in calculation, and no errors)
2020-03-09 13:12:01 +03:00
DiSlord 5cf86ee1a6 Revert dsp changes, need more research 2020-03-09 10:28:33 +03:00
DiSlord a2d90a5e91 Try not lost data on dsp (Less noise on small signals)
Use int64_t acc for values
Use double on calculation

Not cache freq on si5351_set_frequency_with_offset (to fast change in rare cases on cw mode, and process wrong DSP block) as i write before need change DSP delay tactic
2020-03-09 01:25:46 +03:00
DiSlord 77b5d0bcc8 Select CH0 reflect channel before set freq (in some rare cases dsp started but CH not ready)
Little code optimization
Add commented 600kHz I2C bus timings (work, give x1.5 speed, but need change DSP ready timings not by wait_count, need use chVTGetSystemTimeX() its better)
2020-03-08 22:48:36 +03:00
TT c40d78d80f env: clean Makefile 2020-03-08 20:03:54 +09:00
TT 608482a970 env: add debug conf for vscode 2020-03-08 19:56:37 +09:00
TT ba5bf9c1ad fix: board definition 2020-03-08 19:55:57 +09:00
TT 6befd57bc1 fix: segv in sample command 2020-03-08 19:37:26 +09:00
TT 7c2e4364e6
Merge pull request #125 from DiSlord/master
Speedup and fix Si5351 clock generator
2020-03-08 19:33:13 +09: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 e896f32803 Replace function wait_dsp(delay) by definition:
DSP_START(delay)
//================================================
// Place some code thats need execute while delay
//================================================
DSP_WAIT_READY

Fix Band table description

Add power stabilization delay on sweep start
2020-03-07 20:57:43 +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 f6b28c2c14
Merge pull request #121 from DiSlord/master
Fix crash on trace command, reduce flash usage by 8k, up to 2x faster screen render
2020-03-01 09:19: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 cc3370c962 si5351.c
Remove unused function from header
Set static calls for functions (less size)
Set static constants (less size)
2020-02-28 18:57:18 +03:00
DiSlord a164a5765a Disable HAL_USE_RTC usage (need for cmd_time)
Add ENABLE_TIME_COMMAND for enable cmd_time if need

Fix incorrect data on run cmd_scan cmd_data if Tansform enabled on NanoVNA (remove transform_domain() from sweep, add in front of plot_into_index in sweep thread)
Remove pause/run in reload (not need, command run vs CMD_WAIT_MUTEX flag)
2020-02-28 18:52:25 +03:00
DiSlord 0116c529ea Restore sweep stack size as 640 2020-02-28 00:50:12 +03:00
DiSlord cb587d05a4 Makefile:
Remove compile
 #include $(CHIBIOS)/test/rt/test.mk
 #include $(CHIBIOS)/os/various/shell/shell.mk

Shell not used, test not used
2020-02-27 22:11:32 +03:00
DiSlord 95b3f6f7d0 Disable ChibiOS option CH_CFG_USE_MUTEXES_RECURSIVE
All calls chMtxLock - chMtxUnlock not recursive
2020-02-27 21:21:54 +03:00
DiSlord 17734f257d Disable unused ChibiOS options:
CH_CFG_USE_WAITEXIT (used only is Shell run as thread)
CH_CFG_USE_EVENTS (NanoVNA not use events)
CH_CFG_USE_EVENTS_TIMEOUT (NanoVNA not use events)

Implement stack use check in "threads" command, now free stack space show in table as "stk free" in hex
Check stack usage by sweep, and main threads (seems all ok, but add 64 bytes to sweep)

Replace some const values to defined
2020-02-27 20:53:45 +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 a4e9b7a139
Merge branch 'master' into master 2020-02-25 06:35:06 +03:00
TT 48ff4893d3 feat: force putting trailing zeros on float value 2020-02-25 08:41:22 +09: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 c92987c52e Fix default trace refpos set (use NGRIDY value) 2020-02-23 15:58:12 +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 c89cd36f19 fix: checksum 2020-02-23 11:36:05 +09:00
TT 681272c253 fix: update year of the copyright 2020-02-23 10:43:46 +09:00
TT 1b62741a3d fix: erase on DEL key in the vna shell 2020-02-23 08:20:01 +09:00
TT 8e8bc6924e fix: update checksum 2020-02-23 02:00:50 +09:00
TT 39f997f7d4 fix: default scale factor 2020-02-23 00:16:54 +09:00