intermediate: prepare for multiple grove configs
This commit is contained in:
		
							parent
							
								
									8641f0efd9
								
							
						
					
					
						commit
						59a80fcc9a
					
				| 
						 | 
					@ -1,5 +1,19 @@
 | 
				
			||||||
#include "GwChannelList.h"
 | 
					#include "GwChannelList.h"
 | 
				
			||||||
#include "GwApi.h"
 | 
					#include "GwApi.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					using SerInitFunction=std::function<void(GwChannelList *)>;
 | 
				
			||||||
 | 
					std::vector<SerInitFunction> initFunctions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define CFG_EXP(ser) GwChannelList::ser
 | 
				
			||||||
 | 
					#define CFG_SERIAL(ser,rx,tx,mode) \
 | 
				
			||||||
 | 
					    __MSG("serial config " __STR(ser) " rx=" __STR(rx) ", tx=" __STR(tx) ",mode=" __STR(mode)); \
 | 
				
			||||||
 | 
					    static GwInitializer<SerInitFunction> _ ## name ## _init( \
 | 
				
			||||||
 | 
					        initFunctions,[](GwChannelList *cl){cl->addSerial(CFG_EXP(ser),rx,tx,mode);});
 | 
				
			||||||
 | 
					//check for duplicate groove usages
 | 
				
			||||||
 | 
					#define __GR_EXP(GROOVE) __groveuse_ ## GROOVE
 | 
				
			||||||
 | 
					#define GROVE_USE(USER) \
 | 
				
			||||||
 | 
					    __MSG("grove " __STR(USER) " used by " #USER) \
 | 
				
			||||||
 | 
					    static int __GR_EXP(USER) =1;
 | 
				
			||||||
#include "GwHardware.h"
 | 
					#include "GwHardware.h"
 | 
				
			||||||
#include "GwSocketServer.h"
 | 
					#include "GwSocketServer.h"
 | 
				
			||||||
#include "GwSerial.h"
 | 
					#include "GwSerial.h"
 | 
				
			||||||
| 
						 | 
					@ -101,8 +115,18 @@ static SerialParam *getSerialParam(int id){
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return nullptr;
 | 
					    return nullptr;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					void GwChannelList::addSerial(const String &name, int rx, int tx, int type){
 | 
				
			||||||
void GwChannelList:: addSerial(HardwareSerial *stream,int id,int type,int rx,int tx){
 | 
					    if (name == serial){
 | 
				
			||||||
 | 
					        addSerial(&Serial1,SERIAL1_CHANNEL_ID,type,rx,tx);
 | 
				
			||||||
 | 
					        return;   
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (name == serial2){
 | 
				
			||||||
 | 
					        addSerial(&Serial2,SERIAL2_CHANNEL_ID,type,rx,tx);
 | 
				
			||||||
 | 
					        return;   
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    LOG_DEBUG(GwLog::ERROR,"invalid serial config")
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					void GwChannelList::addSerial(HardwareSerial *stream,int id,int type,int rx,int tx){
 | 
				
			||||||
    const char *mode=nullptr;
 | 
					    const char *mode=nullptr;
 | 
				
			||||||
    switch (type)
 | 
					    switch (type)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -126,6 +150,12 @@ void GwChannelList:: addSerial(HardwareSerial *stream,int id,int type,int rx,int
 | 
				
			||||||
    addSerial(stream,id,mode,rx,tx);
 | 
					    addSerial(stream,id,mode,rx,tx);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
void GwChannelList::addSerial(HardwareSerial *serialStream,int id,const String &mode,int rx,int tx){
 | 
					void GwChannelList::addSerial(HardwareSerial *serialStream,int id,const String &mode,int rx,int tx){
 | 
				
			||||||
 | 
					    for (auto &&it:theChannels){
 | 
				
			||||||
 | 
					        if (it->isOwnSource(id)){
 | 
				
			||||||
 | 
					            LOG_DEBUG(GwLog::ERROR,"trying to re-add serial id=%d, ignoring",id);
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    SerialParam *param=getSerialParam(id);
 | 
					    SerialParam *param=getSerialParam(id);
 | 
				
			||||||
    if (param == nullptr){
 | 
					    if (param == nullptr){
 | 
				
			||||||
        logger->logDebug(GwLog::ERROR,"trying to set up an unknown serial channel: %d",id);
 | 
					        logger->logDebug(GwLog::ERROR,"trying to set up an unknown serial channel: %d",id);
 | 
				
			||||||
| 
						 | 
					@ -223,6 +253,11 @@ void GwChannelList::begin(bool fallbackSerial){
 | 
				
			||||||
    LOG_DEBUG(GwLog::LOG,"%s",channel->toString().c_str());
 | 
					    LOG_DEBUG(GwLog::LOG,"%s",channel->toString().c_str());
 | 
				
			||||||
    theChannels.push_back(channel);
 | 
					    theChannels.push_back(channel);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //new serial config handling
 | 
				
			||||||
 | 
					    for (auto &&init:initFunctions){
 | 
				
			||||||
 | 
					        init(this);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    //handle separate defines
 | 
				
			||||||
    //serial 1
 | 
					    //serial 1
 | 
				
			||||||
    #ifndef GWSERIAL_TX
 | 
					    #ifndef GWSERIAL_TX
 | 
				
			||||||
      #define GWSERIAL_TX -1
 | 
					      #define GWSERIAL_TX -1
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,6 +33,9 @@ class GwChannelList{
 | 
				
			||||||
        void addSerial(HardwareSerial *stream,int id,const String &mode,int rx,int tx);
 | 
					        void addSerial(HardwareSerial *stream,int id,const String &mode,int rx,int tx);
 | 
				
			||||||
        void addSerial(HardwareSerial *stream,int id,int type,int rx,int tx);
 | 
					        void addSerial(HardwareSerial *stream,int id,int type,int rx,int tx);
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
 | 
					        static constexpr const char* serial="serial";
 | 
				
			||||||
 | 
					        static constexpr const char* serial2="serial2";
 | 
				
			||||||
 | 
					        void addSerial(const String &name, int rx, int tx, int type);
 | 
				
			||||||
        GwChannelList(GwLog *logger, GwConfigHandler *config);
 | 
					        GwChannelList(GwLog *logger, GwConfigHandler *config);
 | 
				
			||||||
        typedef std::function<void(GwChannel *)> ChannelAction;
 | 
					        typedef std::function<void(GwChannel *)> ChannelAction;
 | 
				
			||||||
        void allChannels(ChannelAction action);
 | 
					        void allChannels(ChannelAction action);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,15 +6,9 @@
 | 
				
			||||||
#include <MD5Builder.h>
 | 
					#include <MD5Builder.h>
 | 
				
			||||||
using CfgInit=std::function<void(GwConfigHandler *)>;
 | 
					using CfgInit=std::function<void(GwConfigHandler *)>;
 | 
				
			||||||
static std::vector<CfgInit> cfgInits;
 | 
					static std::vector<CfgInit> cfgInits;
 | 
				
			||||||
class CfgInitializer{
 | 
					 | 
				
			||||||
    public:
 | 
					 | 
				
			||||||
        CfgInitializer(CfgInit f){
 | 
					 | 
				
			||||||
            cfgInits.push_back(f);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
#define CFG_INIT(name,value,mode) \
 | 
					#define CFG_INIT(name,value,mode) \
 | 
				
			||||||
    __MSG("config set " #name " " #value " " #mode); \
 | 
					    __MSG("config set " #name " " #value " " #mode); \
 | 
				
			||||||
    static CfgInitializer _ ## name ## _init([](GwConfigHandler *cfg){ \
 | 
					    static GwInitializer<CfgInit> _ ## name ## _init(cfgInits,[](GwConfigHandler *cfg){ \
 | 
				
			||||||
        cfg->setValue(GwConfigDefinitions::name,value,GwConfigInterface::mode); \
 | 
					        cfg->setValue(GwConfigDefinitions::name,value,GwConfigInterface::mode); \
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
#include "GwHardware.h"
 | 
					#include "GwHardware.h"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,6 @@
 | 
				
			||||||
#define _GWCONFIGITEM_H
 | 
					#define _GWCONFIGITEM_H
 | 
				
			||||||
#include "WString.h"
 | 
					#include "WString.h"
 | 
				
			||||||
#include <vector>
 | 
					#include <vector>
 | 
				
			||||||
 | 
					 | 
				
			||||||
class GwConfigHandler;
 | 
					class GwConfigHandler;
 | 
				
			||||||
class GwConfigInterface{
 | 
					class GwConfigInterface{
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
| 
						 | 
					@ -79,4 +78,14 @@ class GwNmeaFilter{
 | 
				
			||||||
#define __XSTR(x) __STR(x)
 | 
					#define __XSTR(x) __STR(x)
 | 
				
			||||||
#define __STR(x) #x
 | 
					#define __STR(x) #x
 | 
				
			||||||
#define __MSG(x) _Pragma (__STR(message (x)))
 | 
					#define __MSG(x) _Pragma (__STR(message (x)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<typename F>
 | 
				
			||||||
 | 
					class GwInitializer{
 | 
				
			||||||
 | 
					    public:
 | 
				
			||||||
 | 
					        using List=std::vector<F>;
 | 
				
			||||||
 | 
					        GwInitializer(List &l,F f){
 | 
				
			||||||
 | 
					            l.push_back(f);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					@ -25,9 +25,16 @@
 | 
				
			||||||
#include "GwAppInfo.h"
 | 
					#include "GwAppInfo.h"
 | 
				
			||||||
#include "GwUserTasks.h"
 | 
					#include "GwUserTasks.h"
 | 
				
			||||||
#ifndef CFG_INIT
 | 
					#ifndef CFG_INIT
 | 
				
			||||||
  #define CFG_INIT(name,value,mode)
 | 
					  #define CFG_INIT(...)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#define CFG_INITP(prefix,suffix,value,mode) CFG_INIT(prefix ## suffix,value,mode)
 | 
				
			||||||
 | 
					#ifndef CFG_SERIAL
 | 
				
			||||||
 | 
					  #define CFG_SERIAL(...)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef GROVE_USE
 | 
				
			||||||
 | 
					  #define GROVE_USE(...)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#define _GW_GROOVE_SERIAL serial
 | 
				
			||||||
//general definitions for M5AtomLite
 | 
					//general definitions for M5AtomLite
 | 
				
			||||||
//hint for groove pins:
 | 
					//hint for groove pins:
 | 
				
			||||||
//according to some schematics the numbering is 1,2,3(VCC),4(GND)
 | 
					//according to some schematics the numbering is 1,2,3(VCC),4(GND)
 | 
				
			||||||
| 
						 | 
					@ -71,7 +78,6 @@
 | 
				
			||||||
  #define BOARD_RIGHT1 GPIO_NUM_39
 | 
					  #define BOARD_RIGHT1 GPIO_NUM_39
 | 
				
			||||||
  #define BOARD_RIGHT2 GPIO_NUM_38
 | 
					  #define BOARD_RIGHT2 GPIO_NUM_38
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					 | 
				
			||||||
//M5Stick C
 | 
					//M5Stick C
 | 
				
			||||||
#ifdef PLATFORM_BOARD_M5STICK_C
 | 
					#ifdef PLATFORM_BOARD_M5STICK_C
 | 
				
			||||||
  #define GROOVE_PIN_2 GPIO_NUM_32
 | 
					  #define GROOVE_PIN_2 GPIO_NUM_32
 | 
				
			||||||
| 
						 | 
					@ -150,9 +156,9 @@
 | 
				
			||||||
//M5 Serial (Atomic RS232 Base)
 | 
					//M5 Serial (Atomic RS232 Base)
 | 
				
			||||||
#ifdef M5_SERIAL_KIT_232 
 | 
					#ifdef M5_SERIAL_KIT_232 
 | 
				
			||||||
  #define _GWM5_BOARD
 | 
					  #define _GWM5_BOARD
 | 
				
			||||||
  #define GWSERIAL_TX BOARD_LEFT2
 | 
					  CFG_SERIAL(serial,BOARD_LEFT1,BOARD_LEFT2,GWSERIAL_TYPE_BI)
 | 
				
			||||||
  #define GWSERIAL_RX BOARD_LEFT1
 | 
					  #undef _GW_GROOVE_SERIAL
 | 
				
			||||||
  #define GWSERIAL_TYPE GWSERIAL_TYPE_BI
 | 
					  #define _GW_GROOVE_SERIAL serial2
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//M5 Serial (Atomic RS485 Base)
 | 
					//M5 Serial (Atomic RS485 Base)
 | 
				
			||||||
| 
						 | 
					@ -161,19 +167,19 @@
 | 
				
			||||||
    #error "can only define one M5 base"
 | 
					    #error "can only define one M5 base"
 | 
				
			||||||
  #endif
 | 
					  #endif
 | 
				
			||||||
  #define _GWM5_BOARD
 | 
					  #define _GWM5_BOARD
 | 
				
			||||||
  #define GWSERIAL_TX BOARD_LEFT2
 | 
					  CFG_SERIAL(serial,BOARD_LEFT1,BOARD_LEFT2,GWSERIAL_TYPE_UNI)
 | 
				
			||||||
  #define GWSERIAL_RX BOARD_LEFT1
 | 
					  #undef _GW_GROOVE_SERIAL
 | 
				
			||||||
  #define GWSERIAL_TYPE GWSERIAL_TYPE_UNI
 | 
					  #define _GW_GROOVE_SERIAL serial2
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
CFG_INIT(serialBaud,"9600",READONLY)
 | 
					 | 
				
			||||||
//M5 GPS (Atomic GPS Base)
 | 
					//M5 GPS (Atomic GPS Base)
 | 
				
			||||||
#ifdef M5_GPS_KIT
 | 
					#ifdef M5_GPS_KIT
 | 
				
			||||||
  #ifdef _GWM5_BOARD
 | 
					  #ifdef _GWM5_BOARD
 | 
				
			||||||
    #error "can only define one M5 base"
 | 
					    #error "can only define one M5 base"
 | 
				
			||||||
  #endif
 | 
					  #endif
 | 
				
			||||||
  #define _GWM5_BOARD
 | 
					  #define _GWM5_BOARD
 | 
				
			||||||
  #define GWSERIAL_RX BOARD_LEFT1
 | 
					  CFG_SERIAL(serial,BOARD_LEFT1,-1,GWSERIAL_TYPE_UNI)
 | 
				
			||||||
  #define GWSERIAL_TYPE GWSERIAL_TYPE_RX
 | 
					  #undef _GW_GROOVE_SERIAL
 | 
				
			||||||
 | 
					  #define _GW_GROOVE_SERIAL serial2
 | 
				
			||||||
  CFG_INIT(serialBaud,"9600",READONLY)
 | 
					  CFG_INIT(serialBaud,"9600",READONLY)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -212,48 +218,19 @@ CFG_INIT(serialBaud,"9600",READONLY)
 | 
				
			||||||
//we use serial2 for groove serial if serial1 is already defined
 | 
					//we use serial2 for groove serial if serial1 is already defined
 | 
				
			||||||
//before (e.g. by serial kit)
 | 
					//before (e.g. by serial kit)
 | 
				
			||||||
#ifdef SERIAL_GROOVE_485
 | 
					#ifdef SERIAL_GROOVE_485
 | 
				
			||||||
  #define _GWM5_GROOVE
 | 
					  GROVE_USE(SERIAL_GROOVE_485)
 | 
				
			||||||
  #ifdef GWSERIAL_TYPE
 | 
					  CFG_SERIAL(_GW_GROOVE_SERIAL,GROOVE_PIN_1,GROOVE_PIN_2,GWSERIAL_TYPE_UNI)
 | 
				
			||||||
    #define GWSERIAL2_TX GROOVE_PIN_2
 | 
					 | 
				
			||||||
    #define GWSERIAL2_RX GROOVE_PIN_1
 | 
					 | 
				
			||||||
    #define GWSERIAL2_TYPE GWSERIAL_TYPE_UNI
 | 
					 | 
				
			||||||
  #else
 | 
					 | 
				
			||||||
    #define GWSERIAL_TX GROOVE_PIN_2
 | 
					 | 
				
			||||||
    #define GWSERIAL_RX GROOVE_PIN_1
 | 
					 | 
				
			||||||
    #define GWSERIAL_TYPE GWSERIAL_TYPE_UNI
 | 
					 | 
				
			||||||
  #endif 
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef SERIAL_GROOVE_232
 | 
					#ifdef SERIAL_GROOVE_232
 | 
				
			||||||
  #ifdef _GWM5_GROOVE
 | 
					  GROVE_USE(SERIAL_GROOVE_232)
 | 
				
			||||||
    #error "can only have one groove device"
 | 
					  CFG_SERIAL(_GW_GROOVE_SERIAL,GROOVE_PIN_1,GROOVE_PIN_2,GWSERIAL_TYPE_BI)
 | 
				
			||||||
  #endif
 | 
					 | 
				
			||||||
  #define _GWM5_GROOVE
 | 
					 | 
				
			||||||
  #ifdef GWSERIAL_TYPE
 | 
					 | 
				
			||||||
    #define GWSERIAL2_TX GROOVE_PIN_2
 | 
					 | 
				
			||||||
    #define GWSERIAL2_RX GROOVE_PIN_1
 | 
					 | 
				
			||||||
    #define GWSERIAL2_TYPE GWSERIAL_TYPE_BI
 | 
					 | 
				
			||||||
  #else
 | 
					 | 
				
			||||||
    #define GWSERIAL_TX GROOVE_PIN_2
 | 
					 | 
				
			||||||
    #define GWSERIAL_RX GROOVE_PIN_1
 | 
					 | 
				
			||||||
    #define GWSERIAL_TYPE GWSERIAL_TYPE_BI
 | 
					 | 
				
			||||||
  #endif
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//http://docs.m5stack.com/en/unit/gps
 | 
					//http://docs.m5stack.com/en/unit/gps
 | 
				
			||||||
#ifdef M5_GPS_UNIT
 | 
					#ifdef M5_GPS_UNIT
 | 
				
			||||||
  #ifdef _GWM5_GROOVE
 | 
					  GROVE_USE(M5_GPS_UNIT)
 | 
				
			||||||
    #error "can only have one M5 groove"
 | 
					  CFG_SERIAL(_GW_GROOVE_SERIAL,GROOVE_PIN_1,-1,GWSERIAL_TYPE_RX)
 | 
				
			||||||
  #endif
 | 
					  CFG_INITP(_GW_GROOVE_SERIAL,Baud,"9600",READONLY)
 | 
				
			||||||
  #define _GWM5_GROOVE
 | 
					 | 
				
			||||||
  #ifdef GWSERIAL_TYPE
 | 
					 | 
				
			||||||
    #define GWSERIAL2_RX GROOVE_PIN_1
 | 
					 | 
				
			||||||
    #define GWSERIAL2_TYPE GWSERIAL_TYPE_RX
 | 
					 | 
				
			||||||
    CFG_INIT(serialBaud,"9600",READONLY)
 | 
					 | 
				
			||||||
  #else
 | 
					 | 
				
			||||||
    #define GWSERIAL_RX GROOVE_PIN_1
 | 
					 | 
				
			||||||
    #define GWSERIAL_TYPE GWSERIAL_TYPE_RX
 | 
					 | 
				
			||||||
    CFG_INIT(serial2Baud,"9600",READONLY)
 | 
					 | 
				
			||||||
  #endif 
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//can kit for M5 Atom
 | 
					//can kit for M5 Atom
 | 
				
			||||||
| 
						 | 
					@ -267,17 +244,14 @@ CFG_INIT(serialBaud,"9600",READONLY)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
//CAN via groove 
 | 
					//CAN via groove 
 | 
				
			||||||
#ifdef M5_CANUNIT
 | 
					#ifdef M5_CANUNIT
 | 
				
			||||||
  #ifdef _GWM5_GROOVE
 | 
					  GROVE_USE(M5_CANUNIT)
 | 
				
			||||||
    #error "can only have one M5 groove"
 | 
					 | 
				
			||||||
  #endif
 | 
					 | 
				
			||||||
  #define _GWM5_GROOVE
 | 
					 | 
				
			||||||
  #define ESP32_CAN_TX_PIN GROOVE_PIN_2
 | 
					  #define ESP32_CAN_TX_PIN GROOVE_PIN_2
 | 
				
			||||||
  #define ESP32_CAN_RX_PIN GROOVE_PIN_1
 | 
					  #define ESP32_CAN_RX_PIN GROOVE_PIN_1
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef M5_ENV3
 | 
					#ifdef M5_ENV3
 | 
				
			||||||
  #ifndef M5_GROOVEIIC
 | 
					  #ifndef M5_GROOVEIIC
 | 
				
			||||||
    #define M5_GROOVEIIC
 | 
					    #define M5_GROOVEIIC M5_ENV3
 | 
				
			||||||
  #endif
 | 
					  #endif
 | 
				
			||||||
  #ifndef GWSHT3X
 | 
					  #ifndef GWSHT3X
 | 
				
			||||||
    #define GWSHT3X -1
 | 
					    #define GWSHT3X -1
 | 
				
			||||||
| 
						 | 
					@ -288,10 +262,7 @@ CFG_INIT(serialBaud,"9600",READONLY)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef M5_GROOVEIIC
 | 
					#ifdef M5_GROOVEIIC
 | 
				
			||||||
  #ifdef _GWM5_GROOVE
 | 
					  GROVE_USE(M5_GROOVEIIC)
 | 
				
			||||||
    #error "can only have one M5 groove"
 | 
					 | 
				
			||||||
  #endif
 | 
					 | 
				
			||||||
  #define _GWM5_GROOVE
 | 
					 | 
				
			||||||
  #ifdef GWIIC_SCL
 | 
					  #ifdef GWIIC_SCL
 | 
				
			||||||
    #error "you cannot define both GWIIC_SCL and M5_GROOVEIIC"
 | 
					    #error "you cannot define both GWIIC_SCL and M5_GROOVEIIC"
 | 
				
			||||||
  #endif
 | 
					  #endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -101,7 +101,7 @@ types:
 | 
				
			||||||
        children:
 | 
					        children:
 | 
				
			||||||
        - *m5grooveserial
 | 
					        - *m5grooveserial
 | 
				
			||||||
  - &gpiopin
 | 
					  - &gpiopin
 | 
				
			||||||
    type: dropdown
 | 
					    type: "#gpiotype#"
 | 
				
			||||||
    resource: "gpio:"
 | 
					    resource: "gpio:"
 | 
				
			||||||
    help: 'Select the number of the GPIO pin for this function'
 | 
					    help: 'Select the number of the GPIO pin for this function'
 | 
				
			||||||
    values: "#gpiopinv#"
 | 
					    values: "#gpiopinv#"
 | 
				
			||||||
| 
						 | 
					@ -136,7 +136,7 @@ types:
 | 
				
			||||||
      - 38
 | 
					      - 38
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - &gpioinput
 | 
					  - &gpioinput
 | 
				
			||||||
    type: dropdown
 | 
					    type: "#gpiotype#"
 | 
				
			||||||
    resource: "gpio:"
 | 
					    resource: "gpio:"
 | 
				
			||||||
    help: 'Select the number of the GPIO pin for this function'
 | 
					    help: 'Select the number of the GPIO pin for this function'
 | 
				
			||||||
    values: "#gpiopinv#"
 | 
					    values: "#gpiopinv#"
 | 
				
			||||||
| 
						 | 
					@ -183,6 +183,16 @@ types:
 | 
				
			||||||
      - PPIN25
 | 
					      - PPIN25
 | 
				
			||||||
      - PPIN33
 | 
					      - PPIN33
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 | 
					  - &abcgpio
 | 
				
			||||||
 | 
					      - {label:unset, value:}
 | 
				
			||||||
 | 
					      - ABC_PAYELLOW
 | 
				
			||||||
 | 
					      - ABC_PAYWHITE
 | 
				
			||||||
 | 
					      - ABC_PBYELLOW
 | 
				
			||||||
 | 
					      - ABC_PBYWHITE
 | 
				
			||||||
 | 
					      - ABC_PBYELLOW
 | 
				
			||||||
 | 
					      - ABC_PBYWHITE
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  - &serialRX
 | 
					  - &serialRX
 | 
				
			||||||
    <<: *gpioinput
 | 
					    <<: *gpioinput
 | 
				
			||||||
    key: RX
 | 
					    key: RX
 | 
				
			||||||
| 
						 | 
					@ -235,6 +245,7 @@ types:
 | 
				
			||||||
    type: checkbox
 | 
					    type: checkbox
 | 
				
			||||||
    label: 'Serial 1'
 | 
					    label: 'Serial 1'
 | 
				
			||||||
    key: serial1
 | 
					    key: serial1
 | 
				
			||||||
 | 
					    resource: serial1
 | 
				
			||||||
    base: 
 | 
					    base: 
 | 
				
			||||||
      serial: GWSERIAL_
 | 
					      serial: GWSERIAL_
 | 
				
			||||||
    values: *serialValues
 | 
					    values: *serialValues
 | 
				
			||||||
| 
						 | 
					@ -243,6 +254,7 @@ types:
 | 
				
			||||||
    type: checkbox
 | 
					    type: checkbox
 | 
				
			||||||
    label: 'Serial 2'
 | 
					    label: 'Serial 2'
 | 
				
			||||||
    key: serial2
 | 
					    key: serial2
 | 
				
			||||||
 | 
					    resource: serial2
 | 
				
			||||||
    base:
 | 
					    base:
 | 
				
			||||||
      serial: GWSERIAL2_
 | 
					      serial: GWSERIAL2_
 | 
				
			||||||
    values: *serialValues
 | 
					    values: *serialValues
 | 
				
			||||||
| 
						 | 
					@ -360,6 +372,7 @@ types:
 | 
				
			||||||
    type: checkbox
 | 
					    type: checkbox
 | 
				
			||||||
    label: "I2C #busname#"
 | 
					    label: "I2C #busname#"
 | 
				
			||||||
    key: "i2c#busname#"
 | 
					    key: "i2c#busname#"
 | 
				
			||||||
 | 
					    resource: "i2c#busname#"
 | 
				
			||||||
    description: "I2C Bus #busname#"
 | 
					    description: "I2C Bus #busname#"
 | 
				
			||||||
    values:
 | 
					    values:
 | 
				
			||||||
      - key: true
 | 
					      - key: true
 | 
				
			||||||
| 
						 | 
					@ -433,6 +446,7 @@ types:
 | 
				
			||||||
    type: checkbox
 | 
					    type: checkbox
 | 
				
			||||||
    label: "SPI/SSI #busname#"
 | 
					    label: "SPI/SSI #busname#"
 | 
				
			||||||
    key: "spi#busname#"
 | 
					    key: "spi#busname#"
 | 
				
			||||||
 | 
					    resource: "spi#busname#"
 | 
				
			||||||
    description: "SPI(SSI) Bus #busname#"
 | 
					    description: "SPI(SSI) Bus #busname#"
 | 
				
			||||||
    values:
 | 
					    values:
 | 
				
			||||||
      - key: true
 | 
					      - key: true
 | 
				
			||||||
| 
						 | 
					@ -541,6 +555,11 @@ types:
 | 
				
			||||||
            gpiopinv: *protogpio
 | 
					            gpiopinv: *protogpio
 | 
				
			||||||
          children:
 | 
					          children:
 | 
				
			||||||
            *m5protochildren
 | 
					            *m5protochildren
 | 
				
			||||||
 | 
					        - value: M5_PORTABC
 | 
				
			||||||
 | 
					          description: "M5 Stack Port ABC extension base"
 | 
				
			||||||
 | 
					          url: "https://docs.m5stack.com/en/unit/AtomPortABC"
 | 
				
			||||||
 | 
					          label: "ABC Ext"
 | 
				
			||||||
 | 
					          base: 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
resources:
 | 
					resources:
 | 
				
			||||||
  default: &esp32default
 | 
					  default: &esp32default
 | 
				
			||||||
| 
						 | 
					@ -558,6 +577,7 @@ config:
 | 
				
			||||||
      base:
 | 
					      base:
 | 
				
			||||||
        gpiopinv: *gpiopinv
 | 
					        gpiopinv: *gpiopinv
 | 
				
			||||||
        gpioinputv: *gpioinputv
 | 
					        gpioinputv: *gpioinputv
 | 
				
			||||||
 | 
					        gpiotype: dropdown
 | 
				
			||||||
      values: 
 | 
					      values: 
 | 
				
			||||||
        - value: m5stack-atom-generic
 | 
					        - value: m5stack-atom-generic
 | 
				
			||||||
          label: m5stack-atom
 | 
					          label: m5stack-atom
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -119,7 +119,7 @@ class PipelineInfo{
 | 
				
			||||||
                .then((st)=>{
 | 
					                .then((st)=>{
 | 
				
			||||||
                    if (queryPipeline !== currentPipeline.id) return;
 | 
					                    if (queryPipeline !== currentPipeline.id) return;
 | 
				
			||||||
                    let stid=st.pipeline_id||st.id;
 | 
					                    let stid=st.pipeline_id||st.id;
 | 
				
			||||||
                    if (currentPipeline.id !== stid) return;
 | 
					                    if (stid !== undefined &&  currentPipeline.id !== stid) return;
 | 
				
			||||||
                    if (st.status === undefined) st.status=st.state;
 | 
					                    if (st.status === undefined) st.status=st.state;
 | 
				
			||||||
                    currentPipeline.update(st);
 | 
					                    currentPipeline.update(st);
 | 
				
			||||||
                    updateStatus();
 | 
					                    updateStatus();
 | 
				
			||||||
| 
						 | 
					@ -516,6 +516,11 @@ class PipelineInfo{
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        if (expandedValues.length > 0 && config.type === 'display'){
 | 
				
			||||||
 | 
					            let cb=addEl('div','t'+config.type,inputFrame);
 | 
				
			||||||
 | 
					            addDescription(config,inputFrame);
 | 
				
			||||||
 | 
					            initialConfig=expandedValues[0];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        let childFrame=addEl('div','childFrame',frame);
 | 
					        let childFrame=addEl('div','childFrame',frame);
 | 
				
			||||||
        if (initialConfig !== undefined){
 | 
					        if (initialConfig !== undefined){
 | 
				
			||||||
            callback(initialConfig,true,childFrame);
 | 
					            callback(initialConfig,true,childFrame);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue