@@ -9,6 +9,7 @@ import ShowChartIcon from '@material-ui/icons/ShowChart';
99import SdStorageIcon from '@material-ui/icons/SdStorage' ;
1010import FolderIcon from '@material-ui/icons/Folder' ;
1111import DataUsageIcon from '@material-ui/icons/DataUsage' ;
12+ import AppsIcon from '@material-ui/icons/Apps' ;
1213import PowerSettingsNewIcon from '@material-ui/icons/PowerSettingsNew' ;
1314import RefreshIcon from '@material-ui/icons/Refresh' ;
1415import SettingsBackupRestoreIcon from '@material-ui/icons/SettingsBackupRestore' ;
@@ -17,7 +18,7 @@ import { redirectingAuthorizedFetch, AuthenticatedContextProps, withAuthenticate
1718import { RestFormProps , FormButton , ErrorButton } from '../components' ;
1819import { FACTORY_RESET_ENDPOINT , RESTART_ENDPOINT } from '../api' ;
1920
20- import { SystemStatus } from './types' ;
21+ import { SystemStatus , EspPlatform } from './types' ;
2122
2223interface SystemStatusFormState {
2324 confirmRestart : boolean ;
@@ -31,7 +32,6 @@ function formatNumber(num: number) {
3132 return new Intl . NumberFormat ( ) . format ( num ) ;
3233}
3334
34-
3535class SystemStatusForm extends Component < SystemStatusFormProps , SystemStatusFormState > {
3636
3737 state : SystemStatusFormState = {
@@ -40,11 +40,6 @@ class SystemStatusForm extends Component<SystemStatusFormProps, SystemStatusForm
4040 processing : false
4141 }
4242
43- approxHeapFragmentation = ( ) : number => {
44- const { data : { max_alloc_heap, free_heap } } = this . props ;
45- return 100 - Math . round ( ( max_alloc_heap / free_heap ) * 100 ) ;
46- }
47-
4843 createListItems ( ) {
4944 const { data } = this . props
5045 return (
@@ -73,8 +68,22 @@ class SystemStatusForm extends Component<SystemStatusFormProps, SystemStatusForm
7368 < MemoryIcon />
7469 </ Avatar >
7570 </ ListItemAvatar >
76- < ListItemText primary = "Heap (Free / Max Alloc)" secondary = { formatNumber ( data . free_heap ) + ' / ' + formatNumber ( data . max_alloc_heap ) + ' bytes (~ ' + this . approxHeapFragmentation ( ) + '%\xa0fragmentation)' } />
71+ < ListItemText primary = "Heap (Free / Max Alloc)" secondary = { formatNumber ( data . free_heap ) + ' / ' + formatNumber ( data . max_alloc_heap ) + ' bytes ' + ( data . esp_platform === EspPlatform . ESP8266 ? '(' + data . heap_fragmentation + '% fragmentation)' : '' ) } />
7772 </ ListItem >
73+ {
74+ ( data . esp_platform === EspPlatform . ESP32 && data . psram_size > 0 ) && (
75+ < Fragment >
76+ < Divider variant = "inset" component = "li" />
77+ < ListItem >
78+ < ListItemAvatar >
79+ < Avatar >
80+ < AppsIcon />
81+ </ Avatar >
82+ </ ListItemAvatar >
83+ < ListItemText primary = "PSRAM (Size / Free)" secondary = { formatNumber ( data . psram_size ) + ' / ' + formatNumber ( data . free_psram ) + ' bytes' } />
84+ </ ListItem >
85+ </ Fragment > )
86+ }
7887 < Divider variant = "inset" component = "li" />
7988 < ListItem >
8089 < ListItemAvatar >
0 commit comments