0.1.3 optoma

This commit is contained in:
rob tillaart 2021-12-22 13:38:25 +01:00
parent ae5318b131
commit 59cf47f86e
11 changed files with 78 additions and 48 deletions

View File

@ -2,6 +2,10 @@ compile:
# Choosing to run compilation tests on 2 different Arduino platforms # Choosing to run compilation tests on 2 different Arduino platforms
platforms: platforms:
- uno - uno
- leonardo
- due - due
- zero - zero
# - leonardo
# - m4
- esp32
- esp8266
- mega2560

View File

@ -4,10 +4,14 @@ name: Arduino CI
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
arduino_ci: runTest:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: Arduino-CI/action@master - uses: ruby/setup-ruby@v1
# Arduino-CI/action@v0.1.1 with:
ruby-version: 2.6
- run: |
gem install arduino_ci
arduino_ci.rb

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2017-2021 Rob Tillaart Copyright (c) 2017-2022 Rob Tillaart
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,19 +1,23 @@
[![Arduino CI](https://github.com/RobTillaart/Optoma/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci) [![Arduino CI](https://github.com/RobTillaart/Optoma/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
[![Arduino-lint](https://github.com/RobTillaart/Optoma/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/Optoma/actions/workflows/arduino-lint.yml)
[![JSON check](https://github.com/RobTillaart/Optoma/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/Optoma/actions/workflows/jsoncheck.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/Optoma/blob/master/LICENSE) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/Optoma/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/RobTillaart/Optoma.svg?maxAge=3600)](https://github.com/RobTillaart/Optoma/releases) [![GitHub release](https://img.shields.io/github/release/RobTillaart/Optoma.svg?maxAge=3600)](https://github.com/RobTillaart/Optoma/releases)
# Optoma # Optoma
Arduino library to control Optoma W305ST beamer over RS232. Arduino library to control Optoma W305ST beamer over RS232.
## Description ## Description
The Optoma library contains functions that help to control The Optoma library contains functions that help to control
the beamer from an Arduino. the beamer from an Arduino.
The library is tested with an UNO and an Optoma W305ST Beamer. The library is tested with an UNO and an Optoma W305ST Beamer.
The commands can work on other Optoma Beamers The commands can work on other Optoma Beamers.
Command structure Command structure
``` ```
@ -27,26 +31,26 @@ Command structure
\r end command \r end command
``` ```
## Interface ## Interface
The following functions are implemented: The following functions are implemented:
- **Optoma(HardwareSerial = Serial)** constructor, default uses Serial, - **Optoma(HardwareSerial\* stream = &Serial)** constructor, default uses Serial,
other HW or SW Serial are possible. other HW or SW Serial are possible.
- **init(ID, baudrate)** default baudrate = 9600. - **void init(int ID, uint32_t baudRate = 9600)** default baud rate = 9600.
The ID is used to address a specific beamer. The ID is used to address a specific beamer.
In theory one could have multiple beamers on one RS232 port (never seen or tested) In theory one could have multiple beamers on one RS232 port (never seen or tested).
- **switchOn()** idem - **uint32_t getBaudrate()** return set baud rate.
- **switchOff()** idem - **void switchOn()** idem.
- **increaseVKS()** VKS - Vertical KeyStone - **void switchOff()** idem.
- **decreaseVKS()** VKS - Vertical KeyStone - **bool isOn()** idem.
- **void increaseVKS()** VKS - Vertical KeyStone. check datasheet.
- **void decreaseVKS()** VKS - Vertical KeyStone. check datasheet.
## Future ## Future
- More functionality will be added on a need to basis. - More functionality will be added on a need to basis.
- Create examples. - Create examples.
## Operation
Straightforward

View File

@ -1,19 +1,19 @@
// //
// FILE: optoma_test.ino // FILE: optoma_test.ino
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: demo vertical keystone. // PURPOSE: demo vertical keystone.
// DATE: 2020 // DATE: 2020
// (c) : MIT // (c) : MIT
// //
// Test with TeraTerm or an Optoma beamer) // Test with TeraTerm or an Optoma beamer)
// TeraTerm: Newline Receive mode = CR + LF + 9600 baud. // TeraTerm: Newline Receive mode = CR + LF + 9600 baud.
#include "optoma.h" #include "optoma.h"
Optoma beamer; Optoma beamer;
void setup() void setup()
{ {
beamer.init(22); beamer.init(22);
@ -35,7 +35,11 @@ void setup()
beamer.switchOff(); beamer.switchOff();
} }
void loop() void loop()
{ {
} }
// -- END OF FILE --

View File

@ -1,14 +1,21 @@
# Syntax Coloring Map for optoma Beamer class # Syntax Colouring Map for Optoma Beamer class
# Datatypes (KEYWORD1) # Data types (KEYWORD1)
Optoma KEYWORD1 Optoma KEYWORD1
# Methods and Functions (KEYWORD2) # Methods and Functions (KEYWORD2)
init KEYWORD2
getBaudrate KEYWORD2
switchOn KEYWORD2 switchOn KEYWORD2
switchOff KEYWORD2 switchOff KEYWORD2
isOn KEYWORD2 isOn KEYWORD2
increaseVKS KEYWORD2 increaseVKS KEYWORD2
decreaseVKS KEYWORD2 decreaseVKS KEYWORD2
# Constants (LITERAL1)
# Constants (LITERAL1)
OPTOMA_LIB_VERSION LITERAL1

View File

@ -1,6 +1,6 @@
{ {
"name": "Optoma", "name": "Optoma",
"keywords": "Trapezium beamer", "keywords": "Trapezium,beamer",
"description": "Arduino library to control Optoma W305ST beamer over RS232.", "description": "Arduino library to control Optoma W305ST beamer over RS232.",
"authors": "authors":
[ [
@ -15,8 +15,9 @@
"type": "git", "type": "git",
"url": "https://github.com/RobTillaart/Optoma" "url": "https://github.com/RobTillaart/Optoma"
}, },
"version": "0.1.2", "version": "0.1.3",
"license": "MIT", "license": "MIT",
"frameworks": "arduino", "frameworks": "arduino",
"platforms": "*" "platforms": "*",
"headers": "optoma.h"
} }

View File

@ -1,5 +1,5 @@
name=optoma name=optoma
version=0.1.2 version=0.1.3
author=Rob Tillaart <rob.tillaart@gmail.com> author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com> maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library to control Optoma W305ST beamer over RS232. sentence=Arduino library to control Optoma W305ST beamer over RS232.

View File

@ -1,7 +1,7 @@
// //
// FILE: optoma.cpp // FILE: optoma.cpp
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// VERSION: 0.1.2 // VERSION: 0.1.3
// DATE: 2017-11-27 // DATE: 2017-11-27
// PUPROSE: Arduino library to control Optoma W305ST beamer over RS232. // PUPROSE: Arduino library to control Optoma W305ST beamer over RS232.
// URL: https://github.com/RobTillaart/optoma // URL: https://github.com/RobTillaart/optoma
@ -9,15 +9,19 @@
// HISTORY // HISTORY
// 0.1.0 2017-11-27 initial version // 0.1.0 2017-11-27 initial version
// 0.1.1 2020-07-09 initial release // 0.1.1 2020-07-09 initial release
// 0.1.2 2020-01-02 arduino-CI // 0.1.2 2020-01-02 Arduino-CI
// 0.1.3 2021-12-22 update library.json, license, readme, minor edits
#include "optoma.h" #include "optoma.h"
Optoma::Optoma(HardwareSerial* stream) Optoma::Optoma(HardwareSerial* stream)
{ {
_stream = stream; _stream = stream;
} }
void Optoma::init(int ID, uint32_t baudRate) void Optoma::init(int ID, uint32_t baudRate)
{ {
_ID = ID; _ID = ID;
@ -27,6 +31,7 @@ void Optoma::init(int ID, uint32_t baudRate)
_stream->print("\r"); _stream->print("\r");
} }
void Optoma::switchOn() void Optoma::switchOn()
{ {
sendID(); sendID();
@ -34,6 +39,7 @@ void Optoma::switchOn()
_on = true; _on = true;
}; };
void Optoma::switchOff() void Optoma::switchOff()
{ {
sendID(); sendID();
@ -41,23 +47,27 @@ void Optoma::switchOff()
_on = false; _on = false;
}; };
void Optoma::increaseVKS() void Optoma::increaseVKS()
{ {
sendID(); sendID();
_stream->print(F("140 15\r")); _stream->print(F("140 15\r"));
}; };
void Optoma::decreaseVKS() void Optoma::decreaseVKS()
{ {
sendID(); sendID();
_stream->print(F("140 16\r")); _stream->print(F("140 16\r"));
}; };
bool Optoma::isOn() bool Optoma::isOn()
{ {
return _on; return _on;
}; };
void Optoma::sendID() void Optoma::sendID()
{ {
_stream->print('~'); _stream->print('~');
@ -65,4 +75,6 @@ void Optoma::sendID()
_stream->print(_ID); _stream->print(_ID);
} }
// -- END OF FILE -- // -- END OF FILE --

View File

@ -2,13 +2,17 @@
// //
// FILE: Optoma.h // FILE: Optoma.h
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// VERSION: 0.1.2 // VERSION: 0.1.3
// DATE: 2017-11-27 // DATE: 2017-11-27
// PUPROSE: Arduino library to control Optoma W305ST beamer over RS232. // PUPROSE: Arduino library to control Optoma W305ST beamer over RS232.
// URL: https://github.com/RobTillaart/Optoma // URL: https://github.com/RobTillaart/Optoma
#include "Arduino.h" #include "Arduino.h"
#define OPTOMA_LIB_VERSION (F("0.1.3"))
class Optoma class Optoma
{ {
public: public:
@ -27,12 +31,14 @@ public:
private: private:
HardwareSerial* _stream; HardwareSerial* _stream;
int _ID = 0; int _ID = 0;
bool _on = false; bool _on = false;
uint32_t _baudrate = 9600; uint32_t _baudrate = 9600;
void sendID(); void sendID();
}; };
// -- END OF FILE -- // -- END OF FILE --

View File

@ -29,6 +29,7 @@
// assertNAN(arg); // isnan(a) // assertNAN(arg); // isnan(a)
// assertNotNAN(arg); // !isnan(a) // assertNotNAN(arg); // !isnan(a)
#include <ArduinoUnitTests.h> #include <ArduinoUnitTests.h>
@ -38,29 +39,16 @@
unittest_setup() unittest_setup()
{ {
fprintf(stderr, "OPTOMA_LIB_VERSION: %s\n", (char *) OPTOMA_LIB_VERSION);
} }
unittest_teardown() unittest_teardown()
{ {
} }
/*
unittest(test_new_operator)
{
assertEqualINF(exp(800));
assertEqualINF(0.0/0.0);
assertEqualINF(42);
assertEqualNAN(INFINITY - INFINITY);
assertEqualNAN(0.0/0.0);
assertEqualNAN(42);
}
*/
unittest(test_constructor) unittest(test_constructor)
{ {
fprintf(stderr, "VERSION: %s\n", "-");
Optoma beamer; Optoma beamer;
beamer.init(22); beamer.init(22);