minor changes to error messages

This commit is contained in:
proddy
2020-07-08 19:15:12 +02:00
parent ca130576fd
commit 1477e816e7
3 changed files with 40 additions and 38 deletions

View File

@@ -73,47 +73,49 @@ class EMSESPDevicesForm extends Component<EMSESPDevicesFormProps, EMSESPDevicesF
const { width, data } = this.props; const { width, data } = this.props;
return ( return (
<TableContainer> <TableContainer>
<Table size="small" padding={isWidthDown('xs', width!) ? "none" : "default"}> {!this.noData() && (
<TableHead> <Table size="small" padding={isWidthDown('xs', width!) ? "none" : "default"}>
<TableRow> <TableHead>
<StyledTableCell>Type</StyledTableCell> <TableRow>
<StyledTableCell align="center">Brand</StyledTableCell> <StyledTableCell>Type</StyledTableCell>
<StyledTableCell align="center">Model</StyledTableCell> <StyledTableCell align="center">Brand</StyledTableCell>
<StyledTableCell align="center">Device ID</StyledTableCell> <StyledTableCell align="center">Model</StyledTableCell>
<StyledTableCell align="center">Product ID</StyledTableCell> <StyledTableCell align="center">Device ID</StyledTableCell>
<StyledTableCell align="center">Version</StyledTableCell> <StyledTableCell align="center">Product ID</StyledTableCell>
</TableRow> <StyledTableCell align="center">Version</StyledTableCell>
</TableHead>
<TableBody>
{data.devices.sort(compareDevices).map(device => (
<TableRow hover key={device.type}>
<TableCell component="th" scope="row">
{device.type}
</TableCell>
<TableCell align="center">
{device.brand}
</TableCell>
<TableCell align="center">
{device.name}
</TableCell>
<TableCell align="center">
0x{('00' + device.deviceid.toString(16).toUpperCase()).slice(-2)}
</TableCell>
<TableCell align="center">
{device.productid}
</TableCell>
<TableCell align="center">
{device.version}
</TableCell>
</TableRow> </TableRow>
))} </TableHead>
</TableBody> <TableBody>
</Table> {data.devices.sort(compareDevices).map(device => (
<TableRow hover key={device.type}>
<TableCell component="th" scope="row">
{device.type}
</TableCell>
<TableCell align="center">
{device.brand}
</TableCell>
<TableCell align="center">
{device.name}
</TableCell>
<TableCell align="center">
0x{('00' + device.deviceid.toString(16).toUpperCase()).slice(-2)}
</TableCell>
<TableCell align="center">
{device.productid}
</TableCell>
<TableCell align="center">
{device.version}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
)}
{this.noData() && {this.noData() &&
( (
<Box bgcolor="error.main" color="error.contrastText" p={2} mt={2} mb={2}> <Box bgcolor="error.main" color="error.contrastText" p={2} mt={2} mb={2}>
<Typography variant="body1"> <Typography variant="body1">
No EMS devices found. No EMS devices found. Check connection and for Tx errors. Try forcing a scan.
</Typography> </Typography>
</Box> </Box>
) )

View File

@@ -22,7 +22,7 @@ export const busStatus = ({ status }: EMSESPStatus) => {
case busConnectionStatus.BUS_STATUS_CONNECTED: case busConnectionStatus.BUS_STATUS_CONNECTED:
return "Connected"; return "Connected";
case busConnectionStatus.BUS_STATUS_TX_ERRORS: case busConnectionStatus.BUS_STATUS_TX_ERRORS:
return "Tx not stable"; return "Tx Errors";
case busConnectionStatus.BUS_STATUS_OFFLINE: case busConnectionStatus.BUS_STATUS_OFFLINE:
return "Disconnected"; return "Disconnected";
default: default:

View File

@@ -139,7 +139,7 @@ uint8_t EMSESP::bus_status() {
} }
// Tx Failure rate > 5% // Tx Failure rate > 5%
if (((txservice_.telegram_fail_count() * 100) / total_sent) >= 5) { if (((txservice_.telegram_fail_count() * 100) / total_sent) > 5) {
return BUS_STATUS_TX_ERRORS; return BUS_STATUS_TX_ERRORS;
} }