mirror of
https://github.com/eddyem/stm32samples.git
synced 2025-12-06 02:35:23 +03:00
Oh, fucking shit! It's seems like it's works!!!
This commit is contained in:
parent
bbcc4f18f4
commit
64aac0d9fa
@ -236,6 +236,7 @@ errcodes cu_mcuvdd(uint8_t par, int32_t *val){
|
||||
|
||||
errcodes cu_microsteps(uint8_t _U_ par, int32_t _U_ *val){
|
||||
uint8_t n; CHECKN(n, par);
|
||||
USB_sendstr("===> val="); printi(*val); newline();
|
||||
if(ISSETTER(par)){
|
||||
#if MICROSTEPSMAX > 512
|
||||
#error "Change the code anywhere!"
|
||||
@ -270,7 +271,7 @@ errcodes cu_minspeed(uint8_t _U_ par, int32_t _U_ *val){
|
||||
errcodes cu_motcurrent(uint8_t par, int32_t *val){
|
||||
uint8_t n; CHECKN(n, par);
|
||||
if(ISSETTER(par)){
|
||||
if(*val < 1 || *val > 32) return ERR_BADVAL;
|
||||
if(*val < 0 || *val > 31) return ERR_BADVAL;
|
||||
the_conf.motcurrent[n] = *val;
|
||||
motflags_t *f = the_conf.motflags;
|
||||
if(f->drvtype == DRVTYPE_UART){
|
||||
|
||||
@ -51,10 +51,6 @@ int main(void){
|
||||
adc_setup();
|
||||
pdnuart_setup();
|
||||
USBPU_ON();
|
||||
for(int i = 0; i < MOTORSNO; ++i){
|
||||
motflags_t flag = the_conf.motflags[i];
|
||||
if(flag.drvtype == DRVTYPE_UART) pdnuart_init(i);
|
||||
}
|
||||
uint32_t ctr = 0;
|
||||
CAN_message *can_mesg;
|
||||
while(1){
|
||||
|
||||
Binary file not shown.
@ -120,8 +120,8 @@ int pdnuart_readreg(uint8_t reg, uint32_t *data){
|
||||
}
|
||||
uint32_t o = 0;
|
||||
for(int i = 3; i < 7; ++i){
|
||||
o |= buf[i];
|
||||
o <<= 8;
|
||||
o |= buf[i];
|
||||
}
|
||||
*data = o;
|
||||
return TRUE;
|
||||
@ -165,7 +165,7 @@ int pdnuart_microsteps(uint8_t no, uint32_t val){
|
||||
TMC2209_chopconf_reg_t regval;
|
||||
if(!readregister(no, TMC2209Reg_CHOPCONF, ®val.value)) return FALSE;
|
||||
if(val == 256) regval.mres = 0;
|
||||
else regval.mres = MSB(val) + 1;
|
||||
else regval.mres = 8 - MSB(val);
|
||||
return writeregister(no, TMC2209Reg_CHOPCONF, regval.value);
|
||||
}
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
|
||||
#include "flash.h"
|
||||
#include "hardware.h"
|
||||
#include "pdnuart.h"
|
||||
#include "proto.h"
|
||||
#include "steppers.h"
|
||||
#include "strfunc.h"
|
||||
@ -82,6 +83,13 @@ void update_stepper(uint8_t i){
|
||||
accdecsteps[i] = (the_conf.maxspd[i] * the_conf.maxspd[i]) / the_conf.accel[i] / 2;
|
||||
ustepsshift[i] = MSB(the_conf.microsteps[i]);
|
||||
ESW_reaction[i] = the_conf.ESW_reaction[i];
|
||||
switch(the_conf.motflags[i].drvtype){
|
||||
case DRVTYPE_UART:
|
||||
pdnuart_init(i);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// run this function after each steppers parameters changing
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
#define BUILD_NUMBER "95"
|
||||
#define BUILD_DATE "2023-03-01"
|
||||
#define BUILD_NUMBER "104"
|
||||
#define BUILD_DATE "2023-03-02"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user