33 Commits

Author SHA1 Message Date
AlexGyver 6c91bf4e80 Update library.properties
2.1.1
2024-04-11 16:55:23 +03:00
AlexGyver 102beca9f5 edit badge 2024-04-11 16:38:21 +03:00
AlexGyver c4a9822af4 english readme 2023-12-22 23:51:58 +03:00
AlexGyver b7b2f840da english readme 2023-12-22 23:49:46 +03:00
AlexGyver f0a5bdad5b english readme 2023-12-22 23:39:32 +03:00
AlexGyver a73d2f6bbc Update README.md 2023-08-15 10:26:42 +03:00
AlexGyver 9e7e75ffe5 edit workflow 2023-04-12 14:36:06 +03:00
AlexGyver 1700798c90 edit workflow 2023-04-11 17:37:22 +03:00
AlexGyver 463158e667 edit badge 2022-09-03 14:08:14 +03:00
AlexGyver a2265e1aae edit badge 2022-07-20 13:58:34 +03:00
AlexGyver 17fa4047f9 edit workflow 2022-06-29 15:06:41 +03:00
AlexGyver 17d9e91111 edit readme 2022-06-27 23:48:54 +03:00
AlexGyver f97e26411f edit readme 2022-06-27 23:46:28 +03:00
AlexGyver fe49edcfa6 edit readme 2022-06-27 23:44:23 +03:00
AlexGyver 3587e96247 edit readme 2022-06-27 23:41:04 +03:00
AlexGyver fc967f7554 edit readme 2022-06-27 23:36:34 +03:00
AlexGyver 2d1566ace2 edit readme 2022-06-27 23:34:09 +03:00
AlexGyver a0dd1f6aee edit readme 2022-06-27 23:28:39 +03:00
AlexGyver 035596d252 create workflow 2022-06-27 23:20:36 +03:00
AlexGyver 5a467a1c93 edit readme 2022-06-27 19:36:36 +03:00
AlexGyver e987107e6e issues 2022-06-27 14:52:39 +03:00
AlexGyver f3a861ecd1 update 2022-05-24 12:03:59 +03:00
Alex 8f40368bdf english readme 2022-05-04 04:43:34 +03:00
Alex 83e3903f88 english readme 2022-05-04 04:33:47 +03:00
Alex 33477745b2 Update README.md 2022-05-03 03:26:00 +03:00
Alex 52277d98e8 Update README.md 2022-01-28 02:37:40 +03:00
Alex 9c10e644db Update README.md 2022-01-25 02:38:34 +03:00
Alex 03525ebe93 Merge branch 'main' of https://github.com/GyverLibs/Gyver433 2022-01-06 00:50:23 +03:00
Alex 9d18b80bb6 upd 2022-01-06 00:50:15 +03:00
Alex 415de7a97a Update README.md 2021-12-16 01:45:57 +03:00
Alex 970e454920 Update README.md 2021-12-15 15:40:41 +03:00
Alex b416ae981a Update README.md 2021-12-11 14:34:17 +03:00
Alex e66a74de62 upd 2021-12-11 14:33:29 +03:00
11 changed files with 300 additions and 22 deletions
+20
View File
@@ -0,0 +1,20 @@
name: Telegram Message
on:
release:
types: [published]
jobs:
build:
name: Send Message
runs-on: ubuntu-latest
steps:
- name: send telegram message on push
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
disable_web_page_preview: true
message: |
${{ github.event.repository.name }} v${{ github.event.release.tag_name }}
${{ github.event.release.body }}
https://github.com/${{ github.repository }}
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021 Alex
Copyright (c) 2021 AlexGyver
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+67 -16
View File
@@ -1,7 +1,15 @@
![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)
![author](https://img.shields.io/badge/author-AlexGyver-informational.svg)
[![latest](https://img.shields.io/github/v/release/GyverLibs/Gyver433.svg?color=brightgreen)](https://github.com/GyverLibs/Gyver433/releases/latest/download/Gyver433.zip)
[![PIO](https://badges.registry.platformio.org/packages/gyverlibs/library/Gyver433.svg)](https://registry.platformio.org/libraries/gyverlibs/Gyver433)
[![arduino-library](https://www.ardu-badge.com/badge/Gyver433.svg?)](https://www.ardu-badge.com/Gyver433)
[![Foo](https://img.shields.io/badge/Website-AlexGyver.ru-blue.svg?style=flat-square)](https://alexgyver.ru/)
[![Foo](https://img.shields.io/badge/%E2%82%BD$%E2%82%AC%20%D0%9D%D0%B0%20%D0%BF%D0%B8%D0%B2%D0%BE-%D1%81%20%D1%80%D1%8B%D0%B1%D0%BA%D0%BE%D0%B9-orange.svg?style=flat-square)](https://alexgyver.ru/support_alex/)
[![Foo](https://img.shields.io/badge/README-ENGLISH-blueviolet.svg?style=flat-square)](https://github-com.translate.goog/GyverLibs/Gyver433?_x_tr_sl=ru&_x_tr_tl=en)
[![Foo](https://img.shields.io/badge/ПОДПИСАТЬСЯ-НА%20ОБНОВЛЕНИЯ-brightgreen.svg?style=social&logo=telegram&color=blue)](https://t.me/GyverLibs)
# Gyver433
Библиотека для радиомодулей 433 МГц и Arduino
- **Передача данных с модуля на модуль по собственному интерфейсу связи**, т.е. не работает с китайскими пультами и шлагбаумами!
- Поддержка кривых китайских модулей
- Встроенный CRC контроль целостности
- Ускоренный алгоритм IO для AVR Arduino
@@ -14,6 +22,8 @@
## Содержание
- [Установка](#install)
- [Интерфейс](#interface)
- [Подключение](#wiring)
- [Инициализация](#init)
- [Использование](#usage)
- [Пример](#example)
@@ -32,6 +42,36 @@
- Распаковать и положить в *Документы/Arduino/libraries/*
- (Arduino IDE) автоматическая установка из .zip: *Скетч/Подключить библиотеку/Добавить .ZIP библиотеку…* и указать скачанный архив
- Читай более подробную инструкцию по установке библиотек [здесь](https://alexgyver.ru/arduino-first/#%D0%A3%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BA%D0%B0_%D0%B1%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA)
### Обновление
- Рекомендую всегда обновлять библиотеку: в новых версиях исправляются ошибки и баги, а также проводится оптимизация и добавляются новые фичи
- Через менеджер библиотек IDE: найти библиотеку как при установке и нажать "Обновить"
- Вручную: **удалить папку со старой версией**, а затем положить на её место новую. "Замену" делать нельзя: иногда в новых версиях удаляются файлы, которые останутся при замене и могут привести к ошибкам!
<a id="interface"></a>
## Интерфейс
- Перед отправкой данных идёт синхронизирующий импульс, *TRAIN* мс
- Далее старт импульс, *START* мс, LOW
- Данные кодируются длиной импульса
- Завершает отправку стоп импульс, *TRAIN* мс
![scheme](/doc/interface.png)
![scheme](/doc/timing.png)
<a id="wiring"></a>
## Подключение
![scheme](/doc/radio433.png)
Передатчики:
- SYN115, маленький чип: 1.8-3.6V, макс. скорость 8000
- FS1000A: 3-12V, макс. скорость 10000
- WL102-341: 2.0-3.6V, макс. скорость 6000
Приёмники:
- SYN480R, крупный чип: 3.3-5.5V
- MX-RM-5V (RF-5V): 5V
- RX470 (WL101-341): 3-5V
![scheme](/doc/scheme.jpg)
![scheme](/doc/radio.png)
<a id="init"></a>
## Инициализация
@@ -56,14 +96,16 @@ Gyver433_RX<пин, буфер, CRC> rx;
// ========= Gyver433_TX =========
void sendData(T &data); // отправить данные любого типа (CRC добавляется автоматически)
void write(uint8_t* buf, uint8_t size); // отправить массив байт указанного размера (CRC не добавляется)
uint8_t buffer[]; // доступ к буферу приёма
uint8_t byteBuf; // доступ к буферу принятого байта
// ========= Gyver433_RX =========
// приём в прерывании
void tickISR(); // тикер приёма для вызова в прерывании по CHANGE
uint8_t tickISRraw(); // ручной приём в прерывании по CHANGE. Вернёт 1 (начало приёма), 2 (принят байт), 3 (конец пакета)
// приём в loop
uint16_t tick(); // неблокирующий приём. Вернёт количество успешно принятых байт
uint16_t tickWait(); // блокирующий приём. Вернёт количество успешно принятых байт
bool readData(T &data); // прочитает буфер в любой тип данных (в указанную переменную)
uint16_t getSize(); // получить размер принятых данных
uint16_t gotData(); // вернёт количество успешно принятых в tickISR() байт (см. пример isr_rx)
@@ -87,10 +129,19 @@ uint8_t G433_crc_xor(uint8_t *buffer, uint8_t size); // ручной CRC XOR
#define G433_CUT_RSSI // [RX] убрать расчёт RSSI из кода (сэкономит чуть памяти)
```
### Работа приёмника без прерываний
Для приёма данных достаточно вызывать в основном цикле метод `tick()`, он сам опрашивает пин радио.
- Если в программе есть блокирующие места и loop() выполняется с задержками - будет потеря данных
- Для более надёжного приёма рекомендуется вызывать `tickWait()`, она блокирует выполнение кода на время приёма.
### Работа приёмника с прерываниями
Рекомендуется использовать приём в прерывании по CHANGE, для этого нужно вызывать в нём `tickISR()`.
Тогда приём будет асинхронный и будет работать даже в загруженной программе.
- Если стандартных пинов прерываний не хватает, можно задействовать PCINT. Вручную или с помощью библиотеки https://github.com/NicoHood/PinChangeInterrupt
<a id="example"></a>
## Примеры
Остальные примеры смотри в **examples**!
![scheme](/doc/scheme.jpg)
### Отправка
```cpp
#include <Gyver433.h>
@@ -136,17 +187,6 @@ void loop() {
}
```
## Заметка по модулям:
Передатчики:
- SYN115, маленький чип: 1.8-3.6V, макс. скорость 8000
- FS1000A: 3-12V, макс. скорость 10000
- WL102-341: 2.0-3.6V, макс. скорость 6000
Приёмники:
- SYN480R, крупный чип: 3.3-5.5V
- MX-RM-5V (RF-5V): 5V
- RX470 (WL101-341): 3-5V
<a id="versions"></a>
## Версии
- v1.0
@@ -156,8 +196,19 @@ void loop() {
- v1.4 - переделан FastIO
- v1.4.1 - убран FastIO, CRC вынесен отдельно
- v2.0 - убран буфер на отправку, убран манчестер, полностью переделан и оптимизирован интерфейс связи
- v2.0.1 - fix compiler warnings
<a id="feedback"></a>
## Баги и обратная связь
При нахождении багов создавайте **Issue**, а лучше сразу пишите на почту [alex@alexgyver.ru](mailto:alex@alexgyver.ru)
Библиотека открыта для доработки и ваших **Pull Request**'ов!
При сообщении о багах или некорректной работе библиотеки нужно обязательно указывать:
- Версия библиотеки
- Какой используется МК
- Версия SDK (для ESP)
- Версия Arduino IDE
- Корректно ли работают ли встроенные примеры, в которых используются функции и конструкции, приводящие к багу в вашем коде
- Какой код загружался, какая работа от него ожидалась и как он работает в реальности
- В идеале приложить минимальный код, в котором наблюдается баг. Не полотно из тысячи строк, а минимальный код
+206
View File
@@ -0,0 +1,206 @@
This is an automatic translation, may be incorrect in some places. See sources and examples!
# Gyver433
Library for Radio Modules 433 MHz and Arduino
- ** Data transfer from the module to the module on your own communication interface **, i.e.Does not work with Chinese remote controls and barriers!
- Support for crooked Chinese modules
- Built -in CRC Control of integrity
- Accelerated IO algorithm for AVR Arduino
- asynchronous reception in interruption
- Super lightly Liba, will even start on Tini13
## compatibility
Compatible with all arduino platforms (used arduino functions)
- When connecting an interruption on the ESP8266, do not forget the Attricbut `IRAM_ATTR`
## Content
- [installation] (# Install)
- [interface] (#interface)
- [connection] (#wiring)
- [initialization] (#init)
- [use] (#usage)
- [Example] (# Example)
- [versions] (#varsions)
- [bugs and feedback] (#fedback)
<a id="install"> </a>
## Installation
- The library can be found by the name ** Gyver433 ** and installed through the library manager in:
- Arduino ide
- Arduino ide v2
- Platformio
- [download the library] (https://github.com/gyverlibs/gyver433/archive/refs/heads/main.zip) .Zip archive for manual installation:
- unpack and put in * C: \ Program Files (X86) \ Arduino \ Libraries * (Windows X64)
- unpack and put in * C: \ Program Files \ Arduino \ Libraries * (Windows X32)
- unpack and put in *documents/arduino/libraries/ *
- (Arduino id) Automatic installation from. Zip: * sketch/connect the library/add .Zip library ... * and specify downloaded archive
- Read more detailed instructions for installing libraries [here] (https://alexgyver.ru/arduino-first/#%D0%A3%D1%81%D1%82%D0%B0%BD%D0%BE%BE%BE%BED0%B2%D0%BA%D0%B0_%D0%B1%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA)
### Update
- I recommend always updating the library: errors and bugs are corrected in the new versions, as well as optimization and new features are added
- through the IDE library manager: find the library how to install and click "update"
- Manually: ** remove the folder with the old version **, and then put a new one in its place.“Replacement” cannot be done: sometimes in new versions, files that remain when replacing are deleted and can lead to errors!
<a Id="INterFace"> </a>
## Interface
- Before sending the data, there is a synchronizing pulse, * train * ms
- Next, start impulse, * Start * ms, Low
- Data is encoded by pulse length
- completes the sending of the stop impulse, * train * ms
! [Scheme] (/doc/interface.png)
! [Scheme] (/doc/timing.png)
<a id="wiring"> </a>
## connection
! [Scheme] (/doc/radio433.png)
Transmitters:
- SYN115, small chip: 1.8-3.6V, max.speed 8000
- FS1000A: 3-12V, Max.speed of 10,000
-WL102-341: 2.0-3.6V, max.speed 6000
Receivers:
- SYN480R, large chip: 3.3-5.5V
-MX-RM-5V (RF-5V): 5V
-RX470 (WL101-341): 3-5V
! [Scheme] (/doc/scheme.jpg)
! [Scheme] (/doc/radio.png)
<a id="init"> </a>
## initialization
`` `CPP
// === transmitter ===
Gyver433_TX <PIN> TX;
Gyver433_TX <PIN, CRC> TX;
// === The receiver ====
Gyver433_rx <PIN> RX;
Gyver433_rx <pin, buffer> rx;
Gyver433_rx <pin, buffer, CRC> rx;
// PIN: Digital PIN
// buffer: the size of the buffer in bytes, by the silence.64
// CRC: Statement of data integrity: G433_CRC8 (reliable), G433_XOR (Light), G433_NOCRC (disconnected).By the silence.G433_CRC8
`` `
<a id="usage"> </a>
## Usage`` `CPP
// ========= gyver433_TX ============
VOID SendData (T & Data);// Send data any type (CRC is added automatically)
VOID Write (uint8_t* buf, uint8_t size);// Send an array of byte of the specified size (CRC is not added)
// ========= gyver433_rx ============
// Reception in interruption
VOID Tickisr ();// Take of reception for calling in interruption by Change
uint8_t TickisrRaw ();// manual reception in the interruption in Change.Return 1 (beginning of reception), 2 (Baite adopted), 3 (end of the package)
// Reception in Loop
uint16_t tick ();// Neboking technique.Will return the number of successfully accepted bytes
uint16_t tickwait ();// blocking reception.Will return the number of successfully accepted bytes
Bool Readdata (T & Data);// read the buffer in any type of data (in the specified variable)
uint16_t getsize ();// Get the amount of data accepted
uint16_t gotdata ();// will return the number of byte successfully accepted in Tickisr () (see ISR_RX example)
uint8_t getrssi ();// get the quality of the reception (percentage of successful gears 0 .. 100)
uint8_t buffer [];// Access to the reception buffer
uint8_t bytebuf;// Access to the Baita Boofer
// ============== CRC ==================
// you can use the built -in functions for generating the CRC byt for manual packages
uint8_t g433_crc8 (uint8_t *buffer, uint8_t size);// manual CRC8
uint8_t g433_crc_xor (uint8_t *buffer, uint8_t size);// manual CRC XOR
// ====== Defain-settings ==========
// Call before connecting the library
#define g433_fast // [tx] short synchronization for green modules
#define g433_Medium // [tx] average synchronization when sending to SYN480R more than 400MS (actively by default)
#define g433_slow // [tx] Long synchronization when sending to SYN480R less often 400ms
#define G433_Speed 1000 // [RX/TX] Speed, should be the same on RX and TX, 100-10,000 bits/s, silent.2000 bits/s
#define g433_rssi_count 8 // [RX] The number of successfully accepted packets for RSSI calculation (according to default. 8)
#define g433_cut_rssi // [rx] Remove the RSSI calculation from the code (save a little memory)
`` `
### Work of the receiver without interruption
To receive data, it is enough to cause a basic cycle of the `tick ()` method, he himself interviews a pin of the radio.
- If the program has blocking places and Loop () is performed with delays - there will be a loss of data
- For more reliable reception, it is recommended to call `tickwait ()`, it blocks the performance of the code during the reception.
### Work of the receiver with interruptions
It is recommended to use the technique in the interrupt on Change, for this you need to call `Tickisr ()` in it.
Then the reception will be asynchronous and will work even in a loaded program.
- If the standard pins of interruptions are not enough, you can use PCINT.Manually or with the help of the library https://github.com/nicohood/pinchangeinterrapt
<a id="EXAMPLE"> </a>
## Examples
The rest of the examples look at ** Examples **!
### Sending
`` `CPP
#include <gyver433.h>
Gyver433_tx <2> tx;// indicated the pin
VOID setup () {
}
Char Data [] = "Hello from #xx";// line for sending
Byte count = 0;// counter for sending
VOID loop () {
// Add the counter to the line
Data [12] = (Count / 10) + '0';
Data [13] = (Count % 10) + '0';
if (++ count> = 100) count = 0;
TX.SendData (Data);
DELAY (100);
}
`` `
### Reception in interruption
`` `CPP
#include <gyver433.h>
Gyver433_rx <2, 20> rx;// indicated the pin and size of the buffer
VOID setup () {
Serial.Begin (9600);
Attachinterrupt (0, Isr, Change);// Interruption of Pina Radio on Change
}
// Special.The ticer is called in interruption
VOID isr () {
rx.tickisr ();
}
VOID loop () {
if (rx.gotdata ()) {// If more than 0 successfully accepted
Serial.write (rx.buffer, rx.size);// Display
Serial.println ();
}
DELAY (50);// imitation of a loaded code
}
`` `
<a id="versions"> </a>
## versions
- V1.0
- V1.1 - optimization, new interface, support for cheap blue modules, work in interruption
- V1.2 -improvement in communication quality, optimization of work in interruption
- v1.3 - added RSSI withdrawal
- V1.4 - Redeled Fastio
- v1.4.1 - removed Fastio, CRC is taken separately
- V2.0 - removed the buffer for sending, removed Manchester, completely redone and optimized the communication interface
- V2.0.1 - FIX Compiler Warnings
<a id="feedback"> </a>
## bugs and feedback
Create ** Issue ** when you find the bugs, and better immediately write to the mail [alex@alexgyver.ru] (mailto: alex@alexgyver.ru)
The library is open for refinement and your ** pull Request ** 'ow!
When reporting about bugs or incorrect work of the library, it is necessary to indicate:
- The version of the library
- What is MK used
- SDK version (for ESP)
- version of Arduino ide
- whether the built -in examples work correctly, in which the functions and designs are used, leading to a bug in your code
- what code has been loaded, what work was expected from it and how it works in reality
- Ideally, attach the minimum code in which the bug is observed.Not a canvas of a thousand lines, but a minimum code
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 333 KiB

After

Width:  |  Height:  |  Size: 172 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

+1 -1
View File
@@ -1,5 +1,5 @@
name=Gyver433
version=2.0
version=2.1.1
author=AlexGyver <alex@alexgyver.ru>
maintainer=AlexGyver <alex@alexgyver.ru>
sentence=Simple library for 433 MHz radio
+3 -2
View File
@@ -21,6 +21,7 @@
v1.4 - переделан FastIO
v1.4.1 - убран FastIO, CRC вынесен отдельно
v2.0 - убран буфер на отправку, убран манчестер, полностью переделан и оптимизирован интерфейс связи
v2.0.1 - fix compiler warnings
*/
#ifndef _Gyver433_h
@@ -53,7 +54,7 @@
#define G433_EDGE_S (G433_START + G433_WINDOW)
// жоский delay для avr
#ifdef AVR
#ifdef _delay_us
#define G433_DELAY(x) _delay_us(x)
#else
#define G433_DELAY(x) delayMicroseconds(x)
@@ -85,7 +86,7 @@ public:
// отправка, блокирующая. Кушает любой тип данных
template <typename T>
bool sendData(T &data) {
void sendData(T &data) {
uint8_t *ptr = (uint8_t*) &data;
write(ptr, sizeof(T));
}