mirror of
https://github.com/eddyem/stm32samples.git
synced 2025-12-06 18:55:13 +03:00
start fixing of this shit
This commit is contained in:
parent
eaf137b5b6
commit
018f0d4b33
@ -132,18 +132,18 @@ uint16_t getADCval(int nch){
|
|||||||
return p[4];
|
return p[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
// get voltage @input nch (V)
|
// get voltage @input nch (V) *1000V
|
||||||
float getADCvoltage(int nch){
|
int32_t getADCvoltage(int nch){
|
||||||
float v = getADCval(nch) * 3.3;
|
float v = getADCval(nch) * 3.3;
|
||||||
v /= 4096.f; // 12bit ADC
|
v /= 4.096f; // 12bit ADC
|
||||||
#ifdef EBUG
|
#ifdef EBUG
|
||||||
DBG("v="); printf(v); newline();
|
DBG("v="); printf(v); newline();
|
||||||
#endif
|
#endif
|
||||||
return v;
|
return (uint32_t) v;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return MCU temperature (degrees of celsius)
|
// return MCU temperature (*1000 degrees of celsius)
|
||||||
float getMCUtemp(){
|
int32_t getMCUtemp(){
|
||||||
// make correction on Vdd value
|
// make correction on Vdd value
|
||||||
int32_t ADval = getADCval(ADC_TS);
|
int32_t ADval = getADCval(ADC_TS);
|
||||||
float temperature = (float) *TEMP30_CAL_ADDR - ADval;
|
float temperature = (float) *TEMP30_CAL_ADDR - ADval;
|
||||||
@ -153,15 +153,15 @@ float getMCUtemp(){
|
|||||||
#ifdef EBUG
|
#ifdef EBUG
|
||||||
DBG("t="); printf(temperature); newline();
|
DBG("t="); printf(temperature); newline();
|
||||||
#endif
|
#endif
|
||||||
return(temperature);
|
return (uint32_t) (temperature*1000.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// return ADC Vref (V)
|
// return ADC Vref (V) *1000V
|
||||||
float getVdd(){
|
int32_t getVdd(){
|
||||||
float vdd = ((float) *VREFINT_CAL_ADDR) * 3.3f; // 3.3V
|
float vdd = ((float) *VREFINT_CAL_ADDR) * 3.3f; // 3.3V
|
||||||
vdd /= getADCval(ADC_VREF);
|
vdd /= getADCval(ADC_VREF);
|
||||||
#ifdef EBUG
|
#ifdef EBUG
|
||||||
DBG("vdd="); printf(vdd); newline();
|
DBG("vdd="); printf(vdd); newline();
|
||||||
#endif
|
#endif
|
||||||
return vdd;
|
return (uint32_t) (vdd * 1000.f);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,7 @@
|
|||||||
#define ADC2START (9*NUMBER_OF_ADC1_CHANNELS)
|
#define ADC2START (9*NUMBER_OF_ADC1_CHANNELS)
|
||||||
|
|
||||||
void adc_setup();
|
void adc_setup();
|
||||||
float getMCUtemp();
|
int32_t getMCUtemp();
|
||||||
float getVdd();
|
int32_t getVdd();
|
||||||
uint16_t getADCval(int nch);
|
uint16_t getADCval(int nch);
|
||||||
float getADCvoltage(int nch);
|
int32_t getADCvoltage(int nch);
|
||||||
|
|||||||
@ -53,22 +53,26 @@ errcodes cu_abspos(uint8_t _U_ par, int32_t _U_ *val){
|
|||||||
|
|
||||||
errcodes cu_accel(uint8_t _U_ par, int32_t _U_ *val){
|
errcodes cu_accel(uint8_t _U_ par, int32_t _U_ *val){
|
||||||
uint8_t n; CHECKN(n, par);
|
uint8_t n; CHECKN(n, par);
|
||||||
|
errcodes ret = ERR_OK;
|
||||||
if(ISSETTER(par)){
|
if(ISSETTER(par)){
|
||||||
if(*val/the_conf.microsteps[n] > ACCELMAXSTEPS || *val < 1) return ERR_BADVAL;
|
if(*val/the_conf.microsteps[n] > ACCELMAXSTEPS || *val < 1) return ERR_BADVAL;
|
||||||
|
uint16_t acc = the_conf.accel[n];
|
||||||
the_conf.accel[n] = *val;
|
the_conf.accel[n] = *val;
|
||||||
update_stepper(n);
|
if(!update_stepper(n)){
|
||||||
|
the_conf.accel[n] = acc;
|
||||||
|
ret = ERR_CANTRUN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*val = the_conf.accel[n];
|
*val = the_conf.accel[n];
|
||||||
return ERR_OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const uint8_t extADCchnl[NUMBER_OF_EXT_ADC_CHANNELS] = {ADC_AIN0, ADC_AIN1, ADC_AIN2, ADC_AIN3};
|
static const uint8_t extADCchnl[NUMBER_OF_EXT_ADC_CHANNELS] = {ADC_AIN0, ADC_AIN1, ADC_AIN2, ADC_AIN3};
|
||||||
// V*100
|
// V*1000
|
||||||
errcodes cu_adc(uint8_t par, int32_t *val){
|
errcodes cu_adc(uint8_t par, int32_t *val){
|
||||||
uint8_t n = PARBASE(par);
|
uint8_t n = PARBASE(par);
|
||||||
if(n > NUMBER_OF_EXT_ADC_CHANNELS - 1) return ERR_BADPAR;
|
if(n > NUMBER_OF_EXT_ADC_CHANNELS - 1) return ERR_BADPAR;
|
||||||
float v = getADCvoltage(extADCchnl[n])*100.f;
|
*val = getADCvoltage(extADCchnl[n]);
|
||||||
*val = (int32_t)v;
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,13 +125,18 @@ errcodes cu_esw(uint8_t par, int32_t *val){
|
|||||||
|
|
||||||
errcodes cu_eswreact(uint8_t _U_ par, int32_t _U_ *val){
|
errcodes cu_eswreact(uint8_t _U_ par, int32_t _U_ *val){
|
||||||
uint8_t n; CHECKN(n, par);
|
uint8_t n; CHECKN(n, par);
|
||||||
|
errcodes ret = ERR_OK;
|
||||||
if(ISSETTER(par)){
|
if(ISSETTER(par)){
|
||||||
if(*val < 0 || *val > ESW_AMOUNT-1) return ERR_BADVAL;
|
if(*val < 0 || *val > ESW_AMOUNT-1) return ERR_BADVAL;
|
||||||
|
uint8_t react = the_conf.ESW_reaction[n];
|
||||||
the_conf.ESW_reaction[n] = *val;
|
the_conf.ESW_reaction[n] = *val;
|
||||||
update_stepper(n);
|
if(!update_stepper(n)){
|
||||||
|
the_conf.ESW_reaction[n] = react;
|
||||||
|
ret = ERR_CANTRUN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*val = geteswreact(n);
|
*val = geteswreact(n);
|
||||||
return ERR_OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
errcodes cu_goto(uint8_t _U_ par, int32_t _U_ *val){
|
errcodes cu_goto(uint8_t _U_ par, int32_t _U_ *val){
|
||||||
@ -201,13 +210,18 @@ static uint16_t getSPD(uint8_t n, int32_t speed){
|
|||||||
|
|
||||||
errcodes cu_maxspeed(uint8_t _U_ par, int32_t _U_ *val){
|
errcodes cu_maxspeed(uint8_t _U_ par, int32_t _U_ *val){
|
||||||
uint8_t n; CHECKN(n, par);
|
uint8_t n; CHECKN(n, par);
|
||||||
|
errcodes ret = ERR_OK;
|
||||||
if(ISSETTER(par)){
|
if(ISSETTER(par)){
|
||||||
if(*val <= the_conf.minspd[n]) return ERR_BADVAL;
|
if(*val <= the_conf.minspd[n]) return ERR_BADVAL;
|
||||||
|
uint16_t maxspd = the_conf.maxspd[n];
|
||||||
the_conf.maxspd[n] = getSPD(n, *val);
|
the_conf.maxspd[n] = getSPD(n, *val);
|
||||||
update_stepper(n);
|
if(!update_stepper(n)){
|
||||||
|
the_conf.maxspd[n] = maxspd;
|
||||||
|
ret = ERR_CANTRUN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*val = the_conf.maxspd[n];
|
*val = the_conf.maxspd[n];
|
||||||
return ERR_OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
errcodes cu_maxsteps(uint8_t _U_ par, int32_t _U_ *val){
|
errcodes cu_maxsteps(uint8_t _U_ par, int32_t _U_ *val){
|
||||||
@ -222,15 +236,14 @@ errcodes cu_maxsteps(uint8_t _U_ par, int32_t _U_ *val){
|
|||||||
|
|
||||||
errcodes cu_mcut(uint8_t par, int32_t *val){
|
errcodes cu_mcut(uint8_t par, int32_t *val){
|
||||||
NOPARCHK(par);
|
NOPARCHK(par);
|
||||||
float f = getMCUtemp();
|
getMCUtemp();
|
||||||
*val = (uint32_t)(f*10.f);
|
*val = getMCUtemp();
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
errcodes cu_mcuvdd(uint8_t par, int32_t *val){
|
errcodes cu_mcuvdd(uint8_t par, int32_t *val){
|
||||||
NOPARCHK(par);
|
NOPARCHK(par);
|
||||||
float f = getVdd();
|
*val = getVdd();
|
||||||
*val = (uint32_t)(f*10.f);
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +254,7 @@ errcodes cu_microsteps(uint8_t _U_ par, int32_t _U_ *val){
|
|||||||
#if MICROSTEPSMAX > 512
|
#if MICROSTEPSMAX > 512
|
||||||
#error "Change the code anywhere!"
|
#error "Change the code anywhere!"
|
||||||
#endif
|
#endif
|
||||||
uint16_t m = (uint16_t)*val;
|
uint16_t m = (uint16_t)*val, old = the_conf.microsteps[n];
|
||||||
if(m < 1 || m > MICROSTEPSMAX) return ERR_BADVAL;
|
if(m < 1 || m > MICROSTEPSMAX) return ERR_BADVAL;
|
||||||
// find most significant bit
|
// find most significant bit
|
||||||
if(m != 1<<MSB(m)) return ERR_BADVAL;
|
if(m != 1<<MSB(m)) return ERR_BADVAL;
|
||||||
@ -251,7 +264,10 @@ errcodes cu_microsteps(uint8_t _U_ par, int32_t _U_ *val){
|
|||||||
if(f->drvtype == DRVTYPE_UART){
|
if(f->drvtype == DRVTYPE_UART){
|
||||||
if(!pdnuart_microsteps(n, m)) return ERR_CANTRUN;
|
if(!pdnuart_microsteps(n, m)) return ERR_CANTRUN;
|
||||||
}
|
}
|
||||||
update_stepper(n);
|
if(!update_stepper(n)){
|
||||||
|
the_conf.microsteps[n] = old;
|
||||||
|
return ERR_CANTRUN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*val = the_conf.microsteps[n];
|
*val = the_conf.microsteps[n];
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
@ -259,13 +275,18 @@ errcodes cu_microsteps(uint8_t _U_ par, int32_t _U_ *val){
|
|||||||
|
|
||||||
errcodes cu_minspeed(uint8_t _U_ par, int32_t _U_ *val){
|
errcodes cu_minspeed(uint8_t _U_ par, int32_t _U_ *val){
|
||||||
uint8_t n; CHECKN(n, par);
|
uint8_t n; CHECKN(n, par);
|
||||||
|
errcodes ret = ERR_OK;
|
||||||
if(ISSETTER(par)){
|
if(ISSETTER(par)){
|
||||||
if(*val >= the_conf.maxspd[n] || *val < 0) return ERR_BADVAL;
|
if(*val >= the_conf.maxspd[n] || *val < 0) return ERR_BADVAL;
|
||||||
|
uint16_t minspd = the_conf.minspd[n];
|
||||||
the_conf.minspd[n] = getSPD(n, *val);
|
the_conf.minspd[n] = getSPD(n, *val);
|
||||||
update_stepper(n);
|
if(!update_stepper(n)){
|
||||||
|
the_conf.minspd[n] = minspd;
|
||||||
|
ret = ERR_CANTRUN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*val = the_conf.minspd[n];
|
*val = the_conf.minspd[n];
|
||||||
return ERR_OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
errcodes cu_motcurrent(uint8_t par, int32_t *val){
|
errcodes cu_motcurrent(uint8_t par, int32_t *val){
|
||||||
@ -284,12 +305,17 @@ errcodes cu_motcurrent(uint8_t par, int32_t *val){
|
|||||||
|
|
||||||
errcodes cu_motflags(uint8_t _U_ par, int32_t _U_ *val){
|
errcodes cu_motflags(uint8_t _U_ par, int32_t _U_ *val){
|
||||||
uint8_t n; CHECKN(n, par);
|
uint8_t n; CHECKN(n, par);
|
||||||
|
errcodes ret = ERR_OK;
|
||||||
if(ISSETTER(par)){
|
if(ISSETTER(par)){
|
||||||
|
motflags_t flags = the_conf.motflags[n];
|
||||||
the_conf.motflags[n] = *((motflags_t*)val);
|
the_conf.motflags[n] = *((motflags_t*)val);
|
||||||
update_stepper(n);
|
if(!update_stepper(n)){
|
||||||
|
the_conf.motflags[n] = flags;
|
||||||
|
ret = ERR_CANTRUN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*(motflags_t*)val = the_conf.motflags[n];
|
*(motflags_t*)val = the_conf.motflags[n];
|
||||||
return ERR_OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
errcodes cu_motno(uint8_t _U_ par, int32_t _U_ *val){
|
errcodes cu_motno(uint8_t _U_ par, int32_t _U_ *val){
|
||||||
@ -370,7 +396,7 @@ errcodes cu_stop(uint8_t _U_ par, int32_t _U_ *val){
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static errcodes cu_time(uint8_t par, int32_t *val){
|
errcodes cu_time(uint8_t par, int32_t *val){
|
||||||
NOPARCHK(par);
|
NOPARCHK(par);
|
||||||
*val = Tms;
|
*val = Tms;
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
@ -391,15 +417,13 @@ errcodes cu_usartstatus(uint8_t _U_ par, int32_t _U_ *val){
|
|||||||
// V*10
|
// V*10
|
||||||
errcodes cu_vdrive(uint8_t par, int32_t _U_ *val){
|
errcodes cu_vdrive(uint8_t par, int32_t _U_ *val){
|
||||||
NOPARCHK(par);
|
NOPARCHK(par);
|
||||||
float v = getADCvoltage(ADC_VDRIVE)*1000.f;
|
*val = getADCvoltage(ADC_VDRIVE);
|
||||||
*val = (int32_t)v;
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
errcodes cu_vfive(uint8_t par, int32_t *val){
|
errcodes cu_vfive(uint8_t par, int32_t *val){
|
||||||
NOPARCHK(par);
|
NOPARCHK(par);
|
||||||
float v = getADCvoltage(ADC_VFIVE)*200.f;
|
*val = getADCvoltage(ADC_VFIVE) * 2;
|
||||||
*val = (int32_t)v;
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -475,7 +499,7 @@ const char* cancmds[CCMD_AMOUNT] = {
|
|||||||
[CCMD_RELPOS] = "relpos",
|
[CCMD_RELPOS] = "relpos",
|
||||||
[CCMD_RELSLOW] = "relslow",
|
[CCMD_RELSLOW] = "relslow",
|
||||||
[CCMD_EMERGSTOP] = "emstop N",
|
[CCMD_EMERGSTOP] = "emstop N",
|
||||||
[CCMD_EMERGSTOPALL] = "emstop",
|
[CCMD_EMERGSTOPALL] = "emstop all",
|
||||||
[CCMD_STOP] = "stop",
|
[CCMD_STOP] = "stop",
|
||||||
[CCMD_REINITMOTORS] = "motreinit",
|
[CCMD_REINITMOTORS] = "motreinit",
|
||||||
[CCMD_MOTORSTATE] = "state",
|
[CCMD_MOTORSTATE] = "state",
|
||||||
|
|||||||
@ -140,6 +140,7 @@ errcodes cu_screen(uint8_t par, int32_t *val);
|
|||||||
errcodes cu_speedlimit(uint8_t par, int32_t *val);
|
errcodes cu_speedlimit(uint8_t par, int32_t *val);
|
||||||
errcodes cu_state(uint8_t par, int32_t *val);
|
errcodes cu_state(uint8_t par, int32_t *val);
|
||||||
errcodes cu_stop(uint8_t par, int32_t *val);
|
errcodes cu_stop(uint8_t par, int32_t *val);
|
||||||
|
errcodes cu_time(uint8_t par, int32_t *val);
|
||||||
errcodes cu_tmcbus(uint8_t par, int32_t *val);
|
errcodes cu_tmcbus(uint8_t par, int32_t *val);
|
||||||
errcodes cu_udata(uint8_t par, int32_t *val);
|
errcodes cu_udata(uint8_t par, int32_t *val);
|
||||||
errcodes cu_usartstatus(uint8_t par, int32_t *val);
|
errcodes cu_usartstatus(uint8_t par, int32_t *val);
|
||||||
|
|||||||
@ -175,9 +175,7 @@ static const char *fhdr =
|
|||||||
int i = 0;\n\
|
int i = 0;\n\
|
||||||
while(*str > '@' && i < CMD_MAXLEN){ cmd[i++] = *str++; }\n\
|
while(*str > '@' && i < CMD_MAXLEN){ cmd[i++] = *str++; }\n\
|
||||||
cmd[i] = 0;\n\
|
cmd[i] = 0;\n\
|
||||||
if(*str){\n\
|
while(*str && *str <= ' ') ++str;\n\
|
||||||
while(*str <= ' ') ++str;\n\
|
|
||||||
}\n\
|
|
||||||
char *args = (char*) str;\n\
|
char *args = (char*) str;\n\
|
||||||
uint32_t h = hashf(cmd);\n\
|
uint32_t h = hashf(cmd);\n\
|
||||||
switch(h){\n\n"
|
switch(h){\n\n"
|
||||||
|
|||||||
@ -8,6 +8,8 @@
|
|||||||
#define WAL __attribute__ ((weak, alias ("__f1")))
|
#define WAL __attribute__ ((weak, alias ("__f1")))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
char lastcmd[CMD_MAXLEN + 1];
|
||||||
|
|
||||||
static int __f1(uint32_t _U_ h, char _U_ *a){return 1;}
|
static int __f1(uint32_t _U_ h, char _U_ *a){return 1;}
|
||||||
|
|
||||||
int fn_abspos(uint32_t _U_ hash, char _U_ *args) WAL; // "abspos" (3056382221)
|
int fn_abspos(uint32_t _U_ hash, char _U_ *args) WAL; // "abspos" (3056382221)
|
||||||
@ -137,16 +139,13 @@ static uint32_t hashf(const char *str){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int parsecmd(const char *str){
|
int parsecmd(const char *str){
|
||||||
char cmd[CMD_MAXLEN + 1];
|
|
||||||
if(!str || !*str) return RET_CMDNOTFOUND;
|
if(!str || !*str) return RET_CMDNOTFOUND;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while(*str > '@' && i < CMD_MAXLEN){ cmd[i++] = *str++; }
|
while(*str > '@' && i < CMD_MAXLEN){ lastcmd[i++] = *str++; }
|
||||||
cmd[i] = 0;
|
lastcmd[i] = 0;
|
||||||
if(*str){
|
while(*str && *str <= ' ') ++str;
|
||||||
while(*str <= ' ') ++str;
|
|
||||||
}
|
|
||||||
char *args = (char*) str;
|
char *args = (char*) str;
|
||||||
uint32_t h = hashf(cmd);
|
uint32_t h = hashf(lastcmd);
|
||||||
switch(h){
|
switch(h){
|
||||||
|
|
||||||
case CMD_ABSPOS:
|
case CMD_ABSPOS:
|
||||||
|
|||||||
@ -13,6 +13,8 @@ enum{
|
|||||||
|
|
||||||
int parsecmd(const char *cmdwargs);
|
int parsecmd(const char *cmdwargs);
|
||||||
|
|
||||||
|
extern char lastcmd[];
|
||||||
|
|
||||||
#define CMD_ABSPOS (3056382221)
|
#define CMD_ABSPOS (3056382221)
|
||||||
#define CMD_ACCEL (1490521981)
|
#define CMD_ACCEL (1490521981)
|
||||||
#define CMD_ADC (2963026093)
|
#define CMD_ADC (2963026093)
|
||||||
|
|||||||
@ -42,9 +42,9 @@ int main(void){
|
|||||||
StartHSI();
|
StartHSI();
|
||||||
SysTick_Config((uint32_t)48000); // 1ms
|
SysTick_Config((uint32_t)48000); // 1ms
|
||||||
}
|
}
|
||||||
|
hw_setup(); // GPIO, ADC, timers, watchdog etc.
|
||||||
USBPU_OFF(); // make a reconnection
|
USBPU_OFF(); // make a reconnection
|
||||||
flashstorage_init();
|
flashstorage_init();
|
||||||
hw_setup(); // GPIO, ADC, timers, watchdog etc.
|
|
||||||
init_steppers();
|
init_steppers();
|
||||||
USB_setup();
|
USB_setup();
|
||||||
CAN_setup(the_conf.CANspeed);
|
CAN_setup(the_conf.CANspeed);
|
||||||
@ -60,7 +60,7 @@ int main(void){
|
|||||||
LED_blink();
|
LED_blink();
|
||||||
}
|
}
|
||||||
CAN_proc();
|
CAN_proc();
|
||||||
USB_proc();
|
USB_proc(); // TODO: remove deprecated trash code!
|
||||||
process_steppers();
|
process_steppers();
|
||||||
if(CAN_get_status() == CAN_FIFO_OVERRUN){
|
if(CAN_get_status() == CAN_FIFO_OVERRUN){
|
||||||
USB_sendstr("CAN bus fifo overrun occured!\n");
|
USB_sendstr("CAN bus fifo overrun occured!\n");
|
||||||
|
|||||||
Binary file not shown.
@ -1,14 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 8.0.2, 2023-01-18T20:42:42. -->
|
<!-- Written by QtCreator 13.0.2, 2024-08-15T16:49:30. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
<value type="QByteArray">{7bd84e39-ca37-46d3-be9d-99ebea85bc0d}</value>
|
<value type="QByteArray">{cf63021e-ef53-49b0-b03b-2f2570cdf3b6}</value>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
<value type="int">0</value>
|
<value type="qlonglong">0</value>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||||
@ -28,7 +28,7 @@
|
|||||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
|
<value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||||
<value type="QByteArray" key="EditorConfiguration.Codec">KOI8-R</value>
|
<value type="QByteArray" key="EditorConfiguration.Codec">KOI8-R</value>
|
||||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||||
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||||
@ -37,10 +37,11 @@
|
|||||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||||
|
<value type="int" key="EditorConfiguration.PreferAfterWhitespaceComments">0</value>
|
||||||
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
|
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
|
||||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">false</value>
|
||||||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">1</value>
|
||||||
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
||||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||||
@ -49,11 +50,12 @@
|
|||||||
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
|
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
|
||||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||||
<value type="bool" key="EditorConfiguration.cleanIndentation">false</value>
|
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||||
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
|
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
|
||||||
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
<value type="bool" key="EditorConfiguration.inEntireDocument">true</value>
|
||||||
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
|
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.tintMarginArea">true</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
@ -74,7 +76,8 @@
|
|||||||
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
|
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
|
||||||
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
|
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
|
||||||
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
|
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
|
||||||
<value type="int" key="ClangTools.ParallelJobs">2</value>
|
<value type="int" key="ClangTools.ParallelJobs">4</value>
|
||||||
|
<value type="bool" key="ClangTools.PreferConfigFile">true</value>
|
||||||
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
|
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
|
||||||
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
|
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
|
||||||
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
|
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
|
||||||
@ -88,12 +91,12 @@
|
|||||||
<value type="QString" key="DeviceType">Desktop</value>
|
<value type="QString" key="DeviceType">Desktop</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{65a14f9e-e008-4c1b-89df-4eaa4774b6e3}</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{91347f2c-5221-46a7-80b1-0a054ca02f79}</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Big/Data/00__Electronics/STM32/F303-nolib/blink</value>
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/eddy/Docs/SAO/ELECTRONICS/STM32/F3-srcs/Multistepper</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
|
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
|
||||||
@ -102,7 +105,7 @@
|
|||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Сборка</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Сборка</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
@ -115,7 +118,7 @@
|
|||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Очистка</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Очистка</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
@ -125,13 +128,13 @@
|
|||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Default</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">По умолчанию</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericBuildConfiguration</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericBuildConfiguration</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
|
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Развёртывание</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Развёртывание</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Развёртывание</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Развёртывание</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||||
@ -141,24 +144,31 @@
|
|||||||
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||||
|
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
||||||
|
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||||
|
<value type="int" key="Analyzer.Valgrind.Callgrind.CostFormat">0</value>
|
||||||
|
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||||
|
<value type="QList<int>" key="Analyzer.Valgrind.VisibleErrorKinds"></value>
|
||||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||||
|
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
|
||||||
|
<value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph dwarf,4096 -F 250</value>
|
||||||
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
|
||||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
|
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||||
<value type="int">1</value>
|
<value type="qlonglong">1</value>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||||
|
|||||||
@ -169,7 +169,7 @@ int pdnuart_microsteps(uint8_t no, uint32_t val){
|
|||||||
return writeregister(no, TMC2209Reg_CHOPCONF, regval.value);
|
return writeregister(no, TMC2209Reg_CHOPCONF, regval.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// init driver number `no`
|
// init driver number `no`, return FALSE if failed
|
||||||
int pdnuart_init(uint8_t no){
|
int pdnuart_init(uint8_t no){
|
||||||
TMC2209_gconf_reg_t gconf;
|
TMC2209_gconf_reg_t gconf;
|
||||||
if(!readregister(no, TMC2209Reg_GCONF, &gconf.value)) return FALSE;
|
if(!readregister(no, TMC2209Reg_GCONF, &gconf.value)) return FALSE;
|
||||||
|
|||||||
@ -309,11 +309,8 @@ int fn_cansend(uint32_t _U_ hash, char *args){
|
|||||||
int fn_canfloodt(uint32_t _U_ hash, char *args){
|
int fn_canfloodt(uint32_t _U_ hash, char *args){
|
||||||
uint32_t N;
|
uint32_t N;
|
||||||
const char *n = getnum(args, &N);
|
const char *n = getnum(args, &N);
|
||||||
if(args == n){
|
if(args != n) floodT = N;
|
||||||
USB_sendstr("floodT="); printu(floodT); USB_putbyte('\n');
|
USB_sendstr("canfloodT="); printu(floodT); USB_putbyte('\n');
|
||||||
return RET_GOOD;
|
|
||||||
}
|
|
||||||
floodT = N;
|
|
||||||
return RET_GOOD;
|
return RET_GOOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,14 +393,6 @@ int fn_reset(uint32_t _U_ hash, char _U_ *args){ // "reset" (1907803304)
|
|||||||
return RET_GOOD;
|
return RET_GOOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fn_time(uint32_t _U_ hash, char _U_ *args){ // "time" (19148340)
|
|
||||||
USB_sendstr("Time (ms): ");
|
|
||||||
printu(Tms);
|
|
||||||
USB_putbyte('\n');
|
|
||||||
return RET_GOOD;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static const char* motfl[MOTFLAGS_AMOUNT] = {
|
static const char* motfl[MOTFLAGS_AMOUNT] = {
|
||||||
"0: reverse - invert motor's rotation",
|
"0: reverse - invert motor's rotation",
|
||||||
"1: [reserved]",
|
"1: [reserved]",
|
||||||
@ -433,12 +422,12 @@ int fn_dumpmotflags(uint32_t _U_ hash, char _U_ *args){ // "dumpmotflags" (3615
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char* errtxt[ERR_AMOUNT] = {
|
static const char* errtxt[ERR_AMOUNT] = {
|
||||||
[ERR_OK] = "all OK",
|
[ERR_OK] = "OK",
|
||||||
[ERR_BADPAR] = "wrong parameter's value",
|
[ERR_BADPAR] = "BADPAR",
|
||||||
[ERR_BADVAL] = "wrong setter of parameter",
|
[ERR_BADVAL] = "BADVAL",
|
||||||
[ERR_WRONGLEN] = "bad message length",
|
[ERR_WRONGLEN] = "WRONGLEN",
|
||||||
[ERR_BADCMD] = "unknown command",
|
[ERR_BADCMD] = "BADCMD",
|
||||||
[ERR_CANTRUN] = "temporary can't run given command",
|
[ERR_CANTRUN] = "CANTRUN",
|
||||||
};
|
};
|
||||||
int fn_dumperr(uint32_t _U_ hash, char _U_ *args){ // "dumperr" (1223989764)
|
int fn_dumperr(uint32_t _U_ hash, char _U_ *args){ // "dumperr" (1223989764)
|
||||||
USND("Error codes:");
|
USND("Error codes:");
|
||||||
@ -490,9 +479,11 @@ static int canusb_function(uint32_t hash, char *args){
|
|||||||
uint32_t N;
|
uint32_t N;
|
||||||
int32_t val = 0;
|
int32_t val = 0;
|
||||||
uint8_t par = CANMESG_NOPAR;
|
uint8_t par = CANMESG_NOPAR;
|
||||||
float f;
|
DBG("CMD: hash=");
|
||||||
USB_sendstr("CMD: hash="); printu(hash); USB_sendstr(", args=");
|
#ifdef EBUG
|
||||||
|
printu(hash); USB_sendstr(", args=");
|
||||||
USND(args);
|
USND(args);
|
||||||
|
#endif
|
||||||
if(*args){
|
if(*args){
|
||||||
const char *n = getnum(args, &N);
|
const char *n = getnum(args, &N);
|
||||||
if(n != args){ // get parameter
|
if(n != args){ // get parameter
|
||||||
@ -511,29 +502,17 @@ static int canusb_function(uint32_t hash, char *args){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef EBUG
|
||||||
USB_sendstr("par="); printuhex(par);
|
USB_sendstr("par="); printuhex(par);
|
||||||
USB_sendstr(", val="); printi(val); newline();
|
USB_sendstr(", val="); printi(val); newline();
|
||||||
|
#endif
|
||||||
switch(hash){
|
switch(hash){
|
||||||
case CMD_ADC:
|
case CMD_ADC:
|
||||||
par = PARBASE(par);
|
e = cu_adc(par, &val);
|
||||||
if(par >= NUMBER_OF_ADC_CHANNELS){
|
|
||||||
USB_sendstr("Wrong channel number\n");
|
|
||||||
return RET_BAD;
|
|
||||||
}
|
|
||||||
USB_sendstr("ADC"); USB_putbyte('0'+par);
|
|
||||||
USB_putbyte('='); USB_sendstr(u2str(getADCval(par)));
|
|
||||||
f = getADCvoltage(par);
|
|
||||||
USB_sendstr("\nADCv");USB_putbyte('0'+par);
|
|
||||||
USB_putbyte('='); USB_sendstr(float2str(f, 2));
|
|
||||||
newline();
|
|
||||||
return RET_GOOD;
|
|
||||||
break;
|
break;
|
||||||
case CMD_BUTTON:
|
case CMD_BUTTON:
|
||||||
e = cu_button(par, &val);
|
e = cu_button(par, &val);
|
||||||
if(val == CANMESG_NOPAR){
|
if(val == CANMESG_NOPAR) break; // no button number
|
||||||
USB_sendstr("Wrong button number\n");
|
|
||||||
return RET_BAD;
|
|
||||||
}
|
|
||||||
const char *kstate = "none";
|
const char *kstate = "none";
|
||||||
switch(e){
|
switch(e){
|
||||||
case EVT_PRESS:
|
case EVT_PRESS:
|
||||||
@ -548,9 +527,9 @@ static int canusb_function(uint32_t hash, char *args){
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
USB_sendstr("KEY"); USB_putbyte('0'+PARBASE(par));
|
USB_sendstr("button"); USB_putbyte('0'+PARBASE(par));
|
||||||
USB_putbyte('='); USB_sendstr(kstate);
|
USB_putbyte('='); USB_sendstr(kstate);
|
||||||
USB_sendstr("\nKEYTIME="); USB_sendstr(u2str(val));
|
USB_sendstr("\nbuttontm="); USB_sendstr(u2str(val));
|
||||||
newline();
|
newline();
|
||||||
return RET_GOOD;
|
return RET_GOOD;
|
||||||
break;
|
break;
|
||||||
@ -597,18 +576,10 @@ static int canusb_function(uint32_t hash, char *args){
|
|||||||
e = cu_maxsteps(par, &val);
|
e = cu_maxsteps(par, &val);
|
||||||
break;
|
break;
|
||||||
case CMD_MCUT:
|
case CMD_MCUT:
|
||||||
f = getMCUtemp();
|
e = cu_mcut(par, &val);
|
||||||
USB_sendstr("T=");
|
|
||||||
USB_sendstr(float2str(f, 1));
|
|
||||||
newline();
|
|
||||||
return RET_GOOD;
|
|
||||||
break;
|
break;
|
||||||
case CMD_MCUVDD:
|
case CMD_MCUVDD:
|
||||||
f = getVdd();
|
e = cu_mcuvdd(par, &val);
|
||||||
USB_sendstr("VDD=");
|
|
||||||
USB_sendstr(float2str(f, 1));
|
|
||||||
newline();
|
|
||||||
return RET_GOOD;
|
|
||||||
break;
|
break;
|
||||||
case CMD_MICROSTEPS:
|
case CMD_MICROSTEPS:
|
||||||
e = cu_microsteps(par, &val);
|
e = cu_microsteps(par, &val);
|
||||||
@ -658,6 +629,9 @@ static int canusb_function(uint32_t hash, char *args){
|
|||||||
case CMD_STOP:
|
case CMD_STOP:
|
||||||
e = cu_stop(par, &val);
|
e = cu_stop(par, &val);
|
||||||
break;
|
break;
|
||||||
|
case CMD_TIME:
|
||||||
|
e = cu_time(par, &val);
|
||||||
|
break;
|
||||||
case CMD_TMCBUS:
|
case CMD_TMCBUS:
|
||||||
e = cu_tmcbus(par, &val);
|
e = cu_tmcbus(par, &val);
|
||||||
break;
|
break;
|
||||||
@ -683,7 +657,7 @@ static int canusb_function(uint32_t hash, char *args){
|
|||||||
if(ERR_OK != e){
|
if(ERR_OK != e){
|
||||||
USB_sendstr(errtxt[e]); newline();
|
USB_sendstr(errtxt[e]); newline();
|
||||||
}else{
|
}else{
|
||||||
USB_sendstr("OK par");
|
USB_sendstr(lastcmd);
|
||||||
if(PARBASE(par) != CANMESG_NOPAR) printu(PARBASE(par));
|
if(PARBASE(par) != CANMESG_NOPAR) printu(PARBASE(par));
|
||||||
USB_putbyte('='); printi(val);
|
USB_putbyte('='); printi(val);
|
||||||
newline();
|
newline();
|
||||||
@ -728,6 +702,7 @@ int fn_screen(uint32_t _U_ hash, char _U_ *args) AL; //* "screen" (2100809349)
|
|||||||
int fn_speedlimit(uint32_t _U_ hash, char _U_ *args) AL; //* "speedlimit" (1654184245)
|
int fn_speedlimit(uint32_t _U_ hash, char _U_ *args) AL; //* "speedlimit" (1654184245)
|
||||||
int fn_state(uint32_t _U_ hash, char _U_ *args) AL; //* "state" (2216628902)
|
int fn_state(uint32_t _U_ hash, char _U_ *args) AL; //* "state" (2216628902)
|
||||||
int fn_stop(uint32_t _U_ hash, char _U_ *args) AL; //* "stop" (17184971)
|
int fn_stop(uint32_t _U_ hash, char _U_ *args) AL; //* "stop" (17184971)
|
||||||
|
int fn_time(uint32_t _U_ hash, char _U_ *args) AL; // "time" (19148340)
|
||||||
int fn_tmcbus(uint32_t _U_ hash, char _U_ *args) AL; //* "tmcbus" (1906135955)
|
int fn_tmcbus(uint32_t _U_ hash, char _U_ *args) AL; //* "tmcbus" (1906135955)
|
||||||
int fn_udata(uint32_t _U_ hash, char _U_ *args) AL; //* "udata" (2736127636)
|
int fn_udata(uint32_t _U_ hash, char _U_ *args) AL; //* "udata" (2736127636)
|
||||||
int fn_usartstatus(uint32_t _U_ hash, char _U_ *args) AL; //* "usartstatus" (4007098968)
|
int fn_usartstatus(uint32_t _U_ hash, char _U_ *args) AL; //* "usartstatus" (4007098968)
|
||||||
|
|||||||
@ -78,18 +78,19 @@ TRUE_INLINE void recalcARR(int i){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update stepper's settings
|
// update stepper's settings
|
||||||
void update_stepper(uint8_t i){
|
int update_stepper(uint8_t i){
|
||||||
if(i >= MOTORSNO) return;
|
if(i >= MOTORSNO) return FALSE;
|
||||||
accdecsteps[i] = (the_conf.maxspd[i] * the_conf.maxspd[i]) / the_conf.accel[i] / 2;
|
accdecsteps[i] = (the_conf.maxspd[i] * the_conf.maxspd[i]) / the_conf.accel[i] / 2;
|
||||||
ustepsshift[i] = MSB(the_conf.microsteps[i]);
|
ustepsshift[i] = MSB(the_conf.microsteps[i]);
|
||||||
ESW_reaction[i] = the_conf.ESW_reaction[i];
|
ESW_reaction[i] = the_conf.ESW_reaction[i];
|
||||||
switch(the_conf.motflags[i].drvtype){
|
switch(the_conf.motflags[i].drvtype){
|
||||||
case DRVTYPE_UART:
|
case DRVTYPE_UART:
|
||||||
pdnuart_init(i);
|
return pdnuart_init(i);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// run this function after each steppers parameters changing
|
// run this function after each steppers parameters changing
|
||||||
|
|||||||
@ -53,7 +53,7 @@ enum{
|
|||||||
void addmicrostep(uint8_t i);
|
void addmicrostep(uint8_t i);
|
||||||
|
|
||||||
void init_steppers();
|
void init_steppers();
|
||||||
void update_stepper(uint8_t i);
|
int update_stepper(uint8_t i);
|
||||||
|
|
||||||
errcodes setmotpos(uint8_t i, int32_t position);
|
errcodes setmotpos(uint8_t i, int32_t position);
|
||||||
errcodes getpos(uint8_t i, int32_t *position);
|
errcodes getpos(uint8_t i, int32_t *position);
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
#define BUILD_NUMBER "107"
|
#define BUILD_NUMBER "114"
|
||||||
#define BUILD_DATE "2024-08-15"
|
#define BUILD_DATE "2024-08-15"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user