diff --git a/.gitignore b/.gitignore index 3c8c0fe5c..d88f1f2da 100644 --- a/.gitignore +++ b/.gitignore @@ -72,3 +72,4 @@ nbproject build/macosx/esptool-*-osx.zip build/macosx/dist/osx-xtensa-lx106-elf.tgz +/hardware/esp8266com/esp8266/tools diff --git a/app/src/cc/arduino/view/preferences/AdditionalBoardsManagerURLTextArea.form b/app/src/cc/arduino/view/preferences/AdditionalBoardsManagerURLTextArea.form index 0d47750a3..a8b6eb4bd 100644 --- a/app/src/cc/arduino/view/preferences/AdditionalBoardsManagerURLTextArea.form +++ b/app/src/cc/arduino/view/preferences/AdditionalBoardsManagerURLTextArea.form @@ -3,7 +3,9 @@
- + + + @@ -32,12 +34,16 @@ - + + + + + @@ -47,7 +53,9 @@ - + + + @@ -82,7 +90,9 @@ - + + + @@ -94,7 +104,9 @@ - + + + @@ -104,5 +116,16 @@ + + + + + + + + + + + diff --git a/app/src/cc/arduino/view/preferences/AdditionalBoardsManagerURLTextArea.java b/app/src/cc/arduino/view/preferences/AdditionalBoardsManagerURLTextArea.java index a75e1c8b4..c4ed51e02 100644 --- a/app/src/cc/arduino/view/preferences/AdditionalBoardsManagerURLTextArea.java +++ b/app/src/cc/arduino/view/preferences/AdditionalBoardsManagerURLTextArea.java @@ -74,6 +74,7 @@ public class AdditionalBoardsManagerURLTextArea extends javax.swing.JDialog { javax.swing.JScrollPane jScrollPane1 = new javax.swing.JScrollPane(); javax.swing.JButton cancel = new javax.swing.JButton(); javax.swing.JButton ok = new javax.swing.JButton(); + javax.swing.JLabel jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle(_("Additional Boards Manager URLs")); @@ -99,6 +100,8 @@ public class AdditionalBoardsManagerURLTextArea extends javax.swing.JDialog { } }); + jLabel1.setText(_("Enter additional URLs, one for each row")); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -107,18 +110,23 @@ public class AdditionalBoardsManagerURLTextArea extends javax.swing.JDialog { .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addGap(0, 439, Short.MAX_VALUE) + .addGap(0, 332, Short.MAX_VALUE) .addComponent(ok) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cancel)) - .addComponent(jScrollPane1)) + .addComponent(jScrollPane1) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel1) + .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 141, Short.MAX_VALUE) + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(cancel) @@ -139,48 +147,6 @@ public class AdditionalBoardsManagerURLTextArea extends javax.swing.JDialog { cancelActionPerformed(evt); }//GEN-LAST:event_okActionPerformed - /** - * @param args the command line arguments - */ - public static void main(String args[]) { - /* Set the Nimbus look and feel */ - // - /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. - * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html - */ - try { - for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { - if ("Nimbus".equals(info.getName())) { - javax.swing.UIManager.setLookAndFeel(info.getClassName()); - break; - } - } - } catch (ClassNotFoundException ex) { - java.util.logging.Logger.getLogger(AdditionalBoardsManagerURLTextArea.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (InstantiationException ex) { - java.util.logging.Logger.getLogger(AdditionalBoardsManagerURLTextArea.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (IllegalAccessException ex) { - java.util.logging.Logger.getLogger(AdditionalBoardsManagerURLTextArea.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (javax.swing.UnsupportedLookAndFeelException ex) { - java.util.logging.Logger.getLogger(AdditionalBoardsManagerURLTextArea.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } - // - - /* Create and display the dialog */ - java.awt.EventQueue.invokeLater(new Runnable() { - public void run() { - AdditionalBoardsManagerURLTextArea dialog = new AdditionalBoardsManagerURLTextArea(new javax.swing.JFrame()); - dialog.addWindowListener(new java.awt.event.WindowAdapter() { - @Override - public void windowClosing(java.awt.event.WindowEvent e) { - System.exit(0); - } - }); - dialog.setVisible(true); - } - }); - } - public void setText(String text) { Collection urls = splitAndTrim(text, ","); additionalBoardsManagerURLs.setText(Joiner.on("\n").skipNulls().join(urls)); diff --git a/app/src/cc/arduino/view/preferences/Preferences.form b/app/src/cc/arduino/view/preferences/Preferences.form index 828645018..8f6215f66 100644 --- a/app/src/cc/arduino/view/preferences/Preferences.form +++ b/app/src/cc/arduino/view/preferences/Preferences.form @@ -75,21 +75,16 @@ - - - - - - - - - - - - - - - + + + + + + + + + + @@ -472,6 +467,9 @@ + + +
@@ -479,6 +477,11 @@ + + + + + diff --git a/app/src/cc/arduino/view/preferences/Preferences.java b/app/src/cc/arduino/view/preferences/Preferences.java index 2d0262970..584b1bcb5 100644 --- a/app/src/cc/arduino/view/preferences/Preferences.java +++ b/app/src/cc/arduino/view/preferences/Preferences.java @@ -379,6 +379,9 @@ public class Preferences extends javax.swing.JDialog { ); additionalBoardsManagerLabel.setText(_("Additional Boards Manager URLs: ")); + additionalBoardsManagerLabel.setToolTipText(_("Enter a comma separated list of urls")); + + additionalBoardsManagerField.setToolTipText(_("Enter a comma separated list of urls")); extendedAdditionalUrlFieldWindow.setIcon(new ImageIcon(Base.getThemeImage("newwindow.gif", this))); extendedAdditionalUrlFieldWindow.addActionListener(new java.awt.event.ActionListener() { @@ -490,18 +493,15 @@ public class Preferences extends javax.swing.JDialog { .addComponent(preferencesFileLabel)) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addGap(0, 0, Short.MAX_VALUE) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(additionalBoardsManagerLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(additionalBoardsManagerField, javax.swing.GroupLayout.PREFERRED_SIZE, 494, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(extendedAdditionalUrlFieldWindow, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(okButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cancelButton))))) + .addComponent(okButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cancelButton)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(additionalBoardsManagerLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(additionalBoardsManagerField, javax.swing.GroupLayout.PREFERRED_SIZE, 500, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(extendedAdditionalUrlFieldWindow, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); layout.setVerticalGroup( diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index 37d258ed1..9ca878055 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -1422,7 +1422,7 @@ public class Editor extends JFrame implements RunnerListener { if (find == null) { find = new FindReplace(Editor.this); } - if (!OSUtils.isMacOS() && getSelectedText() != null) { + if (!OSUtils.isMacOS()) { find.setFindText(getSelectedText()); } find.setLocationRelativeTo(Editor.this); @@ -1458,11 +1458,8 @@ public class Editor extends JFrame implements RunnerListener { if (find == null) { find = new FindReplace(Editor.this); } - if (getSelectedText() != null) { - find.setFindText(getSelectedText()); - } - find.setLocationRelativeTo(Editor.this); - find.setVisible(true); + find.setFindText(getSelectedText()); + find.findNext(); } }); menu.add(item); diff --git a/app/src/processing/app/FindReplace.java b/app/src/processing/app/FindReplace.java index df1c95114..1c3b380d9 100644 --- a/app/src/processing/app/FindReplace.java +++ b/app/src/processing/app/FindReplace.java @@ -439,9 +439,12 @@ public class FindReplace extends JFrame implements ActionListener { } } - public void setFindText(String t) { - findField.setText(t); - findString = t; + public void setFindText(String text) { + if (text == null) { + return; + } + findField.setText(text); + findString = text; } public void findNext() { diff --git a/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_analog.c b/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_analog.c index bb5151018..53451b713 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_analog.c +++ b/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_analog.c @@ -21,34 +21,13 @@ #include "wiring_private.h" #include "pins_arduino.h" +extern uint16_t readvdd33(void); + void analogReference(uint8_t mode) {} extern int __analogRead(uint8_t pin) { if(pin == 17){ - //return system_adc_read(); - uint8_t i; - uint16_t data[8]; - - rom_i2c_writeReg_Mask(0x6C,2,0,5,5,1); - - ESP8266_REG(0xD5C) |= (1 << 21); - while ((ESP8266_REG(0xD50) & (7 << 24)) > 0); - ESP8266_REG(0xD50) &= ~(1 << 1); - ESP8266_REG(0xD50) |= (1 << 1); - delayMicroseconds(2); - while ((ESP8266_REG(0xD50) & (7 << 24)) > 0); - - read_sar_dout(data); - rom_i2c_writeReg_Mask(0x6C,2,0,5,5,1); - - while ((ESP8266_REG(0xD50) & (7 << 24)) > 0); - ESP8266_REG(0xD5C) &= ~(1 << 21); - ESP8266_REG(0xD60) |= (1 << 0); - ESP8266_REG(0xD60) &= ~(1 << 0); - - uint16_t tout = 0; - for (i = 0; i < 8; i++) tout += data[i]; - return tout >> 4;//tout is 10 bits fraction + return readvdd33() >> 2; // readvdd33 is 12 bit } return digitalRead(pin) * 1023; } diff --git a/hardware/esp8266com/esp8266/cores/esp8266/debug.cpp b/hardware/esp8266com/esp8266/cores/esp8266/debug.cpp index 5e280122e..68d3a6b82 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/debug.cpp +++ b/hardware/esp8266com/esp8266/cores/esp8266/debug.cpp @@ -26,6 +26,7 @@ void ICACHE_RAM_ATTR hexdump(uint8_t *mem, uint32_t len, uint8_t cols) { for(uint32_t i = 0; i < len; i++) { if(i % cols == 0) { os_printf("\n[0x%08X] 0x%08X: ", mem, i); + yield(); } os_printf("%02X ", *mem); mem++; diff --git a/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp b/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp index 391cc556c..054929971 100644 --- a/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp +++ b/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp @@ -101,7 +101,8 @@ void ESP8266WebServer::handleClient() #endif // Wait for data from client to become available - while(client.connected() && !client.available()){ + uint16_t maxWait = HTTP_MAX_DATA_WAIT; + while(client.connected() && !client.available() && maxWait--){ delay(1); } @@ -136,7 +137,12 @@ void ESP8266WebServer::send(int code, const char* content_type, String content) if (!content_type) content_type = "text/html"; + + String len(content.length()); sendHeader("Content-Type", content_type, true); + sendHeader("Content-Length", len.c_str()); + sendHeader("Connection", "close"); + sendHeader("Access-Control-Allow-Origin", "*"); response += _responseHeaders; response += "\r\n"; @@ -145,6 +151,14 @@ void ESP8266WebServer::send(int code, const char* content_type, String content) sendContent(response); } +void ESP8266WebServer::send(int code, char* content_type, String content) { + send(code, (const char*)content_type, content); +} + +void ESP8266WebServer::send(int code, String content_type, String content) { + send(code, (const char*)content_type.c_str(), content); +} + void ESP8266WebServer::sendContent(String content) { size_t size_to_send = content.length(); size_t size_sent = 0; @@ -158,6 +172,10 @@ void ESP8266WebServer::sendContent(String content) { break; } } + uint16_t maxWait = HTTP_MAX_CLOSE_WAIT; + while(_currentClient.connected() && maxWait--) { + delay(1); + } } String ESP8266WebServer::arg(const char* name) { diff --git a/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.h b/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.h index d957e15ba..9f2b16480 100644 --- a/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.h +++ b/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.h @@ -31,6 +31,8 @@ enum HTTPUploadStatus { UPLOAD_FILE_START, UPLOAD_FILE_WRITE, UPLOAD_FILE_END }; #define HTTP_DOWNLOAD_UNIT_SIZE 1460 #define HTTP_UPLOAD_BUFLEN 2048 +#define HTTP_MAX_DATA_WAIT 1000 //ms to wait for the client to send the request +#define HTTP_MAX_CLOSE_WAIT 2000 //ms to wait for the client to close the connection typedef struct { HTTPUploadStatus status; @@ -73,6 +75,8 @@ public: // content_type - HTTP content type, like "text/plain" or "image/png" // content - actual content body void send(int code, const char* content_type = NULL, String content = String("")); + void send(int code, char* content_type, String content); + void send(int code, String content_type, String content); void sendHeader(String name, String value, bool first = false); void sendContent(String content); @@ -87,7 +91,12 @@ template size_t streamFile(T &file, String contentType){ head += "\r\n\r\n"; _currentClient.print(head); head = String(); - return _currentClient.write(file, HTTP_DOWNLOAD_UNIT_SIZE); + size_t res = _currentClient.write(file, HTTP_DOWNLOAD_UNIT_SIZE); + uint16_t maxWait = HTTP_MAX_CLOSE_WAIT; + while(_currentClient.connected() && maxWait--) { + delay(1); + } + return res; } protected: diff --git a/libraries/Adafruit_ILI9341/Adafruit_ILI9341.cpp b/libraries/Adafruit_ILI9341/Adafruit_ILI9341.cpp index 239a414ac..05d376aed 100644 --- a/libraries/Adafruit_ILI9341/Adafruit_ILI9341.cpp +++ b/libraries/Adafruit_ILI9341/Adafruit_ILI9341.cpp @@ -127,7 +127,7 @@ void Adafruit_ILI9341::spiwrite(uint8_t c) { #endif } -void Adafruit_ILI9341::spiwriteBytes(uint8_t * data, uint8_t size) { +void Adafruit_ILI9341::spiwriteBytes(uint8_t * data, uint32_t size) { #ifdef ESP8266 SPI.writeBytes(data, size); #else @@ -250,13 +250,21 @@ void Adafruit_ILI9341::writeCmdData(uint8_t cmd, uint8_t * data, uint8_t size) { spiCsHigh(); } +uint16_t Adafruit_ILI9341::getHeight(void) { + return _height; +} + +uint16_t Adafruit_ILI9341::getWidth(void){ + return _width; +} + // If the SPI library has transaction support, these functions // establish settings and protect from interference from other // libraries. Otherwise, they simply do nothing. #ifdef SPI_HAS_TRANSACTION #ifdef ESP8266 -SPISettings spiSettings = SPISettings(F_CPU, MSBFIRST, SPI_MODE0); +SPISettings spiSettings = SPISettings(SPI_MAX_SPEED, MSBFIRST, SPI_MODE0); #else SPISettings spiSettings = SPISettings(8000000, MSBFIRST, SPI_MODE0); #endif @@ -438,6 +446,20 @@ void Adafruit_ILI9341::begin(void) { } + +void Adafruit_ILI9341::area_update_start(uint32_t x, uint32_t y, uint32_t w, uint32_t h) { + spiCsLow(); + setAddrWindow_(x, y, x + w - 1, y + h - 1); +} + +void Adafruit_ILI9341::area_update_data(uint8_t *data, uint32_t pixel){ + spiwriteBytes(&data[0], (pixel*2)); +} + +void Adafruit_ILI9341::area_update_end(void){ + spiCsHigh(); +} + void Adafruit_ILI9341::setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) { spiCsLow(); setAddrWindow_(x0, y0, x1, y1); @@ -583,7 +605,7 @@ void Adafruit_ILI9341::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint spiCsLow(); - setAddrWindow_(x, y, x + w - 1, y + h - 1); + setAddrWindow_(x, y, (x + w - 1), (y + h - 1)); uint8_t colorBin[] = { (uint8_t) (color >> 8), (uint8_t) color }; spiwritePattern(&colorBin[0], 2, (w * h)); diff --git a/libraries/Adafruit_ILI9341/Adafruit_ILI9341.h b/libraries/Adafruit_ILI9341/Adafruit_ILI9341.h index 9b33b9b98..a5cf8aa7c 100644 --- a/libraries/Adafruit_ILI9341/Adafruit_ILI9341.h +++ b/libraries/Adafruit_ILI9341/Adafruit_ILI9341.h @@ -158,6 +158,13 @@ class Adafruit_ILI9341 : public Adafruit_GFX { void writedata(uint8_t * data, uint8_t size); void writeCmdData(uint8_t cmd, uint8_t * data, uint8_t size); + + uint16_t getHeight(void); + uint16_t getWidth(void); + + void area_update_start(uint32_t x, uint32_t y, uint32_t w, uint32_t h); + void area_update_data(uint8_t *data, uint32_t pixel); + void area_update_end(void); private: uint8_t spiread(void); @@ -166,7 +173,7 @@ class Adafruit_ILI9341 : public Adafruit_GFX { #ifdef ESP8266 inline void spiwrite(uint8_t data); inline void spiwrite16(uint16_t data); - inline void spiwriteBytes(uint8_t * data, uint8_t size); + inline void spiwriteBytes(uint8_t * data, uint32_t size); inline void spiwritePattern(uint8_t * data, uint8_t size, uint32_t repeat); inline void setAddrWindow_(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);