Finalisation gestion d'icones dans l'écran de veille.
Correction fonctions de gestion des icones. Ajout et modification des bitmaps d'icones. Ajout fonction de changement d'icone en cours de déroulement.
This commit is contained in:
@@ -32,6 +32,8 @@
|
||||
- return to caller on time out
|
||||
* Sleep mode not stable, forum at :
|
||||
"https://github.com/earlephilhower/arduino-pico/issues/345"
|
||||
-----------------------------------------------------------------------
|
||||
Mod: 2026/05/27 added 2 bitmap to sreen saver
|
||||
-----------------------------------------------------------------------*/
|
||||
#define BUTTONPLUS 14 // PullUp 10K I=.33 mA
|
||||
#define BUTTONMINUS 15 // PullUp 10K I=.33 mA
|
||||
@@ -61,7 +63,7 @@ volatile uint16_t downTime; // count down time
|
||||
volatile uint16_t lastSetTime, lastStepTime, time2save=0;
|
||||
volatile boolean plusPushed=false; volatile boolean minusPushed=false;
|
||||
char sMsg[16];
|
||||
screen_t screen=sTITRE;
|
||||
screen_t screen=sNONE;
|
||||
#include <EEPROM.h>
|
||||
#include "displays.h" // Oled functions & led RGB
|
||||
#include "pt.h" // proto threads
|
||||
@@ -120,7 +122,7 @@ void setup() {
|
||||
lastStepTime=stepTime;
|
||||
showLOGO(greetTime);
|
||||
minusPushed=false; plusPushed=false; // in case button pushed while LOGO
|
||||
ledRGB(GREEN);
|
||||
screen=sTITRE;
|
||||
}
|
||||
void loop() { // CPU 0 dedicated to refresh display
|
||||
// TODO not recall screen if values did not change
|
||||
@@ -328,71 +330,30 @@ static PT_THREAD(pSauve(pt_t *lc)) { //
|
||||
}
|
||||
|
||||
static PT_THREAD(pVeille(pt_t *lc)) { // OK and avoid bounces
|
||||
static int8_t f, icons[FLOCONS][3];
|
||||
PT_BEGIN(lc);
|
||||
PT_WAIT_UNTIL(lc, (screen==sVEILLE));
|
||||
ledRGB(NONE);
|
||||
for(f=0; f< FLOCONS; f++) {
|
||||
icons[f][XPOS] = random(1 - SNOOZE_WIDTH, oled.width());
|
||||
icons[f][YPOS] = -SNOOZE_HEIGHT;
|
||||
icons[f][DELTAY] = random(1, 6);
|
||||
}
|
||||
do {
|
||||
oled.clearDisplay();
|
||||
for(f=0; f< FLOCONS; f++) { // ~ 10 ok for this screen
|
||||
oled.drawBitmap(
|
||||
icons[f][XPOS], icons[f][YPOS], flake_bmp,
|
||||
SNOOZE_WIDTH, SNOOZE_HEIGHT, SSD1306_WHITE);
|
||||
}
|
||||
PT_DELAY(lc, 80);
|
||||
if (!(plusPushed || minusPushed)) {
|
||||
oled.display();
|
||||
PT_DELAY(lc, 80);
|
||||
// Then update coordinates of each icon
|
||||
for(f=0; f< FLOCONS; f++) {
|
||||
icons[f][YPOS] += icons[f][DELTAY];
|
||||
// If snowflake is off the bottom of the screen...
|
||||
if (icons[f][YPOS] >= oled.height()) {
|
||||
// Reinitialize to a random position, just off the top
|
||||
icons[f][XPOS] = random(1 - SNOOZE_WIDTH, oled.width());
|
||||
icons[f][YPOS] = -SNOOZE_HEIGHT;
|
||||
icons[f][DELTAY] = random(1, 6);
|
||||
}
|
||||
//PT_DELAY(lc, 100);
|
||||
} // f=0; f< NUMFLAKES; f++)
|
||||
}
|
||||
} while (!(plusPushed || minusPushed ));
|
||||
minusPushed=false; plusPushed=false;
|
||||
oled.clearDisplay();
|
||||
PT_DELAY(lc, 200);
|
||||
screen=sTITRE; //sCHOIX;//
|
||||
PT_END(lc); // to try: exit & return flag ?
|
||||
}
|
||||
|
||||
#define ICONS 4
|
||||
t_iconMvt icons[ICONS];
|
||||
t_sprite sprite;
|
||||
|
||||
static PT_THREAD(pBugVeille(pt_t *lc)) { // OK and avoid bounces
|
||||
const int nbSprites = 10;
|
||||
static t_iconMvt icons[nbSprites];
|
||||
static t_sprite sprite;
|
||||
static uint16_t nbpass=0;
|
||||
PT_BEGIN(lc);
|
||||
PT_WAIT_UNTIL(lc, (screen==sVEILLE));
|
||||
ledRGB(NONE);
|
||||
|
||||
initSprite(&sprite,ICONS,16,16,0,1,2, flake_bmp, icons); // load values to sprite
|
||||
initSprite(&sprite,nbSprites,16,16, flake_bmp, icons); // load values to sprite
|
||||
do {
|
||||
drawSprite(&sprite, oled);
|
||||
PT_DELAY(lc, 80);
|
||||
drawSprite(&sprite);
|
||||
PT_DELAY(lc, 40);
|
||||
if (!(plusPushed || minusPushed)) {
|
||||
oled.display();
|
||||
PT_DELAY(lc, 80);
|
||||
PT_DELAY(lc, 40);
|
||||
updateSprite(&sprite); // update coordinates of each sprite
|
||||
}
|
||||
nbpass = changeSprite(&sprite, nbpass);
|
||||
} while (!(plusPushed || minusPushed ));
|
||||
|
||||
minusPushed=false; plusPushed=false;
|
||||
oled.clearDisplay();
|
||||
PT_DELAY(lc, 200);
|
||||
screen=sCHOIX;// sTITRE; //
|
||||
screen=sTITRE; // sCHOIX;//
|
||||
PT_END(lc); // to try: exit & return flag ?
|
||||
}
|
||||
|
||||
@@ -408,7 +369,6 @@ void loop1() { // CPU 1 dedicated to run threads
|
||||
pDuree (&pDUREE); // process screen DUREE
|
||||
pSauve (&pSAUVE); // process screen SAUVE
|
||||
pVeille(&pVEILLE); // process screen saver
|
||||
|
||||
}
|
||||
/*
|
||||
* code debug
|
||||
|
||||
Reference in New Issue
Block a user