Skip to content

Commit 722d9a1

Browse files
committed
fixed menu
1 parent 6b1c02c commit 722d9a1

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

eprom.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
print(" www.dragaosemchama.com.br")
1919
print(" github.com/robsoncouto/eprom\n")
2020

21+
#Default value, 1MB chip:
22+
romsize=1*1024*1024
23+
numsectors=int(romsize/128) # I am sending data in 128 byte chunks
2124

2225

2326
while True:
@@ -27,12 +30,13 @@
2730
print(" 1-Read eprom ")
2831
print(" 2-burn eprom ")
2932
print(" 3-about this script ")
30-
print(" 4-quit \n")
33+
print(" 4-blank check ")
34+
print(" 5-select chip size ")
35+
print(" ")
36+
print(" 6-quit \n")
3137

3238
option=int(input("Please insert a number:"))
33-
romsize=1*1024*1024
34-
numsectors=int(romsize/128) # I am sending data in 128 byte chunks
35-
block=0
39+
3640
if(option==1):
3741
name=input("What the name of the file?")
3842

@@ -88,17 +92,14 @@
8892
if response!=CHK:
8993
print("wrong checksum, sending chunk again\n")
9094
f.close()
91-
if(option==4):
92-
print("See ya!")
93-
break
9495

9596
if(option==3):
9697

9798
print("\nA more detailed write up about this project is available at www.dragaosemchama.com.br")
9899
print("This script goes together with a Arduino sketch, both are used to read and program")
99100
print("eproms on the cheap.")
100101
print("Written by Robson Couto\n")
101-
if(option==5):
102+
if(option==4):
102103
ser.flushInput()
103104
ser.write(b"\x55")
104105
ser.write(bytes("r","ASCII"))
@@ -118,3 +119,14 @@
118119
else:
119120
print("\nThe chip seems to contain data\n")
120121
print("Done\n")
122+
if(option==5):
123+
print("Current eprom size:",romsize/(1024*1024),"MB\n")
124+
megs=float(input("Please insert the size of the eprom in Megabytes"))
125+
romsize=megs*1024*1024
126+
numsectors=int(romsize/128) # I am sending data in 128 byte chunks
127+
print("Eprom size changed to ",romsize/(1024*1024),"MB\n")
128+
129+
130+
if(option==6):
131+
print("See ya!")
132+
break

0 commit comments

Comments
 (0)