Skip to content

Commit

Permalink
fixing error
Browse files Browse the repository at this point in the history
  • Loading branch information
beniroquai committed Nov 10, 2024
1 parent 5c8e0e3 commit 8fbb260
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion src/components/AxisControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import React, { useState } from "react";

const AxisControl = ({
axisLabel,
onButtonPress,
hostIP,
hostPort,
positionerName,
Expand All @@ -28,6 +27,16 @@ const AxisControl = ({

const dialValues = [1, 5, 10, 50, 100, 500, 1000, 10000, 20000, 100000];


const onButtonPress = async (url) => {
try {
const response = await fetch(url);
const data = await response.json();
} catch (error) {
console.error("Error:", error);
}
};

const handleIncrement = async () => {
const url = `${hostIP}:${hostPort}/PositionerController/movePositioner?positionerName=${positionerName}&axis=${axisLabel}&dist=${Math.abs(
steps
Expand Down
1 change: 1 addition & 0 deletions src/components/LiveView.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ const ControlPanel_1 = ({ hostIP, hostPort }) => {
}
};


const handleIlluminationSliderChange = async (event, laserIndex) => {
const value = event.target.value;
if (laserNames[laserIndex]) {
Expand Down
3 changes: 1 addition & 2 deletions src/components/XYZControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { useEffect, useState } from "react";
import AxisControl from "./AxisControl";
import { useWebSocket } from "../context/WebSocketContext";

function XYZControls({ onButtonPress, hostIP, hostPort }) {
function XYZControls({ hostIP, hostPort }) {
const socket = useWebSocket();
const [positionerName, setPositionerName] = useState("VirtualStage"); // Assume a default or initial value
const [positions, setPositions] = useState({A:0, X: 0, Y: 0, Z: 0 });
Expand Down Expand Up @@ -79,7 +79,6 @@ function XYZControls({ onButtonPress, hostIP, hostPort }) {
<Grid item xs={4} key={axisLabel}>
<AxisControl
axisLabel={axisLabel}
onButtonPress={onButtonPress}
hostIP={hostIP}
hostPort={hostPort}
positionerName={positionerName}
Expand Down

0 comments on commit 8fbb260

Please sign in to comment.