sync 2022 openmaker
This commit is contained in:
29
grbl/examples/grblUpload/grblUpload.ino
Normal file
29
grbl/examples/grblUpload/grblUpload.ino
Normal file
@ -0,0 +1,29 @@
|
||||
/***********************************************************************
|
||||
This sketch compiles and uploads Grbl to your 328p-based Arduino!
|
||||
|
||||
To use:
|
||||
- First make sure you have imported Grbl source code into your Arduino
|
||||
IDE. There are details on our Github website on how to do this.
|
||||
|
||||
- Select your Arduino Board and Serial Port in the Tools drop-down menu.
|
||||
NOTE: Grbl only officially supports 328p-based Arduinos, like the Uno.
|
||||
Using other boards will likely not work!
|
||||
|
||||
- Then just click 'Upload'. That's it!
|
||||
|
||||
For advanced users:
|
||||
If you'd like to see what else Grbl can do, there are some additional
|
||||
options for customization and features you can enable or disable.
|
||||
Navigate your file system to where the Arduino IDE has stored the Grbl
|
||||
source code files, open the 'config.h' file in your favorite text
|
||||
editor. Inside are dozens of feature descriptions and #defines. Simply
|
||||
comment or uncomment the #defines or alter their assigned values, save
|
||||
your changes, and then click 'Upload' here.
|
||||
|
||||
Copyright (c) 2015 Sungeun K. Jeon
|
||||
Released under the MIT-license. See license.txt for details.
|
||||
***********************************************************************/
|
||||
|
||||
#include <grbl.h>
|
||||
|
||||
// Do not alter this file!
|
21
grbl/examples/grblUpload/license.txt
Normal file
21
grbl/examples/grblUpload/license.txt
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Sungeun K. Jeon
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
109
grbl/examples/grblWrite_BuildInfo/grblWrite_BuildInfo.ino
Normal file
109
grbl/examples/grblWrite_BuildInfo/grblWrite_BuildInfo.ino
Normal file
@ -0,0 +1,109 @@
|
||||
/***********************************************************************
|
||||
This sketch writes a `$I` build info string directly into Arduino EEPROM
|
||||
|
||||
To use:
|
||||
- Just alter the "build_info_line" string to whatever you'd like. Then
|
||||
compile and upload this sketch to your Arduino.
|
||||
|
||||
- If your Arduino is blinking slowly, your string has already been
|
||||
written to your EEPROM and been verified by checksums! That's it!
|
||||
|
||||
- If you Arduino LED is blinking fast, something went wrong and the
|
||||
checksums don't match. You can optionally connect to the Arduino via
|
||||
the serial monitor, and the sketch will show what its doing.
|
||||
|
||||
NOTE: This sketch is provided as a tool template for OEMs who may need
|
||||
to restrict users from altering their build info, so they can place
|
||||
important product information here when enabling the restriction.
|
||||
|
||||
NOTE: When uploading Grbl to the Arduino with this sketch on it, make
|
||||
sure you see the slow blink before you start the upload process. This
|
||||
ensures you aren't flashing Grbl when it's in mid-write of the EEPROM.
|
||||
|
||||
Copyright (c) 2016 Sungeun K. Jeon for Gnea Research LLC
|
||||
Released under the MIT-license. See license.txt for details.
|
||||
***********************************************************************/
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <EEPROM.h>
|
||||
|
||||
#define SERIAL_BAUD_RATE 115200
|
||||
#define LINE_LENGTH 80U // Grbl line length
|
||||
#define BYTE_LOCATION 942U // Grbl build info EEPROM address.
|
||||
|
||||
|
||||
// ----- CHANGE THIS LINE -----
|
||||
|
||||
char build_info_line[LINE_LENGTH] = "Testing123.";
|
||||
|
||||
// -----------------------------
|
||||
|
||||
|
||||
uint8_t status = false;
|
||||
int ledPin = 13; // LED connected to digital pin 13
|
||||
|
||||
void setup() {
|
||||
Serial.begin(SERIAL_BAUD_RATE);
|
||||
delay(500);
|
||||
|
||||
uint32_t address = BYTE_LOCATION;
|
||||
uint32_t size = LINE_LENGTH;
|
||||
char *write_pointer = (char*)build_info_line;
|
||||
uint8_t write_checksum = 0;
|
||||
for (; size>0; size--) {
|
||||
write_checksum = (write_checksum << 1) || (write_checksum >> 7);
|
||||
write_checksum += *write_pointer;
|
||||
EEPROM.put(address++, *(write_pointer++));
|
||||
}
|
||||
EEPROM.put(address,write_checksum);
|
||||
|
||||
Serial.print(F("-> Writing line to EEPROM: '"));
|
||||
Serial.print(build_info_line);
|
||||
Serial.print(F("'\n\r-> Write checksum: "));
|
||||
Serial.println(write_checksum,DEC);
|
||||
|
||||
size = LINE_LENGTH;
|
||||
address = BYTE_LOCATION;
|
||||
uint8_t data = 0;
|
||||
char read_line[LINE_LENGTH];
|
||||
char *read_pointer = (char*)read_line;
|
||||
uint8_t read_checksum = 0;
|
||||
uint8_t stored_checksum = 0;
|
||||
for(; size > 0; size--) {
|
||||
data = EEPROM.read(address++);
|
||||
read_checksum = (read_checksum << 1) || (read_checksum >> 7);
|
||||
read_checksum += data;
|
||||
*(read_pointer++) = data;
|
||||
}
|
||||
stored_checksum = EEPROM.read(address);
|
||||
|
||||
Serial.print(F("<- Reading line from EEPROM: '"));
|
||||
Serial.print(read_line);
|
||||
Serial.print("'\n\r<- Read checksum: ");
|
||||
Serial.println(read_checksum,DEC);
|
||||
|
||||
if ((read_checksum == write_checksum) && (read_checksum == stored_checksum)) {
|
||||
status = true;
|
||||
Serial.print(F("SUCCESS! All checksums match!\r\n"));
|
||||
} else {
|
||||
if (write_checksum != stored_checksum) {
|
||||
Serial.println(F("ERROR! Write and stored EEPROM checksums don't match!"));
|
||||
} else {
|
||||
Serial.println(F("ERROR! Read and stored checksums don't match!"));
|
||||
}
|
||||
}
|
||||
pinMode(ledPin, OUTPUT); // sets the digital pin as output
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// Blink to let user know EEPROM write status.
|
||||
// Slow blink is 'ok'. Fast blink is an 'error'.
|
||||
digitalWrite(ledPin, HIGH); // sets the LED on
|
||||
if (status) { delay(1500); } // Slow blink
|
||||
else { delay(100); } // Rapid blink
|
||||
digitalWrite(ledPin, LOW); // sets the LED off
|
||||
if (status) { delay(1500); }
|
||||
else { delay(100); }
|
||||
}
|
||||
|
||||
|
21
grbl/examples/grblWrite_BuildInfo/license.txt
Normal file
21
grbl/examples/grblWrite_BuildInfo/license.txt
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Sungeun K. Jeon for Gnea Research LLC
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
Reference in New Issue
Block a user