2017-06-29 12:54:02 -06:00
|
|
|
import * as React from "react";
|
2017-10-12 19:09:01 -06:00
|
|
|
import { MCUFactoryReset, bulkToggleControlPanel } from "../actions";
|
2019-08-23 08:03:14 -06:00
|
|
|
import { Widget, WidgetHeader, WidgetBody } from "../../ui/index";
|
2017-06-29 12:54:02 -06:00
|
|
|
import { HardwareSettingsProps } from "../interfaces";
|
2019-04-09 19:15:50 -06:00
|
|
|
import { MustBeOnline, isBotOnline } from "../must_be_online";
|
2017-06-29 12:54:02 -06:00
|
|
|
import { ToolTips } from "../../constants";
|
|
|
|
import { DangerZone } from "./hardware_settings/danger_zone";
|
2017-12-16 18:21:13 -07:00
|
|
|
import { PinGuard } from "./hardware_settings/pin_guard";
|
2017-06-29 12:54:02 -06:00
|
|
|
import { EncodersAndEndStops } from "./hardware_settings/encoders_and_endstops";
|
|
|
|
import { Motors } from "./hardware_settings/motors";
|
|
|
|
import { SpacePanelHeader } from "./hardware_settings/space_panel_header";
|
2017-07-26 09:51:31 -06:00
|
|
|
import {
|
|
|
|
HomingAndCalibration
|
|
|
|
} from "./hardware_settings/homing_and_calibration";
|
2018-03-08 21:03:02 -07:00
|
|
|
import { Popover, Position } from "@blueprintjs/core";
|
2018-07-18 20:53:32 -06:00
|
|
|
import { FwParamExportMenu } from "./hardware_settings/export_menu";
|
2019-04-02 13:59:37 -06:00
|
|
|
import { t } from "../../i18next_wrapper";
|
2017-06-29 12:54:02 -06:00
|
|
|
|
|
|
|
export class HardwareSettings extends
|
|
|
|
React.Component<HardwareSettingsProps, {}> {
|
|
|
|
|
|
|
|
render() {
|
2018-03-09 02:34:24 -07:00
|
|
|
const {
|
2019-04-09 19:15:50 -06:00
|
|
|
bot, dispatch, sourceFwConfig, controlPanelState, firmwareConfig,
|
2019-06-21 15:45:44 -06:00
|
|
|
botToMqttStatus, firmwareHardware, resources
|
2018-03-09 02:34:24 -07:00
|
|
|
} = this.props;
|
|
|
|
const { informational_settings } = this.props.bot.hardware;
|
|
|
|
const { sync_status } = informational_settings;
|
2019-04-09 19:15:50 -06:00
|
|
|
const botDisconnected = !isBotOnline(sync_status, botToMqttStatus);
|
2018-01-20 07:46:44 -07:00
|
|
|
return <Widget className="hardware-widget">
|
2018-02-27 10:49:37 -07:00
|
|
|
<WidgetHeader title={t("Hardware")} helpText={ToolTips.HW_SETTINGS}>
|
2018-01-20 07:46:44 -07:00
|
|
|
<MustBeOnline
|
|
|
|
hideBanner={true}
|
|
|
|
syncStatus={sync_status}
|
|
|
|
networkState={this.props.botToMqttStatus}
|
|
|
|
lockOpen={process.env.NODE_ENV !== "production"}>
|
|
|
|
</MustBeOnline>
|
|
|
|
</WidgetHeader>
|
|
|
|
<WidgetBody>
|
|
|
|
<button
|
|
|
|
className={"fb-button gray no-float"}
|
|
|
|
onClick={() => dispatch(bulkToggleControlPanel(true))}>
|
2018-02-27 10:49:37 -07:00
|
|
|
{t("Expand All")}
|
2018-03-08 21:03:02 -07:00
|
|
|
</button>
|
2018-01-20 07:46:44 -07:00
|
|
|
<button
|
|
|
|
className={"fb-button gray no-float"}
|
|
|
|
onClick={() => dispatch(bulkToggleControlPanel(false))}>
|
2018-02-27 10:49:37 -07:00
|
|
|
{t("Collapse All")}
|
2018-03-08 21:03:02 -07:00
|
|
|
</button>
|
2018-03-09 02:34:24 -07:00
|
|
|
{firmwareConfig &&
|
2018-03-08 21:03:02 -07:00
|
|
|
<Popover position={Position.BOTTOM_RIGHT}>
|
|
|
|
<i className="fa fa-download" />
|
2018-03-09 02:34:24 -07:00
|
|
|
<FwParamExportMenu firmwareConfig={firmwareConfig} />
|
2018-03-08 21:03:02 -07:00
|
|
|
</Popover>}
|
2018-01-20 07:46:44 -07:00
|
|
|
<MustBeOnline
|
|
|
|
networkState={this.props.botToMqttStatus}
|
|
|
|
syncStatus={sync_status}
|
2018-03-10 02:42:15 -07:00
|
|
|
lockOpen={process.env.NODE_ENV !== "production" || !!firmwareConfig}>
|
2018-01-20 07:46:44 -07:00
|
|
|
<div className="label-headings">
|
|
|
|
<SpacePanelHeader />
|
|
|
|
</div>
|
|
|
|
<HomingAndCalibration
|
|
|
|
dispatch={dispatch}
|
2018-03-09 02:34:24 -07:00
|
|
|
bot={bot}
|
|
|
|
sourceFwConfig={sourceFwConfig}
|
|
|
|
firmwareConfig={firmwareConfig}
|
|
|
|
botDisconnected={botDisconnected} />
|
2018-01-20 07:46:44 -07:00
|
|
|
<Motors
|
|
|
|
dispatch={dispatch}
|
2018-03-09 02:34:24 -07:00
|
|
|
controlPanelState={controlPanelState}
|
2018-03-10 01:45:42 -07:00
|
|
|
sourceFwConfig={sourceFwConfig}
|
2019-06-03 17:41:59 -06:00
|
|
|
firmwareHardware={firmwareHardware} />
|
2018-01-20 07:46:44 -07:00
|
|
|
<EncodersAndEndStops
|
|
|
|
dispatch={dispatch}
|
2018-05-02 01:05:02 -06:00
|
|
|
shouldDisplay={this.props.shouldDisplay}
|
2018-03-09 02:34:24 -07:00
|
|
|
controlPanelState={controlPanelState}
|
2020-02-07 16:06:40 -07:00
|
|
|
sourceFwConfig={sourceFwConfig}
|
|
|
|
firmwareHardware={firmwareHardware} />
|
2018-01-20 07:46:44 -07:00
|
|
|
<PinGuard
|
|
|
|
dispatch={dispatch}
|
2019-06-21 15:45:44 -06:00
|
|
|
resources={resources}
|
2018-03-09 02:34:24 -07:00
|
|
|
controlPanelState={controlPanelState}
|
|
|
|
sourceFwConfig={sourceFwConfig} />
|
2018-01-20 07:46:44 -07:00
|
|
|
<DangerZone
|
|
|
|
dispatch={dispatch}
|
2018-03-09 02:34:24 -07:00
|
|
|
controlPanelState={controlPanelState}
|
|
|
|
onReset={MCUFactoryReset}
|
|
|
|
botDisconnected={botDisconnected} />
|
2018-01-20 07:46:44 -07:00
|
|
|
</MustBeOnline>
|
|
|
|
</WidgetBody>
|
|
|
|
</Widget>;
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|
|
|
|
}
|