2017-06-29 12:54:02 -06:00
|
|
|
import * as React from "react";
|
|
|
|
import { t } from "i18next";
|
|
|
|
import { BooleanMCUInputGroup } from "../boolean_mcu_input_group";
|
2017-08-11 17:14:55 -06:00
|
|
|
import { ToolTips } from "../../../constants";
|
2017-06-29 12:54:02 -06:00
|
|
|
import { NumericMCUInputGroup } from "../numeric_mcu_input_group";
|
2017-12-07 21:05:22 -07:00
|
|
|
import { HomingRow } from "./homing_row";
|
|
|
|
import { CalibrationRow } from "./calibration_row";
|
|
|
|
import { ZeroRow } from "./zero_row";
|
2017-06-29 12:54:02 -06:00
|
|
|
import { enabledAxisMap } from "../axis_tracking_status";
|
|
|
|
import { HomingAndCalibrationProps } from "../interfaces";
|
|
|
|
import { Header } from "./header";
|
|
|
|
import { Collapse } from "@blueprintjs/core";
|
2017-12-16 17:16:19 -07:00
|
|
|
import { minFwVersionCheck } from "../../../util";
|
2017-06-29 12:54:02 -06:00
|
|
|
|
|
|
|
export function HomingAndCalibration(props: HomingAndCalibrationProps) {
|
|
|
|
|
2017-08-28 05:49:13 -06:00
|
|
|
const { dispatch, bot } = props;
|
|
|
|
const { mcu_params } = bot.hardware;
|
2017-12-16 17:16:19 -07:00
|
|
|
const { firmware_version } = bot.hardware.informational_settings;
|
2017-08-28 05:49:13 -06:00
|
|
|
const { homing_and_calibration } = props.bot.controlPanelState;
|
2017-06-29 12:54:02 -06:00
|
|
|
|
2017-12-16 17:16:19 -07:00
|
|
|
const axisLengthIntSize =
|
|
|
|
minFwVersionCheck(firmware_version, "6.0.0")
|
|
|
|
? "long"
|
|
|
|
: "short";
|
|
|
|
|
2017-06-29 12:54:02 -06:00
|
|
|
/**
|
|
|
|
* Tells us if X/Y/Z have a means of checking their position.
|
|
|
|
* FARMBOT WILL CRASH INTO WALLS IF THIS IS WRONG! BE CAREFUL.
|
|
|
|
*/
|
2017-08-28 05:49:13 -06:00
|
|
|
const enabled = enabledAxisMap(mcu_params);
|
2017-06-29 12:54:02 -06:00
|
|
|
|
|
|
|
return <section>
|
|
|
|
<Header
|
|
|
|
title={"Homing and Calibration"}
|
|
|
|
name={"homing_and_calibration"}
|
|
|
|
dispatch={dispatch}
|
2017-08-23 16:26:09 -06:00
|
|
|
bool={homing_and_calibration} />
|
2017-06-29 12:54:02 -06:00
|
|
|
<Collapse isOpen={!!homing_and_calibration}>
|
|
|
|
<HomingRow hardware={mcu_params} />
|
|
|
|
<CalibrationRow hardware={mcu_params} />
|
|
|
|
<ZeroRow />
|
|
|
|
<BooleanMCUInputGroup
|
|
|
|
name={t("Find Home on Boot")}
|
|
|
|
tooltip={t(ToolTips.FIND_HOME_ON_BOOT)}
|
|
|
|
disableX={!enabled.x}
|
|
|
|
disableY={!enabled.y}
|
|
|
|
disableZ={!enabled.z}
|
|
|
|
x={"movement_home_at_boot_x"}
|
|
|
|
y={"movement_home_at_boot_y"}
|
|
|
|
z={"movement_home_at_boot_z"}
|
|
|
|
dispatch={dispatch}
|
|
|
|
bot={bot}
|
2017-08-23 16:26:09 -06:00
|
|
|
caution={true} />
|
2017-06-29 12:54:02 -06:00
|
|
|
<BooleanMCUInputGroup
|
|
|
|
name={t("Stop at Home")}
|
|
|
|
tooltip={t(ToolTips.STOP_AT_HOME)}
|
|
|
|
x={"movement_stop_at_home_x"}
|
|
|
|
y={"movement_stop_at_home_y"}
|
|
|
|
z={"movement_stop_at_home_z"}
|
|
|
|
dispatch={dispatch}
|
2017-08-23 16:26:09 -06:00
|
|
|
bot={bot} />
|
2017-06-29 12:54:02 -06:00
|
|
|
<BooleanMCUInputGroup
|
|
|
|
name={t("Stop at Max")}
|
|
|
|
tooltip={t(ToolTips.STOP_AT_MAX)}
|
|
|
|
x={"movement_stop_at_max_x"}
|
|
|
|
y={"movement_stop_at_max_y"}
|
|
|
|
z={"movement_stop_at_max_z"}
|
|
|
|
dispatch={dispatch}
|
2017-08-23 16:26:09 -06:00
|
|
|
bot={bot} />
|
2017-06-29 12:54:02 -06:00
|
|
|
<BooleanMCUInputGroup
|
|
|
|
name={t("Negative Coordinates Only")}
|
|
|
|
tooltip={t(ToolTips.NEGATIVE_COORDINATES_ONLY)}
|
|
|
|
x={"movement_home_up_x"}
|
|
|
|
y={"movement_home_up_y"}
|
|
|
|
z={"movement_home_up_z"}
|
|
|
|
dispatch={dispatch}
|
2017-08-23 16:26:09 -06:00
|
|
|
bot={bot} />
|
2017-06-29 12:54:02 -06:00
|
|
|
<NumericMCUInputGroup
|
|
|
|
name={t("Axis Length (steps)")}
|
|
|
|
tooltip={t(ToolTips.LENGTH)}
|
|
|
|
x={"movement_axis_nr_steps_x"}
|
|
|
|
y={"movement_axis_nr_steps_y"}
|
|
|
|
z={"movement_axis_nr_steps_z"}
|
|
|
|
bot={bot}
|
2017-12-16 17:16:19 -07:00
|
|
|
dispatch={dispatch}
|
|
|
|
intSize={axisLengthIntSize} />
|
2017-06-29 12:54:02 -06:00
|
|
|
<NumericMCUInputGroup
|
|
|
|
name={t("Timeout after (seconds)")}
|
|
|
|
tooltip={t(ToolTips.TIMEOUT_AFTER)}
|
|
|
|
x={"movement_timeout_x"}
|
|
|
|
y={"movement_timeout_y"}
|
|
|
|
z={"movement_timeout_z"}
|
|
|
|
bot={bot}
|
2017-08-23 16:26:09 -06:00
|
|
|
dispatch={dispatch} />
|
2017-06-29 12:54:02 -06:00
|
|
|
</Collapse>
|
|
|
|
</section>;
|
|
|
|
}
|