Forum

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1]
Author Topic: MEGA error "Loaded mmPerRev:nan"
soko
Newbie
Posts: 13
Permalink
Post MEGA error "Loaded mmPerRev:nan"
on: December 11, 2017, 17:32
Quote

[color=#][/color]Hello,

I tried install code of polargraph in a arduino Mega.....but not work fine.

The serial of arduino IDE 1.0.6 out is:

POLARGRAPH ON!
Hardware: 2
MC_MEGA
Loaded width:825
Loaded height:750
Loaded mmPerRev:nan
Loaded steps per rev:200
Loaded step multiplier:255
Loaded down pos:180
Loaded up pos:110
Recalc mmPerStep (nan), stepsPerMM (nan)
Recalc pageWidth in steps (-2147483648)
Recalc pageHeight in steps (-2147483648)
READY_100

This is my config:

-----------------------------------------------------

// 1. Specify what kind of controller board you are using
// ======================================================
// UNO or MEGA. Uncomment the line for the kind of board you have.
#ifndef MICROCONTROLLER
//#define MICROCONTROLLER MC_UNO
#define MICROCONTROLLER MC_MEGA
#endif

// 2. Add some libraries if you have a MEGA
// ========================================
// Uncomment the SPI and SD lines below if you have a MEGA.
// http://forum.arduino.cc/index.php?topic=173584.0
#include <SPI.h>
#include <SD.h>

// 3. Specify what kind of motor driver you are using
// ==================================================
// Only ONE set of lines below should be uncommented.

// i. Adafruit Motorshield v1. The original, and still the best.
// -------------------------------------------------------------
//#define ADAFRUIT_MOTORSHIELD_V1
//#include <AFMotor.h>

// ii. Adafruit Motorshield v2. It's all squealy.
// ----------------------------------------------
//#define ADAFRUIT_MOTORSHIELD_V2
//#include <Wire.h>
//#include <Adafruit_MotorShield.h>
//#include "utility/Adafruit_PWMServoDriver.h"

// iii. Using discrete stepper drivers? (eg EasyDriver, stepstick, Pololu gear)
// ----------------------------------------------------------------------------
// Don't forget to define your pins in 'configuration.ino'.
#define SERIAL_STEPPER_DRIVERS

// iv. Using a signal amplifier like a UNL2003?
// --------------------------------------------
// Don't forget to define your pins in 'configuration.ino'.
// #define UNL2003_DRIVER

// 4. Turn on some debugging code if you want horror
// =================================================
//#define DEBUG
//#define DEBUG_COMMS
//#define DEBUG_PENLIFT
//#define DEBUG_PIXEL

// 5. Disable program features if you need to free up space
// ========================================================
#define PIXEL_DRAWING
#define PENLIFT
#define VECTOR_LINES

/* ===========================================================
These variables are common to all polargraph server builds
=========================================================== */

// ==========================================================
// Some microcontroller's names
#define MC_UNO 1
#define MC_MEGA 2

#include <AccelStepper.h>
#include <Servo.h>
#include <EEPROM.h>
#include "EEPROMAnything.h"

const String FIRMWARE_VERSION_NO = "1.2.1";

// EEPROM addresses
const byte EEPROM_MACHINE_WIDTH = 0;
const byte EEPROM_MACHINE_HEIGHT = 2;
const byte EEPROM_MACHINE_MM_PER_REV = 14; // 4 bytes (float)
const byte EEPROM_MACHINE_STEPS_PER_REV = 18;
const byte EEPROM_MACHINE_STEP_MULTIPLIER = 20;

const byte EEPROM_MACHINE_MOTOR_SPEED = 22; // 4 bytes float
const byte EEPROM_MACHINE_MOTOR_ACCEL = 26; // 4 bytes float
const byte EEPROM_MACHINE_PEN_WIDTH = 30; // 4 bytes float

const byte EEPROM_MACHINE_HOME_A = 34; // 4 bytes
const byte EEPROM_MACHINE_HOME_B = 38; // 4 bytes

const byte EEPROM_PENLIFT_DOWN = 42; // 2 bytes
const byte EEPROM_PENLIFT_UP = 44; // 2 bytes

// Pen raising servo
Servo penHeight;
const int DEFAULT_DOWN_POSITION = 180;
const int DEFAULT_UP_POSITION = 110;
static int upPosition = DEFAULT_UP_POSITION; // defaults
static int downPosition = DEFAULT_DOWN_POSITION;
static int penLiftSpeed = 5; // ms between steps of moving motor
const byte PEN_HEIGHT_SERVO_PIN = 9; //UNL2003 driver uses pin 9
boolean isPenUp = false;

// Machine specification defaults
const int DEFAULT_MACHINE_WIDTH = 825;
const int DEFAULT_MACHINE_HEIGHT = 750;
const int DEFAULT_MM_PER_REV = 116;
const int DEFAULT_STEPS_PER_REV = 200;
const int DEFAULT_STEP_MULTIPLIER = 8;

// working machine specification
static int motorStepsPerRev = DEFAULT_STEPS_PER_REV;
static float mmPerRev = DEFAULT_MM_PER_REV;
static byte stepMultiplier = DEFAULT_STEP_MULTIPLIER;
static int machineWidth = DEFAULT_MACHINE_WIDTH;
static int machineHeight = DEFAULT_MACHINE_HEIGHT;

static float currentMaxSpeed = 10000.0;
static float currentAcceleration = 1000.0;
static boolean usingAcceleration = true;

int startLengthMM =1600;

float mmPerStep = 0.0F;
float stepsPerMM = 0.0F;

-------------------------------------------------------------------

Thanks.

soko
Newbie
Posts: 13
Permalink
Post Re: MEGA error "Loaded mmPerRev:nan"
on: December 11, 2017, 22:00
Quote

Hello,

I have managed to compile changing the variables of type float to int in the definitions.

Thank you.

sandy
Administrator
Posts: 1317
Permalink
sandy
Post Re: MEGA error "Loaded mmPerRev:nan"
on: December 11, 2017, 23:11
Quote

It should solve itself when you upload your machine spec?

Pages: [1]
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.031 seconds.