Skip to content

Commit 8a243e2

Browse files
author
TopGun
committed
Fix angle limit error
1 parent be08b9a commit 8a243e2

7 files changed

+27
-8101
lines changed

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
# Swift Pro Firmware V4.7.0 (Base on [Grbl v0.9j](https://github.com/grbl/grbl) )
1+
# Swift Pro Firmware V4.8.0 (Base on [Grbl v0.9j](https://github.com/grbl/grbl) )
22

33
----------
4-
## Update Summary for v4.7.0
4+
## Update Summary for v4.8.0
55

6-
* Add M2211 cmd to read external EEPROM
7-
* Add M2212 cmd to write external EEPROM
8-
* Add P2244 cmd to get the communication status of AS5600
9-
* Fix read bug of work mode
6+
* Fix angle limit error
107

118
## Caution
129
#### The current firmware is not perfect and will be updated periodically

doc/uArm Swift Pro Protocol V4.0.5_cn .pdf

100644100755
File mode changed.

doc/uArm Swift Pro Protocol V4.0.5_en .pdf

100644100755
File mode changed.

hex/uArm3Plus_V4.5.0_release_20190924.hex

Lines changed: 0 additions & 3953 deletions
This file was deleted.

hex/uArmPro_V4.7.0_release_20200710.hex

Lines changed: 0 additions & 4128 deletions
This file was deleted.

src/uarm_coord_convert.c

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@
5454
#define micro_steps (32.0)
5555
#define steps_per_angle (micro_steps/1.8*gearbox_ratio)
5656
#define ARMA_MAX_ANGLE (135.6)
57-
#define ARMA_MIN_ANGLE (0)
57+
#define ARMA_MIN_ANGLE (-4.0)
5858
#define ARMB_MAX_ANGLE (119.9)
59-
#define ARMB_MIN_ANGLE (0)
59+
#define ARMB_MIN_ANGLE (-4.0)
6060
#define BASE_MAX_ANGLE (90)
6161
#define BASE_MIN_ANGLE (-90)
6262
#define ARMA_ARMB_MAX_ANGLE (151)
@@ -124,10 +124,10 @@ void angle_to_coord(float anglea, float angleb, float anglec, float *x, float *y
124124
void coord_to_angle(float x, float y, float z, float *anglea, float *angleb, float *anglec){
125125

126126

127-
/* DB_PRINT_STR("coord xyz:");
128-
DB_PRINT_FLOAT(x);DB_PRINT_STR(" ");
129-
DB_PRINT_FLOAT(y);DB_PRINT_STR(" ");
130-
DB_PRINT_FLOAT(z);DB_PRINT_STR("\r\n"); */
127+
// DB_PRINT_STR("coord xyz:");
128+
// DB_PRINT_FLOAT(x);DB_PRINT_STR(" ");
129+
// DB_PRINT_FLOAT(y);DB_PRINT_STR(" ");
130+
// DB_PRINT_FLOAT(z);DB_PRINT_STR("\r\n");
131131

132132

133133

@@ -140,13 +140,23 @@ void coord_to_angle(float x, float y, float z, float *anglea, float *angleb, flo
140140

141141

142142
*anglea = acos((_stretch * xxx - _height * sqrt(4.0 * ARM_A2 * xx - xxx * xxx)) / (xx * 2.0 * ARM_A)) * RAD_TO_DEG;
143-
144143
// get angle B
145144
xxx = ARM_B2 -ARM_A2 + xx;
146145
*angleb = acos((_stretch * xxx + _height * sqrt(4.0 * ARM_B2 * xx -xxx * xxx)) / (xx * 2.0 * ARM_B)) * RAD_TO_DEG;
147146
if( _height > (ARM_A *sin(*anglea/RAD_TO_DEG)) ){
148147
*angleb = -*angleb;
149148
}
149+
150+
// DB_PRINT_FLOAT(fabs(z));DB_PRINT_STR(" ");
151+
// DB_PRINT_FLOAT(ARM_B *sin(*angleb/RAD_TO_DEG));DB_PRINT_STR(" ");
152+
// DB_PRINT_FLOAT(z);DB_PRINT_STR("\r\n");
153+
154+
155+
if( fabs(_height)>(ARM_B *sin(*angleb/RAD_TO_DEG)) && _height<0.0 ){
156+
*anglea = -*anglea;
157+
}
158+
159+
150160

151161
// get the base rotation angle
152162

@@ -163,10 +173,10 @@ void coord_to_angle(float x, float y, float z, float *anglea, float *angleb, flo
163173
}
164174

165175

166-
/* DB_PRINT_STR("coord abc:");
167-
DB_PRINT_FLOAT(*anglea);DB_PRINT_STR(" ");
168-
DB_PRINT_FLOAT(*angleb);DB_PRINT_STR(" ");
169-
DB_PRINT_FLOAT(*anglec);DB_PRINT_STR("\r\n");*/
176+
// DB_PRINT_STR("coord abc:");
177+
// DB_PRINT_FLOAT(*anglea);DB_PRINT_STR(" ");
178+
// DB_PRINT_FLOAT(*angleb);DB_PRINT_STR(" ");
179+
// DB_PRINT_FLOAT(*anglec);DB_PRINT_STR("\r\n");
170180
}
171181

172182
void get_current_step(float anglea, float angleb, float anglec, float *x_step, float *y_step, float *z_step){

src/uarm_swift.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66

77

88
#if defined(UARM_MINI)
9-
#define DEVICE_NAME "SwiftProMini"
9+
#define DEVICE_NAME "uArmMini"
1010
#elif defined(UARM_2500)
1111
#define DEVICE_NAME "uArm3Plus"
1212
#else
1313
#define DEVICE_NAME "SwiftPro"
1414
#endif
1515

1616
#define HARDWARE_VERSION hardware_version
17-
#define SOFTWARE_VERSION "V4.7.0"
18-
#define API_VERSION "V4.0.4"
17+
#define SOFTWARE_VERSION "V4.8.0"
18+
#define API_VERSION "V4.0.5"
1919
#define BLE_UUID bt_mac_addr
2020

2121

0 commit comments

Comments
 (0)