forked from Arcmyx/pynamics
Update diagnostics/MicroPythonDiagnostics.py
This commit is contained in:
@@ -23,7 +23,7 @@ class MicroPythonDiagnostics:
|
|||||||
micropython.heap_lock()
|
micropython.heap_lock()
|
||||||
print("[Hub Diagnostics - MicroPython - Memory] Heap was locked. Attempting to allocate memory (this should fail):")
|
print("[Hub Diagnostics - MicroPython - Memory] Heap was locked. Attempting to allocate memory (this should fail):")
|
||||||
try:
|
try:
|
||||||
x = 5000
|
y = 10000
|
||||||
print("[Hub Diagnostics - MicroPython - Memory] [FAIL] There was no MemoryError raised. Heap lock failed.")
|
print("[Hub Diagnostics - MicroPython - Memory] [FAIL] There was no MemoryError raised. Heap lock failed.")
|
||||||
except MemoryError:
|
except MemoryError:
|
||||||
print("[Hub Diagnostics - MicroPython - Memory] [SUCCESS] Allocation failed. Test successful. The heap was successfully locked.")
|
print("[Hub Diagnostics - MicroPython - Memory] [SUCCESS] Allocation failed. Test successful. The heap was successfully locked.")
|
||||||
@@ -32,7 +32,7 @@ class MicroPythonDiagnostics:
|
|||||||
micropython.heap_unlock()
|
micropython.heap_unlock()
|
||||||
print("[Hub Diagnostics - MicroPython - Memory] Heap was unlocked. Attempting to allocate memory (this should succeed):")
|
print("[Hub Diagnostics - MicroPython - Memory] Heap was unlocked. Attempting to allocate memory (this should succeed):")
|
||||||
try:
|
try:
|
||||||
y = 5001
|
z = 17000
|
||||||
print("[Hub Diagnostics - MicroPython - Memory] [SUCCESS] There was no MemoryError raised. The value of the new variable y is", x)
|
print("[Hub Diagnostics - MicroPython - Memory] [SUCCESS] There was no MemoryError raised. The value of the new variable y is", x)
|
||||||
except MemoryError:
|
except MemoryError:
|
||||||
print("[Hub Diagnostics - MicroPython - Memory] [FAIL] Allocation failed. The heap failed to unlock.")
|
print("[Hub Diagnostics - MicroPython - Memory] [FAIL] Allocation failed. The heap failed to unlock.")
|
||||||
|
|||||||
Reference in New Issue
Block a user