Compile error Mega latest

Moderators: Voyager, BertB, rtenklooster, Stuntteam, grovkillen, TD-er

Post Reply
Message
Author
rayE
Normal user
Posts: 87
Joined: 12 Oct 2017, 12:53
Location: Philippines

Compile error Mega latest

#1 Post by rayE » 06 Feb 2019, 11:55

Hi All,
Platform: SNOFF POW
Compiler: Ardunio 1.8.8
Source: ESPEasy_mega-20190202
OS: Widows 7.0

Im getting the following error when P076 is included in define_plugin_sets.h

Code: Select all

Arduino: 1.8.8 (Windows 7), Board: "Generic ESP8266 Module, 80 MHz, Flash, ck, 26 MHz, 40MHz, QIO, 4M (1M SPIFFS), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

WARNING: Category 'LED' in library CHT16K33 LED Matrix Library is not valid. Setting to 'Uncategorized'
WARNING: Category 'Input' in library MechInputs is not valid. Setting to 'Uncategorized'
WARNING: Category 'Input' in library SerialSensors is not valid. Setting to 'Uncategorized'
C:\Users\LabDesign\Documents\Laptop Docs\Island Instruments\Projects 13.02.2011\Craft R+R Products\Energy Meter EM01\FirmWare\ESPEasy_mega-20190121 - RAE\source\ESPEasy\_P076_HLW8012.ino: In function 'boolean Plugin_076(byte, EventStruct*, String&)':

_P076_HLW8012:391:32: error: 'p076_hlw8012_cf1_interrupt' was not declared in this scope

       attachInterrupt(CF1_PIN, p076_hlw8012_cf1_interrupt, cf1_trigger);

                                ^

_P076_HLW8012:392:31: error: 'p076_hlw8012_cf_interrupt' was not declared in this scope

       attachInterrupt(CF_PIN, p076_hlw8012_cf_interrupt, cf_trigger);

                               ^

Multiple libraries were found for "Servo.h"
 Used: C:\Users\LabDesign\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\libraries\Servo
 Not used: C:\Program Files (x86)\Arduino\libraries\Servo
exit status 1
'p076_hlw8012_cf1_interrupt' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
This is a snippet from define_plugin_sets.h

Code: Select all

#ifdef PLUGIN_SET_SONOFF_POW
    #define PLUGIN_DESCR  "Sonoff POW R1/R2"

    #define PLUGIN_SET_ONLY_SWITCH
	  #define USES_P001   // Switch
    #define USES_P003   // Pulse
    #define USES_P020   // Ser2Net
    #define USES_P026   // SysInfo
    #define USES_P033   // Dummy
    #define USES_P076   // HWL8012   in POW r1
    // Needs CSE7766 Energy sensor, via Serial RXD 4800 baud 8E1 (GPIO1), TXD (GPIO3)
    //#define USES_P077	  // CSE7766   in POW R2
    //#define USES_P081   // Cron
#endif
Last edited by rayE on 09 Feb 2019, 07:19, edited 1 time in total.

rayE
Normal user
Posts: 87
Joined: 12 Oct 2017, 12:53
Location: Philippines

Re: Compile error Mega latest

#2 Post by rayE » 09 Feb 2019, 06:54

OK i think i figured this out, changes below.

Added this to top of Custom.h file

Code: Select all

#######################################################################################################
	You can basically ovveride ALL macro defined in ESPEasy.ino.
	Don't forget to first #undef each existing #define that you add below.
	Here are some examples:
*/
//-----------------------------------------------------------------
#ifndef CORE_2_5_0                //Added by RAE to make build 20190202
  #define CORE_2_5_0              //work with core 2.5.0-beta2 
#endif                            //(compile IP errors)

#include "ESPeasySerial.h"        //Added by RAE to remove compiler error

#ifdef PLUGIN_BUILD_NORMAL
    #undef PLUGIN_BUILD_NORMAL
#endif
#define PLUGIN_BUILD_CUSTOM       //Needed so it does not default to normal plugin set RAE
#define PLUGIN_BUILD_EM01         //Plugin's for for EM01 energy meter RAE

#define EM01_WEB_MENU             //Remove items unwanted from the GUI web interface
//-----------------------------------------------------------------
This got rid of most errors, the only error left was complaining about the library entry points for P076 (HLW8012) plugin. I moved the following code in the plugin from the bottom to the point after "#define HLW_VOLTAGE_RESISTOR_DOWN (1000)" (at the top of the code)

Code: Select all

// When using interrupts we have to call the library entry point
// whenever an interrupt is triggered
void ICACHE_RAM_ATTR p076_hlw8012_cf1_interrupt() {
  if (Plugin_076_hlw) {
    Plugin_076_hlw->cf1_interrupt();
  }
}

void ICACHE_RAM_ATTR p076_hlw8012_cf_interrupt() {
  if (Plugin_076_hlw) {
    Plugin_076_hlw->cf_interrupt();
  }
}

rayE
Normal user
Posts: 87
Joined: 12 Oct 2017, 12:53
Location: Philippines

Re: Compile error Mega latest

#3 Post by rayE » 09 Feb 2019, 06:56

This work was done on source code from mega_20190202.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests