render all migrated fwConfigs

pull/712/head
gabrielburnworth 2018-03-10 00:45:42 -08:00
parent 05dfefe250
commit 2aeb5ace35
5 changed files with 32 additions and 8 deletions

View File

@ -94,7 +94,8 @@ export class HardwareSettings extends
firmwareVersion={firmwareVersion}
controlPanelState={controlPanelState}
sourceFbosConfig={sourceFbosConfig}
sourceFwConfig={sourceFwConfig} />
sourceFwConfig={sourceFwConfig}
isValidFwConfig={!!firmwareConfig} />
<EncodersAndEndStops
dispatch={dispatch}
controlPanelState={controlPanelState}

View File

@ -31,7 +31,8 @@ describe("<Motors/>", () => {
},
sourceFwConfig: (x) => {
return { value: bot.hardware.mcu_params[x], consistent: true };
}
},
isValidFwConfig: true,
};
};
@ -49,6 +50,7 @@ describe("<Motors/>", () => {
it("doesn't render homing speed", () => {
const p = fakeProps();
p.firmwareVersion = "4.0.0R";
p.isValidFwConfig = false;
const wrapper = render(<Motors {...p} />);
expect(wrapper.text()).not.toContain("Homing Speed");
});
@ -60,6 +62,14 @@ describe("<Motors/>", () => {
expect(wrapper.text()).toContain("Homing Speed");
});
it("renders homing speed while disconnected", () => {
const p = fakeProps();
p.firmwareVersion = undefined;
p.isValidFwConfig = true;
const wrapper = render(<Motors {...p} />);
expect(wrapper.text()).toContain("Homing Speed");
});
function testParamToggle(
description: string, parameter: McuParamName, position: number) {
it(description, () => {
@ -84,7 +94,8 @@ describe("<StepsPerMmSettings/>", () => {
firmwareVersion: undefined,
controlPanelState: panelState(),
sourceFbosConfig: jest.fn(),
sourceFwConfig: jest.fn()
sourceFwConfig: jest.fn(),
isValidFwConfig: true,
};
};
@ -98,6 +109,15 @@ describe("<StepsPerMmSettings/>", () => {
expect(firstInputProps.setting).toBe("steps_per_mm_x");
});
it("renders API settings", () => {
const p = fakeProps();
p.firmwareVersion = undefined;
p.isValidFwConfig = true;
const wrapper = shallow(<StepsPerMmSettings {...p} />);
const firstInputProps = wrapper.find(NumericMCUInputGroup).first().props();
expect(firstInputProps.x).toBe("movement_step_per_mm_x");
});
it("renders mcu settings", () => {
const p = fakeProps();
p.firmwareVersion = "5.0.5R";

View File

@ -17,7 +17,7 @@ import { StepsPerMmSettings } from "./steps_per_mm_settings";
export function Motors(props: MotorsProps) {
const {
dispatch, firmwareVersion, sourceFbosConfig, controlPanelState,
sourceFwConfig
sourceFwConfig, isValidFwConfig
} = props;
const enable2ndXMotor = sourceFwConfig("movement_secondary_motor_x");
const invert2ndXMotor = sourceFwConfig("movement_secondary_motor_invert_x");
@ -67,7 +67,7 @@ export function Motors(props: MotorsProps) {
z={"movement_max_spd_z"}
sourceFwConfig={sourceFwConfig}
dispatch={dispatch} />
{minFwVersionCheck(firmwareVersion, "5.0.5") &&
{(minFwVersionCheck(firmwareVersion, "5.0.5") || isValidFwConfig) &&
<NumericMCUInputGroup
name={t("Homing Speed (steps/s)")}
tooltip={ToolTips.HOME_SPEED}
@ -97,7 +97,8 @@ export function Motors(props: MotorsProps) {
firmwareVersion={firmwareVersion}
controlPanelState={controlPanelState}
sourceFwConfig={sourceFwConfig}
sourceFbosConfig={sourceFbosConfig} />
sourceFbosConfig={sourceFbosConfig}
isValidFwConfig={isValidFwConfig} />
<BooleanMCUInputGroup
name={t("Always Power Motors")}
tooltip={ToolTips.ALWAYS_POWER_MOTORS}

View File

@ -40,8 +40,9 @@ export function LegacyStepsPerMm(props: MotorsProps) {
}
export function StepsPerMmSettings(props: MotorsProps) {
const { dispatch, firmwareVersion, sourceFwConfig } = props;
if (minFwVersionCheck(firmwareVersion, "5.0.5")) {
const { dispatch, firmwareVersion, sourceFwConfig, isValidFwConfig
} = props;
if (minFwVersionCheck(firmwareVersion, "5.0.5") || isValidFwConfig) {
return <NumericMCUInputGroup
name={t("Steps per MM")}
tooltip={ToolTips.STEPS_PER_MM}

View File

@ -72,6 +72,7 @@ export interface MotorsProps {
controlPanelState: ControlPanelState;
sourceFbosConfig: SourceFbosConfig;
sourceFwConfig: SourceFwConfig;
isValidFwConfig: boolean;
}
export interface EncodersProps {