resolved stupid amend merge conflict

This commit is contained in:
Robert Schauklies 2025-10-24 22:25:22 +02:00
commit 10bdaee926
2 changed files with 84 additions and 6 deletions

View file

@ -165,7 +165,7 @@ class TFT(object) :
self._pushcolor(aColor)
# @micropython.native
def print(self,text,color=WHITE,font=sysfont,size = 1,nowrap = False ):
def print(self,text,color=RED,font=sysfont,size = 1,nowrap = False ):
self.text((self.x,self.y),text,color,sysfont,size,False)
# @micropython.native
def text( self, aPos, aString, aColor, aFont, aSize = 1, nowrap = False ) :
@ -204,9 +204,7 @@ class TFT(object) :
self.y += aFont["Height"] * wh[1] + 1
def reset_pos(self):
self.x = 0
self.y = 0
# @micropython.native
def char( self, aPos, aChar, aColor, aFont, aSizes ) :
'''Draw a character at the given position using the given font and color.
@ -292,8 +290,7 @@ class TFT(object) :
e -= dy
e += dx
py += iny
self.y = py
self.x = x
# @micropython.native
def vline( self, aStart, aLen, aColor ) :
'''Draw a vertical line from aStart for aLen. aLen may be negative.'''

View file

@ -77,6 +77,7 @@ def splash():
def start_view(state, rotary):
display.set_pos(0,0)
<<<<<<< HEAD
text="Spin Coater"
display.print(text,size=2)
@ -95,21 +96,50 @@ def draw_edit_menu(state, rotary):
display.print("Coating time:")
display.print("{: >{w}} sec".format(config["coating_time"],w=2))
display.reset_pos()
=======
text="Spin Coater\n"
#display.set_font(tt14)
text += "> " if rotary.value() == 0 else " "
text+="Edit\n"
text+= "> " if rotary.value() == 1 else " "
text+= "Start\n"
display.print(text)
#print(rotary.value())
def draw_edit_menu(state, rotary):
display.text("Deposit speed:", 0, 0, 1)
display.text("{: >{w}} RPM".format(config["deposit_rpm"], w=5), 56, 10, 1)
display.text("Coating speed:", 0, 21, 1)
display.text("{: >{w}} RPM".format(config["coating_rpm"], w=5), 56, 31, 1)
display.text("Coating time:", 0, 42, 1)
display.text("{: >{w}} sec".format(config["coating_time"], w=5), 56, 52, 1)
>>>>>>> refs/remotes/origin/main
def edit_deposit_view(state, rotary):
config["deposit_rpm"] = rotary.value() * 100
draw_edit_menu(state, rotary)
<<<<<<< HEAD
=======
display.text(">", 40, 10, 1)
>>>>>>> refs/remotes/origin/main
def edit_coating_rpm_view(state, rotary):
config["coating_rpm"] = rotary.value() * 100
<<<<<<< HEAD
draw_edit_menu(state, rotary)
=======
draw_edit_menu(state, rotary)
display.text(">", 40, 32, 1)
>>>>>>> refs/remotes/origin/main
def edit_coating_time_view(state, rotary):
config["coating_time"] = rotary.value()
draw_edit_menu(state, rotary)
<<<<<<< HEAD
def draw_rpm(rpm):
@ -129,6 +159,28 @@ def coating_view(state, rotary):
display.text("Coating")
draw_rpm(state["rpm"])
display.text("{: >{w}} sec".format(state["timer"], w=4))
=======
display.text(">", 40, 54, 1)
def draw_rpm(rpm):
display.text("RPM:{: >{w}.0f}".format(rpm, w=5), 30, 27, 1)
def deposit_view(state, rotary):
display.fill_rect(0, 0, 127, 14, 1)
display.text("Deposit", 36, 3, 0)
draw_rpm(state["rpm"])
display.text("Press to", 32, 42, 1)
display.text("continue", 32, 52, 1)
def coating_view(state, rotary):
display.fill_rect(0, 0, 127, 14, 1)
display.text("Coating", 36, 3, 0)
draw_rpm(state["rpm"])
display.text("{: >{w}} sec".format(state["timer"], w=4), 30, 48, 1)
>>>>>>> refs/remotes/origin/main
def decode_ESC_telemetry(data, motor_poles=14):
@ -166,7 +218,11 @@ async def update_display():
while True:
display.fill(color565(0,0,0))
state["view"](state, rotary)
<<<<<<< HEAD
# display.show()
=======
display.show()
>>>>>>> refs/remotes/origin/main
await uasyncio.sleep_ms(33)
@ -306,7 +362,10 @@ def save_config():
global config
with open("config.json", "w") as f:
json.dump(config, f)
<<<<<<< HEAD
=======
>>>>>>> refs/remotes/origin/main
@ -314,8 +373,12 @@ text = 'Now is the time for all good men to come to the aid of the party.'
power = Pin(m5stack.TFT_LED_PIN, Pin.OUT)
power.value(1)
<<<<<<< HEAD
timer1 = Timer(1)
timer2 = Timer(2)
=======
>>>>>>> refs/remotes/origin/main
# No need to change the software. It's just a matter of different names.. Use this translation:
# SDO(MISO) <not used>
@ -344,7 +407,10 @@ spi = SPI(
# h=128,
# r=5)
tft = TFT(spi,m5stack.TFT_DC_PIN,m5stack.TFT_RST_PIN,m5stack.TFT_CS_PIN)
<<<<<<< HEAD
display = tft
=======
>>>>>>> refs/remotes/origin/main
tft.initr()
tft.rgb(True)
#tftprinttest()
@ -366,6 +432,7 @@ state = {
"timer": 0,
"rotary_val":-1
}
<<<<<<< HEAD
with open("config.json", "r") as f:
config = json.load(f)
#display.erase()
@ -380,6 +447,20 @@ splash()
event_loop = uasyncio.get_event_loop()
event_loop.create_task(update_display())
=======
#display.erase()
#display.set_pos(0,0)
#display.set_font(tt32)
tft.fill(TFT.BLACK)
splash()
# for ff in fonts:
# display.set_font(ff)
# display.print(text)
event_loop = uasyncio.get_event_loop()
event_loop.create_task(update_display())
>>>>>>> refs/remotes/origin/main
#event_loop.create_task(update_motor())
event_loop.run_forever()