代码拉取完成,页面将自动刷新
同步操作将从 mingyee/Arduino_ESP32_LyricBox 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "stdio.h"
#include "string.h"
#include "data_transfer.h"
NS_DT_BEGIN
const uint8_t matrix_transf[256] = {//列扫描矩阵
0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152,160,168,176,184,192,200,208,216,224,232,240,248,
1,9,17,25,33,41,49,57,65,73,81,89,97,105,113,121,129,137,145,153,161,169,177,185,193,201,209,217,225,233,241,249,
2,10,18,26,34,42,50,58,66,74,82,90,98,106,114,122,130,138,146,154,162,170,178,186,194,202,210,218,226,234,242,250,
3,11,19,27,35,43,51,59,67,75,83,91,99,107,115,123,131,139,147,155,163,171,179,187,195,203,211,219,227,235,243,251,
4,12,20,28,36,44,52,60,68,76,84,92,100,108,116,124,132,140,148,156,164,172,180,188,196,204,212,220,228,236,244,252,
5,13,21,29,37,45,53,61,69,77,85,93,101,109,117,125,133,141,149,157,165,173,181,189,197,205,213,221,229,237,245,253,
6,14,22,30,38,46,54,62,70,78,86,94,102,110,118,126,134,142,150,158,166,174,182,190,198,206,214,222,230,238,246,254,
7,15,23,31,39,47,55,63,71,79,87,95,103,111,119,127,135,143,151,159,167,175,183,191,199,207,215,223,231,239,247,255
};
const uint8_t matrix_transf2[256] = {//行矩阵扫描
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
};
const uint8_t matrix_transf3[64] = {//列扫描矩阵8x8
0,8,16,24,32,40,48,56,
1,9,17,25,33,41,49,57,
2,10,18,26,34,42,50,58,
3,11,19,27,35,43,51,59,
4,12,20,28,36,44,52,60,
5,13,21,29,37,45,53,61,
6,14,22,30,38,46,54,62,
7,15,23,31,39,47,55,63
};
const uint8_t matrix_transf4[64] = {//竖向8x8
56, 57, 58, 59, 60, 61, 62, 63,
48, 49, 50, 51, 52, 53, 54, 55,
40, 41, 42, 43, 44, 45, 46, 47,
32, 33, 34, 35, 36, 37, 38, 39,
24, 25, 26, 27, 28, 29, 30, 31,
16, 17, 18, 19, 20, 21, 22, 23,
8, 9, 10, 11, 12, 13, 14, 15,
0, 1, 2, 3, 4, 5, 6, 7
};
const uint8_t matrix_transf5[64] = {//竖向8x8
7, 15 ,23, 31, 39, 47, 55, 63,
6, 14 ,22, 30, 38, 46, 54, 62,
5, 13 ,21, 29, 37, 45, 53, 61,
4, 12 ,20, 28, 36, 44, 52, 60,
3, 11 ,19, 27, 35, 43, 51, 59,
2, 10 ,18, 26, 34, 42, 50, 58,
1, 9 ,17, 25, 33, 41, 49, 57,
0, 8 ,16, 24, 32, 40, 48, 56
};
void matrix_icon_transf(DTRGB *pbitmap,const uint8_t *img,uint16_t points)
{
uint16_t i = 0;
if(points == (8*8)){
for(i=0;i<points;i++){
pbitmap[i].red = img[matrix_transf3[i]*3];
pbitmap[i].green = img[matrix_transf3[i]*3+1];
pbitmap[i].blue = img[matrix_transf3[i]*3+2];
}
}else if(points == (32*8)){
for(i=0;i<points;i++){
pbitmap[i].red = img[matrix_transf[i]*3];
pbitmap[i].green = img[matrix_transf[i]*3+1];
pbitmap[i].blue = img[matrix_transf[i]*3+2];
}
}
}
void matrix_icon_transf_dark(DTRGB *pbitmap,const uint8_t *img,uint16_t points)
{
uint16_t i = 0;
if(points == (8*8)){
for(i=0;i<points;i++){
pbitmap[i].red = img[matrix_transf3[i]*3]/2;
pbitmap[i].green = img[matrix_transf3[i]*3+1]/2;
pbitmap[i].blue = img[matrix_transf3[i]*3+2]/2;
}
}else if(points == (32*8)){
for(i=0;i<points;i++){
pbitmap[i].red = img[matrix_transf[i]*3];
pbitmap[i].green = img[matrix_transf[i]*3+1];
pbitmap[i].blue = img[matrix_transf[i]*3+2];
}
}
}
void matrix_icon_transf1(DTRGB *pbitmap,const uint8_t *img,uint16_t points)
{
uint16_t i = 0;
if(points == (8*8)){
for(i=0;i<points;i++){
pbitmap[i].red = img[matrix_transf4[i]*3];
pbitmap[i].green = img[matrix_transf4[i]*3+1];
pbitmap[i].blue = img[matrix_transf4[i]*3+2];
}
}else if(points == (32*8)){
for(i=0;i<points;i++){
pbitmap[i].red = img[i*3];
pbitmap[i].green = img[i*3+1];
pbitmap[i].blue = img[i*3+2];
}
}
}
void matrix_icon_transf2(DTRGB *pbitmapB,uint16_t points)
{
uint16_t i = 0;
DTRGB pbitmapA[points];
if(points == (8*8)){
for(i=0;i<points;i++){
pbitmapA[i].red = pbitmapB[matrix_transf5[i]].red;
pbitmapA[i].green = pbitmapB[matrix_transf5[i]].green;
pbitmapA[i].blue = pbitmapB[matrix_transf5[i]].blue;
}
}else if(points == (32*8)){
for(i=0;i<points;i++){
pbitmapA[i].red = pbitmapB[i].red;
pbitmapA[i].green = pbitmapB[i].green;
pbitmapA[i].blue = pbitmapB[i].blue;
}
}
for(i=0;i<points;i++){
pbitmapB[i].red = pbitmapA[i].red;
pbitmapB[i].green = pbitmapA[i].green;
pbitmapB[i].blue = pbitmapA[i].blue;
}
}
uint8_t MaigicPixelsCenterPose(char *pdata,int follows)
{
uint8_t nums = 0;
uint8_t cntflag = 0;
uint8_t center_pose = 0;
uint8_t total_pixel = 0;
//1)将粉丝数打包成字符串
if(follows < 10){
pdata[0] = follows/10 + '0';
pdata[1] = follows%10 + '0';
pdata[2] = 0;
cntflag = 1;
}else if(follows < 10000){
sprintf(pdata,"%d",follows);
cntflag = 1;
}else if(follows < 10000000){
sprintf(pdata,"%d.%d",follows/10000,follows%10000/1000);
cntflag = 2;
}else if(follows < 100000000){
sprintf(pdata,"%d",follows/10000);
cntflag = 2;
}else{
follows = 99999999;
sprintf(pdata,"%d",follows/10000);
cntflag = 2;
}
nums = strlen(pdata);
//2)根据字符串长度计算中心坐标
if(nums < 1){
center_pose = 9;
return center_pose;
}
if(cntflag == 1){
if(nums <= 6){
total_pixel = nums*3+(nums-1);
center_pose = 8+(24-total_pixel)/2;
}else{
center_pose = 9;
}
}else if(cntflag == 2){
if(nums <= 5){
total_pixel = nums*3+(nums-1);
center_pose = 9+(18-total_pixel)/2;
}else{
center_pose = 9;
}
}
return center_pose;
}
NS_DT_END
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。