<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Settimino and M5 Paper, interacting weirdly]]></title><description><![CDATA[<p dir="auto">Basically, M5Paper has a unique version of the I2C clock integrated into it. This version is causing conflicts with a Platform.h based program.</p>
<p dir="auto">The Error it keeps on pitching is that macro "min" requires 2 arguments, but only is presented with 1.</p>
<p dir="auto">the 8 bit integer could, technically, handle 60 minutes, however it  wants "mm" not "m" in there. So i grabbed another RTC, and when i did , it broke everything. So i have to re-integrate the original I2C.h</p>
<p dir="auto">Any solution for this? I am trying to integrate this to step7. And it seemingly would work if there is a Serial Print function for M5Paper. I do not see that available, as it is actually "Canvas Draw" which leads to confusing integration.</p>
<p dir="auto">Any help would be great, my code is as follows:<br />
*----------------------------------------------------------------------<br />
Data Read Demo</p>
<p dir="auto">Created  12 Dec 2016<br />
Modified 10 Mar 2019 for Settimino 2.0.0<br />
by Davide Nardella</p>
<hr />
<p dir="auto">This demo shows how to read data from the PLC.<br />
A DB with at least 1024 byte into the PLC is needed.<br />
Specify its number into DBNum variable</p>
<ul>
<li>Both small and large data transfer are performed (see DO_IT_SMALL)</li>
<li>During the loop, try to disconnect the ethernet cable.<br />
The system will report the error and will reconnect automatically<br />
when you re-plug the cable.</li>
<li>For safety, this demo <em>doesn't write</em> data into the PLC, try<br />
yourself to change ReadArea with WriteArea.</li>
<li>This demo uses ConnectTo() with Rack=0 and Slot=2 (S7300)
<ul>
<li>If you want to connect to S71200/S71500 change them to Rack=0, Slot=0.</li>
<li>If you want to connect to S7400 see your hardware configuration.</li>
<li>If you want to work with a LOGO 0BA7 or S7200 please refer to the<br />
documentation and change<br />
Client.ConnectTo(&lt;IP&gt;, &lt;Rack&gt;, &lt;Slot&gt;);<br />
with the couple<br />
Client.SetConnectionParams(&lt;IP&gt;, &lt;LocalTSAP&gt;, &lt;Remote TSAP&gt;);<br />
Client.Connect();</li>
</ul>
</li>
</ul>
<p dir="auto">----------------------------------------------------------------------*/<br />
#include &lt;M5EPD.h&gt;<br />
#include &lt;Settimino.h&gt;<br />
//Define Canvas Type<br />
M5EPD_Canvas canvas(&amp;M5.EPD);<br />
// Uncomment next line to perform small and fast data access<br />
#define DO_IT_SMALL</p>
<p dir="auto">// Enter a MAC address and IP address for your controller below.<br />
// The IP address will be dependent on your local network:<br />
byte mac[] = {<br />
0x90, 0xA2, 0xDA, 0x0F, 0x08, 0xE1 };</p>
<p dir="auto">IPAddress Local(192,168,0,90); // Local Address<br />
IPAddress PLC(192,168,0,12);   // PLC Address</p>
<p dir="auto">// Following constants are needed if you are connecting via WIFI<br />
// The ssid is the name of my WIFI network (the password obviously is wrong)<br />
char ssid[] = "SKYNET-AIR";    // Your network SSID (name)<br />
char pass[] = "yourpassword";  // Your network password (if any)<br />
IPAddress Gateway(192, 168, 0, 1);<br />
IPAddress Subnet(255, 255, 255, 0);</p>
<p dir="auto">int DBNum = 100; // This DB must be present in your PLC<br />
byte Buffer[1024];</p>
<p dir="auto">S7Client Client;</p>
<p dir="auto">unsigned long Elapsed; // To calc the execution time<br />
//----------------------------------------------------------------------<br />
// Setup : Init Ethernet and Serial port<br />
//----------------------------------------------------------------------<br />
void setup() {<br />
M5.begin();<br />
M5.EPD.SetRotation(0);<br />
M5.EPD.Clear(true);<br />
M5.RTC.begin();<br />
canvas.createCanvas(960, 540);<br />
canvas.setTextSize(3);<br />
// Open serial communications and wait for port to open:<br />
Serial.begin(115200);</p>
<p dir="auto">#ifdef S7WIFI<br />
//--------------------------------------------- ESP8266 Initialization<br />
Serial.println();<br />
Serial.print("Connecting to ");<br />
Serial.println(ssid);<br />
WiFi.begin(ssid, pass);<br />
WiFi.config(Local, Gateway, Subnet);<br />
while (WiFi.status() != WL_CONNECTED)<br />
{<br />
delay(500);<br />
Serial.print(".");<br />
}<br />
Serial.println("");<br />
Serial.println("WiFi connected");<br />
Serial.print("Local IP address : ");<br />
Serial.println(WiFi.localIP());<br />
#else<br />
//--------------------------------Wired Ethernet Shield Initialization<br />
// Start the Ethernet Library<br />
EthernetInit(mac, Local);<br />
// Setup Time, someone said me to leave 2000 because some<br />
// rubbish compatible boards are a bit deaf.<br />
delay(2000);<br />
Serial.println("");<br />
Serial.println("Cable connected");<br />
Serial.print("Local IP address : ");<br />
Serial.println(Ethernet.localIP());<br />
#endif<br />
}<br />
//----------------------------------------------------------------------<br />
// Connects to the PLC<br />
//----------------------------------------------------------------------<br />
bool Connect()<br />
{<br />
int Result=Client.ConnectTo(PLC,<br />
0,  // Rack (see the doc.)<br />
2); // Slot (see the doc.)<br />
Serial.print("Connecting to ");Serial.println(PLC);<br />
if (Result==0)<br />
{<br />
Serial.print("Connected ! PDU Length = ");Serial.println(Client.GetPDULength());<br />
}<br />
else<br />
Serial.println("Connection error");<br />
return Result==0;<br />
}<br />
//----------------------------------------------------------------------<br />
// Dumps a buffer (a very rough routine)<br />
//----------------------------------------------------------------------<br />
void Dump(void *Buffer, int Length)<br />
{<br />
int i, cnt=0;<br />
pbyte buf;</p>
<p dir="auto">if (Buffer!=NULL)<br />
buf = pbyte(Buffer);<br />
else<br />
buf = pbyte(&amp;PDU.DATA[0]);</p>
<p dir="auto">Serial.print("[ Dumping ");Serial.print(Length);<br />
Serial.println(" bytes ]===========================");<br />
for (i=0; i&lt;Length; i++)<br />
{<br />
cnt++;<br />
if (buf[i]&lt;0x10)<br />
Serial.print("0");<br />
Serial.print(buf[i], HEX);<br />
Serial.print(" ");<br />
if (cnt==16)<br />
{<br />
cnt=0;<br />
Serial.println();<br />
}<br />
}<br />
Serial.println("===============================================");<br />
}<br />
//----------------------------------------------------------------------<br />
// Prints the Error number<br />
//----------------------------------------------------------------------<br />
void CheckError(int ErrNo)<br />
{<br />
Serial.print("Error No. 0x");<br />
Serial.println(ErrNo, HEX);</p>
<p dir="auto">// Checks if it's a Severe Error =&gt; we need to disconnect<br />
if (ErrNo &amp; 0x00FF)<br />
{<br />
Serial.println("SEVERE ERROR, disconnecting.");<br />
Client.Disconnect();<br />
}<br />
}<br />
//----------------------------------------------------------------------<br />
// Profiling routines<br />
//----------------------------------------------------------------------<br />
//void MarkTime()<br />
//{<br />
// Elapsed=millis();<br />
//}<br />
//----------------------------------------------------------------------<br />
//void ShowTime()<br />
//{<br />
// Calcs the time<br />
//Elapsed=millis()-Elapsed;<br />
// Serial.print("Job time (ms) : ");<br />
// Serial.println(Elapsed);<br />
//}<br />
//----------------------------------------------------------------------<br />
// Main Loop<br />
//----------------------------------------------------------------------<br />
void loop()<br />
{<br />
int Size, Result;<br />
void *Target;</p>
<p dir="auto">#ifdef DO_IT_SMALL<br />
Size=64;<br />
Target = NULL; // Uses the internal Buffer (PDU.DATA[])<br />
#else<br />
Size=1024;<br />
Target = &amp;Buffer; // Uses a larger buffer<br />
#endif</p>
<p dir="auto">// Connection<br />
while (!Client.Connected)<br />
{<br />
if (!Connect())<br />
delay(500);<br />
}</p>
<p dir="auto">Serial.print("Reading ");Serial.print(Size);Serial.print(" bytes from DB");Serial.println(DBNum);<br />
// Get the current tick<br />
MarkTime();<br />
Result=Client.ReadArea(S7AreaDB, // We are requesting DB access<br />
DBNum,    // DB Number<br />
0,        // Start from byte N.0<br />
Size,     // We need "Size" bytes<br />
Target);  // Put them into our target (Buffer or PDU)<br />
if (Result==0)<br />
{<br />
//ShowTime();<br />
Dump(Target, Size);<br />
}<br />
else<br />
CheckError(Result);<br />
Result[3]="/0";<br />
M5.begin();<br />
M5.EPD.SetRotation(0);<br />
M5.EPD.Clear(true);<br />
M5.RTC.begin();<br />
canvas.createCanvas(960, 540);<br />
canvas.setTextSize(3);<br />
canvas.drawString((char*)Result, 0, 0);<br />
canvas.pushCanvas(0, 0, UPDATE_MODE_DU4);<br />
delay(500);<br />
}</p>
]]></description><link>https://community.m5stack.com/topic/6789/settimino-and-m5-paper-interacting-weirdly</link><generator>RSS for Node</generator><lastBuildDate>Sat, 14 Mar 2026 22:36:57 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/6789.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 10 Sep 2024 11:33:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Settimino and M5 Paper, interacting weirdly on Thu, 12 Sep 2024 08:35:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/150400">@kdshawee87</a></p>
<p dir="auto">Is there a possibility that it is conflicting with the Arduino macro?</p>
<pre><code>#define min(a,b) ((a)&lt;(b)?(a):(b))
</code></pre>
<p dir="auto">This is a rough way of writing it, but in the header</p>
<pre><code>#include &lt;M5EPD.h&gt;
#include &lt;Settimino.h&gt;
#undef min
</code></pre>
<p dir="auto">Will it compile if I undef it?<br />
However, in this case, the standard min cannot be used in this file.</p>
]]></description><link>https://community.m5stack.com/post/26413</link><guid isPermaLink="true">https://community.m5stack.com/post/26413</guid><dc:creator><![CDATA[namazu2024]]></dc:creator><pubDate>Thu, 12 Sep 2024 08:35:11 GMT</pubDate></item><item><title><![CDATA[Reply to Settimino and M5 Paper, interacting weirdly on Tue, 10 Sep 2024 16:14:02 GMT]]></title><description><![CDATA[<p dir="auto">In file included from c:\Users\KSHAW47\Documents\Arduino\libraries\M5EPD\src/M5EPD.h:11,<br />
from C:\Users\KSHAW47\Documents\Arduino\ReadDemo_M5Paper\ReadDemo_M5Paper.ino:31:<br />
c:\Users\KSHAW47\Documents\Arduino\libraries\M5EPD\src/utility/BM8563.h:10:30: error: macro "min" requires 2 arguments, but only 1 given<br />
RTC_Time() : hour(), min(), sec() {<br />
^<br />
c:\Users\KSHAW47\Documents\Arduino\libraries\M5EPD\src/utility/BM8563.h:12:60: error: macro "min" requires 2 arguments, but only 1 given<br />
RTC_Time(int8_t h, int8_t m, int8_t s) : hour(h), min(m), sec(s) {</p>
<p dir="auto">came back again, no known solution. please help</p>
]]></description><link>https://community.m5stack.com/post/26407</link><guid isPermaLink="true">https://community.m5stack.com/post/26407</guid><dc:creator><![CDATA[kdshawee87]]></dc:creator><pubDate>Tue, 10 Sep 2024 16:14:02 GMT</pubDate></item><item><title><![CDATA[Reply to Settimino and M5 Paper, interacting weirdly on Tue, 10 Sep 2024 12:50:30 GMT]]></title><description><![CDATA[<p dir="auto">kind-of answered my own question. Canvas Draw = Serial Print. So its just transposition or , well, commenting out. I chose commenting out for the time being. Target Not results.</p>
]]></description><link>https://community.m5stack.com/post/26405</link><guid isPermaLink="true">https://community.m5stack.com/post/26405</guid><dc:creator><![CDATA[kdshawee87]]></dc:creator><pubDate>Tue, 10 Sep 2024 12:50:30 GMT</pubDate></item></channel></rss>