Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Strange build error after latest update Release 21.06.06.0 (Read 2521 times)
Groover
Junior Member
**
Offline


Posts: 25
Joined: Sep 8th, 2013
Strange build error after latest update Release 21.06.06.0
Jun 6th, 2021 at 7:05pm
Print Post  
If I build my Project in Debug mode, I get the error :
GardenlightsWebServer.ino: In function void setup() 
GardenlightsWebServer.ino: 264:1: error: 'Web' was not declared in this scope   timeClient.setTimeOffset(7200)
Error compiling project sources
Debug build failed for project 'GardenlightsWebServer'

In release  and previous builds I have no problems and if I try to find Web in my entire solution, Web is not found.







  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange build error after latest update Release 21.06.06.0
Reply #1 - Jun 6th, 2021 at 7:55pm
Print Post  
Hi

We need to see the build properties as well as the verbose output. Can you please switch on "vMicro > Compiler > Show Build Properties" and give the output again.

Also please zip and email (or post here) this file

Code
Select All
-devkit-v1\Debug\GardenlightsWebServer.cpp
 


Thanks
« Last Edit: Jun 6th, 2021 at 8:05pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Groover
Junior Member
**
Offline


Posts: 25
Joined: Sep 8th, 2013
Re: Strange build error after latest update Release 21.06.06.0
Reply #2 - Jun 6th, 2021 at 8:06pm
Print Post  
OK:
« Last Edit: Jun 6th, 2021 at 8:18pm by Groover »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange build error after latest update Release 21.06.06.0
Reply #3 - Jun 6th, 2021 at 8:33pm
Print Post  
Thanks, can you also zip and email or post the .ino code.
  
Back to top
WWW  
IP Logged
 
Groover
Junior Member
**
Offline


Posts: 25
Joined: Sep 8th, 2013
Re: Strange build error after latest update Release 21.06.06.0
Reply #4 - Jun 6th, 2021 at 8:37pm
Print Post  
Code (C++)
Select All
/*
 Name:		GardenlightsWebServer.ino
 Created:	6/6/2021 11:52:05 AM
 Author:	ajkes
r
 example:https://randomnerdtutorials.com/esp32-ntp-client-date-time-arduino-ide/
*/
#include <WiFi.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <arduino-timer.h>
#include <ESPAsyncWebServer.h>
#include <WebSerial.h>
#define LEDC_CHANNEL_0     0
// use 13 bit precission for LEDC timer
#define LEDC_TIMER_13_BIT  13

// use 5000 Hz as a LEDC base frequency
#define LEDC_BASE_FREQ     5000

// Replace with your network credentials

const char* ssid = "****";
const char* password = "********";
const int ledPinPWM = 12;//Green
const int ledOnboard = 2;//PinD2
const int lightSensorPin = 13;
const int activityPin = 16;
volatile uint32_t LightCounter = 0;
volatile int Tocalculate;
volatile int lightValue = 0;
volatile int lightAverage = 0;
volatile int brightness;
volatile bool activityDetected = false;
bool dark = false;
int Hour = 0;
int Minute = 0;
int HourInt = 0;
int MinuteInt = 0;
int SecondsInt = 0;
int Messagedelay = 0;
// Define NTP Client to get time
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP);
String formattedDate;
String dayStamp;
String timeStamp;
//Timer<1, micros> timer;  // create a timer with 1 task and milisecond resolution
auto timer = timer_create_default(); // create a timer with default settings
AsyncWebServer server(80);

// Set your Static IP address
IPAddress local_IP(192, 168, 178, 184);
// Set your Gateway IP address
IPAddress gateway(192,168,178,1);

IPAddress subnet(255, 255, 255, 0);
IPAddress primaryDNS(8, 8, 8, 8); // optional
IPAddress secondaryDNS(8, 8, 4, 4); // optional

bool UpdateTime(void*)
{
	UpdateTimeResult();
	return true;
}

bool UpdateIntTime(void*)
{
	SecondsInt++;
	if (SecondsInt >= 60)
	{
		MinuteInt++;
		SecondsInt = 0;
	}

	if (MinuteInt >= 60)
	{
		HourInt++;
		MinuteInt = 0;
	}

	if (HourInt >= 24)
	{
		HourInt = 0;
	}

	return true;
}

void ledcAnalogWrite(uint32_t value, uint32_t valueMax = 255) {
	// calculate duty, 8191 from 2 ^ 13 - 1
	uint32_t duty = (8191 / valueMax) * min(value, valueMax);
	// write duty to LEDC
	ledcWrite(LEDC_CHANNEL_0, duty);
}

bool ReadPins(void*) {
	/*Serial.print("print_message: Called at: ");
	Serial.println(millis());*/
	LightCounter++;
	int factor = 4;
	uint16_t n = analogRead(lightSensorPin);
	Tocalculate += n;
	lightValue = n;
	activityDetected = digitalRead(activityPin);
	if (LightCounter == factor)
	{
		Hour = timeClient.getHours();
		lightAverage = (int)Tocalculate / factor;

		Serial.println(Hour);
		LightCounter = 0;
		Tocalculate = 0;
	}
	else
	{
		lightValue = n;

	}
	//ledcAnalogWrite(LEDC_CHANNEL_0, brightness);
	if (lightAverage < 30 && Hour < 23 && Hour > 7)
	{
		dark = true;
		brightness = 255;
		if (activityDetected)
		{
			brightness = 255;
		}
	}

	if (lightAverage < 30 && Hour > 23 && Hour < 7)
	{
		dark = true;
		brightness = 50;
		if (activityDetected)
		{
			brightness = 255;
		}
	}

	if (lightAverage > 30)
	{
		brightness = 0;
	}

	ledcAnalogWrite(brightness);
	return true; // repeat? true
}

void UpdateTimeResult()
{
	while (!timeClient.update())
	{
		timeClient.forceUpdate();
		delay(500);
	}
	// The formattedDate comes with the following format:
   // 2018-05-28T16:00:13Z
   // We need to extract date and time
	formattedDate = timeClient.getFormattedDate();
	Serial.println(formattedDate);

	// Extract date
	int splitT = formattedDate.indexOf("T");
	dayStamp = formattedDate.substring(0, splitT);
	WebSerial.print("DATE: ");
	WebSerial.println(dayStamp);
	// Extract time
	timeStamp = formattedDate.substring(splitT + 1, formattedDate.length() - 1);
	WebSerial.print("HOUR: ");
	WebSerial.println(timeStamp);
	int seconds = timeClient.getSeconds();
	Hour = timeClient.getHours();
	Minute = timeClient.getMinutes();
	WebSerial.println("Time updated ");

	if (Hour != HourInt)
	{
		HourInt = Hour;
	}

	if (Minute!= MinuteInt)
	{
		MinuteInt = Minute;
	}
	if (seconds != SecondsInt)
	{
		SecondsInt = seconds;
	}
}

bool CheckConnection(void*)
{
	if ((WiFi.status() != WL_CONNECTED))
	{
		WiFi.disconnect();
		WiFi.reconnect();
	}

	return true;
}

void UpdateWebSerialMessages(int messageType)
{
	if (messageType == 2)
	{
		WebSerial.print("Second = ");
		WebSerial.println(SecondsInt);
		WebSerial.print("MinuteInt = ");
		WebSerial.println(MinuteInt);
		WebSerial.print("HourInt = ");
		WebSerial.println(HourInt);
	}
	if (messageType == 1)
	{
		WebSerial.print("LightAverige = ");
		WebSerial.println(lightAverage);
	}

}


// the setup function runs once when you press reset or power the board
void setup()
{
	int tr = 0;
	// Initialize Serial Monitor
	Serial.begin(115200);
	Serial.print("Connecting to ");
	Serial.println(ssid);
	// Configures static IP address
	if (!WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS)) {
		Serial.println("STA Failed to configure");
	}

	WiFi.begin(ssid, password);
	while (WiFi.status() != WL_CONNECTED) {
		delay(500);
		tr++;
		Serial.print(".");
		if (tr == 10)
		{
			ESP.restart();
		}
	}
	// Print local IP address and start web server
	Serial.println("");
	Serial.println("WiFi connected.");
	Serial.println("IP address: ");
	Serial.println(WiFi.localIP());
	pinMode(ledPinPWM, OUTPUT);
	pinMode(activityPin, INPUT_PULLDOWN);
	ledcSetup(LEDC_CHANNEL_0, LEDC_BASE_FREQ, LEDC_TIMER_13_BIT);
	ledcAttachPin(ledPinPWM, LEDC_CHANNEL_0);
	// Initialize a NTPClient to get time
	timeClient.begin();
	// Set offset time in seconds to adjust for your timezone, for example:
	// GMT +1 = 3600
	// GMT +8 = 28800
	// GMT -1 = -3600
	// GMT 0 = 0
	WebSerial.begin(&server);
	server.begin();
	timeClient.setTimeOffset(7200);
	UpdateTimeResult();
	//timer.every(60000 * 60, UpdateTime);
	timer.every(1000 * 60 * 60, UpdateTime);
	timer.every(1000, ReadPins);
	timer.every(120000, CheckConnection);
	timer.every(1000, UpdateIntTime);
}

// the loop function runs over and over again until power down or reset
void loop()
{
	timer.tick();
	delay(50);
	if (Messagedelay != 0 && (Messagedelay % 80) == 0)
	{
		UpdateWebSerialMessages(1);

	}

	if (Messagedelay > 450)
	{
		UpdateWebSerialMessages(2);
		Messagedelay = 0;
	}

	Messagedelay++;
}
 

« Last Edit: Jun 6th, 2021 at 8:51pm by Groover »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange build error after latest update Release 21.06.06.0
Reply #5 - Jun 6th, 2021 at 8:56pm
Print Post  
Thanks very much and thank you for the report. This is caused by a temp workaround we added to stop the new esp32 beta core from crashing. The esp developer is working on a fix. (it is a known problem with the beta core).

We will release a fix over the coming few days but you can switch off the workaround by adding a board.txt to the project folder (vMicro>Add Code>Local board.txt) then adding this entry into it. Click save and then builds will be okay.

Code
Select All
vm.patch.prevent_serial_begin=false 



« Last Edit: Jun 6th, 2021 at 9:04pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: Strange build error after latest update Release 21.06.06.0
Reply #6 - Jun 7th, 2021 at 8:10am
Print Post  
The latest release (21.06.06.1) from the top of the below board should resolve this without the need for the additional property:
https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint