瀏覽代碼

rotation animation

master
Flo Smilari 3 年之前
父節點
當前提交
a4edd471d3
共有 5 個檔案被更改,包括 117 行新增22 行删除
  1. 54
    2
      Display.cpp
  2. 3
    0
      Display.h
  3. 9
    10
      images/NullingBitmap.h
  4. 50
    9
      images/RotateBitmap.h
  5. 1
    1
      sloeber.ino.cpp

+ 54
- 2
Display.cpp 查看文件

ssd1306 = Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT); ssd1306 = Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT);
u8g2_gfx.begin(ssd1306); u8g2_gfx.begin(ssd1306);
wlsConnected = false; wlsConnected = false;
angle = 0;
starttime = millis();
} }
/****************** /******************
void Display::showFrame(Status status) { void Display::showFrame(Status status) {
switch (status) { switch (status) {
case MOVING_ELEVATOR: case MOVING_ELEVATOR:
drawBitmap((37 - imageSide_R) / 2, 30, imageSide_R, imageSide_R, epd_bitmap_Rotate);
drawBitmap((37 - imageSide_R) / 2, 47, imageSide_R, imageSide_R, epd_bitmap_Dive);
rotateAndDrawRotationBitmap();
drawBitmap((37 - imageSide_R) / 2, 47, imageSide_D, imageSide_D, epd_bitmap_Dive);
break; break;
case TOOL_CHANGE: case TOOL_CHANGE:
redrawFrame(); redrawFrame();
ssd1306.drawLine(0, 15, 37, 15, SSD1306_WHITE); ssd1306.drawLine(0, 15, 37, 15, SSD1306_WHITE);
drawWLSStatus(); drawWLSStatus();
} }
void Display::rotateAndDrawRotationBitmap() {
if (millis() - starttime >= 125) {
int xOffset = 0;
int yOffset = 0;
switch (angle) {
case 0:
xOffset = imageSide_R / 2;
yOffset = 0;
break;
case 1:
xOffset = imageSide_R / 2;
yOffset = imageSide_R / 4;
break;
case 2:
xOffset = imageSide_R / 2;
yOffset = imageSide_R / 2;
break;
case 3:
xOffset = imageSide_R / 4;
yOffset = imageSide_R / 2;
break;
case 4:
xOffset = 0;
yOffset = imageSide_R / 2;
break;
case 5:
xOffset = 0;
yOffset = imageSide_R / 4;
break;
case 6:
xOffset = 0;
yOffset = 0;
break;
case 7:
xOffset = imageSide_R / 4;
yOffset = 0;
break;
default:
break;
}
ssd1306.fillRect((37 - imageSide_R) / 2 + xOffset, 30 + yOffset, imageSide_R / 2 + 1, imageSide_R / 2 + 1, SSD1306_BLACK);
ssd1306.display();
drawBitmap((37 - imageSide_R) / 2, 30, imageSide_R, imageSide_R, epd_rotate_bitmap_allArray[angle]);
angle = (angle + 1) % 8;
starttime = millis();
}
}

+ 3
- 0
Display.h 查看文件

String configText; String configText;
String configOption; String configOption;
bool wlsConnected; bool wlsConnected;
int angle;
unsigned long starttime;
void drawStatusText(String txt); void drawStatusText(String txt);
void drawBitmap(int x, int y, int w, int h, const uint8_t bitmap[]); void drawBitmap(int x, int y, int w, int h, const uint8_t bitmap[]);
void redrawFrame(); void redrawFrame();
void drawWLSStatus(); void drawWLSStatus();
void rotateAndDrawRotationBitmap();
public: public:
Display(); Display();

+ 9
- 10
images/NullingBitmap.h 查看文件

// 'Nulling', 60x60px // 'Nulling', 60x60px
const unsigned char epd_bitmap_Nulling [] PROGMEM = { const unsigned char epd_bitmap_Nulling [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x07, 0xf8, 0x01, 0xfe, 0x00, 0x7f, 0xee, 0x00, 0x0f, 0xfc, 0x03, 0xff, 0x00, 0x7f, 0xee, 0x00, 0x07, 0xf8, 0x01, 0xfe, 0x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ee, 0x00, 0x3c, 0x0f, 0x0f, 0x03, 0xc0, 0x00, 0x0e, 0x00, 0x3c, 0x0f, 0x0f, 0x03, 0xc0, 0x07, 0xee, 0x00,
0x1e, 0x0e, 0x07, 0x83, 0x80, 0x07, 0xee, 0x00, 0x1e, 0x1e, 0x07, 0x87, 0x80, 0x00, 0x0e, 0x00, 0x1e, 0x0e, 0x07, 0x83, 0x80, 0x07, 0xee, 0x00, 0x1e, 0x1e, 0x07, 0x87, 0x80, 0x00, 0x0e, 0x00,
0x1f, 0x3e, 0xf7, 0xcf, 0x80, 0x00, 0x0e, 0x00, 0x0f, 0xfc, 0xf3, 0xff, 0x00, 0x07, 0xee, 0x00,
0x07, 0xf8, 0xf1, 0xfe, 0x00, 0x07, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00,
0x1f, 0xfe, 0xf7, 0xff, 0x80, 0x00, 0x0e, 0x00, 0x0f, 0xfc, 0xf3, 0xff, 0x00, 0x07, 0xee, 0x00,
0x07, 0xf8, 0xf1, 0xfe, 0x00, 0x07, 0xee, 0x00, 0x03, 0xf0, 0xf0, 0xfc, 0x00, 0x00, 0x0e, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xee, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xee, 0x00, 0x00, 0x1f, 0xff, 0x80, 0x00, 0x7f, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xee, 0x00, 0x00, 0x1f, 0xff, 0x80, 0x00, 0x7f, 0xee, 0x00,
0x00, 0x1f, 0xff, 0x80, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x1f, 0xff, 0x80, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x1f, 0xff, 0x80, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x1f, 0xff, 0x80, 0x00, 0x00, 0x0e, 0x00,
0x00, 0x1c, 0x03, 0x80, 0x00, 0x07, 0xee, 0x00, 0x00, 0x1c, 0x03, 0x80, 0x00, 0x07, 0xee, 0x00, 0x00, 0x1c, 0x03, 0x80, 0x00, 0x07, 0xee, 0x00, 0x00, 0x1c, 0x03, 0x80, 0x00, 0x07, 0xee, 0x00,
0x00, 0x1c, 0x03, 0x80, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x1c, 0x03, 0x80, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x1c, 0x03, 0x80, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x1c, 0x03, 0x80, 0x00, 0x00, 0x0e, 0x00,
0x07, 0xfc, 0x03, 0xfe, 0x00, 0x07, 0xee, 0x00, 0x07, 0xfc, 0x03, 0xfe, 0x00, 0x07, 0xee, 0x00, 0x07, 0xfc, 0x03, 0xfe, 0x00, 0x07, 0xee, 0x00, 0x07, 0xfc, 0x03, 0xfe, 0x00, 0x07, 0xee, 0x00,
0x07, 0xf8, 0x01, 0xfe, 0x00, 0x00, 0x0e, 0x00, 0x03, 0xe0, 0x00, 0x7c, 0x00, 0x00, 0x0e, 0x00,
0x01, 0xf0, 0x00, 0xf8, 0x00, 0x07, 0xee, 0x00, 0x00, 0x78, 0x01, 0xf0, 0x00, 0x07, 0xee, 0x00,
0x00, 0x3c, 0x03, 0xe0, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x1e, 0x07, 0x80, 0x00, 0x00, 0x0e, 0x00,
0x03, 0xfc, 0x03, 0xfc, 0x00, 0x00, 0x0e, 0x00, 0x01, 0xe0, 0x00, 0x78, 0x00, 0x00, 0x0e, 0x00,
0x00, 0xf0, 0x00, 0xf0, 0x00, 0x07, 0xee, 0x00, 0x00, 0x78, 0x01, 0xe0, 0x00, 0x07, 0xee, 0x00,
0x00, 0x3c, 0x03, 0xc0, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x1e, 0x07, 0x80, 0x00, 0x00, 0x0e, 0x00,
0x00, 0x0f, 0x0f, 0x00, 0x00, 0x7f, 0xee, 0x00, 0x00, 0x07, 0x9e, 0x00, 0x00, 0x7f, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x7f, 0xee, 0x00, 0x00, 0x07, 0x9e, 0x00, 0x00, 0x7f, 0xee, 0x00,
0x00, 0x03, 0xfc, 0x00, 0x00, 0x7f, 0xee, 0x00, 0x00, 0x01, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfc, 0x00, 0x00, 0x7f, 0xee, 0x00, 0x00, 0x01, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 496) // Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 496)
//const int epd_bitmap_allArray_LEN = 1; //const int epd_bitmap_allArray_LEN = 1;
//const unsigned char* epd_bitmap_allArray[1] = {
// epd_bitmap_Nulling
//const unsigned char *epd_bitmap_allArray[1] = {
// epd_bitmap_Nulling
//}; //};
#endif /* IMAGES_NULLINGBITMAP_H_ */ #endif /* IMAGES_NULLINGBITMAP_H_ */

+ 50
- 9
images/RotateBitmap.h 查看文件

* Created on: 14.02.2022 * Created on: 14.02.2022
* Author: FSmilari * Author: FSmilari
*/ */
#ifndef IMAGES_ROTATEBITMAP_H_ #ifndef IMAGES_ROTATEBITMAP_H_
#define IMAGES_ROTATEBITMAP_H_ #define IMAGES_ROTATEBITMAP_H_
#define imageSide_R 15 #define imageSide_R 15
// 'Rotate', 15x15px // 'Rotate', 15x15px
const unsigned char epd_bitmap_Rotate [] PROGMEM = {
0x07, 0xc4, 0x1f, 0xf4, 0x38, 0x3c, 0x70, 0x1c, 0x60, 0x7c, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x06,
0x00, 0x06, 0x00, 0x06, 0x7c, 0x0c, 0x70, 0x1c, 0x78, 0x38, 0x5f, 0xf0, 0x47, 0xc0
const unsigned char epd_bitmap_Rotate_0 [] PROGMEM = {
0x07, 0xc0, 0x1f, 0xf0, 0x3e, 0x38, 0x7e, 0x0c, 0x7e, 0x0c, 0xfe, 0x06, 0xfe, 0x06, 0xfe, 0x06,
0xff, 0xfe, 0xff, 0xfe, 0x7f, 0xfc, 0x7f, 0xfc, 0x3f, 0xf8, 0x1f, 0xf0, 0x07, 0xc0
}; };
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 48)
//const int epd_bitmap_allArray_LEN = 1;
//const unsigned char* epd_bitmap_allArray[1] = {
// epd_bitmap_Rotate
//};
const unsigned char epd_bitmap_Rotate_45 [] PROGMEM = {
0x07, 0xc0, 0x1f, 0xf0, 0x3f, 0xf8, 0x7f, 0xec, 0x7f, 0xcc, 0xff, 0x86, 0xff, 0x06, 0xfe, 0x06,
0xff, 0x06, 0xff, 0x86, 0x7f, 0xcc, 0x7f, 0xec, 0x3f, 0xf8, 0x1f, 0xf0, 0x07, 0xc0
};
const unsigned char epd_bitmap_Rotate_90 [] PROGMEM = {
0x07, 0xc0, 0x1f, 0xf0, 0x3f, 0xf8, 0x7f, 0xfc, 0x7f, 0xfc, 0xff, 0xfe, 0xff, 0xfe, 0xfe, 0x06,
0xfe, 0x06, 0xfe, 0x06, 0x7e, 0x0c, 0x7e, 0x0c, 0x3e, 0x38, 0x1f, 0xf0, 0x07, 0xc0
};
const unsigned char epd_bitmap_Rotate_135 [] PROGMEM = {
0x07, 0xc0, 0x1f, 0xf0, 0x3f, 0xf8, 0x7f, 0xfc, 0x7f, 0xfc, 0xff, 0xfe, 0xff, 0xfe, 0xfe, 0xfe,
0xfc, 0x7e, 0xf8, 0x3e, 0x70, 0x1c, 0x60, 0x0c, 0x38, 0x38, 0x1f, 0xf0, 0x07, 0xc0
};
const unsigned char epd_bitmap_Rotate_180 [] PROGMEM = {
0x07, 0xc0, 0x1f, 0xf0, 0x3f, 0xf8, 0x7f, 0xfc, 0x7f, 0xfc, 0xff, 0xfe, 0xff, 0xfe, 0xc0, 0xfe,
0xc0, 0xfe, 0xc0, 0xfe, 0x60, 0xfc, 0x60, 0xfc, 0x38, 0xf8, 0x1f, 0xf0, 0x07, 0xc0
};
const unsigned char epd_bitmap_Rotate_225 [] PROGMEM = {
0x07, 0xc0, 0x1f, 0xf0, 0x3f, 0xf8, 0x6f, 0xfc, 0x67, 0xfc, 0xc3, 0xfe, 0xc1, 0xfe, 0xc0, 0xfe,
0xc1, 0xfe, 0xc3, 0xfe, 0x67, 0xfc, 0x6f, 0xfc, 0x3f, 0xf8, 0x1f, 0xf0, 0x07, 0xc0
};
const unsigned char epd_bitmap_Rotate_270 [] PROGMEM = {
0x07, 0xc0, 0x1f, 0xf0, 0x38, 0xf8, 0x60, 0xfc, 0x60, 0xfc, 0xc0, 0xfe, 0xc0, 0xfe, 0xc0, 0xfe,
0xff, 0xfe, 0xff, 0xfe, 0x7f, 0xfc, 0x7f, 0xfc, 0x3f, 0xf8, 0x1f, 0xf0, 0x07, 0xc0
};
const unsigned char epd_bitmap_Rotate_315 [] PROGMEM = {
0x07, 0xc0, 0x1f, 0xf0, 0x38, 0x38, 0x60, 0x0c, 0x70, 0x1c, 0xf8, 0x3e, 0xfc, 0x7e, 0xfe, 0xfe,
0xff, 0xfe, 0xff, 0xfe, 0x7f, 0xfc, 0x7f, 0xfc, 0x3f, 0xf8, 0x1f, 0xf0, 0x07, 0xc0
};
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 48)
const int epd_rotate_bitmap_allArray_LEN = 8;
const static unsigned char *epd_rotate_bitmap_allArray[epd_rotate_bitmap_allArray_LEN] = {
epd_bitmap_Rotate_0,
epd_bitmap_Rotate_45,
epd_bitmap_Rotate_90,
epd_bitmap_Rotate_135,
epd_bitmap_Rotate_180,
epd_bitmap_Rotate_225,
epd_bitmap_Rotate_270,
epd_bitmap_Rotate_315
};
#endif /* IMAGES_ROTATEBITMAP_H_ */ #endif /* IMAGES_ROTATEBITMAP_H_ */

+ 1
- 1
sloeber.ino.cpp 查看文件

//This is a automatic generated file //This is a automatic generated file
//Please do not modify this file //Please do not modify this file
//If you touch this file your change will be overwritten during the next build //If you touch this file your change will be overwritten during the next build
//This file has been generated on 2022-02-14 19:37:01
//This file has been generated on 2022-02-15 23:07:21


#include "Arduino.h" #include "Arduino.h"
#include <Arduino.h> #include <Arduino.h>

Loading…
取消
儲存