Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
adenjonah committed May 20, 2024
1 parent aa283db commit fbb621a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/json_databases/DCUUIA.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"timestamp": "2024-05-20T05:46:01.705067", "dcu": {"eva1": {"batt": false, "oxy": true, "comm": false, "fan": true, "pump": false, "co2": false}, "eva2": {"batt": false, "oxy": false, "comm": true, "fan": false, "pump": false, "co2": false}}, "uia": {"eva1_power": false, "eva1_oxy": false, "eva1_water_supply": false, "eva1_water_waste": false, "eva2_power": false, "eva2_oxy": false, "eva2_water_supply": false, "eva2_water_waste": false, "oxy_vent": false, "depress": false}}
{"timestamp": "2024-05-20T05:50:15.085340", "dcu": {"eva1": {"batt": false, "oxy": true, "comm": false, "fan": true, "pump": false, "co2": false}, "eva2": {"batt": false, "oxy": false, "comm": true, "fan": false, "pump": false, "co2": false}}, "uia": {"eva1_power": false, "eva1_oxy": false, "eva1_water_supply": false, "eva1_water_waste": false, "eva2_power": false, "eva2_oxy": false, "eva2_water_supply": false, "eva2_water_waste": false, "oxy_vent": false, "depress": false}}
15 changes: 14 additions & 1 deletion src/components/RoverCamera.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import './rovercamera.css'; // Import the CSS file
const RoverCamera = () => {
const [isConnected, setIsConnected] = useState(true);
const [streamUrl, setStreamUrl] = useState('');
const [isNativeFeed, setIsNativeFeed] = useState(true); // Track the current feed type

useEffect(() => {
// Fetch configuration data from localhost:8000/config
Expand All @@ -21,6 +22,16 @@ const RoverCamera = () => {
});
}, []);

const toggleFeed = () => {
// Toggle the stream URL between native_feed and thermal_feed
setStreamUrl((prevUrl) =>
prevUrl.includes('native_feed')
? prevUrl.replace('native_feed', 'thermal_feed')
: prevUrl.replace('thermal_feed', 'native_feed')
);
setIsNativeFeed(!isNativeFeed); // Toggle the feed type state
};

if (!isConnected) {
return (
<div>
Expand All @@ -32,8 +43,10 @@ const RoverCamera = () => {
}

return (
<div className="stream-container">
<div className="stream-container" onClick={toggleFeed}>
<img src={streamUrl} alt="Rover Stream" className="stream-image" />
<p style={{ textAlign: 'center', marginTop: '10px' }}>
</p>
</div>
);
};
Expand Down

0 comments on commit fbb621a

Please sign in to comment.