Browse Source

Update test func to use redraw signal

master
Adam Pippin 4 years ago
parent
commit
f03e6f327c
  1. 36
      watchos.ino

36
watchos.ino

@ -5,19 +5,14 @@
#include "PowerManagement.h" #include "PowerManagement.h"
#include "UserInput.h" #include "UserInput.h"
#include "Clock.h"
int count = 0; int count = 0;
int test_func(int pid, unsigned int signal) int test_func(int pid, unsigned int signal)
{ {
M5.Lcd.fillScreen(TFT_DARKGREY);
M5.Lcd.setTextColor(TFT_WHITE, TFT_DARKGREY);
M5.Lcd.setCursor(0, 0);
if (signal & SIGNAL_START) if (signal & SIGNAL_START)
{ {
M5.Lcd.setRotation(3); Kernel_signal_mask(pid, SIGNAL_START | SIGNAL_STOP | SIGNAL_TICK | SIGNAL_REDRAW);
M5.Lcd.print("Initializing...");
M5.Lcd.setCursor(0, 15);
if (EAT_allocate(1, 2)) if (EAT_allocate(1, 2))
{ {
EAT_write(1, 0, 0); EAT_write(1, 0, 0);
@ -33,29 +28,25 @@ int test_func(int pid, unsigned int signal)
if ((signal & SIGNAL_STOP)) // || count == 5) if ((signal & SIGNAL_STOP)) // || count == 5)
{ {
M5.Lcd.print("Stopping");
EAT_write(1, 0, count & 0xFF); EAT_write(1, 0, count & 0xFF);
EAT_write(1, 1, (count >> 8) & 0xFF); EAT_write(1, 1, (count >> 8) & 0xFF);
return 255; return 255;
} }
if (signal & SIGNAL_TICK && (signal & SIGNAL_INPUT_A) == 0 && (signal & SIGNAL_INPUT_B) ==0) if ((signal & SIGNAL_TICK) && (signal & SIGNAL_INPUT_A) == 0 && (signal & SIGNAL_INPUT_B) == 0)
{ {
count++; count++;
M5.Lcd.print("Ran: "); Kernel_signal(SIGNAL_REDRAW);
M5.Lcd.print(String(count));
M5.Lcd.print(" times");
} }
if (signal & SIGNAL_INPUT_A) if (signal & SIGNAL_REDRAW)
{ {
M5.Lcd.print("Input A!"); M5.Lcd.setCursor(0, 0);
M5.Lcd.print("Ran: ");
M5.Lcd.print(String(count));
M5.Lcd.print(" times");
} }
if (signal & SIGNAL_INPUT_B)
{
M5.Lcd.print("Input B!");
}
return 0; return 0;
} }
@ -65,7 +56,8 @@ void setup()
Kernel_setup(); Kernel_setup();
Kernel_start(&PowerManagement, 1000); Kernel_start(&PowerManagement, 1000);
Kernel_start(&UserInput, 0); Kernel_start(&UserInput, 0);
Kernel_start(&test_func, 1000); //Kernel_start(&test_func, 5000);
Kernel_start(&Clock, 1000);
M5.update(); M5.update();
if (M5.BtnB.isPressed()) if (M5.BtnB.isPressed())
@ -76,6 +68,10 @@ void setup()
{ {
EAT_load(); EAT_load();
} }
M5.Lcd.fillScreen(TFT_DARKGREY);
M5.Lcd.setRotation(3);
M5.Lcd.setTextColor(TFT_WHITE, TFT_DARKGREY);
} }
void loop() void loop()

Loading…
Cancel
Save