pull/34/head
erikkaashoek 3 years ago
parent a18614ea30
commit e0abacaf13

@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/> <provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-465279327364006" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true"> <provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="164294660241561" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/> <language-scope id="org.eclipse.cdt.core.g++"/>
</provider> </provider>
@ -17,7 +17,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/> <provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-465279327364006" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true"> <provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="164294660241561" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/> <language-scope id="org.eclipse.cdt.core.g++"/>
</provider> </provider>

@ -32,6 +32,10 @@
//#include "memstreams.h" //#include "memstreams.h"
#include <math.h> #include <math.h>
#pragma GCC optimize ("Og")
// Enable [flags], support: // Enable [flags], support:
// ' ' Prepends a space for positive signed-numeric types. positive = ' ', negative = '-'. This flag is ignored if the + flag exists. // ' ' Prepends a space for positive signed-numeric types. positive = ' ', negative = '-'. This flag is ignored if the + flag exists.
#define CHPRINTF_USE_SPACE_FLAG #define CHPRINTF_USE_SPACE_FLAG
@ -164,7 +168,7 @@ ulong_freq(char *p, ulong_t freq, uint32_t width, uint32_t precision)
return p; return p;
} }
#if CHPRINTF_USE_FLOAT //#if CHPRINTF_USE_FLOAT
static char *ftoa(char *p, float num, uint32_t precision) { static char *ftoa(char *p, float num, uint32_t precision) {
// Check precision limit // Check precision limit
if (precision > FLOAT_PRECISION) if (precision > FLOAT_PRECISION)
@ -222,7 +226,26 @@ static char *ftoaS(char *p, float num, int precision) {
*p++ = prefix; *p++ = prefix;
return p; return p;
} }
#endif
static char *etoa(char *p, float num, uint32_t precision) {
int exp = 0;
if (num == 0) { *p++ = '0'; return p; }
while (num < 10) { num *= 10.0; exp--; }
while (num > 10) { num /= 10.0; exp++; }
*p++ = ((int)num) + '0'; num *=10.0;
*p++ = '.';
if (precision == 0) precision = 6;
while (precision--) { *p++ = (((int)num) % 10) + '0'; num *=10.0; }
*p++ = 'e';
if (exp < 0) { *p++ = '-'; exp = -exp;} else *p++ = '+';
*p++ = (((int)exp) / 10 ) + '0';
*p++ = (((int)exp) % 10 ) + '0';
return p;
}
//#endif
/** /**
* @brief System formatted output function. * @brief System formatted output function.
@ -405,9 +428,10 @@ int chvprintf(BaseSequentialStream *chp, const char *fmt, va_list ap) {
precision = MAX_FREQ_PRESCISION; precision = MAX_FREQ_PRESCISION;
p=ulong_freq(p, value.ux, width, precision); p=ulong_freq(p, value.ux, width, precision);
break; break;
#if CHPRINTF_USE_FLOAT //#if CHPRINTF_USE_FLOAT
case 'F': case 'F':
case 'f': case 'f':
case 'e':
if (state & _32_BIT_FLOAT) if (state & _32_BIT_FLOAT)
value.u = va_arg(ap, uint32_t); value.u = va_arg(ap, uint32_t);
else else
@ -427,9 +451,9 @@ int chvprintf(BaseSequentialStream *chp, const char *fmt, va_list ap) {
*p++ = 0x19; *p++ = 0x19;
break; break;
} }
p = (c=='F') ? ftoaS(p, value.f, precision) : ftoa(p, value.f, state&DEFAULT_PRESCISION ? FLOAT_PRECISION : precision); p = (c=='F') ? ftoaS(p, value.f, precision) : ((c=='e') ? etoa(p, value.f, precision) : ftoa(p, value.f, state&DEFAULT_PRESCISION ? FLOAT_PRECISION : precision));
break; break;
#endif //#endif
case 'X': case 'X':
case 'x': case 'x':
c = 16; c = 16;

@ -237,8 +237,8 @@ caldata_recall(uint16_t id)
set_reflevel(setting.reflevel); set_reflevel(setting.reflevel);
set_waterfall(); set_waterfall();
set_level_meter(); set_level_meter();
if (setting.show_stored) // if (setting.show_stored)
enableTracesAtComplete(TRACE_STORED_FLAG); // enableTracesAtComplete(TRACE_STORED_FLAG);
return 0; return 0;
} }
#if 0 #if 0

@ -739,7 +739,7 @@ VNA_SHELL_FUNCTION(cmd_data)
static const uint8_t sel_conv[]={TRACE_TEMP, TRACE_STORED, TRACE_ACTUAL}; static const uint8_t sel_conv[]={TRACE_TEMP, TRACE_STORED, TRACE_ACTUAL};
float *data = measured[sel_conv[sel]]; float *data = measured[sel_conv[sel]];
for (i = 0; i < sweep_points; i++) for (i = 0; i < sweep_points; i++)
shell_printf("%f\r\n", value(data[i])); shell_printf("%e\r\n", value(data[i]));
return; return;
} }
usage: usage:
@ -1138,9 +1138,9 @@ do_scan:
if (mask) { if (mask) {
for (i = 0; i < sweep_points; i++) { for (i = 0; i < sweep_points; i++) {
if (mask & 1) shell_printf("%U ", getFrequency(i)); if (mask & 1) shell_printf("%U ", getFrequency(i));
if (mask & 2) shell_printf("%f %f ", value(measured[TRACE_ACTUAL][i]), 0.0); if (mask & 2) shell_printf("%e %f ", value(measured[TRACE_ACTUAL][i]), 0.0);
if (mask & 4) shell_printf("%f %f ", value(measured[TRACE_STORED][i]), 0.0); if (mask & 4) shell_printf("%e %f ", value(measured[TRACE_STORED][i]), 0.0);
if (mask & 8) shell_printf("%f %f ", value(measured[TRACE_TEMP][i]), 0.0); if (mask & 8) shell_printf("%e %f ", value(measured[TRACE_TEMP][i]), 0.0);
shell_printf("\r\n"); shell_printf("\r\n");
} }
} }
@ -1632,7 +1632,7 @@ show_one:
goto usage; goto usage;
float v = my_atof(argv[next_arg]); float v = my_atof(argv[next_arg]);
measured[t][i] = v; measured[t][i] = v;
goto update; return;
} }
} }
goto usage; goto usage;
@ -1654,7 +1654,7 @@ VNA_SHELL_FUNCTION(cmd_marker)
if (argc == 0) { if (argc == 0) {
for (t = 0; t < MARKERS_MAX; t++) { for (t = 0; t < MARKERS_MAX; t++) {
if (markers[t].enabled) { if (markers[t].enabled) {
shell_printf("%d %d %D %.2f\r\n", t+1, markers[t].index, markers[t].frequency, marker_to_value(t)); shell_printf("%d %d %D %.2e\r\n", t+1, markers[t].index, markers[t].frequency, marker_to_value(t));
} }
} }
return; return;
@ -1673,7 +1673,7 @@ VNA_SHELL_FUNCTION(cmd_marker)
goto usage; goto usage;
if (argc == 1) { if (argc == 1) {
display_marker: display_marker:
shell_printf("%d %d %D %.2f\r\n", t+1, markers[t].index, markers[t].frequency, marker_to_value(t)); shell_printf("%d %d %D %.2e\r\n", t+1, markers[t].index, markers[t].frequency, marker_to_value(t));
active_marker = t; active_marker = t;
// select active marker // select active marker
markers[t].enabled = TRUE; markers[t].enabled = TRUE;

@ -18,7 +18,7 @@
*/ */
#include "ch.h" #include "ch.h"
//#ifdef TINYSA_F303 #ifdef TINYSA_F303
#ifdef TINYSA_F072 #ifdef TINYSA_F072
#error "Remove comment for #ifdef TINYSA_F303" #error "Remove comment for #ifdef TINYSA_F303"
#endif #endif
@ -26,7 +26,7 @@
#define TINYSA4 #define TINYSA4
#endif #endif
#define TINYSA4_PROTO #define TINYSA4_PROTO
//#endif #endif
#ifdef TINYSA_F072 #ifdef TINYSA_F072
#ifdef TINYSA_F303 #ifdef TINYSA_F303
@ -1104,7 +1104,7 @@ typedef struct setting
bool auto_reflevel; // bool bool auto_reflevel; // bool
bool auto_attenuation; // bool bool auto_attenuation; // bool
bool mirror_masking; // bool bool mirror_masking; // bool
bool show_stored; // bool // bool show_stored; // bool
bool tracking_output; // bool bool tracking_output; // bool
bool mute; // bool bool mute; // bool
bool auto_IF; // bool bool auto_IF; // bool
@ -1345,7 +1345,7 @@ typedef struct properties {
//sizeof(properties_t) == 0x1200 //sizeof(properties_t) == 0x1200
#define CONFIG_MAGIC 0x434f4e59 /* 'CONF' */ #define CONFIG_MAGIC 0x434f4e5A /* 'CONF' */
extern int16_t lastsaveid; extern int16_t lastsaveid;
//extern properties_t *active_props; //extern properties_t *active_props;

@ -370,19 +370,25 @@ VNA_SHELL_FUNCTION(cmd_leveloffset)
{ {
// 0 1 2 // 0 1 2
#ifdef TINYSA4 #ifdef TINYSA4
static const char cmd_mode_list[] = "low|high|switch|receive_switch|out_switch|lna|harmonic|shift1|shift2|shift3|drive1|drive2|drive3|direct|direct_lna|ultra|ultra_lna"; static const char cmd_mode_list[] = "low|switch|receive_switch|out_switch|lna|harmonic|shift1|shift2|shift3|drive1|drive2|drive3|direct|direct_lna|ultra|ultra_lna";
#else #else
static const char cmd_mode_list[] = "low|high|switch|receive_switch"; static const char cmd_mode_list[] = "low|high|switch|receive_switch";
#endif #endif
if (argc == 0) { if (argc == 0) {
const char *p = "leveloffset %s %.1f\r\n"; const char *p = "leveloffset %s %.1f\r\n";
#ifdef TINYSA3
shell_printf(p, "low", config.low_level_offset); shell_printf(p, "low", config.low_level_offset);
shell_printf(p, "high", config.high_level_offset); shell_printf(p, "high", config.high_level_offset);
shell_printf(p, "low output", config.low_level_output_offset); shell_printf(p, "low output", config.low_level_output_offset);
shell_printf(p, "high output", config.high_level_output_offset); shell_printf(p, "high output", config.high_level_output_offset);
shell_printf(p, "switch", config.switch_offset); shell_printf(p, "switch", config.switch_offset);
shell_printf(p, "receive_switch",config.receive_switch_offset); shell_printf(p, "receive_switch",config.receive_switch_offset);
#endif
#ifdef TINYSA4 #ifdef TINYSA4
shell_printf(p, "low", config.low_level_offset);
shell_printf(p, "low output", config.low_level_output_offset);
shell_printf(p, "switch", config.switch_offset);
shell_printf(p, "receive_switch",config.receive_switch_offset);
shell_printf(p, "out_switch", config.out_switch_offset); shell_printf(p, "out_switch", config.out_switch_offset);
shell_printf(p, "lna", config.lna_level_offset); shell_printf(p, "lna", config.lna_level_offset);
shell_printf(p, "harmonic", config.harmonic_level_offset); shell_printf(p, "harmonic", config.harmonic_level_offset);
@ -408,24 +414,29 @@ VNA_SHELL_FUNCTION(cmd_leveloffset)
if (argc == 2){ if (argc == 2){
v = my_atof(argv[1]); v = my_atof(argv[1]);
switch (mode){ switch (mode){
#ifdef TINYSA3
case 0: config.low_level_offset = v; break; case 0: config.low_level_offset = v; break;
case 1: config.high_level_offset = v; break; case 1: config.high_level_offset = v; break;
case 2: config.switch_offset = v; break; case 2: config.switch_offset = v; break;
case 3: config.receive_switch_offset = v; break; case 3: config.receive_switch_offset = v; break;
#endif
#ifdef TINYSA4 #ifdef TINYSA4
case 4: config.out_switch_offset = v; break; case 0: config.low_level_offset = v; break;
case 5: config.lna_level_offset = v; break; case 1: config.switch_offset = v; break;
case 6: config.harmonic_level_offset = v; break; case 2: config.receive_switch_offset = v; break;
case 7: config.shift1_level_offset = v; break; case 3: config.out_switch_offset = v; break;
case 8: config.shift2_level_offset = v; break; case 4: config.lna_level_offset = v; break;
case 9: config.shift3_level_offset = v; break; case 5: config.harmonic_level_offset = v; break;
case 10: config.drive1_level_offset = v; break; case 6: config.shift1_level_offset = v; break;
case 11: config.drive2_level_offset = v; break; case 7: config.shift2_level_offset = v; break;
case 12: config.drive3_level_offset = v; break; case 8: config.shift3_level_offset = v; break;
case 13: config.direct_level_offset = v; break; case 9: config.drive1_level_offset = v; break;
case 14: config.direct_lna_level_offset = v; break; case 10: config.drive2_level_offset = v; break;
case 15: config.ultra_level_offset = v; break; case 11: config.drive3_level_offset = v; break;
case 16: config.ultra_lna_level_offset = v; break; case 12: config.direct_level_offset = v; break;
case 13: config.direct_lna_level_offset = v; break;
case 14: config.ultra_level_offset = v; break;
case 15: config.ultra_lna_level_offset = v; break;
#endif #endif
default: goto usage; default: goto usage;
} }

@ -588,7 +588,7 @@ void reset_settings(int m)
#ifdef __DRAW_LINE__ #ifdef __DRAW_LINE__
setting.draw_line = false; setting.draw_line = false;
#endif #endif
setting.show_stored = 0; // setting.show_stored = 0;
setting.auto_attenuation = false; setting.auto_attenuation = false;
setting.normalize_level = 0.0; setting.normalize_level = 0.0;
setting.normalized_trace = -1; setting.normalized_trace = -1;
@ -1418,7 +1418,7 @@ void store_trace(int f, int t)
void set_clear_storage(void) void set_clear_storage(void)
{ {
setting.show_stored = false; // setting.show_stored = false;
// setting.subtract = false; // setting.subtract = false;
TRACE_DISABLE(TRACE_STORED_FLAG); TRACE_DISABLE(TRACE_STORED_FLAG);
// dirty = true; // No HW update required, only status panel refresh // dirty = true; // No HW update required, only status panel refresh

Loading…
Cancel
Save

Powered by TurnKey Linux.