Skip to content

Commit

Permalink
Better flow of error display and hide controls if needed
Browse files Browse the repository at this point in the history
Build all packages
  • Loading branch information
luc-github committed Apr 9, 2024
1 parent fccdb44 commit 33f06c5
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 23 deletions.
Binary file modified dist/CNC/GRBL/index.html.gz
Binary file not shown.
Binary file modified dist/CNC/GRBLHal/index.html.gz
Binary file not shown.
Binary file modified dist/Plotter/HP-GL/index.html.gz
Binary file not shown.
Binary file modified dist/Printer3D/Marlin-embedded/index.html.gz
Binary file not shown.
Binary file modified dist/Printer3D/Marlin/index.html.gz
Binary file not shown.
Binary file modified dist/Printer3D/Repetier/index.html.gz
Binary file not shown.
Binary file modified dist/Printer3D/Smoothieware/index.html.gz
Binary file not shown.
Binary file modified dist/SandTable/GRBL/index.html.gz
Binary file not shown.
41 changes: 22 additions & 19 deletions src/components/Panels/Status.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ const TimeControl = ({ label, time }) => {
const StatusControls = () => {
const { streamStatus, status } = useTargetContext()
if (!useUiContextFn.getValue('showstatuspanel')) return null
console.log("streamStatus")
console.log('streamStatus')
console.log(streamStatus)
console.log( "status")
console.log( status)
console.log('status')
console.log(status)
return (
<Fragment>
{streamStatus &&
Expand Down Expand Up @@ -140,22 +140,24 @@ const StatusControls = () => {
{status.filename}
</div>
)}
{status.printState.printing && (
<Fragment>
<div class="extra-control-value">
{status.printState.progress}%
</div>
{status.printState.printing &&
status.printState.progress !=
'NaN'(
<Fragment>
<div class="extra-control-value">
{status.printState.progress}%
</div>

<TimeControl
label="P105"
time={status.printTime}
/>
<TimeControl
label="P112"
time={status.printLeftTime}
/>
</Fragment>
)}
<TimeControl
label="P105"
time={status.printTime}
/>
<TimeControl
label="P112"
time={status.printLeftTime}
/>
</Fragment>
)}
</div>
</div>
)}
Expand All @@ -166,6 +168,7 @@ const StatusControls = () => {
const StatusPanel = () => {
const { toasts, panels } = useUiContext()
const { status, streamStatus } = useTargetContext()
console.log(status, streamStatus);
const { createNewRequest } = useHttpFn
const id = 'statusPanel'
const hidePanel = () => {
Expand Down Expand Up @@ -317,7 +320,7 @@ const StatusPanel = () => {
{((status.printState && status.printState.printing) ||
(streamStatus &&
streamStatus.status &&
streamStatus.status != 'no stream')) &&
streamStatus.status != 'no stream') && streamStatus.name !="") &&
deviceList.map((device) => {
if (
!device.depend.every((d) =>
Expand Down
6 changes: 5 additions & 1 deletion src/targets/Printer3D/Marlin/TargetContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ const TargetContextProvider = ({ children }) => {
if (data[0] === '{') {
console.log('response', data)
if (isStreamingStatus(data)) {
setStatus({ printState: null })

const preStatus = getStreamingStatus(data)
const name = preStatus.name
const status = preStatus.status
Expand Down Expand Up @@ -294,6 +294,10 @@ const TargetContextProvider = ({ children }) => {
printLeftTime,
}
setStreamStatus(fullstatus)
if (status!="no stream"){
setStatus({ printState: null })

}
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/targets/Printer3D/Marlin/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ const getSensor = (str) => {
//
// Streaming status
const isStreamingStatus = (str) => {
console.log('isStreamingStatus', str)
//console.log('isStreamingStatus', str)
try {
const res = JSON.parse(str)
if (res.cmd == '701' && typeof res.data != 'undefined') {
Expand All @@ -376,9 +376,9 @@ const isStreamingStatus = (str) => {
}

const getStreamingStatus = (str) => {
console.log('getStreamingStatus', str)
//console.log('getStreamingStatus', str)
const res = JSON.parse(str)
console.log('getStreamingStatus', res)
//console.log('getStreamingStatus', res)
if (res.data.status) return res.data
return { status: res.data }
}
Expand Down

0 comments on commit 33f06c5

Please sign in to comment.