更新DeerESP中文版代码

This commit is contained in:
Easy 2022-02-17 17:53:54 +08:00
parent a3cc2f4fd3
commit ec2a968aae
23 changed files with 20249 additions and 6 deletions

View File

@ -4,13 +4,13 @@ PushDeer是一个可以自行架设的无APP推送服务。
**🔥 PushDeer支持推送消息到智能设备了**
👉[点此查看如何将消息推送到成本35元左右的自制设备上](other_devices/README.md)
👉[点此查看如何将消息推送到成本35元左右的自制设备上](iot/README.md)
||||
|-|-|-|
|[👨🏻‍🏫 教程](other_devices/README.md)|[⌨️ 源码](other_devices/deeresp/)|[📼 演示视频,可以听到提示音♪](https://weibo.com/1088413295/LfJtvDx6K?type=comment)|
|[👨🏻‍🏫 教程](iot/README.md)|[⌨️ 源码](iot/deeresp/)|[📼 演示视频,可以听到提示音♪](https://weibo.com/1088413295/LfJtvDx6K?type=comment)|
![](other_devices/image/deeresp.gif)
![](iot/image/deeresp.gif)
[🐙🐱 GitHub仓库](https://github.com/easychen/pushdeer) [🔮 中国大陆镜像仓库@Gitee](https://gitee.com/easychen/pushdeer)

View File

@ -251,7 +251,8 @@ docker-compose -f docker-compose.self-hosted.yml up --build -d
|text|推送消息内容|
|type|格式,选填|文本=textmarkdown图片=image默认为markdown|
> ⚠️ 推送中文会显示乱码,这是因为没有中文字库,稍后优化
> ⚠️ 图片只能为256*256的JPG否则显示会出问题
> ⚠️ 中文字库字库只有2000字部分文字会乱码
> type 为 text 时,且 text 中包含 `♪` 字符时,蜂鸣器会发声
> type 为 image 时text 中为要发送图片的URL

38
iot/deeresp/RoboFile.php Normal file
View File

@ -0,0 +1,38 @@
<?php
/**
* This is project's console commands configuration for Robo task runner.
*
* @see http://robo.li/
*/
class RoboFile extends \Robo\Tasks
{
// define public methods as commands
public function text2hex()
{
$chars = utf8Split(file_get_contents('font.txt'));
$chars = array_unique($chars);
foreach ($chars as $char) {
if (strlen($char) > 0) {
echo '0x'.dechex(uniord($char)).',';
}
// break;
}
}
}
function utf8Split($str, $len = 1)
{
$arr = array();
$strLen = mb_strlen($str, 'UTF-8');
for ($i = 0; $i < $strLen; $i++) {
$arr[] = mb_substr($str, $i, $len, 'UTF-8');
}
return $arr;
}
function uniord($u)
{
$k = mb_convert_encoding($u, 'UCS-2LE', 'UTF-8');
$k1 = ord(substr($k, 0, 1));
$k2 = ord(substr($k, 1, 1));
return $k2 * 256 + $k1;
}

20131
iot/deeresp/cubic_12.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@ EspMQTTClient mclient(
MQTT_CLIENT_NAME,
MQTT_PORT
);
#include "cubic_12.h"
#include "SPI.h"
#include <TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI();
@ -74,10 +74,29 @@ void onConnectionEstablished()
if(payload.indexOf("") >= 0) tone(BEEP_PIN, 1000, 100);
tft.loadFont(cubic_11);
if( payload.length() > 80 ) tft.setTextSize(1);
else tft.setTextSize(2);
tft.setTextColor(0xFFFF,0x0000);tft.setCursor(0, 0, 1);tft.println(payload);
char *found;
short line = 0;
int base = 5;
int now_base = 0;
char * payloads = const_cast<char*> ( payload.c_str() );
while( (found = strsep( &payloads , "\n" ) ) != NULL )
{
now_base = base + line*14;
tft.setTextColor(0x0000);tft.setCursor(base+1, now_base+1);tft.println(found);
tft.setTextColor(0x0000);tft.setCursor(base+2, now_base+2);tft.println(found);
tft.setTextColor(0xFFFF);tft.setCursor(base, now_base);tft.println(found);
line++;
}
tft.unloadFont();
});
mclient.subscribe(String(MQTT_TOPIC)+"_bg_url", [] (const String &payload)

1
iot/deeresp/font.hex.txt Normal file

File diff suppressed because one or more lines are too long

17
iot/deeresp/font.txt Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,36 @@
.dash-box
{
width:256px;
height:256px!important;
}
.dash-box .dash-item
{
max-width:100%!important;
max-height:100%!important;
width:calc( 100% - 10px );
height: calc( 100% - 10px );
justify-content: center;
background-color: hsla(0,0%,100%,.0);
}
.dash-box .dash-item .title
{
font-size:24px;
font-family:"Cubic 11";
font-weight:bold;
position: absolute;
bottom: 10px;
right:10px;
color:white;
text-shadow:2px 2px black;
}
.dash-box .dash-item .value
{
font-size:48px;
color:white;
text-shadow:2px 2px black;
padding-top:80px;
}

View File

Before

Width:  |  Height:  |  Size: 864 KiB

After

Width:  |  Height:  |  Size: 864 KiB

View File

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

View File

Before

Width:  |  Height:  |  Size: 497 KiB

After

Width:  |  Height:  |  Size: 497 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

View File

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

Before

Width:  |  Height:  |  Size: 388 KiB

After

Width:  |  Height:  |  Size: 388 KiB

View File

Before

Width:  |  Height:  |  Size: 529 KiB

After

Width:  |  Height:  |  Size: 529 KiB

View File

Before

Width:  |  Height:  |  Size: 326 KiB

After

Width:  |  Height:  |  Size: 326 KiB

View File

Before

Width:  |  Height:  |  Size: 494 KiB

After

Width:  |  Height:  |  Size: 494 KiB

View File

Before

Width:  |  Height:  |  Size: 771 KiB

After

Width:  |  Height:  |  Size: 771 KiB

View File

Before

Width:  |  Height:  |  Size: 458 KiB

After

Width:  |  Height:  |  Size: 458 KiB

View File

Before

Width:  |  Height:  |  Size: 957 KiB

After

Width:  |  Height:  |  Size: 957 KiB

BIN
iot/image/deeresp.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB