mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-25 04:06:47 +00:00
Xplatform changes
This commit is contained in:
parent
760de1b092
commit
5ffbd18d8b
@ -29,85 +29,87 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ArduinoLog.h"
|
#ifdef ARDUINO
|
||||||
|
|
||||||
|
#include "ArduinoLog.h"
|
||||||
|
|
||||||
void Logging::begin(int level, bool showLevel)
|
void Logging::begin(int level, bool showLevel)
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_LOGGING
|
#ifndef DISABLE_LOGGING
|
||||||
setLevel(0, level);
|
setLevel(0, level);
|
||||||
setLevel(1, level);
|
setLevel(1, level);
|
||||||
setLevel(2, level);
|
setLevel(2, level);
|
||||||
setShowLevel(0, showLevel);
|
setShowLevel(0, showLevel);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logging::registerOutput(uint8_t slot, Print * logOutput, int level, bool showLevel)
|
void Logging::registerOutput(uint8_t slot, Print * logOutput, int level, bool showLevel)
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_LOGGING
|
#ifndef DISABLE_LOGGING
|
||||||
if(slot >= 3) return;
|
if(slot >= 3) return;
|
||||||
setLevel(slot, level);
|
setLevel(slot, level);
|
||||||
setShowLevel(slot, showLevel);
|
setShowLevel(slot, showLevel);
|
||||||
_logOutput[slot] = logOutput;
|
_logOutput[slot] = logOutput;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logging::unregisterOutput(uint8_t slot)
|
void Logging::unregisterOutput(uint8_t slot)
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_LOGGING
|
#ifndef DISABLE_LOGGING
|
||||||
if(slot >= 3) return;
|
if(slot >= 3) return;
|
||||||
_logOutput[slot] = NULL;
|
_logOutput[slot] = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logging::setLevel(uint8_t slot, int level)
|
void Logging::setLevel(uint8_t slot, int level)
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_LOGGING
|
#ifndef DISABLE_LOGGING
|
||||||
_level[slot] = constrain(level, LOG_LEVEL_SILENT, LOG_LEVEL_OUTPUT);
|
_level[slot] = constrain(level, LOG_LEVEL_SILENT, LOG_LEVEL_OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int Logging::getLevel(uint8_t slot) const
|
int Logging::getLevel(uint8_t slot) const
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_LOGGING
|
#ifndef DISABLE_LOGGING
|
||||||
return _level[slot];
|
return _level[slot];
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logging::setShowLevel(uint8_t slot, bool showLevel)
|
void Logging::setShowLevel(uint8_t slot, bool showLevel)
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_LOGGING
|
#ifndef DISABLE_LOGGING
|
||||||
_showLevel[slot] = showLevel;
|
_showLevel[slot] = showLevel;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Logging::getShowLevel(uint8_t slot) const
|
bool Logging::getShowLevel(uint8_t slot) const
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_LOGGING
|
#ifndef DISABLE_LOGGING
|
||||||
return _showLevel[slot];
|
return _showLevel[slot];
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logging::setPrefix(printfunction f)
|
void Logging::setPrefix(printfunction f)
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_LOGGING
|
#ifndef DISABLE_LOGGING
|
||||||
_prefix = f;
|
_prefix = f;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logging::setSuffix(printfunction f)
|
void Logging::setSuffix(printfunction f)
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_LOGGING
|
#ifndef DISABLE_LOGGING
|
||||||
_suffix = f;
|
_suffix = f;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logging::print(Print * logOutput, const __FlashStringHelper * format, va_list args)
|
void Logging::print(Print * logOutput, const __FlashStringHelper * format, va_list args)
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_LOGGING
|
#ifndef DISABLE_LOGGING
|
||||||
PGM_P p = reinterpret_cast<PGM_P>(format);
|
PGM_P p = reinterpret_cast<PGM_P>(format);
|
||||||
char c = pgm_read_byte(p++);
|
char c = pgm_read_byte(p++);
|
||||||
for(; c != 0; c = pgm_read_byte(p++)) {
|
for(; c != 0; c = pgm_read_byte(p++)) {
|
||||||
@ -118,12 +120,12 @@ void Logging::print(Print * logOutput, const __FlashStringHelper * format, va_li
|
|||||||
logOutput->print(c);
|
logOutput->print(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logging::print(Print * logOutput, const char * format, va_list args)
|
void Logging::print(Print * logOutput, const char * format, va_list args)
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_LOGGING
|
#ifndef DISABLE_LOGGING
|
||||||
for(; *format != 0; ++format) {
|
for(; *format != 0; ++format) {
|
||||||
if(*format == '%') {
|
if(*format == '%') {
|
||||||
++format;
|
++format;
|
||||||
@ -132,12 +134,12 @@ void Logging::print(Print * logOutput, const char * format, va_list args)
|
|||||||
logOutput->print(*format);
|
logOutput->print(*format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logging::printFormat(Print * logOutput, const char format, va_list * args)
|
void Logging::printFormat(Print * logOutput, const char format, va_list * args)
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_LOGGING
|
#ifndef DISABLE_LOGGING
|
||||||
if(format == '%') {
|
if(format == '%') {
|
||||||
logOutput->print(format);
|
logOutput->print(format);
|
||||||
} else if(format == 's') {
|
} else if(format == 's') {
|
||||||
@ -179,7 +181,9 @@ void Logging::printFormat(Print * logOutput, const char format, va_list * args)
|
|||||||
logOutput->print(F("false"));
|
logOutput->print(F("false"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Logging Log = Logging();
|
Logging Log = Logging();
|
||||||
|
|
||||||
|
#endif // ARDUINO
|
@ -6,6 +6,8 @@
|
|||||||
/*********************
|
/*********************
|
||||||
* INCLUDES
|
* INCLUDES
|
||||||
*********************/
|
*********************/
|
||||||
|
#ifdef ARDUINO
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "lv_fs_if.h"
|
#include "lv_fs_if.h"
|
||||||
#include "lv_fs_spiffs.h"
|
#include "lv_fs_spiffs.h"
|
||||||
@ -504,3 +506,5 @@ static lv_fs_res_t fs_dir_close(lv_fs_drv_t * drv, void * dir_p)
|
|||||||
|
|
||||||
#endif /*LV_USE_FS_IF*/
|
#endif /*LV_USE_FS_IF*/
|
||||||
#endif /*LV_FS_IF_SPIFFS*/
|
#endif /*LV_FS_IF_SPIFFS*/
|
||||||
|
|
||||||
|
#endif /*ARDUINO*/
|
@ -1,6 +1,9 @@
|
|||||||
/*********************
|
/*********************
|
||||||
* INCLUDES
|
* INCLUDES
|
||||||
*********************/
|
*********************/
|
||||||
|
|
||||||
|
#ifndef WINDOWS
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -557,6 +560,8 @@ static inline void IRAM_ATTR colorsAdd(uint8_t * charBitmap_p, uint8_t color1, u
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void printPixel(uint8_t pixel)
|
void printPixel(uint8_t pixel)
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
/* MIT License - Copyright (c) 2020 Francis Van Roie
|
/* MIT License - Copyright (c) 2020 Francis Van Roie
|
||||||
For full license information read the LICENSE file in the project folder */
|
For full license information read the LICENSE file in the project folder */
|
||||||
|
|
||||||
#ifdef ARDUINO
|
#ifndef WINDOWS
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#include "lvgl.h"
|
||||||
#include "hasp_conf.h" // load first
|
#include "hasp_conf.h" // load first
|
||||||
|
|
||||||
#if HASP_USE_CONFIG > 0
|
#if HASP_USE_CONFIG > 0
|
||||||
|
@ -98,6 +98,7 @@ int main(int argv, char ** args)
|
|||||||
setup();
|
setup();
|
||||||
std::cout << "HSetup OK\n";
|
std::cout << "HSetup OK\n";
|
||||||
|
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
SDL_Delay(5);
|
SDL_Delay(5);
|
||||||
lv_task_handler();
|
lv_task_handler();
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#include "Arduino.h"
|
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user