Compare commits
2 Commits
6fde4cfd66
...
4009a2794d
Author | SHA1 | Date | |
---|---|---|---|
4009a2794d | |||
d9c145ec81 |
@ -122,12 +122,6 @@ enum analog_value_monitor {
|
|||||||
*/
|
*/
|
||||||
#define SAFETY_MIN_STACK_FREE 0x100
|
#define SAFETY_MIN_STACK_FREE 0x100
|
||||||
|
|
||||||
#define PID_CONTROLLER_ERR_CAREMASK (ERR_FLAG_STACK | ERR_FLAG_AMON_UC_TEMP | ERR_FLAG_AMON_VREF | \
|
|
||||||
ERR_FLAG_TIMING_PID | ERR_FLAG_TIMING_MEAS_ADC | ERR_FLAG_MEAS_ADC_OFF | \
|
|
||||||
ERR_FLAG_MEAS_ADC_OVERFLOW)
|
|
||||||
|
|
||||||
#define HALTING_CAREMASK (ERR_FLAG_STACK | ERR_FLAG_AMON_UC_TEMP)
|
|
||||||
|
|
||||||
#define SAFETY_ADC_VREF_MVOLT (2500.0f)
|
#define SAFETY_ADC_VREF_MVOLT (2500.0f)
|
||||||
#define SAFETY_ADC_VREF_TOL_MVOLT (100.0f)
|
#define SAFETY_ADC_VREF_TOL_MVOLT (100.0f)
|
||||||
#define SAFETY_ADC_TEMP_LOW_LIM (0.0f)
|
#define SAFETY_ADC_TEMP_LOW_LIM (0.0f)
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
* @param mid mid word of ID
|
* @param mid mid word of ID
|
||||||
* @param low low word of ID
|
* @param low low word of ID
|
||||||
*/
|
*/
|
||||||
void unique_id_get(uint32_t *high, uint32_t *mid, uint32_t *low);
|
void stm_unique_id_get(uint32_t *high, uint32_t *mid, uint32_t *low);
|
||||||
|
|
||||||
|
void stm_dev_rev_id_get(uint32_t *device_id, uint32_t *revision_id);
|
||||||
|
|
||||||
#endif /* __UNIQUE_ID_H__ */
|
#endif /* __UNIQUE_ID_H__ */
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include <reflow-controller/hw-version-detect.h>
|
#include <reflow-controller/hw-version-detect.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief PID ontroller instance of the oven driver
|
* @brief PID controller instance of the oven driver
|
||||||
*/
|
*/
|
||||||
static struct pid_controller IN_SECTION(.ccm.bss) oven_pid;
|
static struct pid_controller IN_SECTION(.ccm.bss) oven_pid;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ static void get_controller_folder_path(char *path, size_t size)
|
|||||||
if (!path)
|
if (!path)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unique_id_get(&high, &mid, &low);
|
stm_unique_id_get(&high, &mid, &low);
|
||||||
|
|
||||||
snprintf(path, size, "/%08X-%08X-%08X",
|
snprintf(path, size, "/%08X-%08X-%08X",
|
||||||
(unsigned int)high, (unsigned int)mid, (unsigned int)low);
|
(unsigned int)high, (unsigned int)mid, (unsigned int)low);
|
||||||
|
@ -64,10 +64,13 @@ static shellmatta_retCode_t shell_cmd_ver(const shellmatta_handle_t handle,
|
|||||||
uint32_t low_id;
|
uint32_t low_id;
|
||||||
uint32_t mid_id;
|
uint32_t mid_id;
|
||||||
uint32_t high_id;
|
uint32_t high_id;
|
||||||
|
uint32_t stm_rev_id;
|
||||||
|
uint32_t stm_dev_id;
|
||||||
const char *hw_rev_str;
|
const char *hw_rev_str;
|
||||||
enum hw_revision pcb_rev;
|
enum hw_revision pcb_rev;
|
||||||
|
|
||||||
unique_id_get(&high_id, &mid_id, &low_id);
|
stm_unique_id_get(&high_id, &mid_id, &low_id);
|
||||||
|
stm_dev_rev_id_get(&stm_dev_id, &stm_rev_id);
|
||||||
|
|
||||||
shellmatta_printf(handle, "Reflow Oven Controller Firmware " xstr(GIT_VER) "\r\n"
|
shellmatta_printf(handle, "Reflow Oven Controller Firmware " xstr(GIT_VER) "\r\n"
|
||||||
"Compiled: " __DATE__ " at " __TIME__ "\r\n");
|
"Compiled: " __DATE__ " at " __TIME__ "\r\n");
|
||||||
@ -85,7 +88,10 @@ static shellmatta_retCode_t shell_cmd_ver(const shellmatta_handle_t handle,
|
|||||||
hw_rev_str = "Hardware: Unknown Revision. You might have to update the firmware!";
|
hw_rev_str = "Hardware: Unknown Revision. You might have to update the firmware!";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
shellmatta_printf(handle, "%s", hw_rev_str);
|
shellmatta_printf(handle, "%s\r\n", hw_rev_str);
|
||||||
|
|
||||||
|
shellmatta_printf(handle, "STM Device ID: 0x%04X\r\n", stm_dev_id);
|
||||||
|
shellmatta_printf(handle, "STM Revision ID: 0x%04X\r\n", stm_rev_id);
|
||||||
|
|
||||||
return SHELLMATTA_OK;
|
return SHELLMATTA_OK;
|
||||||
}
|
}
|
||||||
|
@ -19,12 +19,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stm-periph/unique-id.h>
|
#include <stm-periph/unique-id.h>
|
||||||
|
#include <stm32/stm32f4xx.h>
|
||||||
|
|
||||||
#define LOW_WORD_ADDR (0x1FFF7A10UL)
|
#define LOW_WORD_ADDR (0x1FFF7A10UL)
|
||||||
#define MID_WORD_ADDR (LOW_WORD_ADDR+4U)
|
#define MID_WORD_ADDR (LOW_WORD_ADDR+4U)
|
||||||
#define HIGH_WORD_ADDR (LOW_WORD_ADDR+8U)
|
#define HIGH_WORD_ADDR (LOW_WORD_ADDR+8U)
|
||||||
|
|
||||||
void unique_id_get(uint32_t *high, uint32_t *mid, uint32_t *low)
|
void stm_unique_id_get(uint32_t *high, uint32_t *mid, uint32_t *low)
|
||||||
{
|
{
|
||||||
if (!high || !mid || !low)
|
if (!high || !mid || !low)
|
||||||
return;
|
return;
|
||||||
@ -33,3 +34,12 @@ void unique_id_get(uint32_t *high, uint32_t *mid, uint32_t *low)
|
|||||||
*mid = *((uint32_t *)MID_WORD_ADDR);
|
*mid = *((uint32_t *)MID_WORD_ADDR);
|
||||||
*high = *((uint32_t *)HIGH_WORD_ADDR);
|
*high = *((uint32_t *)HIGH_WORD_ADDR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void stm_dev_rev_id_get(uint32_t *device_id, uint32_t *revision_id)
|
||||||
|
{
|
||||||
|
if (device_id)
|
||||||
|
*device_id = DBGMCU->IDCODE & DBGMCU_IDCODE_DEV_ID;
|
||||||
|
if (revision_id)
|
||||||
|
*revision_id = (DBGMCU->IDCODE & DBGMCU_IDCODE_REV_ID) >> 16;
|
||||||
|
}
|
||||||
|
@ -53,6 +53,7 @@ void button_init()
|
|||||||
enum button_state button_read_event()
|
enum button_state button_read_event()
|
||||||
{
|
{
|
||||||
uint64_t time_delta;
|
uint64_t time_delta;
|
||||||
|
uint64_t activation_stmp;
|
||||||
enum button_state temp_state;
|
enum button_state temp_state;
|
||||||
|
|
||||||
if (override_state != BUTTON_IDLE) {
|
if (override_state != BUTTON_IDLE) {
|
||||||
@ -66,7 +67,13 @@ enum button_state button_read_event()
|
|||||||
int_state = BUTTON_IDLE;
|
int_state = BUTTON_IDLE;
|
||||||
return temp_state;
|
return temp_state;
|
||||||
} else {
|
} else {
|
||||||
time_delta = systick_get_global_tick() - to_active_timestamp;
|
/* Unfortunately I don't jave a better idea for now to ensure,
|
||||||
|
* that to_active_timestamp is read atomically
|
||||||
|
*/
|
||||||
|
__disable_irq();
|
||||||
|
activation_stmp = to_active_timestamp;
|
||||||
|
__enable_irq();
|
||||||
|
time_delta = systick_get_global_tick() - activation_stmp;
|
||||||
if (time_delta >= BUTTON_LONG_ON_TIME_MS)
|
if (time_delta >= BUTTON_LONG_ON_TIME_MS)
|
||||||
return BUTTON_LONG;
|
return BUTTON_LONG;
|
||||||
else if (time_delta >= BUTTON_SHORT_ON_TIME_MS)
|
else if (time_delta >= BUTTON_SHORT_ON_TIME_MS)
|
||||||
|
@ -189,7 +189,7 @@ static void gui_menu_about(struct lcd_menu *menu, enum menu_entry_func_entry ent
|
|||||||
if (last_page == 3)
|
if (last_page == 3)
|
||||||
break;
|
break;
|
||||||
last_page = 3;
|
last_page = 3;
|
||||||
unique_id_get(&ser1, &ser2, &ser3);
|
stm_unique_id_get(&ser1, &ser2, &ser3);
|
||||||
|
|
||||||
menu_lcd_outputf(menu, 0, "Serial: %08X", ser1);
|
menu_lcd_outputf(menu, 0, "Serial: %08X", ser1);
|
||||||
menu_lcd_outputf(menu, 1, " %08X", ser2);
|
menu_lcd_outputf(menu, 1, " %08X", ser2);
|
||||||
@ -791,7 +791,7 @@ static void gui_menu_root_entry(struct lcd_menu *menu, enum menu_entry_func_entr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int gui_handle()
|
int gui_handle(void)
|
||||||
{
|
{
|
||||||
int32_t rot_delta;
|
int32_t rot_delta;
|
||||||
enum button_state button;
|
enum button_state button;
|
||||||
@ -813,7 +813,7 @@ int gui_handle()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gui_init()
|
void gui_init(void)
|
||||||
{
|
{
|
||||||
rotary_encoder_setup();
|
rotary_encoder_setup();
|
||||||
button_init();
|
button_init();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user