@@ -9,6 +9,7 @@ import ShowChartIcon from '@material-ui/icons/ShowChart';
9
9
import SdStorageIcon from '@material-ui/icons/SdStorage' ;
10
10
import FolderIcon from '@material-ui/icons/Folder' ;
11
11
import DataUsageIcon from '@material-ui/icons/DataUsage' ;
12
+ import AppsIcon from '@material-ui/icons/Apps' ;
12
13
import PowerSettingsNewIcon from '@material-ui/icons/PowerSettingsNew' ;
13
14
import RefreshIcon from '@material-ui/icons/Refresh' ;
14
15
import SettingsBackupRestoreIcon from '@material-ui/icons/SettingsBackupRestore' ;
@@ -17,7 +18,7 @@ import { redirectingAuthorizedFetch, AuthenticatedContextProps, withAuthenticate
17
18
import { RestFormProps , FormButton , ErrorButton } from '../components' ;
18
19
import { FACTORY_RESET_ENDPOINT , RESTART_ENDPOINT } from '../api' ;
19
20
20
- import { SystemStatus } from './types' ;
21
+ import { SystemStatus , EspPlatform } from './types' ;
21
22
22
23
interface SystemStatusFormState {
23
24
confirmRestart : boolean ;
@@ -31,7 +32,6 @@ function formatNumber(num: number) {
31
32
return new Intl . NumberFormat ( ) . format ( num ) ;
32
33
}
33
34
34
-
35
35
class SystemStatusForm extends Component < SystemStatusFormProps , SystemStatusFormState > {
36
36
37
37
state : SystemStatusFormState = {
@@ -40,11 +40,6 @@ class SystemStatusForm extends Component<SystemStatusFormProps, SystemStatusForm
40
40
processing : false
41
41
}
42
42
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
-
48
43
createListItems ( ) {
49
44
const { data } = this . props
50
45
return (
@@ -73,8 +68,22 @@ class SystemStatusForm extends Component<SystemStatusFormProps, SystemStatusForm
73
68
< MemoryIcon />
74
69
</ Avatar >
75
70
</ 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)' : '' ) } />
77
72
</ 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
+ }
78
87
< Divider variant = "inset" component = "li" />
79
88
< ListItem >
80
89
< ListItemAvatar >
0 commit comments