Max repeat 10000

pwm
erikkaashoek 3 years ago
parent 4f5396afd6
commit e904ac99a6

@ -78,7 +78,7 @@ void __early_init(void) {
// __enable_irq(); // __enable_irq();
// reset magic bytes // reset magic bytes
*((unsigned long *)BOOT_FROM_SYTEM_MEMORY_MAGIC_ADDRESS) = 0; *((unsigned long *)BOOT_FROM_SYTEM_MEMORY_MAGIC_ADDRESS) = 0;
#if 1 #if 0
// https://stm32f4-discovery.net/2017/04/tutorial-jump-system-memory-software-stm32/ // https://stm32f4-discovery.net/2017/04/tutorial-jump-system-memory-software-stm32/
// Step: Disable systick timer and reset it to default values // Step: Disable systick timer and reset it to default values
#if 0 #if 0
@ -109,12 +109,22 @@ void __early_init(void) {
//msp = *(uint32_t *) 0; //msp = *(uint32_t *) 0;
msp = 0x20002250; msp = 0x20002250;
#endif #endif
// bootloader = (pFunction) 0x1FFFF796;
__set_MSP(msp); __set_MSP(msp);
bootloader(); bootloader();
while(1); while(1);
#else #else
__set_MSP(SYSTEM_BOOT_MSP); __disable_irq();
( (void (*)(void)) (*((uint32_t *)(STM32F303xC_SYSTEM_MEMORY+4))) )(); uint32_t foo = SYSCFG->CFGR1;
foo = (foo & ~SYSCFG_CFGR1_MEM_MODE) || SYSCFG_CFGR1_MEM_MODE_0;
SYSCFG->CFGR1 = foo;
__DSB();
__ISB();
__set_MSP(*((uint32_t *)(STM32F303xC_SYSTEM_MEMORY)));
((void (*)(void))(*((uint32_t *)(STM32F303xC_SYSTEM_MEMORY + 4))))(); // jump to DFU
// __set_MSP(SYSTEM_BOOT_MSP);
// ( (void (*)(void)) (*((uint32_t *)(STM32F303xC_SYSTEM_MEMORY+4))) )();
while(1); while(1);
#endif #endif
} }

@ -84,6 +84,7 @@
#define __LIMITS__ #define __LIMITS__
#define __CURVE_EDIT__ #define __CURVE_EDIT__
#ifdef TINYSA3 #ifdef TINYSA3
#define __HAS_DFU__
#define __MCU_CLOCK_SHIFT__ #define __MCU_CLOCK_SHIFT__
#endif #endif
#ifdef TINYSA4 #ifdef TINYSA4
@ -1176,7 +1177,6 @@ typedef struct setting
uint8_t atten_step; // 0...1 !!! need convert to bool uint8_t atten_step; // 0...1 !!! need convert to bool
int8_t _active_marker; // -1...MARKER_MAX int8_t _active_marker; // -1...MARKER_MAX
uint8_t unit_scale_index; // table index uint8_t unit_scale_index; // table index
uint8_t repeat; // 1...100
uint8_t noise; // 2...50 uint8_t noise; // 2...50
uint8_t lo_drive; // 0-3 , 3dB steps uint8_t lo_drive; // 0-3 , 3dB steps
uint8_t rx_drive; // 0-15 , 7=+20dBm, 3dB steps uint8_t rx_drive; // 0-15 , 7=+20dBm, 3dB steps
@ -1186,6 +1186,7 @@ typedef struct setting
uint8_t _traces; // enabled traces flags uint8_t _traces; // enabled traces flags
uint8_t draw_line; // uses the trigger level setting uint8_t draw_line; // uses the trigger level setting
uint16_t repeat; // 1...100
uint16_t linearity_step; // range equal POINTS_COUNT uint16_t linearity_step; // range equal POINTS_COUNT
uint16_t _sweep_points; uint16_t _sweep_points;
int16_t attenuate_x2; // 0...60 !!! in calculation can be < 0 int16_t attenuate_x2; // 0...60 !!! in calculation can be < 0
@ -1391,7 +1392,7 @@ typedef struct properties {
//sizeof(properties_t) == 0x1200 //sizeof(properties_t) == 0x1200
#define CONFIG_MAGIC 0x434f4e60 /* 'CONF' */ #define CONFIG_MAGIC 0x434f4e60 /* 'CONF' */
#define SETTING_MAGIC 0x434f4e60 #define SETTING_MAGIC 0x434f4e61
extern int16_t lastsaveid; extern int16_t lastsaveid;
//extern properties_t *active_props; //extern properties_t *active_props;

@ -1083,17 +1083,17 @@ void set_modulation_frequency(int f)
f = 50; f = 50;
if (f > 10000) if (f > 10000)
f = 10000; f = 10000;
//#ifdef TINYSA4 #ifdef TINYSA4
// if (setting.modulation == MO_WFM && f > 2000) if (setting.modulation == MO_WFM && f > 3500)
// f = 2000; f = 3500;
//#endif #endif
setting.modulation_frequency = f; setting.modulation_frequency = f;
dirty = true; dirty = true;
} }
void set_repeat(int r) void set_repeat(int r)
{ {
if (r > 0 && r <= 500) { if (r > 0 && r <= 10000) {
setting.repeat = r; setting.repeat = r;
// dirty = true; // No HW update required, only status panel refresh // dirty = true; // No HW update required, only status panel refresh
} }

12
ui.c

@ -666,7 +666,7 @@ extern const char *states[];
lcd_set_font(FONT_SMALL); lcd_set_font(FONT_SMALL);
} }
#ifndef TINYSA4 #ifdef __HAS_DFU__
void void
enter_dfu(void) enter_dfu(void)
{ {
@ -2143,7 +2143,7 @@ static UI_FUNCTION_CALLBACK(menu_config_cb)
redraw_frame(); redraw_frame();
request_to_redraw_grid(); request_to_redraw_grid();
} }
#ifndef TINYSA4 #ifdef __HAS_DFU__
static UI_FUNCTION_CALLBACK(menu_dfu_cb) static UI_FUNCTION_CALLBACK(menu_dfu_cb)
{ {
(void)data; (void)data;
@ -3882,7 +3882,7 @@ static const menuitem_t menu_modulation[] = {
{ MT_FORM | MT_ADV_CALLBACK | MT_LOW, MO_AM, "AM", menu_modulation_acb}, { MT_FORM | MT_ADV_CALLBACK | MT_LOW, MO_AM, "AM", menu_modulation_acb},
#ifdef TINYSA4 #ifdef TINYSA4
{ MT_FORM | MT_ADV_CALLBACK, MO_WFM, "FM", menu_modulation_acb}, { MT_FORM | MT_ADV_CALLBACK, MO_WFM, "FM", menu_modulation_acb},
{ MT_FORM | MT_KEYPAD, KM_MODULATION, "FREQ: %s", "50Hz..5kHz"}, { MT_FORM | MT_KEYPAD, KM_MODULATION, "FREQ: %s", "50Hz..3.5kHz"},
{ MT_FORM | MT_KEYPAD, KM_DEPTH, "AM DEPTH: %s%%", "0..100"}, { MT_FORM | MT_KEYPAD, KM_DEPTH, "AM DEPTH: %s%%", "0..100"},
{ MT_FORM | MT_KEYPAD, KM_DEVIATION, "FM DEVIATION: %s", "1kHz..300kHz"}, { MT_FORM | MT_KEYPAD, KM_DEVIATION, "FM DEVIATION: %s", "1kHz..300kHz"},
// { MT_FORM | MT_ADV_CALLBACK, MO_NFM2, MT_CUSTOM_LABEL, menu_modulation_acb}, // { MT_FORM | MT_ADV_CALLBACK, MO_NFM2, MT_CUSTOM_LABEL, menu_modulation_acb},
@ -4097,7 +4097,7 @@ static const menuitem_t menu_marker[] = {
{ MT_NONE, 0, NULL, menu_back} // next-> menu_back { MT_NONE, 0, NULL, menu_back} // next-> menu_back
}; };
#ifndef TINYSA4 #ifdef __HAS_DFU__
static const menuitem_t menu_dfu[] = { static const menuitem_t menu_dfu[] = {
{ MT_FORM | MT_CALLBACK, 0, "ENTER DFU", menu_dfu_cb}, { MT_FORM | MT_CALLBACK, 0, "ENTER DFU", menu_dfu_cb},
{ MT_FORM | MT_NONE, 0, NULL, menu_back} // next-> menu_back { MT_FORM | MT_NONE, 0, NULL, menu_back} // next-> menu_back
@ -4502,14 +4502,14 @@ static const menuitem_t menu_config[] = {
#ifdef __SPUR__ #ifdef __SPUR__
{ MT_ADV_CALLBACK,0, "%s", menu_spur_acb}, { MT_ADV_CALLBACK,0, "%s", menu_spur_acb},
#endif #endif
{ MT_KEYPAD, KM_REPEAT, "SAMPLE REP\n\b%s", "1..100"}, { MT_KEYPAD, KM_REPEAT, "SAMPLE REP\n\b%s", "1..10000"},
#ifdef __LCD_BRIGHTNESS__ #ifdef __LCD_BRIGHTNESS__
{ MT_ADV_CALLBACK, 0, "BRIGHTNESS\n \b%d%%", menu_brightness_acb}, { MT_ADV_CALLBACK, 0, "BRIGHTNESS\n \b%d%%", menu_brightness_acb},
#endif #endif
#ifdef __USE_RTC__ #ifdef __USE_RTC__
{ MT_SUBMENU, 0, "DATE\nTIME", menu_date_time}, { MT_SUBMENU, 0, "DATE\nTIME", menu_date_time},
#endif #endif
#ifndef TINYSA4 #ifdef __HAS_DFU__
{ MT_SUBMENU, 0, S_RARROW" DFU", menu_dfu}, { MT_SUBMENU, 0, S_RARROW" DFU", menu_dfu},
#endif #endif
{ MT_SUBMENU, 0, S_RARROW"MORE", menu_config2}, { MT_SUBMENU, 0, S_RARROW"MORE", menu_config2},

Loading…
Cancel
Save

Powered by TurnKey Linux.