mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-23 11:16:45 +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.
|
||||
*/
|
||||
|
||||
#include "ArduinoLog.h"
|
||||
#ifdef ARDUINO
|
||||
|
||||
#include "ArduinoLog.h"
|
||||
|
||||
void Logging::begin(int level, bool showLevel)
|
||||
{
|
||||
#ifndef DISABLE_LOGGING
|
||||
#ifndef DISABLE_LOGGING
|
||||
setLevel(0, level);
|
||||
setLevel(1, level);
|
||||
setLevel(2, level);
|
||||
setShowLevel(0, showLevel);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void Logging::registerOutput(uint8_t slot, Print * logOutput, int level, bool showLevel)
|
||||
{
|
||||
#ifndef DISABLE_LOGGING
|
||||
#ifndef DISABLE_LOGGING
|
||||
if(slot >= 3) return;
|
||||
setLevel(slot, level);
|
||||
setShowLevel(slot, showLevel);
|
||||
_logOutput[slot] = logOutput;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void Logging::unregisterOutput(uint8_t slot)
|
||||
{
|
||||
#ifndef DISABLE_LOGGING
|
||||
#ifndef DISABLE_LOGGING
|
||||
if(slot >= 3) return;
|
||||
_logOutput[slot] = NULL;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void Logging::setLevel(uint8_t slot, int level)
|
||||
{
|
||||
#ifndef DISABLE_LOGGING
|
||||
#ifndef DISABLE_LOGGING
|
||||
_level[slot] = constrain(level, LOG_LEVEL_SILENT, LOG_LEVEL_OUTPUT);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
int Logging::getLevel(uint8_t slot) const
|
||||
{
|
||||
#ifndef DISABLE_LOGGING
|
||||
#ifndef DISABLE_LOGGING
|
||||
return _level[slot];
|
||||
#else
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void Logging::setShowLevel(uint8_t slot, bool showLevel)
|
||||
{
|
||||
#ifndef DISABLE_LOGGING
|
||||
#ifndef DISABLE_LOGGING
|
||||
_showLevel[slot] = showLevel;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Logging::getShowLevel(uint8_t slot) const
|
||||
{
|
||||
#ifndef DISABLE_LOGGING
|
||||
#ifndef DISABLE_LOGGING
|
||||
return _showLevel[slot];
|
||||
#else
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void Logging::setPrefix(printfunction f)
|
||||
{
|
||||
#ifndef DISABLE_LOGGING
|
||||
#ifndef DISABLE_LOGGING
|
||||
_prefix = f;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void Logging::setSuffix(printfunction f)
|
||||
{
|
||||
#ifndef DISABLE_LOGGING
|
||||
#ifndef DISABLE_LOGGING
|
||||
_suffix = f;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
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);
|
||||
char 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);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void Logging::print(Print * logOutput, const char * format, va_list args)
|
||||
{
|
||||
#ifndef DISABLE_LOGGING
|
||||
#ifndef DISABLE_LOGGING
|
||||
for(; *format != 0; ++format) {
|
||||
if(*format == '%') {
|
||||
++format;
|
||||
@ -132,12 +134,12 @@ void Logging::print(Print * logOutput, const char * format, va_list args)
|
||||
logOutput->print(*format);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void Logging::printFormat(Print * logOutput, const char format, va_list * args)
|
||||
{
|
||||
#ifndef DISABLE_LOGGING
|
||||
#ifndef DISABLE_LOGGING
|
||||
if(format == '%') {
|
||||
logOutput->print(format);
|
||||
} else if(format == 's') {
|
||||
@ -179,7 +181,9 @@ void Logging::printFormat(Print * logOutput, const char format, va_list * args)
|
||||
logOutput->print(F("false"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
Logging Log = Logging();
|
||||
|
||||
#endif // ARDUINO
|
@ -6,6 +6,8 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#ifdef ARDUINO
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "lv_fs_if.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_FS_IF_SPIFFS*/
|
||||
|
||||
#endif /*ARDUINO*/
|
@ -1,6 +1,9 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#ifndef WINDOWS
|
||||
|
||||
#include <Arduino.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)
|
||||
{
|
||||
|
@ -1,9 +1,10 @@
|
||||
/* MIT License - Copyright (c) 2020 Francis Van Roie
|
||||
For full license information read the LICENSE file in the project folder */
|
||||
|
||||
#ifdef ARDUINO
|
||||
#ifndef WINDOWS
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "lvgl.h"
|
||||
#include "hasp_conf.h" // load first
|
||||
|
||||
#if HASP_USE_CONFIG > 0
|
||||
|
@ -98,6 +98,7 @@ int main(int argv, char ** args)
|
||||
setup();
|
||||
std::cout << "HSetup OK\n";
|
||||
|
||||
|
||||
while(1) {
|
||||
SDL_Delay(5);
|
||||
lv_task_handler();
|
||||
|
@ -1,4 +1,3 @@
|
||||
#include "Arduino.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
#if 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user