IR driver wrapper, also warning fixes

This commit is contained in:
openshwprojects
2022-10-19 13:54:25 +02:00
parent c0169983a4
commit c94194e6d3
14 changed files with 23 additions and 18 deletions

View File

@ -36,7 +36,7 @@ static int CMD_SimonTest(const void *context, const char *cmd, const char *args,
ADDLOG_INFO(LOG_FEATURE_CMD, "CMD_SimonTest: ir test routine");
#ifdef PLATFORM_BK7231T
testmehere();
// anything
#endif

View File

@ -68,7 +68,7 @@ static int testMallocFree(const void * context, const char *cmd, const char *arg
int repeats;
int rep;
char *msg;
int i;
//int i;
int ra1;
static int totalCalls = 0;

View File

@ -105,7 +105,8 @@ void BL09XX_AppendInformationToHTTPIndexPage(http_request_t *request)
memset(tmp,0,128);
}
}
sprintf(tmp, "<br>History Index: %d<br>JSON Stats: %s </h5>", energyCounterMinutesIndex,
// energyCounterMinutesIndex is a long type, we need to use %ld instead of %d
sprintf(tmp, "<br>History Index: %ld<br>JSON Stats: %s </h5>", energyCounterMinutesIndex,
(energyCounterStatsJSONEnable == true) ? "enabled" : "disabled");
//addLogAdv(LOG_INFO, LOG_FEATURE_TUYAMCU,"'%s'\n", tmp);
hprintf128(request, tmp);

View File

@ -381,7 +381,7 @@ extern "C" void DRV_IR_ISR(UINT8 t){
// test routine to start IR RX and TX
// currently fixed pins for testing.
extern "C" void testmehere(){
extern "C" void DRV_IR_Init(){
ADDLOG_INFO(LOG_FEATURE_CMD, (char *)"Log from extern C CPP");
unsigned char pin = 9;// PWM3/25
@ -509,7 +509,7 @@ void PrintIRData(IRData *aIRDataPtr){
// this polls the IR receive to see off there was any IR received
// currently called once per sec from user_main timer
// should probably be called every 100ms.
extern "C" void DRV_IR_Print(){
extern "C" void DRV_IR_RunFrame(){
if (ir_counter){
//ADDLOG_INFO(LOG_FEATURE_CMD, (char *)"IR counter: %u", ir_counter);
}

View File

@ -1,9 +1,7 @@
#ifndef __DRV_IR_H__
#define __DRV_IR_H__
void DRV_IR_Test();
void DRV_IR_Print();
void testmehere();
void DRV_IR_Init();
void DRV_IR_RunFrame();
#endif

View File

@ -37,6 +37,7 @@ void BP1658CJ_Init();
void BP1658CJ_RunFrame();
void BP1658CJ_OnChannelChanged(int ch, int value);
void BL_Shared_Init();
void BL_ProcessUpdate(float voltage, float current, float power);
void BL09XX_AppendInformationToHTTPIndexPage(http_request_t *request);
bool DRV_IsRunning(const char *name);

View File

@ -7,6 +7,7 @@
#include "drv_local.h"
#include "drv_uart.h"
#include "drv_tuyaMCU.h"
#include "drv_ir.h"
#include "../i2c/drv_i2c_public.h"
#include "drv_ntp.h"
#include "../httpserver/new_http.h"
@ -57,6 +58,7 @@ static driver_t g_drivers[] = {
#if PLATFORM_BEKEN
{ "IR", DRV_IR_Init, DRV_IR_RunFrame, NULL, NULL, NULL, NULL, false },
{ "DGR", DRV_DGR_Init, NULL, DRV_DGR_RunEverySecond, DRV_DGR_RunQuickTick, DRV_DGR_Shutdown, DRV_DGR_OnChannelChanged, false },
{ "DDP", DRV_DDP_Init, NULL, NULL, DRV_DDP_RunFrame, DRV_DDP_Shutdown, NULL, false },
#endif

View File

@ -76,7 +76,7 @@ int NTP_SetServer(const void *context, const char *cmd, const char *args, int cm
addLogAdv(LOG_INFO, LOG_FEATURE_NTP,"Argument missing e.g. ntp_setServer ipAddress\n");
return 0;
}
char *newValue = Tokenizer_GetArg(0);
const char *newValue = Tokenizer_GetArg(0);
CFG_SetNTPServer(newValue);
addLogAdv(LOG_INFO, LOG_FEATURE_NTP, "NTP server set to %s\n", newValue);
return 1;

View File

@ -34,6 +34,7 @@ bool DRV_IsRunning(const char *name);
void DRV_OnChannelChanged(int channel,int iVal);
void SM2135_Write(byte *rgbcw);
void BP5758D_Write(byte *rgbcw);
void BP1658CJ_Write(byte *rgbcw);
void DRV_DGR_OnLedDimmerChange(int iVal);
void DRV_DGR_OnLedEnableAllChange(int iVal);

View File

@ -144,7 +144,8 @@ static bool heartbeat_valid = false;
static int heartbeat_timer = 0;
static int heartbeat_counter = 0;
static bool product_information_valid = false;
static char *prod_info = NULL;
// ?? it's unused atm
//static char *prod_info = NULL;
static bool working_mode_valid = false;
static bool wifi_state_valid = false;
static bool wifi_state = false;

View File

@ -1336,7 +1336,7 @@ int http_fn_ha_discovery(http_request_t* request) {
return 0;
}
void http_generate_rgb_cfg(http_request_t* request, char* clientId) {
void http_generate_rgb_cfg(http_request_t* request, const char* clientId) {
hprintf128(request, " rgb_command_template: \"{{ '#%%02x%%02x%%02x0000' | format(red, green, blue)}}\"\n");
hprintf128(request, " rgb_value_template: \"{{ value[1:3] | int(base=16) }},{{ value[3:5] | int(base=16) }},{{ value[5:7] | int(base=16) }}\"\n");
hprintf128(request, " rgb_state_topic: \"%s/led_basecolor_rgb/get\"\n", clientId);

View File

@ -86,7 +86,7 @@ void LOG_SetRawSocketCallback(int newFD)
}
#ifdef WINDOWS
void addLogAdv(int level, int feature, char *fmt, ...)
void addLogAdv(int level, int feature, const char *fmt, ...)
{
va_list argList;
const size_t tmp_len = 1024;
@ -137,7 +137,7 @@ void addLogAdv(int level, int feature, char *fmt, ...)
static SemaphoreHandle_t g_mutex = 0;
void addLogAdv(int level, int feature, char *fmt, ...)
void addLogAdv(int level, int feature, const char *fmt, ...)
{
va_list argList;
BaseType_t taken;
@ -252,7 +252,7 @@ static void initLog( void )
// adds a log to the log memory
// if head collides with either tail, move the tails on.
void addLogAdv(int level, int feature, char *fmt, ...)
void addLogAdv(int level, int feature, const char *fmt, ...)
{
char *tmp;
char *t;

View File

@ -14,7 +14,7 @@
#ifndef _OBK_LOGGING_H
#define _OBK_LOGGING_H
void addLogAdv(int level, int feature, char *fmt, ...);
void addLogAdv(int level, int feature, const char *fmt, ...);
void LOG_SetRawSocketCallback(int newFD);
int log_command(const void *context, const char *cmd, const char *args, int cmdFlags);

View File

@ -9,7 +9,8 @@
#include "hal/hal_adc.h"
#include "new_common.h"
#include "driver/drv_ir.h"
//#include "driver/drv_ir.h"
#include "driver/drv_public.h"
//#include "ir/ir_local.h"
// Commands register, execution API and cmd tokenizer
@ -270,7 +271,7 @@ void Main_OnEverySecond()
}
// IR TESTING ONLY!!!!
#ifdef PLATFORM_BK7231T
DRV_IR_Print();
//DRV_IR_Print();
#endif
// when we hit 30s, mark as boot complete.