Farmbot-Web-App/webpack/devices/components/hardware_settings/homing_and_calibration.tsx

103 lines
3.7 KiB
TypeScript
Raw Normal View History

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";
import { HomingRow } from "./homing_row";
import { CalibrationRow } from "./calibration_row";
import { ZeroRow } from "./zero_row";
2018-01-29 13:53:24 -07:00
import { disabledAxisMap } from "../axis_tracking_status";
2017-06-29 12:54:02 -06:00
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) {
2018-03-09 02:34:24 -07:00
const { dispatch, bot, sourceFwConfig, firmwareConfig, botDisconnected
} = props;
const hardware = firmwareConfig ? firmwareConfig : bot.hardware.mcu_params;
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.
*/
2018-03-09 02:34:24 -07:00
const disabled = disabledAxisMap(hardware);
2017-06-29 12:54:02 -06:00
return <section>
<Header
2018-02-26 06:50:41 -07:00
title={t("Homing and Calibration")}
2017-06-29 12:54:02 -06:00
name={"homing_and_calibration"}
dispatch={dispatch}
expanded={homing_and_calibration} />
2017-06-29 12:54:02 -06:00
<Collapse isOpen={!!homing_and_calibration}>
2018-03-09 02:34:24 -07:00
<HomingRow hardware={hardware} botDisconnected={botDisconnected} />
<CalibrationRow hardware={hardware} botDisconnected={botDisconnected} />
<ZeroRow botDisconnected={botDisconnected} />
2017-06-29 12:54:02 -06:00
<BooleanMCUInputGroup
name={t("Find Home on Boot")}
tooltip={ToolTips.FIND_HOME_ON_BOOT}
2018-01-29 13:53:24 -07:00
disable={disabled}
2017-06-29 12:54:02 -06:00
x={"movement_home_at_boot_x"}
y={"movement_home_at_boot_y"}
z={"movement_home_at_boot_z"}
dispatch={dispatch}
2018-03-09 02:34:24 -07:00
sourceFwConfig={sourceFwConfig}
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={ToolTips.STOP_AT_HOME}
2017-06-29 12:54:02 -06:00
x={"movement_stop_at_home_x"}
y={"movement_stop_at_home_y"}
z={"movement_stop_at_home_z"}
dispatch={dispatch}
2018-03-09 02:34:24 -07:00
sourceFwConfig={sourceFwConfig} />
2017-06-29 12:54:02 -06:00
<BooleanMCUInputGroup
name={t("Stop at Max")}
tooltip={ToolTips.STOP_AT_MAX}
2017-06-29 12:54:02 -06:00
x={"movement_stop_at_max_x"}
y={"movement_stop_at_max_y"}
z={"movement_stop_at_max_z"}
dispatch={dispatch}
2018-03-09 02:34:24 -07:00
sourceFwConfig={sourceFwConfig} />
2017-06-29 12:54:02 -06:00
<BooleanMCUInputGroup
name={t("Negative Coordinates Only")}
tooltip={ToolTips.NEGATIVE_COORDINATES_ONLY}
2017-06-29 12:54:02 -06:00
x={"movement_home_up_x"}
y={"movement_home_up_y"}
z={"movement_home_up_z"}
dispatch={dispatch}
2018-03-09 02:34:24 -07:00
sourceFwConfig={sourceFwConfig} />
2017-06-29 12:54:02 -06:00
<NumericMCUInputGroup
name={t("Axis Length (steps)")}
tooltip={ToolTips.LENGTH}
2017-06-29 12:54:02 -06:00
x={"movement_axis_nr_steps_x"}
y={"movement_axis_nr_steps_y"}
z={"movement_axis_nr_steps_z"}
2018-01-29 13:53:24 -07:00
gray={{
2018-03-09 02:34:24 -07:00
x: !sourceFwConfig("movement_stop_at_max_x").value,
y: !sourceFwConfig("movement_stop_at_max_y").value,
z: !sourceFwConfig("movement_stop_at_max_z").value,
2018-01-29 13:53:24 -07:00
}}
2018-03-09 02:34:24 -07:00
sourceFwConfig={sourceFwConfig}
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={ToolTips.TIMEOUT_AFTER}
2017-06-29 12:54:02 -06:00
x={"movement_timeout_x"}
y={"movement_timeout_y"}
z={"movement_timeout_z"}
2018-03-09 02:34:24 -07:00
sourceFwConfig={sourceFwConfig}
2017-08-23 16:26:09 -06:00
dispatch={dispatch} />
2017-06-29 12:54:02 -06:00
</Collapse>
</section>;
}