-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit of the homie-benq-projector-rs232 firmware
This commit serves as the base to progress the firmware. It implements a very basic behavior which is allow to set power on and off with a predictive (and quite dumb) status reporting. The implementation is as simple as it gets and will change quite a bit as the project progresses.
- Loading branch information
0 parents
commit 4f50a89
Showing
7 changed files
with
839 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.pioenvs | ||
.piolibdeps | ||
.vscode/.browse.c_cpp.db* | ||
.vscode/c_cpp_properties.json | ||
.vscode/launch.json | ||
.vscode/settings.json | ||
.vscode/extensions.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Continuous Integration (CI) is the practice, in software | ||
# engineering, of merging all developer working copies with a shared mainline | ||
# several times a day < https://docs.platformio.org/page/ci/index.html > | ||
# | ||
# Documentation: | ||
# | ||
# * Travis CI Embedded Builds with PlatformIO | ||
# < https://docs.travis-ci.com/user/integration/platformio/ > | ||
# | ||
# * PlatformIO integration with Travis CI | ||
# < https://docs.platformio.org/page/ci/travis.html > | ||
# | ||
# * User Guide for `platformio ci` command | ||
# < https://docs.platformio.org/page/userguide/cmd_ci.html > | ||
# | ||
|
||
language: python | ||
python: | ||
- "2.7" | ||
|
||
sudo: false | ||
cache: | ||
directories: | ||
- "~/.platformio" | ||
|
||
install: | ||
- pip install -U tox-travis | ||
- pip install -U platformio | ||
- platformio update | ||
- pip install -U cpplint | ||
|
||
script: | ||
- platformio run | ||
- cpplint --repository=. --recursive src/ include/ |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Homie Benq Projector RS232 Controller | ||
===================================== | ||
[![Build Status](https://img.shields.io/travis/mpeterson/homie-benq-projector-rs232.svg)](https://travis-ci.org/mpeterson/homie-benq-projector-rs232) [![License](https://img.shields.io/badge/license-GPLv3-brightgreen.svg)](https://github.com/mpeterson/homie-benq-projector-rs232/blob/master/LICENSE) | ||
|
||
BenQ Projector MQTT <-> RS232 controller based on the [Homie MQTT convention](https://github.com/marvinroger/homie). | ||
|
||
This project is a [Homie for ESP8266 v2.0.0](https://github.com/marvinroger/homie-esp8266/releases/tag/v2.0.0) sketch implementing [Homie 2.0.1](https://github.com/marvinroger/homie/releases/tag/v2.0.1). | ||
|
||
The goal of the project is to support a big array of commands and thus not need to rely on the IR remote control but it will grow organically as I find time to work on it. | ||
|
||
The project follows [Semantic Versioning](http://semver.org/). It's currently on development (ergo the v0.x.y) towards the first version and is thus unstable in nature. Once it reaches a maturity level that I feel comfortable, I will bump the version to v1.0.0 and continue from there. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
BenQ Projector MQTT <-> RS232 controller based on the Homie MQTT convention | ||
Copyright (C) 2018 Michel Peterson | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef INCLUDE_MAIN_HPP_ | ||
#define INCLUDE_MAIN_HPP_ | ||
|
||
#define FW_NAME "homie-benq-projector-rs232" | ||
#define FW_VERSION "0.1.0" | ||
|
||
#define SERIAL_BAUD 115200 | ||
#define SERIAL_HEAD "\r*" | ||
#define SERIAL_TOKEN "=" | ||
#define SERIAL_TRAIL "#\r" | ||
|
||
|
||
void sendCommand(const String& command, const String& value); | ||
|
||
bool powerHandler(const HomieRange& range, const String& value); | ||
|
||
#endif // INCLUDE_MAIN_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
; PlatformIO Project Configuration File | ||
; | ||
; Build options: build flags, source filter | ||
; Upload options: custom upload port, speed and extra flags | ||
; Library options: dependencies, extra library storages | ||
; Advanced options: extra scripting | ||
; | ||
; Please visit documentation for the other options and examples | ||
; https://docs.platformio.org/page/projectconf.html | ||
|
||
[common] | ||
platform = espressif8266 | ||
framework = arduino | ||
lib_deps = | ||
git+https://github.com/marvinroger/homie-esp8266.git#v2.0.0 | ||
|
||
[env:d1_mini] | ||
platform = ${common.platform} | ||
framework = ${common.framework} | ||
board = d1_mini | ||
lib_deps = | ||
${common.lib_deps} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
BenQ Projector MQTT <-> RS232 controller based on the Homie MQTT convention | ||
Copyright (C) 2018 Michel Peterson | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <Homie.h> | ||
|
||
#include "main.hpp" | ||
|
||
|
||
HomieNode projectorNode("benq", "projector"); | ||
|
||
void sendCommand(const String& command, const String& value) { | ||
Serial.print(SERIAL_HEAD); | ||
Serial.print(command); | ||
Serial.print(SERIAL_TOKEN); | ||
Serial.print(value); | ||
Serial.print(SERIAL_TRAIL); | ||
} | ||
|
||
bool powerHandler(const HomieRange& range, const String& value) { | ||
if (value != "on" && value != "off") { | ||
return false; | ||
} | ||
|
||
sendCommand("pow", value); | ||
projectorNode.setProperty("power").send(value); | ||
|
||
return true; | ||
} | ||
|
||
void setup() { | ||
Homie.disableLogging(); | ||
Serial.begin(SERIAL_BAUD); | ||
Serial.swap(); | ||
|
||
Homie_setFirmware(FW_NAME, FW_VERSION); | ||
Homie.setup(); | ||
|
||
projectorNode.advertise("power").settable(powerHandler); | ||
} | ||
|
||
void loop() { | ||
Homie.loop(); | ||
} |