PWM compile error

Do you have a question on how to do something.
Ask in here.
Post Reply
User avatar
Loose
Posts: 88
Joined: Fri Sep 01, 2017 8:15 am
Location: Severna Park, MD

PWM compile error

Post by Loose »

I haven't modified my code in a while but wanted to tweak it a bit. I loaded my currently working code, tried to compile it as is, and I get the following error:

Code: Select all

Compiling code for RA_STAR board

Number of Relay Expansion Modules: 3
Relay Expansion Module
16 Channel Dimming Expansion Module 
Dimming Signal 
Water Level Expansion Module 
Reef Angel Star 
Salinity Expansion Module 
Multi Channel Water Level Expansion Module 
Extra Temperature Probes 
D:\Arduino\libraries\RA_PWM\RA_PWM.cpp: In member function 'void RA_PWMClass::SIXTEENChannelPWMSmoothRamp(byte, byte, byte, byte)':
D:\Arduino\libraries\RA_PWM\RA_PWM.cpp:1124:58: error: 'SIXTEENChannelSmoothRamp' was not declared in this scope
SIXTEENChannelSmoothRamp(Channel,Start,End,SlopeLength,0);
^
exit status 1

Progress: 55.17%
Your code has some errors and couldn't be compiled.
Please fix the errors above and try again.
Full code:

Code: Select all

#include <Salinity.h>
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_TS.h>
#include <RA_TouchLCD.h>
#include <RA_TFT.h>
#include <RA_TS.h>
#include <Font.h>
#include <RA_Wifi.h>
#include <RA_Wiznet5100.h>
#include <SD.h>
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetDHCP.h>
#include <PubSubClient.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_ATO.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <RA_CustomLabels.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <PAR.h>
#include <DCPump.h>
#include <ReefAngel.h>
#include <SoftwareSerial.h>

////// Place global variable code below here

#define Heater1 Box1_Port1
#define Heater2 Box1_Port3
#define Heater3 Box1_Port5
#define SalExp Box1_Port7
#define ReturnDCP Box1_Port2
#define TopOff Box1_Port4
#define Skimmer Box1_Port6
#define QTFiltHeat Box1_Port8

#define DimExp1 Box2_Port1
#define DimExp2 Box2_Port2
#define SE_600_48 Box2_Port8
#define RODIHeat Box2_Port5
#define SaltH2OHeat Box2_Port7

#define EhiemFeed Box3_Port1

// Define Custom Memory
#define Mem_I_Latitude      100
#define Mem_I_Longitude     102
#define Mem_B_AcclDay       108
#define Mem_B_ResetMemory   117

////// Place global variable code above here

int LEDgroupslvl = 90; // Used for main LED groups 1 - 8 <--- This needs to be moved to internal memory

///// 16ch DImming using Cloud Wifi Hub Expansion code begin
unsigned long last16channelcheck = millis();
int OldPercentage16[16];
byte OldPercentage16Override[16];
char buffer[15];
///// 16ch DImming using Cloud Wifi Hub Expansion code end

long randNumber;
unsigned long lastdircheck = millis();

void init_memory()
{
    // Initialize Custom Memory Locations
InternalMemory.write_int(Mem_I_Latitude,39);
InternalMemory.write_int(Mem_I_Longitude,77);
InternalMemory.write(Mem_B_AcclDay,0);

InternalMemory.write(Mem_B_ResetMemory,false);
}

void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.Star();
    ReefAngel.AddSalinityExpansion();  // Salinity Expanion Module
    ReefAngel.AddMultiChannelWaterLevelExpansion();  // Multi-Channel Water Level Expanion Module
    ReefAngel.AddExtraTempProbes();  //Add additional temperature probes - Dispaly Temp 4, Temp 5, and Temp 6
    ReefAngel.Add16ChPWM();  // Add second Dimming Expansion Module (6 Channel in this code)
    
    randomSeed(now()/SECS_PER_DAY);
    
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    ReefAngel.FeedingModePortsE[0] = Port2Bit | Port4Bit | Port6Bit;
    ReefAngel.FeedingModePortsE[1] = 0;
    ReefAngel.FeedingModePortsE[2] = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = 0;
    ReefAngel.WaterChangePortsE[0] = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit;
    ReefAngel.WaterChangePortsE[1] = 0;
    ReefAngel.WaterChangePortsE[2] = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    ReefAngel.OverheatShutoffPortsE[0] = Port1Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit;
    ReefAngel.OverheatShutoffPortsE[1] = 0;
    ReefAngel.OverheatShutoffPortsE[2] = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    ReefAngel.LightsOnPortsE[0] = 0;
    ReefAngel.LightsOnPortsE[1] = 0;
    ReefAngel.LightsOnPortsE[2] = 0;
    

    // Use T2 probe as temperature and overheat functions
    ReefAngel.TempProbe = T2_PROBE;
    ReefAngel.OverheatProbe = T2_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 810 );

    // Ports that are always on
    ReefAngel.Relay.On( ReturnDCP );
    ReefAngel.Relay.On( SalExp );
    ReefAngel.Relay.On( QTFiltHeat );
    ReefAngel.Relay.On( DimExp1 );
    ReefAngel.Relay.On( DimExp2 );
    ReefAngel.Relay.On( SE_600_48 );
    
    // Ports that are always off
    ReefAngel.Relay.Off( TopOff );

    ////// Place additional initialization code below here
    
    ReefAngel.DCPump.DaylightChannel = Sync;
    ReefAngel.DCPump.Daylight2Channel = AntiSync;
    ReefAngel.DCPump.FeedingSpeed = 36;
    ReefAngel.DCPump.WaterChangeSpeed = 0;

  if ( InternalMemory.read(Mem_B_ResetMemory) ) init_memory();
    
    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.StandardHeater( T2_PROBE,Heater1,760,780 );
    ReefAngel.StandardHeater( T2_PROBE,Heater2,750,780 );
    ReefAngel.StandardHeater( T2_PROBE,Heater3,740,780 );
    
    ReefAngel.Relay.DelayedOn( Skimmer );

    boolean buzzer=false;
    if ( ReefAngel.isOverheat() ) buzzer=true;
    if ( ReefAngel.isBusLock() ) buzzer=true;
    if ( buzzer ) ReefAngel.BuzzerOn(2); else ReefAngel.BuzzerOff();

    // ATO/Water functions - Begin
    
    if ( ( hour() == 6 ) && ( minute() >= 45 ) && ( hour() == 6 ) && ( minute() < 48 ) )
    {
        if ( ReefAngel.WaterLevel.GetLevel(2) <= 72 && ReefAngel.WaterLevel.GetLevel(2) >= 9 ) ReefAngel.Relay.On( TopOff );
        if ( ReefAngel.WaterLevel.GetLevel(2) >= 81 || ReefAngel.WaterLevel.GetLevel(2) < 9 || ReefAngel.HighATO.IsActive() ) ReefAngel.Relay.Off( TopOff );
    }

    if ( ( hour() == 18 ) && ( minute() >= 45 ) && ( hour() == 18 ) && ( minute() < 48 ) )
    {
        if ( ReefAngel.WaterLevel.GetLevel(2) <= 72 && ReefAngel.WaterLevel.GetLevel(2) >= 9 ) ReefAngel.Relay.On( TopOff );
        if ( ReefAngel.WaterLevel.GetLevel(2) >= 81 || ReefAngel.WaterLevel.GetLevel(2) < 9 || ReefAngel.HighATO.IsActive() ) ReefAngel.Relay.Off( TopOff );
    }

    if ( ReefAngel.WaterLevel.GetLevel(2) <= 36 ) ReefAngel.Relay.Off( ReturnDCP );
    if ( ReefAngel.WaterLevel.GetLevel(2) >= 63 ) ReefAngel.Relay.On( ReturnDCP );
    if ( ReefAngel.WaterLevel.GetLevel(2) >= 90 || ReefAngel.WaterLevel.GetLevel(1) >= 108 || ReefAngel.HighATO.IsActive() )
    {
        ReefAngel.Relay.Off( Skimmer );
        ReefAngel.Relay.Off( TopOff );
    }    

    // ATO/Water functions - End

    if ( ReefAngel.WaterLevel.GetLevel(1) < 72 && ReefAngel.WaterLevel.GetLevel(1) >= 9 ) // Main Heater run dry protection
    {
        ReefAngel.Relay.Off( Heater1 );
        ReefAngel.Relay.Off( Heater2 );
        ReefAngel.Relay.Off( Heater3 );
    }
    
    if (ReefAngel.WaterLevel.GetLevel(3) < 90 && ReefAngel.WaterLevel.GetLevel(3) >= 9 ) // Quarantine tank run dry protection (no auto topoff)
    {
        ReefAngel.Relay.Off( QTFiltHeat );
        // buzzer=true;
        // if ( buzzer ) ReefAngel.BuzzerOn(2); else ReefAngel.BuzzerOff();
    }
    else ReefAngel.Relay.On( QTFiltHeat );

    ////// Place your custom code below here
    
//  Gyre Pumps begin

    ReefAngel.DCPump.UseMemory = false;
    ReefAngel.DCPump.SetMode( Sine,99,63,45 ); // For Sine mode (Mode, Max speed, Cycle duration, Min speed [Threshold in App])

    /// Random switching of Gyre directions - 18 % of time
    
    if ( millis() - lastdircheck > 60000 ) // check for direction swicth every var/1000 seconds [currently once a minute]
    {
        lastdircheck = millis();
        randNumber = random(101);
        if ( randNumber < 18 )
        {
            ReefAngel.PWM.SetActinic(100);  // Gyre 1 Reverse
            ReefAngel.PWM.SetActinic2(0);   // Gyre 2 Forward
        }
        else
        {
            ReefAngel.PWM.SetActinic(0);    // Gyre 1 Forward
            ReefAngel.PWM.SetActinic2(100); // Gyre 2 Reverse
        }
    }

// Gyre Pumps end

// Dosing pump code begin

    ReefAngel.DosingPumpRepeat(EhiemFeed,420,720,30);
    /*
    Used for modified auto feeder
    - Feeds at 7am (420 minutes offset from Midnight)
    - Feeds at 7pm (720 minutes offset from last feed or feed every 12 hours)
    - Feeds for 30 seconds
    */

// Dosing pump end

    // 6 channelPWM testing
//  for (int a=0;a<6;a++)
//  {
//    ReefAngel.PWM.SetChannel(a,3);
//  }
//  ReefAngel.PWM.SetChannel(now()%6,54);

// Lighting

    Coralacclimation(); // add acclimation to Lights
    int LEDgroupslvlaccl=LEDgroupslvl - Mem_B_AcclDay;
    
    ReefAngel.PWM.SetChannelRaw( 0, PWMParabolaHighRes(7,0,23,0,3,81,1) );               // Blues
    ReefAngel.PWM.SetChannelRaw( 1, PWMParabolaHighRes(14,30,22,30,9,63,0) );            // Cool White
    ReefAngel.PWM.SetChannelRaw( 2, PWMParabolaHighRes(7,9,23,18,3,81,1) );              // UV Left
    ReefAngel.PWM.SetChannelRaw( 3, PWMParabolaHighRes(7,9,23,18,3,81,1) );              // UV Right
    ReefAngel.PWM.SetChannelRaw( 4, PWMSlopeHighRes(12,36,21,36,3,LEDgroupslvl,30,0) );   // LED Group 1 - B0
    ReefAngel.PWM.SetChannelRaw( 5, PWMSlopeHighRes(12,45,21,45,3,LEDgroupslvl,30,0) );   // LED Group 2 - B1

    ////// Place your custom code above here

///// 16ch DImming using Cloud Wifi Hub Expansion code begin

//    int Led16lvl=40.95*LEDgroupslvl;

//    ReefAngel.PWM.Set16Channel( 0, PWMSlope(9,54,20,54,18,LEDgroupslvl,30,0) );   // LED Group 3 - B2
//    ReefAngel.PWM.Set16Channel( 1, PWMSlope(10,3,21,3,18,LEDgroupslvl,30,0) );    // LED Group 4 - B3
//    ReefAngel.PWM.Set16Channel( 2, PWMSlope(10,12,18,12,18,LEDgroupslvl,30,0) );  // LED Group 5 - C0
//    ReefAngel.PWM.Set16Channel( 3, PWMSlope(10,21,21,21,18,LEDgroupslvl,30,0) );  // LED Group 6 - C1
//    ReefAngel.PWM.Set16Channel( 4, PWMSlope(10,30,21,30,18,LEDgroupslvl,30,0) );  // LED Group 7 - C2
//    ReefAngel.PWM.Set16Channel( 5, PWMSlope(10,39,21,39,18,LEDgroupslvl,30,0) );  // LED Group 8 - C3

//  Normalized code for Lights across all groups

    for (int z=0;z<6;z++)
    {
        ReefAngel.PWM.Set16Channel( z , PWMSlope(14,12,21,12,9,LEDgroupslvl,45,0) );
    }

  if (millis() - last16channelcheck > 1000 && ReefAngel.Network.IsMQTTConnected())

  {
    last16channelcheck = millis();
    for (byte a = 0; a < 6; a++) // a < 16 has been Modified for 6ch Dimming module
    {
      if (ReefAngel.PWM.SIXTEENChExpansionChannel[a] != OldPercentage16[a])
      {
        if (a<10)
          sprintf(buffer, "%s0%d:%d", "PWM16E", a, ReefAngel.PWM.SIXTEENChExpansionChannel[a]);
        else
          sprintf(buffer, "%s%d:%d", "PWM16E", a, ReefAngel.PWM.SIXTEENChExpansionChannel[a]);
        Serial.println(buffer);
        ReefAngel.Network.CloudPublish(buffer);
        OldPercentage16[a] = ReefAngel.PWM.SIXTEENChExpansionChannel[a];
      }
      if (ReefAngel.PWM.SIXTEENChExpansionChannelOverride[a] != OldPercentage16Override[a])
      {
        if (a<10)
          sprintf(buffer, "%s0%d:%d", "PWM16EO", a, ReefAngel.PWM.SIXTEENChExpansionChannelOverride[a]);
        else
          sprintf(buffer, "%s%d:%d", "PWM16EO", a, ReefAngel.PWM.SIXTEENChExpansionChannelOverride[a]);
        Serial.println(buffer);
        ReefAngel.Network.CloudPublish(buffer);
        OldPercentage16Override[a] = ReefAngel.PWM.SIXTEENChExpansionChannelOverride[a];
      }
    }
  }
///// 16ch DImming using Cloud Wifi Hub Expansion code end

    ReefAngel.Network.Cloud();
    // This should always be the last line
    ReefAngel.ShowTouchInterface();
}

void Coralacclimation()
{
    // Start acclimation foutine
    byte acclDay=InternalMemory.read(Mem_B_AcclDay);
    
    // See if acclimating Coral
    static boolean acclCounterReady=false;
    if (now()%SECS_PER_DAY!=0) acclCounterReady=true;
    if (now()%SECS_PER_DAY==0 && acclCounterReady && acclDay>0)
    {
        acclDay--;
        acclCounterReady=false;
        InternalMemory.write(Mem_B_AcclDay,acclDay);
    }
    // End acclimation
}

// RA_STRING1=U2FsdGVkX19F8Kk0jJty8c49l7bZE9qgmvWmV0+hTN0=
// RA_STRING2=U2FsdGVkX1/DtmFyHppSDKW+4mDVsuaSdZnDAiMonRs=
// RA_STRING3=K2GVR
// RA_LABEL LABEL_ACTINIC=Gyre 1 Direction
// RA_LABEL LABEL_ACTINIC2=Gyre 2 Direction
// RA_LABEL LABEL_DAYLIGHT=Gyre 1 Speed
// RA_LABEL LABEL_DAYLIGHT2=Gyre 2 Speed
// RA_LABEL LABEL_PORT11=Heater 1
// RA_LABEL LABEL_PORT12=Return DCP-10000
// RA_LABEL LABEL_PORT13=Heater 2
// RA_LABEL LABEL_PORT14=ATO (Level 2)
// RA_LABEL LABEL_PORT15=Heater 3
// RA_LABEL LABEL_PORT16=Skimmer
// RA_LABEL LABEL_PORT17=Salinity expansion
// RA_LABEL LABEL_PORT18=QT heat/filter
// RA_LABEL LABEL_PORT21=Not Used
// RA_LABEL LABEL_PORT22=Dim Exp 1
// RA_LABEL LABEL_PORT23=Dim Exp 2
// RA_LABEL LABEL_PORT24=Not Used
// RA_LABEL LABEL_PORT25=Not Used
// RA_LABEL LABEL_PORT26=Not Used
// RA_LABEL LABEL_PORT27=Not Used
// RA_LABEL LABEL_PORT28=SE_600_48
// RA_LABEL LABEL_PORT31=Not Used

Can someone tell me what I'm doing incorrectly?
Try to learn something about everything and everything about something... Thomas Huxley
210gal DT | 50gal sump/refug | Jebao DCP 10000 pump | RO 200-int skimmer | DIY built stand | DIY 160 led, 12 channel, 458 watt, on MakersLED 72" heatsink
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: PWM compile error

Post by rimai »

Fixed.
Try compiling it again.
Roberto.
User avatar
Loose
Posts: 88
Joined: Fri Sep 01, 2017 8:15 am
Location: Severna Park, MD

Re: PWM compile error

Post by Loose »

Works. Thanks. What was it?
Try to learn something about everything and everything about something... Thomas Huxley
210gal DT | 50gal sump/refug | Jebao DCP 10000 pump | RO 200-int skimmer | DIY built stand | DIY 160 led, 12 channel, 458 watt, on MakersLED 72" heatsink
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: PWM compile error

Post by rimai »

Bug in the libraries
Roberto.
Post Reply