Skip to content

Commit 939dba6

Browse files
UFUF
authored andcommitted
compatible to hw1.1
1 parent 7e1d080 commit 939dba6

10 files changed

Lines changed: 96 additions & 20 deletions

File tree

lib/Marlin/Configuration.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
//#define SWIFT_TEST_MODE
132132

133133
#define HW_VER "3.3"
134-
#define SW_VER_BASE "3.1.18"
134+
#define SW_VER_BASE "3.1.20"
135135

136136
#ifdef SWIFT_TEST_MODE
137137
#define SW_VER SW_VER_BASE"_t"
@@ -786,7 +786,7 @@
786786

787787

788788
//#define DEFAULT_AXIS_STEPS_PER_UNIT {80,80,4000,500} // default steps per unit for Ultimaker
789-
#define DEFAULT_MAX_FEEDRATE {500, 500, 500, 25} // (mm/sec)
789+
#define DEFAULT_MAX_FEEDRATE {2000, 2000, 2000, 25} // (mm/sec)
790790
#define DEFAULT_MAX_ACCELERATION {2000,2000,2000,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot.
791791

792792
#define DEFAULT_ACCELERATION 25 // X, Y, Z and E acceleration in mm/s^2 for printing moves

lib/Marlin/Marlin_main.cpp

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,8 +1843,16 @@ unsigned char inverse_kinematics(const float in_cartesian[3], float angle[3]) {
18431843

18441844
float s = sqrt(x*x + y*y);
18451845

1846-
if (s - get_front_end_offset() < POLAR_MODULE_LENGTH_MIN)
1847-
return -1;
1846+
if (z > BASE_HEIGHT)
1847+
{
1848+
if (s - get_front_end_offset() < POLAR_MODULE_LENGTH_MIN_ABOVE_BASE)
1849+
return -1;
1850+
}
1851+
else
1852+
{
1853+
if (s - get_front_end_offset() < POLAR_MODULE_LENGTH_MIN)
1854+
return -1;
1855+
}
18481856

18491857
if (x < 0.01)
18501858
{
@@ -7506,13 +7514,25 @@ void process_next_command() {
75067514
#endif
75077515
needReply = 1;
75087516
result = gcode_G0_G1();
7517+
if (result != E_OK)
7518+
{
7519+
// need ok even position out of range to skip this point
7520+
result = E_OK;
7521+
sprintf(replyBuf, "E22 Position out of range\r\n");
7522+
}
75097523
break;
75107524
case 1:
75117525
#ifdef UARM_SWIFT
75127526
uarm_gcode_G1();
75137527
#endif
75147528
needReply = 1;
75157529
result = gcode_G0_G1();
7530+
if (result != E_OK)
7531+
{
7532+
// need ok even position out of range to skip this point
7533+
result = E_OK;
7534+
sprintf(replyBuf, "E22 Position out of range\r\n");
7535+
}
75167536
break;
75177537

75187538
// G2, G3
@@ -7651,6 +7671,12 @@ void process_next_command() {
76517671
relative_mode = true;
76527672
needReply = 1;
76537673
result = gcode_G0_G1();
7674+
if (result != E_OK)
7675+
{
7676+
// need ok even position out of range to skip this point
7677+
result = E_OK;
7678+
sprintf(replyBuf, "E22 Position out of range\r\n");
7679+
}
76547680
relative_mode = relative_mode_backup;
76557681
}
76567682
break;
@@ -7661,6 +7687,12 @@ void process_next_command() {
76617687
relative_mode = true;
76627688
needReply = 1;
76637689
result = gcode_get_destination_polor();
7690+
if (result != E_OK)
7691+
{
7692+
// need ok even position out of range to skip this point
7693+
result = E_OK;
7694+
sprintf(replyBuf, "E22 Position out of range\r\n");
7695+
}
76647696
relative_mode = relative_mode_backup;
76657697
}
76667698
break;
@@ -8206,6 +8238,9 @@ void process_next_command() {
82068238

82078239
#ifdef UARM_SWIFT
82088240
//
8241+
case 2000:
8242+
uarm_gcode_M2000();
8243+
break;
82098244

82108245
case 2019:
82118246
disable_all_steppers();

lib/Marlin/uArmAPI.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ UserMode_t get_user_mode()
461461
void set_front_end_offset(float offset)
462462
{
463463
front_end_offset = offset;
464+
save_front_offset(offset);
464465
}
465466

466467
/*!
@@ -477,6 +478,7 @@ float get_front_end_offset()
477478
void set_height_offset(float offset)
478479
{
479480
height_offset = offset;
481+
save_height_offset(offset);
480482
}
481483

482484
/*!

lib/Marlin/uArmAPI.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#define DEFAULT_3DPRINT_FRONT 56.5
3333

3434
#define DEFAULT_PEN_HEIGHT 74.43
35-
#define DEFAULT_PEN_FRONT 92.8
35+
#define DEFAULT_PEN_FRONT 69.5 //92.8
3636

3737

3838
typedef enum {

lib/Marlin/uArmParams.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@
114114
#define LOWER_UPPER_MAX_ANGLE 151
115115
#define LOWER_UPPER_MIN_ANGLE 10
116116

117-
#define POLAR_MODULE_LENGTH_MIN 72
117+
#define BASE_HEIGHT 71
118+
#define POLAR_MODULE_LENGTH_MIN_ABOVE_BASE 48
119+
#define POLAR_MODULE_LENGTH_MIN 72
118120

119121

120122
#define BT_NAME_MAX_LEN 11
@@ -124,5 +126,8 @@
124126
#define REPORT_TYPE_POS 3
125127
#define REPORT_TYPE_GROVE 10
126128

129+
#define SERVO_HW_FIX_VER 2
130+
#define PUMP_HW_FIX_VER 1
131+
127132

128133
#endif // _UARMPARAMS_H_

lib/Marlin/uArmPump.cpp

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99

1010
#include "uArmPump.h"
1111

12+
1213
#define VALVE_ON_TIMES_MAX 10
1314

1415
pump_state_t pump_state = PUMP_STATE_OFF;
1516

17+
extern unsigned char getHWSubversion();
1618

1719
pump_state_t pump_get_state()
1820
{
@@ -45,14 +47,28 @@ void pump_run()
4547
case PUMP_STATE_VALVE_ON:
4648
valve_on_times++;
4749
digitalWrite(VALVE_EN, HIGH);
48-
if (valve_on_times >= VALVE_ON_TIMES_MAX)
50+
51+
if (getHWSubversion() >= PUMP_HW_FIX_VER)
4952
{
50-
valve_on_times = 0;
51-
pump_state = PUMP_STATE_OFF;
53+
if (valve_on_times >= VALVE_ON_TIMES_MAX)
54+
{
55+
valve_on_times = 0;
56+
digitalWrite(VALVE_EN, LOW);
57+
pump_state = PUMP_STATE_OFF;
58+
}
5259
}
5360
else
54-
{
55-
pump_state = PUMP_STATE_VALVE_OFF;
61+
{
62+
63+
if (valve_on_times >= VALVE_ON_TIMES_MAX)
64+
{
65+
valve_on_times = 0;
66+
pump_state = PUMP_STATE_OFF;
67+
}
68+
else
69+
{
70+
pump_state = PUMP_STATE_VALVE_OFF;
71+
}
5672
}
5773
break;
5874

lib/Marlin/uArmService.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ void uArmService::handleButtonEvent(BUTTON_ID button, unsigned char event)
461461

462462

463463
disable_all_steppers();
464-
if (getHWSubversion() > 0)
464+
if (getHWSubversion() >= SERVO_HW_FIX_VER)
465465
{
466466
servo[0].detach();
467467
}
@@ -595,7 +595,7 @@ void uArmService::recorderTick()
595595

596596
//controller.attachAllServo();
597597
enable_all_steppers();
598-
if (getHWSubversion() > 0)
598+
if (getHWSubversion() >= SERVO_HW_FIX_VER)
599599
{
600600
servo[0].attach(SERVO0_PIN);
601601
}
@@ -1232,7 +1232,7 @@ bool uArmService::play()
12321232

12331233
play_data_record.getCurData(curData);
12341234

1235-
if (getHWSubversion() > 0)
1235+
if (getHWSubversion() >= SERVO_HW_FIX_VER)
12361236
{
12371237
servo[0].write(curData.e);
12381238
}
@@ -1454,7 +1454,7 @@ bool uArmService::play()
14541454

14551455
if (angledata[0] != 0xffff)
14561456
{
1457-
if (getHWSubversion() > 0)
1457+
if (getHWSubversion() >= SERVO_HW_FIX_VER)
14581458
{
14591459
servo[0].write((double)realdata[3]);
14601460
}

lib/Marlin/uArmSwift.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ void swift_init()
113113
enable_e0();
114114
#else
115115
enable_all_steppers();
116-
if (getHWSubversion() > 0)
116+
if (getHWSubversion() >= SERVO_HW_FIX_VER)
117117
{
118118
servo[0].attach(SERVO0_PIN);
119119
}
@@ -402,7 +402,7 @@ void rotate_frontend_motor()
402402
}
403403

404404

405-
if (getHWSubversion() > 0)
405+
if (getHWSubversion() >= SERVO_HW_FIX_VER)
406406
{
407407
servo[0].write((int)angle);
408408
}
@@ -413,7 +413,17 @@ void rotate_frontend_motor()
413413

414414
}
415415

416-
416+
417+
void uarm_gcode_M2000()
418+
{
419+
clear_command_queue();
420+
quickstop_stepper();
421+
print_job_timer.stop();
422+
thermalManager.autotempShutdown();
423+
wait_for_heatup = false;
424+
update_current_pos();
425+
}
426+
417427

418428
void uarm_gcode_M2120()
419429
{
@@ -469,7 +479,7 @@ void uarm_gcode_M2201()
469479
break;
470480

471481
case 3:
472-
if (getHWSubversion() > 0)
482+
if (getHWSubversion() >= SERVO_HW_FIX_VER)
473483
{
474484
servo[0].attach(SERVO0_PIN);
475485
}
@@ -527,7 +537,7 @@ uint8_t uarm_gcode_M2203(char reply[])
527537
break;
528538

529539
case 3:
530-
if (getHWSubversion() > 0)
540+
if (getHWSubversion() >= SERVO_HW_FIX_VER)
531541
{
532542
attached = servo[0].attached();
533543
}

lib/Marlin/uArmSwift.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ void uarm_gcode_G0();
5252

5353
void uarm_gcode_G1();
5454

55+
void uarm_gcode_M2000();
56+
5557
void uarm_gcode_M2120();
5658
uint8_t uarm_gcode_M2200(char reply[]);
5759

update.log

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
v3.1.20 20170829
2+
compatible to hw1.1
3+
4+
v3.1.19 20170810
5+
save front and height offset to E2PROM when set
6+
17
v3.1.18 20170725
28
Return E22 when position unreachable
39

0 commit comments

Comments
 (0)