Added pen lift position stuff. This means by default, using the penlift buttons sets the positions too. Hitting "send pen width" sends the low and the high values, with the expectation that they will be saved in EEPROM.

This commit is contained in:
Sandy Noble 2013-03-24 00:13:00 +00:00
parent a822e1545d
commit 8c5ddcf440
5 changed files with 55 additions and 2 deletions

View File

@ -430,6 +430,10 @@ class Machine
PVector framePos = new PVector(getIntProperty("controller.pictureframe.position.x", 200), getIntProperty("controller.pictureframe.position.y", 200)); PVector framePos = new PVector(getIntProperty("controller.pictureframe.position.x", 200), getIntProperty("controller.pictureframe.position.y", 200));
Rectangle frame = new Rectangle(inSteps(framePos), inSteps(frameSize)); Rectangle frame = new Rectangle(inSteps(framePos), inSteps(frameSize));
setPictureFrame(frame); setPictureFrame(frame);
// penlift positions
penLiftDownPosition = getIntProperty("machine.penlift.down", 90);
penLiftUpPosition = getIntProperty("machine.penlift.up", 180);
} }
@ -502,6 +506,9 @@ class Machine
// picture frame position // picture frame position
props.setProperty("controller.pictureframe.position.x", Integer.toString((int) inMM(framePosX))); props.setProperty("controller.pictureframe.position.x", Integer.toString((int) inMM(framePosX)));
props.setProperty("controller.pictureframe.position.y", Integer.toString((int) inMM(framePosY))); props.setProperty("controller.pictureframe.position.y", Integer.toString((int) inMM(framePosY)));
props.setProperty("machine.penlift.down", Integer.toString((int) penLiftDownPosition));
props.setProperty("machine.penlift.up", Integer.toString((int) penLiftUpPosition));
// println("framesize: " + inMM(frameSizeX)); // println("framesize: " + inMM(frameSizeX));

View File

@ -89,12 +89,25 @@ void unsetOtherToggles(String except)
} }
void button_mode_penUp() void button_mode_penUp()
{ {
addToCommandQueue(CMD_PENUP + "END"); addToCommandQueue(CMD_PENUP + penLiftUpPosition +",END");
} }
void button_mode_penDown() void button_mode_penDown()
{ {
addToCommandQueue(CMD_PENDOWN + "END"); addToCommandQueue(CMD_PENDOWN + penLiftDownPosition +",END");
} }
void numberbox_mode_penUpPos(int value)
{
penLiftUpPosition = value;
}
void numberbox_mode_penDownPos(int value)
{
penLiftDownPosition = value;
}
void button_mode_sendPenliftRange()
{
addToCommandQueue(CMD_SETPENLIFTRANGE+penLiftDownPosition+","+penLiftUpPosition+",END");
}
void toggle_mode_inputBoxTopLeft(boolean flag) void toggle_mode_inputBoxTopLeft(boolean flag)
{ {
if (flag) if (flag)

View File

@ -441,6 +441,22 @@ Map<String, Controller> initialiseNumberboxValues(Map<String, Controller> map)
{ {
n.setValue(minimumVectorLineLength); n.setValue(minimumVectorLineLength);
n.setMin(0); n.setMin(0);
n.setMultiplier(1);
}
else if (MODE_PEN_LIFT_POS_UP.equals(key))
{
n.setDecimalPrecision(1);
n.setValue(penLiftUpPosition);
n.setMin(0);
n.setMax(360);
n.setMultiplier(1);
}
else if (MODE_PEN_LIFT_POS_DOWN.equals(key))
{
n.setDecimalPrecision(1);
n.setValue(penLiftDownPosition);
n.setMin(0);
n.setMax(360);
n.setMultiplier(0.1); n.setMultiplier(0.1);
} }
} }
@ -673,6 +689,10 @@ List<String> getControlNamesForDetailPanel()
controlNames.add(MODE_CHANGE_PEN_TEST_INCREMENT_SIZE); controlNames.add(MODE_CHANGE_PEN_TEST_INCREMENT_SIZE);
controlNames.add(MODE_DRAW_TEST_PENWIDTH); controlNames.add(MODE_DRAW_TEST_PENWIDTH);
controlNames.add(MODE_PEN_LIFT_POS_UP);
controlNames.add(MODE_PEN_LIFT_POS_DOWN);
controlNames.add(MODE_SEND_PEN_LIFT_RANGE);
controlNames.add(MODE_CHANGE_MACHINE_MAX_SPEED); controlNames.add(MODE_CHANGE_MACHINE_MAX_SPEED);
controlNames.add(MODE_CHANGE_MACHINE_ACCELERATION); controlNames.add(MODE_CHANGE_MACHINE_ACCELERATION);
controlNames.add(MODE_SEND_MACHINE_SPEED); controlNames.add(MODE_SEND_MACHINE_SPEED);
@ -818,6 +838,9 @@ Map<String, String> buildControlLabels()
result.put(MODE_PEN_LIFT_UP, "Pen lift"); result.put(MODE_PEN_LIFT_UP, "Pen lift");
result.put(MODE_PEN_LIFT_DOWN, "Pen drop"); result.put(MODE_PEN_LIFT_DOWN, "Pen drop");
result.put(MODE_PEN_LIFT_POS_UP, "Pen up position");
result.put(MODE_PEN_LIFT_POS_DOWN, "Pen down position");
result.put(MODE_SEND_PEN_LIFT_RANGE, "Send lift range");
result.put(MODE_SEND_ROVE_AREA, "Send Roving Area"); result.put(MODE_SEND_ROVE_AREA, "Send Roving Area");
result.put(MODE_SEND_START_TEXT, "Start text at point"); result.put(MODE_SEND_START_TEXT, "Start text at point");
@ -940,6 +963,9 @@ Set<String> buildControlNames()
result.add(MODE_CHANGE_PIXEL_SCALING); result.add(MODE_CHANGE_PIXEL_SCALING);
result.add(MODE_PEN_LIFT_UP); result.add(MODE_PEN_LIFT_UP);
result.add(MODE_PEN_LIFT_DOWN); result.add(MODE_PEN_LIFT_DOWN);
result.add(MODE_PEN_LIFT_POS_UP);
result.add(MODE_PEN_LIFT_POS_DOWN);
result.add(MODE_SEND_PEN_LIFT_RANGE);
result.add(MODE_SEND_ROVE_AREA); result.add(MODE_SEND_ROVE_AREA);
result.add(MODE_SEND_START_TEXT); result.add(MODE_SEND_START_TEXT);

View File

@ -120,6 +120,8 @@ void sendMachineSpec()
addToCommandQueue(command); addToCommandQueue(command);
command = CMD_SETMACHINESTEPMULTIPLIER+machineStepMultiplier+",END"; command = CMD_SETMACHINESTEPMULTIPLIER+machineStepMultiplier+",END";
addToCommandQueue(command); addToCommandQueue(command);
command = CMD_SETPENLIFTRANGE+penLiftDownPosition+","+penLiftUpPosition+",END";
addToCommandQueue(command);
} }
public PVector getMouseVector() public PVector getMouseVector()

View File

@ -114,6 +114,8 @@ float gridSize = 75.0;
float currentPenWidth = 0.8; float currentPenWidth = 0.8;
float penIncrement = 0.05; float penIncrement = 0.05;
int penLiftDownPosition = 90;
int penLiftUpPosition = 180;
// this variable controls how big the pixels are scaled when drawn. // this variable controls how big the pixels are scaled when drawn.
// 1.0 represents full size, 2.0 would be twice as big as the grid size, // 1.0 represents full size, 2.0 would be twice as big as the grid size,
// 0.5 would be half the grid size. // 0.5 would be half the grid size.
@ -281,6 +283,9 @@ static final String MODE_CHOOSE_CHROMA_KEY_COLOUR = "toggle_mode_chooseChromaKey
static final String MODE_CHANGE_PIXEL_SCALING = "numberbox_mode_changePixelScaling"; static final String MODE_CHANGE_PIXEL_SCALING = "numberbox_mode_changePixelScaling";
static final String MODE_PEN_LIFT_UP = "button_mode_penUp"; static final String MODE_PEN_LIFT_UP = "button_mode_penUp";
static final String MODE_PEN_LIFT_DOWN = "button_mode_penDown"; static final String MODE_PEN_LIFT_DOWN = "button_mode_penDown";
static final String MODE_PEN_LIFT_POS_UP = "numberbox_mode_penUpPos";
static final String MODE_PEN_LIFT_POS_DOWN = "numberbox_mode_penDownPos";
static final String MODE_SEND_PEN_LIFT_RANGE = "button_mode_sendPenliftRange";
static final String MODE_SEND_ROVE_AREA = "button_mode_sendRoveArea"; static final String MODE_SEND_ROVE_AREA = "button_mode_sendRoveArea";
static final String MODE_SEND_START_TEXT = "toggle_mode_sendStartText"; static final String MODE_SEND_START_TEXT = "toggle_mode_sendStartText";