Bayley Wang
/
flash_configuration
flash based config testing
Diff: main.cpp
- Revision:
- 0:941e150e78b6
- Child:
- 1:df6bbacb7bb9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Mar 01 00:52:47 2017 +0000 @@ -0,0 +1,114 @@ +#include "mbed.h" +#include "config.h" +#include "config_driving.h" +#include "config_inverter.h" +#include "config_logging.h" +#include "config_loop.h" +#include "config_motor.h" +#include "config_pins.h" +#include "config_table.h" +#include "PreferenceWriter.h" +#include "FlashWriter.h" + +Serial pc(USBTX, USBRX); +PreferenceWriter pref(6); + +int main() { + pc.baud(115200); + pc.printf("%s\n", "Serial Configuration Test"); + + /* + DEFAULT(TORQUE_MODE); + DEFAULT(MAX_TQPCT_PLUS); + DEFAULT(MAX_TQPCT_MINUS); + DEFAULT(TORQUE_MAX); + DEFAULT(W_MAX); + DEFAULT(BUS_VOLTAGE); + DEFAULT(F_SW); + DEFAULT(K_LOOP_D); + DEFAULT(KI_BASE_D); + DEFAULT(K_LOOP_Q); + DEFAULT(KI_BASE_Q); + DEFAULT(F_SLOW_LOOP); + DEFAULT(INTEGRAL_MAX); + DEFAULT(W_FILTER_STRENGTH); + DEFAULT(DQ_FILTER_STRENGTH); + DEFAULT(THROTTLE_FILTER_STRENGTH); + DEFAULT(KP_D); + DEFAULT(KI_D); + DEFAULT(KP_Q); + DEFAULT(KI_Q); + DEFAULT(SLOW_LOOP_COUNTER); + DEFAULT(POLE_PAIRS); + DEFAULT(POS_OFFSET); + DEFAULT(RESOLVER_LOBES); + DEFAULT(CPR); + DEFAULT(Ld); + DEFAULT(Lq); + DEFAULT(FLUX_LINKAGE); + DEFAULT(Rs); + DEFAULT(KT); + DEFAULT(W_SAFE); + DEFAULT(W_CRAZY); + DEFAULT(TH_LIMIT_LOW); + DEFAULT(TH_LIMIT_HIGH); + DEFAULT(TH_LIMIT_CRAZY); + DEFAULT(ROWS); + DEFAULT(COLUMNS); + DEFAULT(W_STEP); + + pref.open(); + pref.flush(); + pref.close(); + + int offs; + for (offs = 0; offs < 64; offs++) { + __float_reg[offs] = 0.0f; + __int_reg[offs] = 0; + } + */ + + pref.load(); + + DPRINT(TORQUE_MODE); + FPRINT(MAX_TQPCT_PLUS); + FPRINT(MAX_TQPCT_MINUS); + FPRINT(TORQUE_MAX); + FPRINT(W_MAX); + FPRINT(BUS_VOLTAGE); + FPRINT(F_SW); + FPRINT(K_LOOP_D); + FPRINT(KI_BASE_D); + FPRINT(K_LOOP_Q); + FPRINT(KI_BASE_Q); + FPRINT(F_SLOW_LOOP); + FPRINT(INTEGRAL_MAX); + FPRINT(W_FILTER_STRENGTH); + FPRINT(DQ_FILTER_STRENGTH); + FPRINT(THROTTLE_FILTER_STRENGTH); + FPRINT(KP_D); + FPRINT(KI_D); + FPRINT(KP_Q); + FPRINT(KI_Q); + FPRINT(SLOW_LOOP_COUNTER); + FPRINT(POLE_PAIRS); + FPRINT(POS_OFFSET); + FPRINT(RESOLVER_LOBES); + DPRINT(CPR); + FPRINT(Ld); + FPRINT(Lq); + FPRINT(FLUX_LINKAGE); + FPRINT(Rs); + FPRINT(KT); + FPRINT(W_SAFE); + FPRINT(W_CRAZY); + DPRINT(TH_LIMIT_LOW); + DPRINT(TH_LIMIT_HIGH); + DPRINT(TH_LIMIT_CRAZY); + DPRINT(ROWS); + DPRINT(COLUMNS); + FPRINT(W_STEP); + + for(;;) { + } +}