thunderbug1 / Spherebot-Host-GUI

Qt based GUI to control the spherebot
54 stars 60 forks source link

overflow and bad communication, i suppose... #22

Closed marcogarzotti closed 8 years ago

marcogarzotti commented 9 years ago

Hi thunderbug, i'm facing some problems, i don't know what's wrong. I've downloaded everything, i've uploaded the arduino code with some warnings (see below) but no errors. I've modified the config.h (i will copypaste it below) and the servo is ok but the stepper don't work. I don't think that's a motor/driver problem, they used to work last time i checked. I can connect the spherebot control 2.0 to the arduino, i've tried to send the example gcode inkscape-unicorn.gcode that i've found but i see a very slow communication in the two boxes in the control software, transcieved data and received data. Just to give some numbers, a new line appears once every 3-5 seconds, only for the first 5-6 lines and no more lines after that, and an "Overflow Error" appears once on the received data box. If i use the serial terminal in the arduino ide i can move the servo and i have a fast response, i'm trying to move the steppers but i cant actually control them properly. Anyway, my opinion is that the problem is related to the control software but i don't know how to check that.

I'm using a windows 7 pc and an arduino 2009 wiht the 1.6.5 ide, this are the warning that i see when i upload the code and my config.h.

Thanks for the help!

----- warnings ---- In file included from SoftwareServo.cpp:1:0: SoftwareServo.h:4:22: warning: extra tokens at end of #include directive [enabled by default]

include "Arduino.h"</wprogram.h>

                  ^

In file included from SphereBot.ino:34:0: SoftwareServo.h:4:22: warning: extra tokens at end of #include directive [enabled by default]

include "Arduino.h"</wprogram.h>

                  ^

SphereBot.ino: In function 'void process_commands(char*, int)': SphereBot.ino:295:49: warning: NULL used in arithmetic [-Wpointer-arith]

In file included from SoftwareServo.cpp:1:0: SoftwareServo.h:4:22: warning: extra tokens at end of #include directive [enabled by default]

include "Arduino.h"</wprogram.h>

                  ^

In file included from SphereBot.ino:34:0: SoftwareServo.h:4:22: warning: extra tokens at end of #include directive [enabled by default]

include "Arduino.h"</wprogram.h>

                  ^

SphereBot.ino: In function 'void process_commands(char*, int)': SphereBot.ino:295:49: warning: NULL used in arithmetic [-Wpointer-arith]

----- config.h ---- //#define BAUDRATE 9600

define BAUDRATE 57600

//#define BAUDRATE 115200 //#define BAUDRATE 256000

/*

// Y-Axis //#define YAXIS_DIR_PIN 14 //#define YAXIS_STEP_PIN 15 //#define YAXIS_ENABLE_PIN 21

define YAXIS_DIR_PIN 5

define YAXIS_STEP_PIN 6

define YAXIS_ENABLE_PIN 2

define YAXIS_RST_PIN -1

define YAXIS_SLP_PIN -1

define YAXIS_MS1_PIN -1

define YAXIS_MS2_PIN -1

define YAXIS_MS3_PIN -1

define YAXIS_ENDSTOP_PIN -1 // -1 -> No Endstop

define YAXIS_VMS1 HIGH

define YAXIS_VMS2 HIGH

define YAXIS_VMS3 HIGH

define YAXIS_MIN_STEPCOUNT -50 // Travel limits

define YAXIS_MAX_STEPCOUNT 50

define YAXIS_STEPS_PER_FULL_ROTATION 200.0

define YAXIS_MICROSTEPPING 1

//X-Axis //#define XAXIS_DIR_PIN 10 //#define XAXIS_STEP_PIN 8 //#define XAXIS_ENABLE_PIN 2

define XAXIS_DIR_PIN 9

define XAXIS_STEP_PIN 10

define XAXIS_ENABLE_PIN 4

define XAXIS_RST_PIN -1

define XAXIS_SLP_PIN -1

define XAXIS_MS1_PIN -1

define XAXIS_MS2_PIN -1

define XAXIS_MS3_PIN -1

define XAXIS_ENDSTOP_PIN -1 // -1 -> No Endstop

define XAXIS_VMS1 HIGH

define XAXIS_VMS2 HIGH

define XAXIS_VMS3 HIGH

define XAXIS_MIN_STEPCOUNT -50 // Travel limits

define XAXIS_MAX_STEPCOUNT 50

define XAXIS_STEPS_PER_FULL_ROTATION 200.0

define XAXIS_MICROSTEPPING 1

define SERVO_PIN_1 13

/*

                           // The zoom factor can be also manipulated by the propretiary code M402

define X_SCALING_FACTOR 1.65/2 //this factor is for correction to meet the unicorn coordinates

define Y_SCALING_FACTOR 1

/*

//MS1, MS2 and MS3 are optional. You can simply make these settings by hardwiring the pins to high or low

/* MS1 | MS2 | MS3 Microstepping Resolution

  L    |  L    |  L     ->  Full Step
  H    |  L    |  L     ->  Half Step 
  L    |  H    |  L     ->  Quarter Step
  H    |  H    |  L     ->  Eighth Step
  H    |  H    |  H     ->  Sixteenth Step

*/

thunderbug1 commented 9 years ago

yes the problem lies probably on the control sofware side. There is a nasty bug I couldn´t find so far.

It is programmed to resend the command after some seconds if no "ok" was received as an answer. Probably this goes on until the receive buffer of the arduino overflows. I implemented this resending as sometimes the print just stoped.

marcogarzotti commented 8 years ago

Thank you for the reply. Any chance that this bug will be chased in the near future? I've tried to send commands over a serial monitor and the firmware seems to be ok, the unikorn plug in is working, but i can't figure out how to deal with the host-gui. It's a pity, it's the most updated and complete project i've seen...

i'm available as beta tester, if needed! :)

thunderbug1 commented 8 years ago

I think I have found the bug and updated the code.

ace-132 commented 8 years ago

Hi thunderbug1,

I'm facing the exact same problem as marcogarzotti. I downloaded everything today, so I still think there is a problem.

When I use the arduino serial monitor I can send commands with quick response. Also with putty I can send all gcode from a file and get fast response (I don't know if it runs the file till the bottom)

Could you have another look at the software, because I really like your work and I'd like to use it.