diff --git a/implementation/software/LICENSE_ASTROID_FONT b/implementation/software/LICENSE_ASTROID_FONT new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/implementation/software/LICENSE_ASTROID_FONT @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/implementation/software/Makefile b/implementation/software/Makefile index 095f467..9b1f557 100644 --- a/implementation/software/Makefile +++ b/implementation/software/Makefile @@ -5,7 +5,12 @@ BOARD ?= nucleo-f411re RIOTBASE ?= /home/wouter/Development/RIOT/ USEMODULE += xtimer -USEMODULE += checksum +USEMODULE += event_callback +USEMODULE += event_timeout +USEMODULE += printf_float +USEMODULE += servo +CFLAGS += -DSERVO_FREQUENCY=50U +CFLAGS += -DSERVO_RESOLUTION=10000U include $(RIOTBASE)/Makefile.include diff --git a/implementation/software/asteroids_font.c b/implementation/software/asteroids_font.c new file mode 100644 index 0000000..0c0c640 --- /dev/null +++ b/implementation/software/asteroids_font.c @@ -0,0 +1,86 @@ +/** \file + * Super simple font from Asteroids. + * + * http://www.edge-online.com/wp-content/uploads/edgeonline/oldfiles/images/feature_article/2009/05/asteroids2.jpg + */ + +#include +#include "include/asteroids_font.h" + +#define P(x,y) ((((x) & 0xF) << 4) | (((y) & 0xF) << 0)) + +//#pragma GCC diagnostic push +//#pragma GCC diagnostic ignored "-Wmissing-braces" +const asteroids_char_t asteroids_font[] = { + ['0' - 0x20] = {{ P(0,0), P(8,0), P(8,12), P(0,12), P(0,0), P(8,12), FONT_LAST }}, + ['1' - 0x20] = {{ P(4,0), P(4,12), P(3,10), FONT_LAST }}, + ['2' - 0x20] = {{ P(0,12), P(8,12), P(8,7), P(0,5), P(0,0), P(8,0), FONT_LAST }}, + ['3' - 0x20] = {{ P(0,12), P(8,12), P(8,0), P(0,0), FONT_UP, P(0,6), P(8,6), FONT_LAST }}, + ['4' - 0x20] = {{ P(0,12), P(0,6), P(8,6), FONT_UP, P(8,12), P(8,0), FONT_LAST }}, + ['5' - 0x20] = {{ P(0,0), P(8,0), P(8,6), P(0,7), P(0,12), P(8,12), FONT_LAST }}, + ['6' - 0x20] = {{ P(0,12), P(0,0), P(8,0), P(8,5), P(0,7), FONT_LAST }}, + ['7' - 0x20] = {{ P(0,12), P(8,12), P(8,6), P(4,0), FONT_LAST }}, + ['8' - 0x20] = {{ P(0,0), P(8,0), P(8,12), P(0,12), P(0,0), FONT_UP, P(0,6), P(8,6), }}, + ['9' - 0x20] = {{ P(8,0), P(8,12), P(0,12), P(0,7), P(8,5), FONT_LAST }}, + [' ' - 0x20] = {{ FONT_LAST }}, + ['.' - 0x20] = {{ 0x30, 0x40, FONT_LAST }}, + [',' - 0x20] = {{ P(2,0), P(4,2), FONT_LAST }}, + ['-' - 0x20] = {{ P(2,6), P(6,6), FONT_LAST }}, + ['+' - 0x20] = {{ P(1,6), P(7,6), FONT_UP, P(4,9), P(4,3), FONT_LAST }}, + ['!' - 0x20] = {{ P(4,0), P(3,2), P(5,2), P(4,0), FONT_UP, P(4,4), P(4,12), FONT_LAST }}, + ['#' - 0x20] = {{ P(0,4), P(8,4), P(6,2), P(6,10), P(8,8), P(0,8), P(2,10), P(2,2) }}, + ['^' - 0x20] = {{ P(2,6), P(4,12), P(6,6), FONT_LAST }}, + ['=' - 0x20] = {{ P(1,4), P(7,4), FONT_UP, P(1,8), P(7,8), FONT_LAST }}, + ['*' - 0x20] = {{ P(0,0), P(4,12), P(8,0), P(0,8), P(8,8), P(0,0), FONT_LAST }}, + ['_' - 0x20] = {{ P(0,0), P(8,0), FONT_LAST }}, + ['/' - 0x20] = {{ P(0,0), P(8,12), FONT_LAST }}, + ['\\' - 0x20] = {{ P(0,12), P(8,0), FONT_LAST }}, + ['@' - 0x20] = {{ P(8,4), P(4,0), P(0,4), P(0,8), P(4,12), P(8,8), P(4,4), P(3,6) }}, + ['$' - 0x20] = {{ P(6,2), P(2,6), P(6,10), FONT_UP, P(4,12), P(4,0), FONT_LAST }}, + ['&' - 0x20] = {{ P(8,0), P(4,12), P(8,8), P(0,4), P(4,0), P(8,4), FONT_LAST }}, + ['[' - 0x20] = {{ P(6,0), P(2,0), P(2,12), P(6,12), FONT_LAST }}, + [']' - 0x20] = {{ P(2,0), P(6,0), P(6,12), P(2,12), FONT_LAST }}, + ['(' - 0x20] = {{ P(6,0), P(2,4), P(2,8), P(6,12), FONT_LAST }}, + [')' - 0x20] = {{ P(2,0), P(6,4), P(6,8), P(2,12), FONT_LAST }}, + ['{' - 0x20] = {{ P(6,0), P(4,2), P(4,10), P(6,12), FONT_UP, P(2,6), P(4,6), FONT_LAST }}, + ['}' - 0x20] = {{ P(4,0), P(6,2), P(6,10), P(4,12), FONT_UP, P(6,6), P(8,6), FONT_LAST }}, + ['%' - 0x20] = {{ P(0,0), P(8,12), FONT_UP, P(2,10), P(2,8), FONT_UP, P(6,4), P(6,2) }}, + ['<' - 0x20] = {{ P(6,0), P(2,6), P(6,12), FONT_LAST }}, + ['>' - 0x20] = {{ P(2,0), P(6,6), P(2,12), FONT_LAST }}, + ['|' - 0x20] = {{ P(4,0), P(4,5), FONT_UP, P(4,6), P(4,12), FONT_LAST }}, + [':' - 0x20] = {{ P(4,9), P(4,7), FONT_UP, P(4,5), P(4,3), FONT_LAST }}, + [';' - 0x20] = {{ P(4,9), P(4,7), FONT_UP, P(4,5), P(1,2), FONT_LAST }}, + ['"' - 0x20] = {{ P(2,10), P(2,6), FONT_UP, P(6,10), P(6,6), FONT_LAST }}, + ['\'' - 0x20] = {{ P(2,6), P(6,10), FONT_LAST }}, + ['`' - 0x20] = {{ P(2,10), P(6,6), FONT_LAST }}, + ['~' - 0x20] = {{ P(0,4), P(2,8), P(6,4), P(8,8), FONT_LAST }}, + ['?' - 0x20] = {{ P(0,8), P(4,12), P(8,8), P(4,4), FONT_UP, P(4,1), P(4,0), FONT_LAST }}, + ['A' - 0x20] = {{ P(0,0), P(0,8), P(4,12), P(8,8), P(8,0), FONT_UP, P(0,4), P(8,4) }}, + ['B' - 0x20] = {{ P(0,0), P(0,12), P(4,12), P(8,10), P(4,6), P(8,2), P(4,0), P(0,0) }}, + ['C' - 0x20] = {{ P(8,0), P(0,0), P(0,12), P(8,12), FONT_LAST }}, + ['D' - 0x20] = {{ P(0,0), P(0,12), P(4,12), P(8,8), P(8,4), P(4,0), P(0,0), FONT_LAST }}, + ['E' - 0x20] = {{ P(8,0), P(0,0), P(0,12), P(8,12), FONT_UP, P(0,6), P(6,6), FONT_LAST }}, + ['F' - 0x20] = {{ P(0,0), P(0,12), P(8,12), FONT_UP, P(0,6), P(6,6), FONT_LAST }}, + ['G' - 0x20] = {{ P(6,6), P(8,4), P(8,0), P(0,0), P(0,12), P(8,12), FONT_LAST }}, + ['H' - 0x20] = {{ P(0,0), P(0,12), FONT_UP, P(0,6), P(8,6), FONT_UP, P(8,12), P(8,0) }}, + ['I' - 0x20] = {{ P(0,0), P(8,0), FONT_UP, P(4,0), P(4,12), FONT_UP, P(0,12), P(8,12) }}, + ['J' - 0x20] = {{ P(0,4), P(4,0), P(8,0), P(8,12), FONT_LAST }}, + ['K' - 0x20] = {{ P(0,0), P(0,12), FONT_UP, P(8,12), P(0,6), P(6,0), FONT_LAST }}, + ['L' - 0x20] = {{ P(8,0), P(0,0), P(0,12), FONT_LAST }}, + ['M' - 0x20] = {{ P(0,0), P(0,12), P(4,8), P(8,12), P(8,0), FONT_LAST }}, + ['N' - 0x20] = {{ P(0,0), P(0,12), P(8,0), P(8,12), FONT_LAST }}, + ['O' - 0x20] = {{ P(0,0), P(0,12), P(8,12), P(8,0), P(0,0), FONT_LAST }}, + ['P' - 0x20] = {{ P(0,0), P(0,12), P(8,12), P(8,6), P(0,5), FONT_LAST }}, + ['Q' - 0x20] = {{ P(0,0), P(0,12), P(8,12), P(8,4), P(0,0), FONT_UP, P(4,4), P(8,0) }}, + ['R' - 0x20] = {{ P(0,0), P(0,12), P(8,12), P(8,6), P(0,5), FONT_UP, P(4,5), P(8,0) }}, + ['S' - 0x20] = {{ P(0,2), P(2,0), P(8,0), P(8,5), P(0,7), P(0,12), P(6,12), P(8,10) }}, + ['T' - 0x20] = {{ P(0,12), P(8,12), FONT_UP, P(4,12), P(4,0), FONT_LAST }}, + ['U' - 0x20] = {{ P(0,12), P(0,2), P(4,0), P(8,2), P(8,12), FONT_LAST }}, + ['V' - 0x20] = {{ P(0,12), P(4,0), P(8,12), FONT_LAST }}, + ['W' - 0x20] = {{ P(0,12), P(2,0), P(4,4), P(6,0), P(8,12), FONT_LAST }}, + ['X' - 0x20] = {{ P(0,0), P(8,12), FONT_UP, P(0,12), P(8,0), FONT_LAST }}, + ['Y' - 0x20] = {{ P(0,12), P(4,6), P(8,12), FONT_UP, P(4,6), P(4,0), FONT_LAST }}, + ['Z' - 0x20] = {{ P(0,12), P(8,12), P(0,0), P(8,0), FONT_UP, P(2,6), P(6,6), FONT_LAST }}, +}; +//#pragma GCC diagnostic pop + diff --git a/implementation/software/controller.c b/implementation/software/controller.c index b2e0ae5..b2041f5 100644 --- a/implementation/software/controller.c +++ b/implementation/software/controller.c @@ -9,16 +9,34 @@ void print_point(gbVec2 *point) int controller_init(controller_t *control) { gpio_init(BTN0_PIN,BTN0_MODE); - event_t event = {.handler = controller_update}; - control->event = event; controller_home(control); - event_timeout_init(&(control->event_timeout), control->queue, &(control->event)); - event_post(control->queue,&(control->event)); + control->flags = control->stepper_a->flags | control->stepper_b->flags; return 0; } +int controller_loop(controller_t *control){ + path_node_t *setpoint = (path_node_t*)control->path->current.next; + //printf("start controller loop\n"); + while(setpoint->list.next != 0x0){ + if ((setpoint->point.x > 127) | (setpoint->point.x < 0) | (setpoint->point.y > 127) | (setpoint->point.y < 0 ) ) { + printf("Controller Error, x and y value are out of range x: %i, y: %i\n", setpoint->point.x, setpoint->point.y); + return CONTROLLER_ERR; + } + //printf("Controller: look up x: %i, y: %i\n", setpoint->point.x, setpoint->point.y); + int16_t angle1 = lookup_table_angle1[setpoint->point.y][setpoint->point.x]; + int16_t angle2 = lookup_table_angle2[setpoint->point.y][setpoint->point.x]; + //printf("Controller: next setpoint A: %i, B: %i\n",angle1, angle2); + stepper_set_setpoint(control->stepper_a, angle1, control->time_step); + stepper_set_setpoint(control->stepper_b, angle2, control->time_step); + xtimer_usleep(10000); + thread_flags_wait_all(control->flags); + setpoint = path_next(setpoint); + } + printf("controller loop done\n"); + return CONTROLLER_OK; +} -void controller_update(event_t *event) +/*void controller_update(event_t *event) { controller_t *control = container_of(event, controller_t, event); controller_calculate_velocity(control); @@ -148,7 +166,7 @@ int controller_sub_setpoint(controller_t *control, gbVec2 *setpoint, float dista printf("Increment Path\n"); } } - /*gbVec2 position_error; + gbVec2 position_error; gb_vec2_sub(&position_error, control->setpoint, current_position); // scale the length of the error. // to limit the length. @@ -160,9 +178,9 @@ int controller_sub_setpoint(controller_t *control, gbVec2 *setpoint, float dista scaled_position_error = position_error; } gb_vec2_add(setpoint, current_position, scaled_position_error); - return 0;*/ + return 0; } - +*/ int controller_home(controller_t *control){ stepper_disable(control->stepper_b); stepper_disable(control->stepper_a); @@ -185,19 +203,17 @@ int controller_home(controller_t *control){ for(uint32_t i = 0; i < homing_combined; i++) { stepper_step(control->stepper_b); - xtimer_usleep(3000); + xtimer_usleep(1000); } stepper_enable(control->stepper_b); for(uint32_t i = 0; i < homing_a_steps; i++) { stepper_step(control->stepper_b); stepper_step(control->stepper_a); - xtimer_usleep(3000); + xtimer_usleep(1000); } control->stepper_a->step_count = stepper_get_count(control->stepper_a,GB_MATH_PI/2.0); control->stepper_b->step_count = 0; - control->stepper_a->zero_count = 0; - control->stepper_b->zero_count = 0; float angle_a; float angle_b; stepper_get_angle(control->stepper_a, &angle_a); @@ -208,13 +224,6 @@ int controller_home(controller_t *control){ { } xtimer_usleep(500000); - // - // run stepper_a clockwise - // until switch. - // - // set homing angles - // - // set setpoint return 0; } diff --git a/implementation/software/include/angle.h b/implementation/software/include/angle.h new file mode 100644 index 0000000..430085b --- /dev/null +++ b/implementation/software/include/angle.h @@ -0,0 +1,259 @@ +#pragma once +static const int16_t lookup_table_angle1[128][128] = {{1051,1044,1038,1032,1025,1019,1013,1007,1001,995,989,984,978,972,967,961,956,951,945,940,935,930,924,919,914,909,905,900,895,890,885,881,876,872,867,862,858,854,849,845,841,836,832,828,824,819,815,811,807,803,799,795,791,787,783,779,775,772,768,764,760,756,753,749,745,741,738,734,730,727,723,720,716,712,709,705,702,698,695,691,688,684,681,677,674,670,667,663,660,656,653,649,646,643,639,636,632,629,625,622,619,615,612,608,605,601,598,595,591,588,584,581,577,574,570,567,563,560,556,553,549,546,542,539,535,532,528,525}, +{1053,1047,1041,1034,1028,1022,1016,1010,1004,998,992,986,981,975,970,964,959,953,948,943,937,932,927,922,917,912,907,902,898,893,888,883,879,874,870,865,861,856,852,847,843,839,834,830,826,822,818,814,809,805,801,797,793,789,785,782,778,774,770,766,762,759,755,751,747,744,740,736,733,729,725,722,718,714,711,707,704,700,697,693,690,686,682,679,675,672,668,665,662,658,655,651,648,644,641,637,634,630,627,624,620,617,613,610,606,603,600,596,593,589,586,582,579,575,572,568,565,561,558,554,551,547,544,540,537,533,530,526}, +{1056,1049,1043,1037,1031,1024,1018,1012,1006,1001,995,989,983,978,972,967,961,956,951,945,940,935,930,925,920,915,910,905,900,895,891,886,881,877,872,868,863,859,854,850,845,841,837,833,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,765,761,757,753,749,746,742,738,735,731,727,724,720,716,713,709,706,702,698,695,691,688,684,681,677,674,670,667,663,660,656,653,649,646,642,639,636,632,629,625,622,618,615,611,608,605,601,598,594,591,587,584,580,577,573,570,566,563,559,556,552,549,545,542,538,534,531,527}, +{1058,1052,1045,1039,1033,1027,1021,1015,1009,1003,997,992,986,980,975,969,964,958,953,948,943,937,932,927,922,917,912,907,903,898,893,888,884,879,875,870,865,861,857,852,848,844,839,835,831,827,822,818,814,810,806,802,798,794,790,786,782,778,774,770,767,763,759,755,751,748,744,740,737,733,729,726,722,718,715,711,708,704,700,697,693,690,686,683,679,676,672,669,665,662,658,655,651,648,644,641,637,634,630,627,623,620,616,613,610,606,603,599,596,592,589,585,582,578,575,571,568,564,561,557,554,550,546,543,539,536,532,529}, +{1060,1054,1048,1042,1035,1029,1023,1017,1011,1006,1000,994,988,983,977,972,966,961,956,950,945,940,935,930,925,920,915,910,905,900,896,891,886,882,877,872,868,863,859,855,850,846,842,837,833,829,825,820,816,812,808,804,800,796,792,788,784,780,776,773,769,765,761,757,754,750,746,742,739,735,731,728,724,720,717,713,709,706,702,699,695,691,688,684,681,677,674,670,667,663,660,656,653,649,646,642,639,635,632,628,625,621,618,615,611,608,604,601,597,594,590,587,583,580,576,573,569,566,562,558,555,551,548,544,541,537,533,530}, +{1063,1056,1050,1044,1038,1032,1026,1020,1014,1008,1002,997,991,985,980,974,969,963,958,953,948,942,937,932,927,922,917,912,908,903,898,893,889,884,879,875,870,866,861,857,853,848,844,840,835,831,827,823,819,814,810,806,802,798,794,790,786,782,779,775,771,767,763,759,756,752,748,744,741,737,733,729,726,722,719,715,711,708,704,700,697,693,690,686,683,679,676,672,668,665,661,658,654,651,647,644,640,637,633,630,626,623,620,616,613,609,606,602,599,595,592,588,585,581,578,574,570,567,563,560,556,553,549,546,542,538,535,531}, +{1065,1059,1052,1046,1040,1034,1028,1022,1016,1010,1005,999,993,988,982,977,971,966,960,955,950,945,940,935,930,925,920,915,910,905,900,896,891,886,882,877,873,868,864,859,855,850,846,842,838,833,829,825,821,817,813,808,804,800,796,792,788,785,781,777,773,769,765,761,758,754,750,746,743,739,735,731,728,724,720,717,713,709,706,702,699,695,691,688,684,681,677,674,670,667,663,660,656,653,649,646,642,639,635,632,628,625,621,618,614,611,607,604,600,596,593,589,586,582,579,575,572,568,565,561,558,554,550,547,543,540,536,532}, +{1067,1061,1054,1048,1042,1036,1030,1024,1018,1013,1007,1001,996,990,984,979,974,968,963,958,952,947,942,937,932,927,922,917,912,907,903,898,893,889,884,879,875,870,866,861,857,853,848,844,840,836,831,827,823,819,815,811,807,803,798,795,791,787,783,779,775,771,767,763,760,756,752,748,744,741,737,733,730,726,722,719,715,711,708,704,700,697,693,690,686,682,679,675,672,668,665,661,658,654,651,647,644,640,637,633,630,626,623,619,615,612,608,605,601,598,594,591,587,584,580,577,573,570,566,562,559,555,552,548,544,541,537,533}, +{1069,1063,1057,1050,1044,1038,1032,1026,1021,1015,1009,1003,998,992,987,981,976,970,965,960,955,949,944,939,934,929,924,919,915,910,905,900,895,891,886,882,877,873,868,864,859,855,851,846,842,838,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,758,754,750,746,743,739,735,731,728,724,720,717,713,709,706,702,699,695,691,688,684,681,677,673,670,666,663,659,656,652,649,645,642,638,635,631,628,624,620,617,613,610,606,603,599,596,592,589,585,582,578,574,571,567,564,560,557,553,549,546,542,538,535}, +{1071,1065,1059,1052,1046,1040,1034,1029,1023,1017,1011,1006,1000,994,989,983,978,973,967,962,957,952,947,941,936,931,927,922,917,912,907,902,898,893,888,884,879,875,870,866,861,857,853,848,844,840,836,831,827,823,819,815,811,807,803,799,795,791,787,783,779,775,771,767,763,760,756,752,748,744,741,737,733,729,726,722,718,715,711,707,704,700,697,693,689,686,682,679,675,672,668,664,661,657,654,650,647,643,640,636,633,629,625,622,618,615,611,608,604,601,597,594,590,586,583,579,576,572,569,565,561,558,554,550,547,543,540,536}, +{1073,1067,1060,1054,1048,1042,1036,1031,1025,1019,1013,1008,1002,997,991,986,980,975,970,964,959,954,949,944,939,934,929,924,919,914,909,905,900,895,891,886,881,877,872,868,864,859,855,850,846,842,838,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,758,754,750,746,742,739,735,731,728,724,720,717,713,709,706,702,698,695,691,687,684,680,677,673,670,666,662,659,655,652,648,645,641,638,634,630,627,623,620,616,613,609,606,602,598,595,591,588,584,581,577,573,570,566,563,559,555,552,548,544,541,537}, +{1075,1068,1062,1056,1050,1044,1038,1033,1027,1021,1015,1010,1004,999,993,988,982,977,972,966,961,956,951,946,941,936,931,926,921,916,911,907,902,897,893,888,884,879,875,870,866,861,857,852,848,844,840,835,831,827,823,819,815,811,807,802,798,794,791,787,783,779,775,771,767,763,759,756,752,748,744,740,737,733,729,726,722,718,715,711,707,704,700,696,693,689,685,682,678,675,671,668,664,660,657,653,650,646,643,639,635,632,628,625,621,618,614,611,607,603,600,596,593,589,585,582,578,575,571,567,564,560,557,553,549,546,542,538}, +{1076,1070,1064,1058,1052,1046,1040,1035,1029,1023,1017,1012,1006,1001,995,990,984,979,974,968,963,958,953,948,943,938,933,928,923,918,914,909,904,899,895,890,886,881,877,872,868,863,859,855,850,846,842,837,833,829,825,821,817,813,808,804,800,796,792,788,784,781,777,773,769,765,761,757,754,750,746,742,738,735,731,727,724,720,716,713,709,705,702,698,694,691,687,683,680,676,673,669,665,662,658,655,651,648,644,640,637,633,630,626,623,619,615,612,608,605,601,598,594,590,587,583,580,576,572,569,565,561,558,554,550,547,543,539}, +{1078,1072,1066,1060,1054,1048,1042,1036,1031,1025,1019,1014,1008,1003,997,992,986,981,976,970,965,960,955,950,945,940,935,930,925,920,916,911,906,901,897,892,888,883,879,874,870,865,861,856,852,848,844,839,835,831,827,823,819,814,810,806,802,798,794,790,786,782,778,775,771,767,763,759,755,752,748,744,740,736,733,729,725,722,718,714,710,707,703,700,696,692,689,685,681,678,674,671,667,663,660,656,653,649,645,642,638,635,631,628,624,620,617,613,610,606,602,599,595,592,588,584,581,577,574,570,566,563,559,555,552,548,544,540}, +{1080,1074,1068,1062,1056,1050,1044,1038,1033,1027,1021,1016,1010,1005,999,994,988,983,978,972,967,962,957,952,947,942,937,932,927,922,918,913,908,903,899,894,890,885,881,876,872,867,863,858,854,850,846,841,837,833,829,825,820,816,812,808,804,800,796,792,788,784,780,776,772,769,765,761,757,753,749,746,742,738,734,731,727,723,719,716,712,708,705,701,697,694,690,687,683,679,676,672,668,665,661,658,654,650,647,643,640,636,632,629,625,622,618,615,611,607,604,600,596,593,589,586,582,578,575,571,567,564,560,556,553,549,545,541}, +{1081,1075,1069,1063,1057,1052,1046,1040,1034,1029,1023,1017,1012,1006,1001,996,990,985,980,974,969,964,959,954,949,944,939,934,929,924,920,915,910,905,901,896,892,887,882,878,874,869,865,860,856,852,847,843,839,835,831,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,763,759,755,751,747,744,740,736,732,729,725,721,717,714,710,706,703,699,695,692,688,684,681,677,673,670,666,663,659,655,652,648,645,641,637,634,630,627,623,619,616,612,609,605,601,598,594,590,587,583,580,576,572,569,565,561,557,554,550,546,543}, +{1083,1077,1071,1065,1059,1053,1047,1042,1036,1030,1025,1019,1014,1008,1003,997,992,987,981,976,971,966,961,956,951,946,941,936,931,926,921,917,912,907,903,898,893,889,884,880,875,871,867,862,858,854,849,845,841,837,832,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,764,760,757,753,749,745,741,738,734,730,726,723,719,715,712,708,704,700,697,693,689,686,682,679,675,671,668,664,660,657,653,650,646,642,639,635,632,628,624,621,617,613,610,606,603,599,595,592,588,584,581,577,573,570,566,562,559,555,551,547,544}, +{1084,1078,1072,1067,1061,1055,1049,1043,1038,1032,1026,1021,1015,1010,1005,999,994,989,983,978,973,968,963,958,953,948,943,938,933,928,923,919,914,909,905,900,895,891,886,882,877,873,868,864,860,855,851,847,843,838,834,830,826,822,818,814,809,805,801,797,793,789,785,782,778,774,770,766,762,758,754,751,747,743,739,735,732,728,724,720,717,713,709,706,702,698,695,691,687,684,680,676,673,669,665,662,658,655,651,647,644,640,636,633,629,626,622,618,615,611,607,604,600,597,593,589,586,582,578,574,571,567,563,560,556,552,548,545}, +{1086,1080,1074,1068,1062,1056,1051,1045,1039,1034,1028,1023,1017,1012,1006,1001,996,990,985,980,975,970,964,959,954,949,945,940,935,930,925,920,916,911,906,902,897,893,888,884,879,875,870,866,862,857,853,849,844,840,836,832,828,823,819,815,811,807,803,799,795,791,787,783,779,775,771,768,764,760,756,752,748,745,741,737,733,729,726,722,718,715,711,707,703,700,696,692,689,685,681,678,674,670,667,663,660,656,652,649,645,641,638,634,630,627,623,620,616,612,609,605,601,598,594,590,587,583,579,576,572,568,564,561,557,553,549,546}, +{1087,1081,1075,1069,1064,1058,1052,1047,1041,1035,1030,1024,1019,1013,1008,1003,997,992,987,982,976,971,966,961,956,951,946,941,937,932,927,922,918,913,908,904,899,894,890,885,881,876,872,868,863,859,855,850,846,842,838,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,758,754,750,746,742,739,735,731,727,723,720,716,712,709,705,701,698,694,690,686,683,679,675,672,668,665,661,657,654,650,646,643,639,635,632,628,624,621,617,614,610,606,603,599,595,592,588,584,580,577,573,569,566,562,558,554,550,547}, +{1088,1083,1077,1071,1065,1059,1054,1048,1042,1037,1031,1026,1020,1015,1010,1004,999,994,988,983,978,973,968,963,958,953,948,943,938,934,929,924,919,915,910,905,901,896,892,887,883,878,874,869,865,861,856,852,848,844,839,835,831,827,823,819,815,810,806,802,798,794,790,786,782,779,775,771,767,763,759,755,751,748,744,740,736,732,729,725,721,717,714,710,706,703,699,695,692,688,684,681,677,673,670,666,662,659,655,651,648,644,640,637,633,629,626,622,618,615,611,607,604,600,596,593,589,585,582,578,574,570,567,563,559,555,551,548}, +{1090,1084,1078,1072,1067,1061,1055,1050,1044,1038,1033,1027,1022,1017,1011,1006,1001,995,990,985,980,975,970,965,960,955,950,945,940,935,930,926,921,916,912,907,902,898,893,889,884,880,875,871,867,862,858,854,849,845,841,837,833,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,765,761,757,753,749,745,742,738,734,730,726,723,719,715,711,708,704,700,697,693,689,686,682,678,674,671,667,663,660,656,652,649,645,642,638,634,631,627,623,620,616,612,609,605,601,597,594,590,586,583,579,575,571,568,564,560,556,552,549}, +{1091,1085,1079,1074,1068,1062,1057,1051,1045,1040,1034,1029,1023,1018,1013,1007,1002,997,992,987,981,976,971,966,961,956,951,947,942,937,932,927,923,918,913,909,904,900,895,890,886,882,877,873,868,864,860,855,851,847,843,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,751,747,743,739,735,732,728,724,720,717,713,709,705,702,698,694,691,687,683,679,676,672,668,665,661,657,654,650,646,643,639,635,632,628,624,621,617,613,610,606,602,599,595,591,587,584,580,576,572,569,565,561,557,553,550}, +{1092,1086,1081,1075,1069,1063,1058,1052,1047,1041,1036,1030,1025,1020,1014,1009,1004,998,993,988,983,978,973,968,963,958,953,948,943,939,934,929,924,920,915,910,906,901,897,892,888,883,879,874,870,866,861,857,853,849,844,840,836,832,828,823,819,815,811,807,803,799,795,791,787,783,779,775,771,768,764,760,756,752,748,744,741,737,733,729,725,722,718,714,710,707,703,699,696,692,688,684,681,677,673,670,666,662,659,655,651,648,644,640,637,633,629,626,622,618,614,611,607,603,600,596,592,588,585,581,577,573,570,566,562,558,554,551}, +{1093,1088,1082,1076,1070,1065,1059,1054,1048,1043,1037,1032,1026,1021,1016,1010,1005,1000,995,990,984,979,974,969,964,959,955,950,945,940,935,931,926,921,917,912,907,903,898,894,889,885,880,876,872,867,863,859,854,850,846,842,837,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,757,754,750,746,742,738,734,731,727,723,719,716,712,708,704,701,697,693,689,686,682,678,675,671,667,664,660,656,652,649,645,641,638,634,630,627,623,619,616,612,608,604,601,597,593,589,586,582,578,574,571,567,563,559,555,551}, +{1094,1089,1083,1077,1072,1066,1060,1055,1049,1044,1038,1033,1028,1022,1017,1012,1007,1001,996,991,986,981,976,971,966,961,956,951,946,942,937,932,927,923,918,913,909,904,900,895,891,886,882,878,873,869,864,860,856,852,847,843,839,835,831,827,822,818,814,810,806,802,798,794,790,786,782,778,774,770,767,763,759,755,751,747,743,740,736,732,728,724,721,717,713,709,706,702,698,694,691,687,683,680,676,672,668,665,661,657,654,650,646,643,639,635,631,628,624,620,617,613,609,605,602,598,594,590,587,583,579,575,572,568,564,560,556,552}, +{1095,1090,1084,1078,1073,1067,1062,1056,1051,1045,1040,1034,1029,1024,1018,1013,1008,1003,998,992,987,982,977,972,967,962,958,953,948,943,938,934,929,924,920,915,910,906,901,897,892,888,883,879,875,870,866,862,857,853,849,845,840,836,832,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,764,760,756,752,749,745,741,737,733,730,726,722,718,714,711,707,703,699,696,692,688,685,681,677,673,670,666,662,659,655,651,647,644,640,636,633,629,625,621,618,614,610,607,603,599,595,591,588,584,580,576,573,569,565,561,557,553}, +{1096,1091,1085,1079,1074,1068,1063,1057,1052,1046,1041,1036,1030,1025,1020,1014,1009,1004,999,994,989,984,979,974,969,964,959,954,949,945,940,935,930,926,921,917,912,907,903,898,894,889,885,881,876,872,868,863,859,855,850,846,842,838,834,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,762,758,754,750,746,742,738,735,731,727,723,719,716,712,708,704,701,697,693,689,686,682,678,675,671,667,663,660,656,652,649,645,641,637,634,630,626,622,619,615,611,608,604,600,596,592,589,585,581,577,573,570,566,562,558,554}, +{1097,1092,1086,1080,1075,1069,1064,1058,1053,1048,1042,1037,1032,1026,1021,1016,1011,1005,1000,995,990,985,980,975,970,965,960,956,951,946,941,937,932,927,923,918,913,909,904,900,895,891,886,882,878,873,869,865,860,856,852,848,843,839,835,831,827,823,819,815,810,806,802,798,794,790,786,782,779,775,771,767,763,759,755,751,747,744,740,736,732,728,725,721,717,713,709,706,702,698,694,691,687,683,679,676,672,668,665,661,657,653,650,646,642,638,635,631,627,624,620,616,612,609,605,601,597,593,590,586,582,578,574,571,567,563,559,555}, +{1098,1093,1087,1081,1076,1070,1065,1059,1054,1049,1043,1038,1033,1027,1022,1017,1012,1007,1002,997,991,986,981,977,972,967,962,957,952,947,943,938,933,929,924,919,915,910,906,901,897,892,888,883,879,875,870,866,862,858,853,849,845,841,836,832,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,764,760,756,753,749,745,741,737,733,730,726,722,718,714,711,707,703,699,696,692,688,684,681,677,673,669,666,662,658,654,651,647,643,640,636,632,628,625,621,617,613,610,606,602,598,594,591,587,583,579,575,571,568,564,560,556}, +{1099,1094,1088,1082,1077,1071,1066,1061,1055,1050,1044,1039,1034,1029,1023,1018,1013,1008,1003,998,993,988,983,978,973,968,963,958,954,949,944,939,935,930,925,921,916,912,907,903,898,894,889,885,880,876,872,867,863,859,855,850,846,842,838,834,830,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,766,762,758,754,750,746,742,738,735,731,727,723,719,716,712,708,704,701,697,693,689,685,682,678,674,671,667,663,659,656,652,648,644,641,637,633,629,626,622,618,614,610,607,603,599,595,591,588,584,580,576,572,568,564,561,557}, +{1100,1094,1089,1083,1078,1072,1067,1062,1056,1051,1046,1040,1035,1030,1025,1019,1014,1009,1004,999,994,989,984,979,974,969,964,960,955,950,945,941,936,931,927,922,918,913,908,904,900,895,891,886,882,878,873,869,865,860,856,852,848,843,839,835,831,827,823,819,815,810,806,802,798,794,790,786,782,779,775,771,767,763,759,755,751,747,744,740,736,732,728,724,721,717,713,709,705,702,698,694,690,687,683,679,675,672,668,664,660,657,653,649,645,642,638,634,630,627,623,619,615,611,608,604,600,596,592,589,585,581,577,573,569,565,561,557}, +{1101,1095,1090,1084,1079,1073,1068,1063,1057,1052,1047,1041,1036,1031,1026,1021,1015,1010,1005,1000,995,990,985,980,975,971,966,961,956,951,947,942,937,933,928,923,919,914,910,905,901,896,892,888,883,879,875,870,866,862,857,853,849,845,841,836,832,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,764,760,756,752,749,745,741,737,733,729,726,722,718,714,710,707,703,699,695,691,688,684,680,676,673,669,665,661,658,654,650,646,643,639,635,631,628,624,620,616,612,609,605,601,597,593,589,586,582,578,574,570,566,562,558}, +{1102,1096,1091,1085,1080,1074,1069,1063,1058,1053,1048,1042,1037,1032,1027,1022,1017,1011,1006,1001,996,991,986,982,977,972,967,962,957,953,948,943,939,934,929,925,920,916,911,907,902,898,893,889,885,880,876,871,867,863,859,854,850,846,842,838,834,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,758,754,750,746,742,738,734,731,727,723,719,715,712,708,704,700,696,693,689,685,681,677,674,670,666,662,659,655,651,647,644,640,636,632,628,625,621,617,613,609,606,602,598,594,590,586,583,579,575,571,567,563,559}, +{1102,1097,1091,1086,1080,1075,1070,1064,1059,1054,1049,1043,1038,1033,1028,1023,1018,1013,1007,1002,997,993,988,983,978,973,968,963,959,954,949,944,940,935,931,926,921,917,912,908,903,899,895,890,886,881,877,873,868,864,860,856,851,847,843,839,835,831,827,822,818,814,810,806,802,798,794,790,786,782,778,774,770,767,763,759,755,751,747,743,739,736,732,728,724,720,716,713,709,705,701,697,694,690,686,682,679,675,671,667,663,660,656,652,648,645,641,637,633,629,626,622,618,614,610,607,603,599,595,591,587,583,579,576,572,568,564,560}, +{1103,1097,1092,1087,1081,1076,1071,1065,1060,1055,1049,1044,1039,1034,1029,1024,1019,1014,1009,1004,999,994,989,984,979,974,969,965,960,955,950,946,941,936,932,927,923,918,914,909,905,900,896,891,887,883,878,874,870,865,861,857,853,849,844,840,836,832,828,824,820,816,811,807,803,799,795,791,787,783,779,776,772,768,764,760,756,752,748,744,741,737,733,729,725,721,718,714,710,706,702,698,695,691,687,683,680,676,672,668,664,661,657,653,649,645,642,638,634,630,627,623,619,615,611,607,604,600,596,592,588,584,580,576,572,568,565,561}, +{1104,1098,1093,1087,1082,1077,1071,1066,1061,1056,1050,1045,1040,1035,1030,1025,1020,1015,1010,1005,1000,995,990,985,980,975,970,966,961,956,952,947,942,938,933,928,924,919,915,910,906,901,897,893,888,884,880,875,871,867,862,858,854,850,846,841,837,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,757,753,749,745,742,738,734,730,726,722,719,715,711,707,703,700,696,692,688,684,681,677,673,669,665,662,658,654,650,646,643,639,635,631,627,624,620,616,612,608,604,600,597,593,589,585,581,577,573,569,565,561}, +{1104,1099,1093,1088,1083,1077,1072,1067,1062,1056,1051,1046,1041,1036,1031,1026,1021,1016,1011,1006,1001,996,991,986,981,976,972,967,962,957,953,948,943,939,934,930,925,920,916,912,907,903,898,894,889,885,881,876,872,868,864,859,855,851,847,843,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,747,743,739,735,731,727,723,720,716,712,708,704,701,697,693,689,685,682,678,674,670,666,663,659,655,651,647,644,640,636,632,628,624,621,617,613,609,605,601,597,594,590,586,582,578,574,570,566,562}, +{1105,1099,1094,1089,1083,1078,1073,1068,1062,1057,1052,1047,1042,1037,1032,1027,1021,1016,1012,1007,1002,997,992,987,982,977,973,968,963,958,954,949,944,940,935,931,926,922,917,913,908,904,899,895,891,886,882,878,873,869,865,861,856,852,848,844,840,835,831,827,823,819,815,811,807,803,799,795,791,787,783,779,775,771,767,763,759,755,752,748,744,740,736,732,728,725,721,717,713,709,705,702,698,694,690,686,683,679,675,671,667,663,660,656,652,648,644,641,637,633,629,625,621,618,614,610,606,602,598,594,590,586,583,579,575,571,567,563}, +{1105,1100,1095,1089,1084,1079,1074,1068,1063,1058,1053,1048,1043,1037,1032,1027,1022,1017,1012,1008,1003,998,993,988,983,978,974,969,964,959,955,950,946,941,936,932,927,923,918,914,909,905,900,896,892,887,883,879,874,870,866,862,857,853,849,845,841,837,832,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,764,760,756,753,749,745,741,737,733,729,726,722,718,714,710,706,703,699,695,691,687,683,680,676,672,668,664,661,657,653,649,645,641,638,634,630,626,622,618,615,611,607,603,599,595,591,587,583,579,575,571,567,563}, +{1106,1100,1095,1090,1085,1079,1074,1069,1064,1059,1054,1048,1043,1038,1033,1028,1023,1018,1013,1008,1004,999,994,989,984,979,975,970,965,960,956,951,947,942,937,933,928,924,919,915,910,906,902,897,893,888,884,880,876,871,867,863,859,854,850,846,842,838,834,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,758,754,750,746,742,738,734,730,727,723,719,715,711,707,703,700,696,692,688,684,681,677,673,669,665,661,658,654,650,646,642,638,635,631,627,623,619,615,611,608,604,600,596,592,588,584,580,576,572,568,564}, +{1106,1101,1096,1090,1085,1080,1075,1070,1064,1059,1054,1049,1044,1039,1034,1029,1024,1019,1014,1009,1004,1000,995,990,985,980,976,971,966,961,957,952,948,943,938,934,929,925,920,916,911,907,903,898,894,890,885,881,877,872,868,864,860,855,851,847,843,839,835,831,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,759,755,751,747,743,739,735,731,727,724,720,716,712,708,704,701,697,693,689,685,681,678,674,670,666,662,658,655,651,647,643,639,635,632,628,624,620,616,612,608,604,600,596,593,589,585,581,577,573,569,565}, +{1107,1101,1096,1091,1086,1081,1075,1070,1065,1060,1055,1050,1045,1040,1035,1030,1025,1020,1015,1010,1005,1000,996,991,986,981,977,972,967,962,958,953,949,944,939,935,930,926,921,917,912,908,904,899,895,891,886,882,878,873,869,865,861,856,852,848,844,840,836,832,827,823,819,815,811,807,803,799,795,791,787,783,779,775,771,767,763,760,756,752,748,744,740,736,732,728,725,721,717,713,709,705,702,698,694,690,686,682,678,675,671,667,663,659,655,652,648,644,640,636,632,628,625,621,617,613,609,605,601,597,593,589,585,581,577,573,569,565}, +{1107,1102,1097,1091,1086,1081,1076,1071,1066,1061,1056,1051,1046,1040,1036,1031,1026,1021,1016,1011,1006,1001,996,992,987,982,977,973,968,963,959,954,950,945,940,936,931,927,922,918,913,909,905,900,896,892,887,883,879,874,870,866,862,858,853,849,845,841,837,833,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,764,761,757,753,749,745,741,737,733,729,726,722,718,714,710,706,702,699,695,691,687,683,679,675,672,668,664,660,656,652,649,645,641,637,633,629,625,621,618,614,610,606,602,598,594,590,586,582,578,574,570,566}, +{1108,1102,1097,1092,1087,1082,1076,1071,1066,1061,1056,1051,1046,1041,1036,1031,1026,1021,1017,1012,1007,1002,997,992,988,983,978,974,969,964,960,955,950,946,941,937,932,928,923,919,914,910,906,901,897,893,888,884,880,875,871,867,863,859,854,850,846,842,838,834,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,758,754,750,746,742,738,734,730,726,723,719,715,711,707,703,699,696,692,688,684,680,676,672,669,665,661,657,653,649,645,642,638,634,630,626,622,618,614,610,606,602,599,595,591,587,583,579,574,570,566}, +{1108,1103,1098,1092,1087,1082,1077,1072,1067,1062,1057,1052,1047,1042,1037,1032,1027,1022,1017,1012,1008,1003,998,993,989,984,979,974,970,965,960,956,951,947,942,938,933,929,924,920,915,911,907,902,898,894,889,885,881,876,872,868,864,859,855,851,847,843,839,835,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,755,751,747,743,739,735,731,727,723,720,716,712,708,704,700,696,693,689,685,681,677,673,669,666,662,658,654,650,646,642,638,635,631,627,623,619,615,611,607,603,599,595,591,587,583,579,575,571,567}, +{1108,1103,1098,1093,1088,1083,1077,1072,1067,1062,1057,1052,1047,1042,1037,1033,1028,1023,1018,1013,1008,1004,999,994,989,985,980,975,971,966,961,957,952,948,943,939,934,930,925,921,916,912,908,903,899,894,890,886,882,877,873,869,865,860,856,852,848,844,840,836,831,827,823,819,815,811,807,803,799,795,791,787,783,779,775,771,767,763,759,755,752,748,744,740,736,732,728,724,720,717,713,709,705,701,697,693,689,686,682,678,674,670,666,662,659,655,651,647,643,639,635,631,627,623,620,616,612,608,604,600,596,592,588,584,580,576,572,567}, +{1108,1103,1098,1093,1088,1083,1078,1073,1068,1063,1058,1053,1048,1043,1038,1033,1028,1023,1019,1014,1009,1004,999,995,990,985,981,976,971,967,962,958,953,948,944,939,935,930,926,922,917,913,908,904,900,895,891,887,883,878,874,870,866,861,857,853,849,845,841,836,832,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,764,760,756,752,748,745,741,737,733,729,725,721,717,713,710,706,702,698,694,690,686,683,679,675,671,667,663,659,655,652,648,644,640,636,632,628,624,620,616,612,608,604,600,596,592,588,584,580,576,572,568}, +{1109,1104,1099,1093,1088,1083,1078,1073,1068,1063,1058,1053,1048,1044,1039,1034,1029,1024,1019,1014,1010,1005,1000,995,991,986,981,977,972,968,963,958,954,949,945,940,936,931,927,922,918,914,909,905,901,896,892,888,883,879,875,871,866,862,858,854,850,846,841,837,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,757,753,749,745,742,738,734,730,726,722,718,714,710,707,703,699,695,691,687,683,679,676,672,668,664,660,656,652,648,644,641,637,633,629,625,621,617,613,609,605,601,597,593,589,585,581,577,573,568}, +{1109,1104,1099,1094,1089,1084,1079,1074,1069,1064,1059,1054,1049,1044,1039,1034,1029,1025,1020,1015,1010,1006,1001,996,991,987,982,977,973,968,964,959,955,950,946,941,937,932,928,923,919,914,910,906,901,897,893,889,884,880,876,872,867,863,859,855,851,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,735,731,727,723,719,715,711,707,703,700,696,692,688,684,680,676,672,668,665,661,657,653,649,645,641,637,633,629,625,621,617,614,610,606,602,598,593,589,585,581,577,573,569}, +{1109,1104,1099,1094,1089,1084,1079,1074,1069,1064,1059,1054,1049,1045,1040,1035,1030,1025,1020,1016,1011,1006,1001,997,992,987,983,978,974,969,964,960,955,951,946,942,937,933,928,924,920,915,911,907,902,898,894,889,885,881,877,872,868,864,860,856,851,847,843,839,835,831,827,823,819,815,811,807,803,798,794,791,787,783,779,775,771,767,763,759,755,751,747,743,739,735,731,728,724,720,716,712,708,704,700,696,693,689,685,681,677,673,669,665,661,657,654,650,646,642,638,634,630,626,622,618,614,610,606,602,598,594,590,586,582,578,574,569}, +{1109,1104,1099,1094,1089,1084,1079,1074,1069,1065,1060,1055,1050,1045,1040,1035,1031,1026,1021,1016,1011,1007,1002,997,993,988,983,979,974,970,965,961,956,952,947,943,938,934,929,925,920,916,912,907,903,899,894,890,886,882,877,873,869,865,861,856,852,848,844,840,836,832,828,824,819,815,811,807,803,799,795,791,787,783,779,775,771,768,764,760,756,752,748,744,740,736,732,728,724,720,717,713,709,705,701,697,693,689,685,682,678,674,670,666,662,658,654,650,646,642,638,635,631,627,623,619,615,611,607,603,599,594,590,586,582,578,574,570}, +{1109,1104,1099,1094,1090,1085,1080,1075,1070,1065,1060,1055,1050,1045,1041,1036,1031,1026,1021,1017,1012,1007,1003,998,993,989,984,979,975,970,966,961,957,952,948,943,939,934,930,926,921,917,912,908,904,900,895,891,887,882,878,874,870,866,861,857,853,849,845,841,837,832,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,764,760,756,753,749,745,741,737,733,729,725,721,717,713,710,706,702,698,694,690,686,682,678,674,670,667,663,659,655,651,647,643,639,635,631,627,623,619,615,611,607,603,599,595,591,587,583,579,574,570}, +{1110,1105,1100,1095,1090,1085,1080,1075,1070,1065,1060,1055,1051,1046,1041,1036,1031,1027,1022,1017,1013,1008,1003,999,994,989,985,980,975,971,966,962,957,953,948,944,940,935,931,926,922,918,913,909,905,900,896,892,887,883,879,875,871,866,862,858,854,850,846,841,837,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,757,753,749,745,741,738,734,730,726,722,718,714,710,706,702,698,695,691,687,683,679,675,671,667,663,659,655,651,648,644,640,636,632,628,624,620,616,612,608,604,600,595,591,587,583,579,575,571}, +{1110,1105,1100,1095,1090,1085,1080,1075,1070,1065,1061,1056,1051,1046,1041,1037,1032,1027,1022,1018,1013,1008,1004,999,994,990,985,981,976,972,967,963,958,954,949,945,940,936,931,927,923,918,914,910,905,901,897,892,888,884,880,875,871,867,863,859,855,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,734,730,727,723,719,715,711,707,703,699,695,691,687,683,680,676,672,668,664,660,656,652,648,644,640,636,632,628,624,620,616,612,608,604,600,596,592,588,584,579,575,571}, +{1110,1105,1100,1095,1090,1085,1080,1075,1071,1066,1061,1056,1051,1047,1042,1037,1032,1028,1023,1018,1013,1009,1004,1000,995,990,986,981,977,972,968,963,959,954,950,945,941,936,932,928,923,919,915,910,906,902,897,893,889,885,880,876,872,868,864,859,855,851,847,843,839,835,831,827,823,818,814,810,806,802,798,794,790,786,782,778,774,770,767,763,759,755,751,747,743,739,735,731,727,723,719,715,712,708,704,700,696,692,688,684,680,676,672,668,664,661,657,653,649,645,641,637,633,629,625,621,617,613,609,605,600,596,592,588,584,580,576,571}, +{1110,1105,1100,1095,1090,1085,1080,1076,1071,1066,1061,1056,1052,1047,1042,1037,1033,1028,1023,1019,1014,1009,1005,1000,995,991,986,982,977,973,968,964,959,955,950,946,941,937,933,928,924,920,915,911,907,902,898,894,890,885,881,877,873,869,864,860,856,852,848,844,840,835,831,827,823,819,815,811,807,803,799,795,791,787,783,779,775,771,767,763,759,755,751,747,744,740,736,732,728,724,720,716,712,708,704,700,696,693,689,685,681,677,673,669,665,661,657,653,649,645,641,637,633,629,625,621,617,613,609,605,601,597,593,588,584,580,576,572}, +{1110,1105,1100,1095,1090,1085,1081,1076,1071,1066,1061,1057,1052,1047,1042,1038,1033,1028,1024,1019,1014,1010,1005,1000,996,991,987,982,978,973,969,964,960,955,951,946,942,938,933,929,925,920,916,912,907,903,899,894,890,886,882,878,873,869,865,861,857,853,848,844,840,836,832,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,764,760,756,752,748,744,740,736,732,728,725,721,717,713,709,705,701,697,693,689,685,681,677,673,670,666,662,658,654,650,646,642,638,634,630,626,622,618,614,609,605,601,597,593,589,585,581,576,572}, +{1110,1105,1100,1095,1090,1086,1081,1076,1071,1066,1062,1057,1052,1047,1043,1038,1033,1029,1024,1019,1015,1010,1005,1001,996,992,987,983,978,974,969,965,960,956,951,947,943,938,934,929,925,921,916,912,908,904,899,895,891,887,882,878,874,870,866,862,857,853,849,845,841,837,833,829,825,821,817,812,808,804,800,796,792,788,784,780,776,772,769,765,761,757,753,749,745,741,737,733,729,725,721,717,713,709,705,702,698,694,690,686,682,678,674,670,666,662,658,654,650,646,642,638,634,630,626,622,618,614,610,606,602,598,593,589,585,581,577,572}, +{1110,1105,1100,1095,1090,1086,1081,1076,1071,1067,1062,1057,1052,1048,1043,1038,1034,1029,1024,1020,1015,1010,1006,1001,997,992,988,983,979,974,970,965,961,956,952,948,943,939,934,930,926,921,917,913,908,904,900,896,891,887,883,879,875,870,866,862,858,854,850,846,842,837,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,757,753,749,745,741,738,734,730,726,722,718,714,710,706,702,698,694,690,686,682,678,675,671,667,663,659,655,651,647,643,639,635,631,627,622,618,614,610,606,602,598,594,590,585,581,577,573}, +{1110,1105,1100,1095,1090,1086,1081,1076,1071,1067,1062,1057,1053,1048,1043,1039,1034,1029,1025,1020,1015,1011,1006,1002,997,993,988,984,979,975,970,966,961,957,952,948,944,939,935,931,926,922,918,913,909,905,901,896,892,888,884,879,875,871,867,863,859,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,734,730,726,722,718,714,711,707,703,699,695,691,687,683,679,675,671,667,663,659,655,651,647,643,639,635,631,627,623,619,615,611,606,602,598,594,590,586,581,577,573}, +{1110,1105,1100,1095,1090,1086,1081,1076,1072,1067,1062,1057,1053,1048,1043,1039,1034,1029,1025,1020,1016,1011,1007,1002,997,993,988,984,979,975,971,966,962,957,953,948,944,940,935,931,927,922,918,914,910,905,901,897,893,888,884,880,876,872,867,863,859,855,851,847,843,839,835,831,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,751,747,743,739,735,731,727,723,719,715,711,707,703,699,695,691,687,683,679,675,671,668,664,660,656,652,648,644,639,635,631,627,623,619,615,611,607,603,599,594,590,586,582,577,573}, +{1109,1105,1100,1095,1090,1086,1081,1076,1072,1067,1062,1058,1053,1048,1044,1039,1034,1030,1025,1021,1016,1011,1007,1002,998,993,989,984,980,975,971,967,962,958,953,949,945,940,936,932,927,923,919,914,910,906,902,897,893,889,885,881,876,872,868,864,860,856,852,847,843,839,835,831,827,823,819,815,811,807,803,799,795,791,787,783,779,775,771,767,763,759,755,751,747,743,739,735,731,727,723,719,716,712,708,704,700,696,692,688,684,680,676,672,668,664,660,656,652,648,644,640,636,632,628,624,620,615,611,607,603,599,595,590,586,582,578,573}, +{1109,1105,1100,1095,1090,1086,1081,1076,1072,1067,1062,1058,1053,1048,1044,1039,1035,1030,1025,1021,1016,1012,1007,1003,998,994,989,985,980,976,971,967,962,958,954,949,945,941,936,932,928,923,919,915,911,906,902,898,894,889,885,881,877,873,869,864,860,856,852,848,844,840,836,832,828,824,819,815,811,807,803,799,795,791,787,783,779,775,771,767,763,760,756,752,748,744,740,736,732,728,724,720,716,712,708,704,700,696,692,688,684,680,676,672,668,664,660,656,652,648,644,640,636,632,628,624,620,616,612,607,603,599,595,591,586,582,578,574}, +{1109,1104,1100,1095,1090,1086,1081,1076,1072,1067,1062,1058,1053,1048,1044,1039,1035,1030,1026,1021,1016,1012,1007,1003,998,994,989,985,981,976,972,967,963,958,954,950,945,941,937,932,928,924,920,915,911,907,903,898,894,890,886,882,877,873,869,865,861,857,853,849,844,840,836,832,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,764,760,756,752,748,744,740,736,732,728,724,720,716,713,709,705,701,697,693,689,685,681,677,673,669,665,661,657,653,649,645,641,637,632,628,624,620,616,612,608,604,599,595,591,587,582,578,574}, +{1109,1104,1100,1095,1090,1086,1081,1076,1072,1067,1062,1058,1053,1049,1044,1039,1035,1030,1026,1021,1017,1012,1008,1003,999,994,990,985,981,976,972,968,963,959,954,950,946,941,937,933,929,924,920,916,911,907,903,899,895,890,886,882,878,874,870,865,861,857,853,849,845,841,837,833,829,825,821,816,812,808,804,800,796,792,788,784,780,776,772,768,764,761,757,753,749,745,741,737,733,729,725,721,717,713,709,705,701,697,693,689,685,681,677,673,669,665,661,657,653,649,645,641,637,633,629,625,620,616,612,608,604,600,595,591,587,583,578,574}, +{1109,1104,1099,1095,1090,1086,1081,1076,1072,1067,1062,1058,1053,1049,1044,1039,1035,1030,1026,1021,1017,1012,1008,1003,999,994,990,986,981,977,972,968,964,959,955,950,946,942,938,933,929,925,920,916,912,908,903,899,895,891,887,883,878,874,870,866,862,858,854,849,845,841,837,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,757,753,749,745,741,737,733,729,725,721,717,713,709,705,701,698,694,690,686,682,678,674,670,666,661,657,653,649,645,641,637,633,629,625,621,617,612,608,604,600,596,591,587,583,578,574}, +{1109,1104,1099,1095,1090,1085,1081,1076,1072,1067,1062,1058,1053,1049,1044,1040,1035,1030,1026,1021,1017,1012,1008,1004,999,995,990,986,981,977,973,968,964,959,955,951,946,942,938,934,929,925,921,917,912,908,904,900,895,891,887,883,879,875,870,866,862,858,854,850,846,842,838,834,830,826,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,757,753,750,746,742,738,734,730,726,722,718,714,710,706,702,698,694,690,686,682,678,674,670,666,662,658,654,650,646,642,637,633,629,625,621,617,613,608,604,600,596,591,587,583,579,574}, +{1108,1104,1099,1094,1090,1085,1081,1076,1071,1067,1062,1058,1053,1049,1044,1040,1035,1031,1026,1022,1017,1013,1008,1004,999,995,990,986,982,977,973,968,964,960,955,951,947,942,938,934,930,925,921,917,913,908,904,900,896,892,888,883,879,875,871,867,863,859,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,734,730,726,722,718,714,710,706,702,698,694,690,686,682,678,674,670,666,662,658,654,650,646,642,638,634,629,625,621,617,613,609,604,600,596,592,587,583,579,574}, +{1108,1103,1099,1094,1090,1085,1081,1076,1071,1067,1062,1058,1053,1049,1044,1040,1035,1031,1026,1022,1017,1013,1008,1004,999,995,991,986,982,977,973,969,964,960,956,951,947,943,939,934,930,926,921,917,913,909,905,900,896,892,888,884,880,875,871,867,863,859,855,851,847,843,839,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,734,730,726,723,719,715,711,707,703,699,695,691,687,683,679,675,671,666,662,658,654,650,646,642,638,634,630,626,621,617,613,609,605,600,596,592,587,583,579,574}, +{1108,1103,1099,1094,1089,1085,1080,1076,1071,1067,1062,1058,1053,1049,1044,1040,1035,1031,1026,1022,1017,1013,1008,1004,1000,995,991,986,982,978,973,969,965,960,956,952,947,943,939,935,930,926,922,918,913,909,905,901,897,892,888,884,880,876,872,868,863,859,855,851,847,843,839,835,831,827,823,819,815,811,807,803,799,795,791,787,783,779,775,771,767,763,759,755,751,747,743,739,735,731,727,723,719,715,711,707,703,699,695,691,687,683,679,675,671,667,663,659,655,650,646,642,638,634,630,626,622,617,613,609,605,600,596,592,588,583,579,574}, +{1107,1103,1098,1094,1089,1085,1080,1076,1071,1067,1062,1058,1053,1049,1044,1040,1035,1031,1026,1022,1017,1013,1008,1004,1000,995,991,987,982,978,973,969,965,960,956,952,948,943,939,935,931,926,922,918,914,909,905,901,897,893,889,884,880,876,872,868,864,860,856,852,847,843,839,835,831,827,823,819,815,811,807,803,799,795,791,787,783,779,775,771,767,763,759,755,751,747,743,739,735,731,727,723,719,715,711,707,703,699,695,691,687,683,679,675,671,667,663,659,655,651,647,642,638,634,630,626,622,618,613,609,605,601,596,592,588,583,579,574}, +{1107,1103,1098,1094,1089,1084,1080,1075,1071,1066,1062,1057,1053,1048,1044,1040,1035,1031,1026,1022,1017,1013,1009,1004,1000,995,991,987,982,978,974,969,965,961,956,952,948,944,939,935,931,927,922,918,914,910,906,901,897,893,889,885,881,876,872,868,864,860,856,852,848,844,840,836,832,828,823,819,815,811,807,803,799,795,791,787,783,779,775,771,767,763,759,755,751,747,743,739,735,732,728,724,720,716,712,708,704,700,696,691,687,683,679,675,671,667,663,659,655,651,647,643,639,634,630,626,622,618,613,609,605,601,596,592,588,583,579,574}, +{1107,1102,1098,1093,1089,1084,1080,1075,1071,1066,1062,1057,1053,1048,1044,1039,1035,1031,1026,1022,1017,1013,1009,1004,1000,995,991,987,982,978,974,969,965,961,957,952,948,944,939,935,931,927,923,918,914,910,906,902,897,893,889,885,881,877,873,869,864,860,856,852,848,844,840,836,832,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,764,760,756,752,748,744,740,736,732,728,724,720,716,712,708,704,700,696,692,688,684,680,676,672,667,663,659,655,651,647,643,639,635,630,626,622,618,614,609,605,601,596,592,588,583,579,574}, +{1106,1102,1097,1093,1088,1084,1079,1075,1071,1066,1062,1057,1053,1048,1044,1039,1035,1031,1026,1022,1017,1013,1009,1004,1000,995,991,987,982,978,974,970,965,961,957,952,948,944,940,935,931,927,923,919,914,910,906,902,898,894,889,885,881,877,873,869,865,861,857,853,848,844,840,836,832,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,764,760,756,752,748,744,740,736,732,728,724,720,716,712,708,704,700,696,692,688,684,680,676,672,668,664,659,655,651,647,643,639,635,630,626,622,618,614,609,605,601,596,592,588,583,579,574}, +{1106,1102,1097,1093,1088,1084,1079,1075,1070,1066,1061,1057,1053,1048,1044,1039,1035,1030,1026,1022,1017,1013,1009,1004,1000,996,991,987,983,978,974,970,965,961,957,953,948,944,940,936,931,927,923,919,915,910,906,902,898,894,890,886,881,877,873,869,865,861,857,853,849,845,841,837,833,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,764,760,756,752,748,744,740,736,732,728,724,720,716,712,708,704,700,696,692,688,684,680,676,672,668,664,660,656,651,647,643,639,635,631,626,622,618,614,609,605,601,596,592,588,583,579,574}, +{1106,1101,1097,1092,1088,1083,1079,1074,1070,1066,1061,1057,1052,1048,1044,1039,1035,1030,1026,1022,1017,1013,1009,1004,1000,996,991,987,983,978,974,970,965,961,957,953,948,944,940,936,932,927,923,919,915,911,906,902,898,894,890,886,882,878,873,869,865,861,857,853,849,845,841,837,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,757,753,749,745,741,737,733,729,725,721,717,713,709,705,700,696,692,688,684,680,676,672,668,664,660,656,652,647,643,639,635,631,626,622,618,614,609,605,601,596,592,588,583,579,574}, +{1105,1101,1096,1092,1087,1083,1079,1074,1070,1065,1061,1057,1052,1048,1043,1039,1035,1030,1026,1022,1017,1013,1008,1004,1000,996,991,987,983,978,974,970,966,961,957,953,949,944,940,936,932,928,923,919,915,911,907,903,898,894,890,886,882,878,874,870,866,861,857,853,849,845,841,837,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,757,753,749,745,741,737,733,729,725,721,717,713,709,705,701,697,693,689,684,680,676,672,668,664,660,656,652,647,643,639,635,631,626,622,618,614,609,605,601,596,592,588,583,579,574}, +{1105,1100,1096,1092,1087,1083,1078,1074,1069,1065,1061,1056,1052,1048,1043,1039,1034,1030,1026,1021,1017,1013,1008,1004,1000,995,991,987,983,978,974,970,966,961,957,953,949,944,940,936,932,928,923,919,915,911,907,903,899,894,890,886,882,878,874,870,866,862,858,854,849,845,841,837,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,757,753,749,745,741,737,733,729,725,721,717,713,709,705,701,697,693,689,685,681,676,672,668,664,660,656,652,648,643,639,635,631,627,622,618,614,609,605,601,596,592,587,583,578,574}, +{1104,1100,1096,1091,1087,1082,1078,1074,1069,1065,1060,1056,1052,1047,1043,1039,1034,1030,1026,1021,1017,1013,1008,1004,1000,995,991,987,983,978,974,970,966,961,957,953,949,944,940,936,932,928,924,919,915,911,907,903,899,895,890,886,882,878,874,870,866,862,858,854,850,846,842,838,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,757,753,749,745,741,737,733,729,725,721,717,713,709,705,701,697,693,689,685,681,677,672,668,664,660,656,652,648,643,639,635,631,627,622,618,614,609,605,601,596,592,587,583,578,574}, +{1104,1099,1095,1091,1086,1082,1078,1073,1069,1064,1060,1056,1051,1047,1043,1038,1034,1030,1025,1021,1017,1013,1008,1004,1000,995,991,987,983,978,974,970,966,961,957,953,949,945,940,936,932,928,924,920,915,911,907,903,899,895,891,887,882,878,874,870,866,862,858,854,850,846,842,838,834,830,826,822,818,814,810,805,801,797,793,789,785,781,777,773,769,765,761,757,753,749,745,741,737,733,729,725,721,717,713,709,705,701,697,693,689,685,681,677,673,668,664,660,656,652,648,643,639,635,631,626,622,618,614,609,605,601,596,592,587,583,578,574}, +{1103,1099,1095,1090,1086,1082,1077,1073,1068,1064,1060,1055,1051,1047,1042,1038,1034,1030,1025,1021,1017,1012,1008,1004,1000,995,991,987,983,978,974,970,966,961,957,953,949,945,940,936,932,928,924,920,915,911,907,903,899,895,891,887,883,878,874,870,866,862,858,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,734,729,725,721,717,713,709,705,701,697,693,689,685,681,677,673,668,664,660,656,652,648,643,639,635,631,626,622,618,614,609,605,600,596,592,587,583,578,573}, +{1103,1098,1094,1090,1085,1081,1077,1072,1068,1064,1059,1055,1051,1047,1042,1038,1034,1029,1025,1021,1016,1012,1008,1004,999,995,991,987,982,978,974,970,966,961,957,953,949,945,940,936,932,928,924,920,916,911,907,903,899,895,891,887,883,879,874,870,866,862,858,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,734,730,726,722,718,713,709,705,701,697,693,689,685,681,677,673,668,664,660,656,652,648,643,639,635,631,626,622,618,613,609,605,600,596,591,587,582,578,573}, +{1102,1098,1094,1089,1085,1081,1076,1072,1068,1063,1059,1055,1051,1046,1042,1038,1033,1029,1025,1021,1016,1012,1008,1003,999,995,991,987,982,978,974,970,965,961,957,953,949,945,940,936,932,928,924,920,916,911,907,903,899,895,891,887,883,879,875,871,866,862,858,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,734,730,726,722,718,714,709,705,701,697,693,689,685,681,677,673,668,664,660,656,652,648,643,639,635,631,626,622,618,613,609,605,600,596,591,587,582,578,573}, +{1102,1097,1093,1089,1085,1080,1076,1072,1067,1063,1059,1054,1050,1046,1042,1037,1033,1029,1025,1020,1016,1012,1008,1003,999,995,991,986,982,978,974,970,965,961,957,953,949,945,940,936,932,928,924,920,916,911,907,903,899,895,891,887,883,879,875,871,867,862,858,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,734,730,726,722,718,714,710,705,701,697,693,689,685,681,677,673,668,664,660,656,652,648,643,639,635,631,626,622,618,613,609,604,600,595,591,586,582,577,573}, +{1101,1097,1093,1088,1084,1080,1075,1071,1067,1063,1058,1054,1050,1046,1041,1037,1033,1029,1024,1020,1016,1012,1007,1003,999,995,990,986,982,978,974,969,965,961,957,953,949,944,940,936,932,928,924,920,916,911,907,903,899,895,891,887,883,879,875,871,867,863,858,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,734,730,726,722,718,714,710,705,701,697,693,689,685,681,677,673,668,664,660,656,652,647,643,639,635,630,626,622,617,613,609,604,600,595,591,586,582,577,572}, +{1101,1096,1092,1088,1083,1079,1075,1071,1066,1062,1058,1054,1049,1045,1041,1037,1032,1028,1024,1020,1016,1011,1007,1003,999,994,990,986,982,978,974,969,965,961,957,953,949,944,940,936,932,928,924,920,916,911,907,903,899,895,891,887,883,879,875,871,867,863,859,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,734,730,726,722,718,714,710,706,701,697,693,689,685,681,677,673,668,664,660,656,652,647,643,639,635,630,626,622,617,613,608,604,599,595,590,586,581,577,572}, +{1100,1096,1091,1087,1083,1079,1074,1070,1066,1062,1057,1053,1049,1045,1041,1036,1032,1028,1024,1019,1015,1011,1007,1003,998,994,990,986,982,978,973,969,965,961,957,953,948,944,940,936,932,928,924,920,915,911,907,903,899,895,891,887,883,879,875,871,867,863,859,855,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,734,730,726,722,718,714,710,705,701,697,693,689,685,681,677,673,668,664,660,656,651,647,643,639,634,630,626,621,617,613,608,604,599,595,590,586,581,576,572}, +{1099,1095,1091,1087,1082,1078,1074,1070,1065,1061,1057,1053,1049,1044,1040,1036,1032,1028,1023,1019,1015,1011,1007,1002,998,994,990,986,981,977,973,969,965,961,957,952,948,944,940,936,932,928,924,920,915,911,907,903,899,895,891,887,883,879,875,871,867,863,859,855,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,734,730,726,722,718,714,710,705,701,697,693,689,685,681,677,672,668,664,660,656,651,647,643,639,634,630,626,621,617,612,608,603,599,594,590,585,581,576,571}, +{1099,1094,1090,1086,1082,1078,1073,1069,1065,1061,1057,1052,1048,1044,1040,1036,1031,1027,1023,1019,1015,1010,1006,1002,998,994,990,985,981,977,973,969,965,961,956,952,948,944,940,936,932,928,924,919,915,911,907,903,899,895,891,887,883,879,875,871,867,863,859,855,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,734,730,726,722,718,714,709,705,701,697,693,689,685,681,676,672,668,664,660,655,651,647,643,638,634,630,625,621,617,612,608,603,599,594,589,585,580,576,571}, +{1098,1094,1090,1085,1081,1077,1073,1069,1064,1060,1056,1052,1048,1044,1039,1035,1031,1027,1023,1018,1014,1010,1006,1002,998,993,989,985,981,977,973,969,964,960,956,952,948,944,940,936,932,927,923,919,915,911,907,903,899,895,891,887,883,879,875,871,867,863,859,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,734,730,726,722,718,714,709,705,701,697,693,689,685,681,676,672,668,664,660,655,651,647,642,638,634,629,625,621,616,612,607,603,598,594,589,584,580,575,570}, +{1097,1093,1089,1085,1081,1076,1072,1068,1064,1060,1056,1051,1047,1043,1039,1035,1031,1026,1022,1018,1014,1010,1006,1001,997,993,989,985,981,977,972,968,964,960,956,952,948,944,940,936,931,927,923,919,915,911,907,903,899,895,891,887,883,879,875,871,867,862,858,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,734,730,726,722,718,713,709,705,701,697,693,689,685,680,676,672,668,664,659,655,651,647,642,638,634,629,625,620,616,611,607,602,598,593,589,584,579,575,570}, +{1097,1092,1088,1084,1080,1076,1072,1068,1063,1059,1055,1051,1047,1043,1038,1034,1030,1026,1022,1018,1013,1009,1005,1001,997,993,989,985,980,976,972,968,964,960,956,952,948,943,939,935,931,927,923,919,915,911,907,903,899,895,891,887,883,879,874,870,866,862,858,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,734,730,726,721,717,713,709,705,701,697,693,689,684,680,676,672,668,663,659,655,651,646,642,638,633,629,625,620,616,611,607,602,598,593,588,584,579,574,569}, +{1096,1092,1088,1083,1079,1075,1071,1067,1063,1059,1054,1050,1046,1042,1038,1034,1030,1025,1021,1017,1013,1009,1005,1001,997,992,988,984,980,976,972,968,964,960,956,951,947,943,939,935,931,927,923,919,915,911,907,903,899,895,891,886,882,878,874,870,866,862,858,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,734,730,725,721,717,713,709,705,701,697,693,688,684,680,676,672,667,663,659,655,650,646,642,637,633,629,624,620,615,611,606,602,597,593,588,583,578,574,569}, +{1095,1091,1087,1083,1079,1075,1070,1066,1062,1058,1054,1050,1046,1042,1037,1033,1029,1025,1021,1017,1013,1009,1004,1000,996,992,988,984,980,976,972,968,963,959,955,951,947,943,939,935,931,927,923,919,915,911,907,902,898,894,890,886,882,878,874,870,866,862,858,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,742,738,733,729,725,721,717,713,709,705,701,697,692,688,684,680,676,671,667,663,659,654,650,646,641,637,633,628,624,619,615,610,606,601,597,592,587,583,578,573,568}, +{1094,1090,1086,1082,1078,1074,1070,1066,1062,1057,1053,1049,1045,1041,1037,1033,1029,1025,1020,1016,1012,1008,1004,1000,996,992,988,984,979,975,971,967,963,959,955,951,947,943,939,935,931,927,922,918,914,910,906,902,898,894,890,886,882,878,874,870,866,862,858,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,746,741,737,733,729,725,721,717,713,709,705,700,696,692,688,684,680,675,671,667,663,658,654,650,645,641,637,632,628,623,619,615,610,605,601,596,592,587,582,577,573,568}, +{1094,1090,1085,1081,1077,1073,1069,1065,1061,1057,1053,1049,1045,1040,1036,1032,1028,1024,1020,1016,1012,1008,1004,999,995,991,987,983,979,975,971,967,963,959,955,951,947,942,938,934,930,926,922,918,914,910,906,902,898,894,890,886,882,878,874,870,866,862,858,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,753,749,745,741,737,733,729,725,721,717,713,709,704,700,696,692,688,684,679,675,671,667,662,658,654,649,645,641,636,632,628,623,619,614,610,605,600,596,591,586,582,577,572,567}, +{1093,1089,1085,1081,1077,1073,1068,1064,1060,1056,1052,1048,1044,1040,1036,1032,1028,1024,1019,1015,1011,1007,1003,999,995,991,987,983,979,975,971,967,962,958,954,950,946,942,938,934,930,926,922,918,914,910,906,902,898,894,890,886,882,878,874,870,866,862,858,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,773,769,765,761,757,753,749,745,741,737,733,729,725,721,717,712,708,704,700,696,692,688,683,679,675,671,666,662,658,653,649,645,640,636,632,627,623,618,614,609,604,600,595,590,586,581,576,571,566}, +{1092,1088,1084,1080,1076,1072,1068,1064,1060,1056,1051,1047,1043,1039,1035,1031,1027,1023,1019,1015,1011,1007,1003,999,995,990,986,982,978,974,970,966,962,958,954,950,946,942,938,934,930,926,922,918,914,910,906,902,898,894,890,886,882,878,873,869,865,861,857,853,849,845,841,837,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,757,753,749,745,741,737,733,729,725,720,716,712,708,704,700,696,691,687,683,679,675,670,666,662,657,653,649,644,640,636,631,627,622,618,613,609,604,599,595,590,585,580,576,571,566}, +{1091,1087,1083,1079,1075,1071,1067,1063,1059,1055,1051,1047,1043,1039,1035,1031,1026,1022,1018,1014,1010,1006,1002,998,994,990,986,982,978,974,970,966,962,958,954,950,946,942,937,933,929,925,921,917,913,909,905,901,897,893,889,885,881,877,873,869,865,861,857,853,849,845,841,837,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,757,753,749,745,741,737,733,728,724,720,716,712,708,704,699,695,691,687,683,678,674,670,666,661,657,653,648,644,640,635,631,626,622,617,613,608,603,599,594,589,585,580,575,570,565}, +{1090,1086,1082,1078,1074,1070,1066,1062,1058,1054,1050,1046,1042,1038,1034,1030,1026,1022,1018,1014,1010,1006,1002,998,994,990,985,981,977,973,969,965,961,957,953,949,945,941,937,933,929,925,921,917,913,909,905,901,897,893,889,885,881,877,873,869,865,861,857,853,849,845,841,837,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,757,753,749,745,740,736,732,728,724,720,716,712,708,703,699,695,691,687,682,678,674,670,665,661,657,652,648,644,639,635,630,626,621,617,612,607,603,598,593,589,584,579,574,569,564}, +{1090,1086,1082,1078,1074,1070,1066,1062,1057,1053,1049,1045,1041,1037,1033,1029,1025,1021,1017,1013,1009,1005,1001,997,993,989,985,981,977,973,969,965,961,957,953,949,945,941,937,933,929,925,921,917,913,909,905,901,897,893,889,885,881,877,873,869,865,861,857,853,849,845,841,837,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,756,752,748,744,740,736,732,728,724,720,716,711,707,703,699,695,690,686,682,678,674,669,665,661,656,652,648,643,639,634,630,625,621,616,612,607,602,598,593,588,583,578,573,568,563}, +{1089,1085,1081,1077,1073,1069,1065,1061,1057,1053,1049,1045,1041,1037,1033,1029,1025,1021,1017,1013,1009,1005,1001,997,993,989,984,980,976,972,968,964,960,956,952,948,944,940,936,932,928,924,920,916,912,908,904,900,896,892,888,884,880,876,872,868,864,860,856,852,848,845,841,837,833,829,825,821,817,813,809,805,801,797,793,788,784,780,776,772,768,764,760,756,752,748,744,740,736,732,728,723,719,715,711,707,703,699,694,690,686,682,677,673,669,665,660,656,651,647,643,638,634,629,625,620,616,611,606,602,597,592,587,582,578,573,568,563}, +{1088,1084,1080,1076,1072,1068,1064,1060,1056,1052,1048,1044,1040,1036,1032,1028,1024,1020,1016,1012,1008,1004,1000,996,992,988,984,980,976,972,968,964,960,956,952,948,944,940,936,932,928,924,920,916,912,908,904,900,896,892,888,884,880,876,872,868,864,860,856,852,848,844,840,836,832,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,764,760,756,752,748,744,740,735,731,727,723,719,715,711,707,702,698,694,690,685,681,677,673,668,664,660,655,651,647,642,638,633,629,624,620,615,610,606,601,596,591,587,582,577,572,567,562}, +{1087,1083,1079,1075,1071,1067,1063,1059,1055,1051,1047,1043,1039,1035,1031,1027,1023,1019,1015,1011,1007,1003,999,995,991,987,983,979,975,971,967,963,959,955,951,947,944,940,936,932,928,924,920,916,912,908,904,900,896,892,888,884,880,876,872,868,864,860,856,852,848,844,840,836,832,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,764,760,756,751,747,743,739,735,731,727,723,719,714,710,706,702,698,694,689,685,681,677,672,668,664,659,655,650,646,642,637,633,628,624,619,614,610,605,600,595,591,586,581,576,571,566,561}, +{1086,1082,1078,1074,1070,1066,1062,1058,1054,1050,1047,1043,1039,1035,1031,1027,1023,1019,1015,1011,1007,1003,999,995,991,987,983,979,975,971,967,963,959,955,951,947,943,939,935,931,927,923,919,915,911,907,903,899,895,891,887,883,879,875,871,867,863,859,856,852,848,844,840,836,832,828,824,820,816,812,808,804,800,796,792,788,784,780,775,771,767,763,759,755,751,747,743,739,735,731,727,722,718,714,710,706,702,697,693,689,685,680,676,672,667,663,659,654,650,645,641,637,632,627,623,618,614,609,604,600,595,590,585,580,575,570,565,560}, +{1085,1081,1077,1073,1069,1065,1062,1058,1054,1050,1046,1042,1038,1034,1030,1026,1022,1018,1014,1010,1006,1002,998,994,990,986,982,978,974,970,966,962,958,954,951,947,943,939,935,931,927,923,919,915,911,907,903,899,895,891,887,883,879,875,871,867,863,859,855,851,847,843,839,835,831,827,823,819,815,811,807,803,799,795,791,787,783,779,775,771,767,763,759,755,751,747,743,739,734,730,726,722,718,714,710,705,701,697,693,688,684,680,676,671,667,663,658,654,649,645,640,636,631,627,622,618,613,608,604,599,594,589,584,579,574,569,564,559}, +{1084,1080,1076,1072,1069,1065,1061,1057,1053,1049,1045,1041,1037,1033,1029,1025,1021,1017,1013,1009,1005,1001,998,994,990,986,982,978,974,970,966,962,958,954,950,946,942,938,934,930,926,922,918,914,910,906,902,898,894,890,887,883,879,875,871,867,863,859,855,851,847,843,839,835,831,827,823,819,815,811,807,803,799,795,791,787,783,779,775,771,767,763,759,754,750,746,742,738,734,730,726,722,717,713,709,705,701,696,692,688,684,679,675,671,666,662,658,653,649,644,640,635,631,626,622,617,612,608,603,598,593,588,583,578,573,568,563,558}, +{1083,1079,1075,1072,1068,1064,1060,1056,1052,1048,1044,1040,1036,1032,1028,1024,1021,1017,1013,1009,1005,1001,997,993,989,985,981,977,973,969,965,961,957,953,949,945,942,938,934,930,926,922,918,914,910,906,902,898,894,890,886,882,878,874,870,866,862,858,854,850,846,842,838,834,831,827,823,819,815,811,807,803,799,795,791,786,782,778,774,770,766,762,758,754,750,746,742,738,734,729,725,721,717,713,709,704,700,696,692,687,683,679,675,670,666,661,657,653,648,644,639,635,630,625,621,616,612,607,602,597,592,587,582,577,572,567,562,557}, +{1082,1078,1074,1071,1067,1063,1059,1055,1051,1047,1043,1039,1035,1032,1028,1024,1020,1016,1012,1008,1004,1000,996,992,988,984,980,976,973,969,965,961,957,953,949,945,941,937,933,929,925,921,917,913,909,905,901,898,894,890,886,882,878,874,870,866,862,858,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,750,745,741,737,733,729,725,721,716,712,708,704,700,695,691,687,683,678,674,670,665,661,656,652,648,643,639,634,629,625,620,615,611,606,601,596,591,586,581,576,571,566,561,556}, +{1081,1077,1074,1070,1066,1062,1058,1054,1050,1046,1042,1039,1035,1031,1027,1023,1019,1015,1011,1007,1003,999,996,992,988,984,980,976,972,968,964,960,956,952,948,944,940,936,933,929,925,921,917,913,909,905,901,897,893,889,885,881,877,873,869,865,861,857,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,769,765,761,757,753,749,745,741,737,733,728,724,720,716,712,708,703,699,695,691,686,682,678,673,669,665,660,656,651,647,642,638,633,629,624,619,615,610,605,600,595,590,585,580,575,570,565,560,554}, +{1080,1076,1073,1069,1065,1061,1057,1053,1049,1045,1042,1038,1034,1030,1026,1022,1018,1014,1010,1007,1003,999,995,991,987,983,979,975,971,967,963,959,956,952,948,944,940,936,932,928,924,920,916,912,908,904,900,897,893,889,885,881,877,873,869,865,861,857,853,849,845,841,837,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,757,753,749,745,740,736,732,728,724,720,715,711,707,703,699,694,690,686,681,677,673,668,664,660,655,651,646,642,637,632,628,623,619,614,609,604,599,594,590,585,579,574,569,564,559,553}, +{1079,1075,1072,1068,1064,1060,1056,1052,1048,1045,1041,1037,1033,1029,1025,1021,1017,1014,1010,1006,1002,998,994,990,986,982,978,975,971,967,963,959,955,951,947,943,939,935,931,927,924,920,916,912,908,904,900,896,892,888,884,880,876,872,868,864,860,857,853,849,845,841,837,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,764,760,756,752,748,744,740,736,732,727,723,719,715,711,707,702,698,694,689,685,681,676,672,668,663,659,654,650,645,641,636,632,627,622,618,613,608,603,598,594,589,583,578,573,568,563,557,552}, +{1078,1074,1071,1067,1063,1059,1055,1051,1048,1044,1040,1036,1032,1028,1024,1021,1017,1013,1009,1005,1001,997,993,989,986,982,978,974,970,966,962,958,954,950,946,943,939,935,931,927,923,919,915,911,907,903,899,895,892,888,884,880,876,872,868,864,860,856,852,848,844,840,836,832,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,764,760,756,752,748,743,739,735,731,727,723,719,714,710,706,702,697,693,689,685,680,676,671,667,663,658,654,649,645,640,636,631,626,622,617,612,607,602,597,592,587,582,577,572,567,561,556,551}, +{1077,1073,1070,1066,1062,1058,1054,1050,1047,1043,1039,1035,1031,1027,1024,1020,1016,1012,1008,1004,1000,996,993,989,985,981,977,973,969,965,961,958,954,950,946,942,938,934,930,926,922,918,914,911,907,903,899,895,891,887,883,879,875,871,867,863,859,855,852,848,844,840,836,832,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,767,763,759,755,751,747,743,739,735,731,726,722,718,714,710,705,701,697,692,688,684,680,675,671,666,662,657,653,648,644,639,635,630,625,621,616,611,606,601,596,591,586,581,576,571,566,560,555,549}, +{1076,1072,1068,1065,1061,1057,1053,1049,1046,1042,1038,1034,1030,1026,1023,1019,1015,1011,1007,1003,999,996,992,988,984,980,976,972,968,965,961,957,953,949,945,941,937,933,930,926,922,918,914,910,906,902,898,894,890,886,883,879,875,871,867,863,859,855,851,847,843,839,835,831,827,823,819,815,811,807,803,799,795,791,787,783,779,775,771,767,763,759,755,751,746,742,738,734,730,726,722,717,713,709,705,700,696,692,688,683,679,674,670,666,661,657,652,648,643,638,634,629,624,620,615,610,605,600,595,590,585,580,575,570,564,559,553,548}, +{1075,1071,1067,1064,1060,1056,1052,1048,1045,1041,1037,1033,1029,1026,1022,1018,1014,1010,1006,1003,999,995,991,987,983,979,975,972,968,964,960,956,952,948,944,941,937,933,929,925,921,917,913,909,905,902,898,894,890,886,882,878,874,870,866,862,858,854,850,846,843,839,835,831,827,823,819,815,811,807,803,799,795,791,787,783,779,775,770,766,762,758,754,750,746,742,738,733,729,725,721,717,712,708,704,700,695,691,687,682,678,674,669,665,660,656,651,647,642,638,633,628,624,619,614,609,604,599,594,589,584,579,574,568,563,557,552,546}, +{1074,1070,1066,1063,1059,1055,1051,1047,1044,1040,1036,1032,1028,1025,1021,1017,1013,1009,1006,1002,998,994,990,986,982,979,975,971,967,963,959,955,951,948,944,940,936,932,928,924,920,916,913,909,905,901,897,893,889,885,881,877,873,870,866,862,858,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,754,749,745,741,737,733,729,724,720,716,712,708,703,699,695,690,686,682,677,673,669,664,660,655,651,646,641,637,632,627,623,618,613,608,603,598,593,588,583,578,572,567,562,556,550,545}, +{1073,1069,1065,1062,1058,1054,1050,1046,1043,1039,1035,1031,1028,1024,1020,1016,1012,1008,1005,1001,997,993,989,985,982,978,974,970,966,962,958,955,951,947,943,939,935,931,927,924,920,916,912,908,904,900,896,892,888,885,881,877,873,869,865,861,857,853,849,845,841,837,833,829,825,821,818,814,810,806,802,798,794,789,785,781,777,773,769,765,761,757,753,749,745,740,736,732,728,724,720,715,711,707,703,698,694,690,685,681,677,672,668,663,659,654,650,645,640,636,631,626,622,617,612,607,602,597,592,587,582,576,571,566,560,555,549,543}, +{1072,1068,1064,1060,1057,1053,1049,1045,1042,1038,1034,1030,1027,1023,1019,1015,1011,1008,1004,1000,996,992,988,985,981,977,973,969,965,962,958,954,950,946,942,938,934,931,927,923,919,915,911,907,903,900,896,892,888,884,880,876,872,868,864,860,856,853,849,845,841,837,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,760,756,752,748,744,740,736,731,727,723,719,715,710,706,702,698,693,689,685,680,676,671,667,662,658,653,649,644,639,635,630,625,621,616,611,606,601,596,591,586,580,575,570,564,559,553,547,541}, +{1071,1067,1063,1059,1056,1052,1048,1044,1041,1037,1033,1029,1026,1022,1018,1014,1010,1007,1003,999,995,991,988,984,980,976,972,968,965,961,957,953,949,945,941,938,934,930,926,922,918,914,911,907,903,899,895,891,887,883,879,875,872,868,864,860,856,852,848,844,840,836,832,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,764,760,756,752,747,743,739,735,731,727,722,718,714,710,705,701,697,692,688,684,679,675,670,666,661,657,652,648,643,639,634,629,624,619,615,610,605,600,595,589,584,579,574,568,563,557,551,546,540}, +{1069,1066,1062,1058,1055,1051,1047,1043,1040,1036,1032,1028,1025,1021,1017,1013,1009,1006,1002,998,994,990,987,983,979,975,971,968,964,960,956,952,948,945,941,937,933,929,925,921,918,914,910,906,902,898,894,890,886,883,879,875,871,867,863,859,855,851,847,843,839,835,831,828,824,820,816,812,808,804,800,796,792,788,783,779,775,771,767,763,759,755,751,747,743,738,734,730,726,722,717,713,709,705,700,696,692,687,683,678,674,670,665,661,656,651,647,642,637,633,628,623,618,613,609,604,598,593,588,583,578,572,567,561,555,550,544,538}, +{1068,1065,1061,1057,1053,1050,1046,1042,1039,1035,1031,1027,1024,1020,1016,1012,1008,1005,1001,997,993,990,986,982,978,974,971,967,963,959,955,951,948,944,940,936,932,928,924,921,917,913,909,905,901,897,893,890,886,882,878,874,870,866,862,858,854,851,847,843,839,835,831,827,823,819,815,811,807,803,799,795,791,787,783,779,775,771,767,762,758,754,750,746,742,738,733,729,725,721,717,712,708,704,699,695,691,686,682,678,673,669,664,660,655,650,646,641,636,632,627,622,617,612,607,602,597,592,587,582,576,571,565,560,554,548,542,536}, +{1067,1063,1060,1056,1052,1049,1045,1041,1037,1034,1030,1026,1023,1019,1015,1011,1008,1004,1000,996,992,989,985,981,977,973,970,966,962,958,954,951,947,943,939,935,931,928,924,920,916,912,908,904,901,897,893,889,885,881,877,873,869,865,862,858,854,850,846,842,838,834,830,826,822,818,814,810,806,802,798,794,790,786,782,778,774,770,766,762,758,753,749,745,741,737,733,729,724,720,716,712,707,703,699,694,690,686,681,677,672,668,663,659,654,649,645,640,635,631,626,621,616,611,606,601,596,591,585,580,575,569,564,558,552,546,540,534}, +{1066,1062,1058,1055,1051,1047,1044,1040,1036,1033,1029,1025,1021,1018,1014,1010,1006,1003,999,995,991,988,984,980,976,973,969,965,961,957,953,950,946,942,938,934,931,927,923,919,915,911,907,904,900,896,892,888,884,880,876,873,869,865,861,857,853,849,845,841,837,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,773,769,765,761,757,753,749,744,740,736,732,728,723,719,715,711,706,702,698,693,689,685,680,676,671,667,662,658,653,648,644,639,634,629,625,620,615,610,605,600,594,589,584,579,573,568,562,556,550,544,538,532}, +{1065,1061,1057,1054,1050,1046,1043,1039,1035,1032,1028,1024,1020,1017,1013,1009,1005,1002,998,994,990,987,983,979,975,972,968,964,960,956,953,949,945,941,937,934,930,926,922,918,914,910,907,903,899,895,891,887,883,880,876,872,868,864,860,856,852,848,844,840,837,833,829,825,821,817,813,809,805,801,797,793,789,785,781,777,772,768,764,760,756,752,748,744,739,735,731,727,723,718,714,710,706,701,697,692,688,684,679,675,670,666,661,657,652,647,643,638,633,628,623,618,613,608,603,598,593,588,582,577,571,566,560,554,548,542,536,530}, +{1063,1060,1056,1052,1049,1045,1041,1038,1034,1030,1027,1023,1019,1016,1012,1008,1004,1001,997,993,989,986,982,978,974,971,967,963,959,955,952,948,944,940,936,933,929,925,921,917,913,910,906,902,898,894,890,886,883,879,875,871,867,863,859,855,851,848,844,840,836,832,828,824,820,816,812,808,804,800,796,792,788,784,780,776,772,768,763,759,755,751,747,743,739,734,730,726,722,717,713,709,705,700,696,692,687,683,678,674,669,665,660,655,651,646,641,637,632,627,622,617,612,607,602,597,592,586,581,575,570,564,558,552,546,540,534,527}, +{1062,1058,1055,1051,1048,1044,1040,1037,1033,1029,1026,1022,1018,1015,1011,1007,1003,1000,996,992,988,985,981,977,973,970,966,962,958,955,951,947,943,939,936,932,928,924,920,916,913,909,905,901,897,893,890,886,882,878,874,870,866,862,858,855,851,847,843,839,835,831,827,823,819,815,811,807,803,799,795,791,787,783,779,775,771,767,763,759,754,750,746,742,738,734,729,725,721,717,712,708,704,699,695,691,686,682,677,673,668,664,659,654,650,645,640,635,631,626,621,616,611,606,601,595,590,585,579,574,568,562,556,550,544,538,532,525}}; + +static const int16_t lookup_table_angle2[128][128] = {{-258,-262,-267,-271,-275,-279,-282,-286,-290,-293,-296,-299,-302,-305,-308,-311,-313,-316,-318,-321,-323,-325,-327,-329,-331,-332,-334,-335,-337,-338,-340,-341,-342,-343,-344,-345,-346,-347,-347,-348,-349,-349,-350,-350,-350,-351,-351,-351,-351,-351,-351,-351,-351,-351,-351,-351,-350,-350,-350,-349,-349,-348,-348,-347,-346,-346,-345,-344,-344,-343,-342,-341,-340,-339,-338,-337,-336,-335,-334,-332,-331,-330,-329,-327,-326,-325,-323,-322,-320,-319,-317,-316,-314,-313,-311,-309,-308,-306,-304,-302,-301,-299,-297,-295,-293,-291,-289,-287,-285,-283,-281,-279,-277,-274,-272,-270,-268,-265,-263,-261,-258,-256,-253,-251,-248,-246,-243,-241}, +{-252,-256,-261,-265,-269,-273,-276,-280,-284,-287,-290,-293,-297,-299,-302,-305,-308,-310,-313,-315,-317,-319,-321,-323,-325,-327,-328,-330,-332,-333,-334,-336,-337,-338,-339,-340,-341,-342,-342,-343,-344,-344,-345,-345,-346,-346,-346,-346,-346,-347,-347,-347,-347,-346,-346,-346,-346,-345,-345,-345,-344,-344,-343,-343,-342,-342,-341,-340,-339,-339,-338,-337,-336,-335,-334,-333,-332,-331,-330,-329,-327,-326,-325,-324,-322,-321,-320,-318,-317,-315,-314,-312,-311,-309,-307,-306,-304,-302,-301,-299,-297,-295,-293,-291,-290,-288,-286,-284,-282,-280,-277,-275,-273,-271,-269,-267,-264,-262,-260,-257,-255,-253,-250,-248,-245,-243,-240,-237}, +{-246,-251,-255,-259,-263,-267,-271,-274,-278,-281,-285,-288,-291,-294,-297,-299,-302,-305,-307,-309,-312,-314,-316,-318,-320,-321,-323,-325,-326,-328,-329,-330,-331,-333,-334,-335,-336,-336,-337,-338,-339,-339,-340,-340,-341,-341,-341,-342,-342,-342,-342,-342,-342,-342,-342,-342,-341,-341,-341,-340,-340,-339,-339,-338,-338,-337,-337,-336,-335,-334,-334,-333,-332,-331,-330,-329,-328,-327,-326,-325,-323,-322,-321,-320,-318,-317,-316,-314,-313,-311,-310,-308,-307,-305,-304,-302,-300,-299,-297,-295,-293,-292,-290,-288,-286,-284,-282,-280,-278,-276,-274,-272,-270,-268,-266,-263,-261,-259,-256,-254,-252,-249,-247,-244,-242,-239,-237,-234}, +{-241,-245,-249,-253,-257,-261,-265,-269,-272,-276,-279,-282,-285,-288,-291,-294,-296,-299,-301,-304,-306,-308,-310,-312,-314,-316,-318,-319,-321,-322,-324,-325,-326,-327,-329,-330,-331,-331,-332,-333,-334,-334,-335,-335,-336,-336,-336,-337,-337,-337,-337,-337,-337,-337,-337,-337,-337,-337,-336,-336,-336,-335,-335,-334,-334,-333,-332,-332,-331,-330,-329,-329,-328,-327,-326,-325,-324,-323,-322,-321,-320,-318,-317,-316,-315,-313,-312,-311,-309,-308,-306,-305,-303,-302,-300,-299,-297,-295,-293,-292,-290,-288,-286,-285,-283,-281,-279,-277,-275,-273,-271,-269,-267,-264,-262,-260,-258,-255,-253,-251,-249,-246,-244,-241,-239,-236,-234,-231}, +{-235,-239,-243,-248,-252,-255,-259,-263,-266,-270,-273,-276,-279,-282,-285,-288,-291,-293,-296,-298,-301,-303,-305,-307,-309,-311,-312,-314,-316,-317,-318,-320,-321,-322,-323,-324,-325,-326,-327,-328,-329,-329,-330,-330,-331,-331,-332,-332,-332,-332,-333,-333,-333,-333,-333,-332,-332,-332,-332,-331,-331,-331,-330,-330,-329,-329,-328,-327,-327,-326,-325,-324,-324,-323,-322,-321,-320,-319,-318,-317,-316,-314,-313,-312,-311,-310,-308,-307,-305,-304,-303,-301,-300,-298,-296,-295,-293,-292,-290,-288,-286,-285,-283,-281,-279,-277,-275,-273,-271,-269,-267,-265,-263,-261,-259,-257,-254,-252,-250,-248,-245,-243,-240,-238,-236,-233,-231,-228}, +{-229,-234,-238,-242,-246,-250,-254,-257,-261,-264,-268,-271,-274,-277,-280,-283,-285,-288,-290,-293,-295,-297,-299,-301,-303,-305,-307,-309,-310,-312,-313,-315,-316,-317,-318,-319,-320,-321,-322,-323,-324,-324,-325,-326,-326,-327,-327,-327,-328,-328,-328,-328,-328,-328,-328,-328,-328,-328,-327,-327,-327,-326,-326,-326,-325,-324,-324,-323,-323,-322,-321,-320,-320,-319,-318,-317,-316,-315,-314,-313,-312,-311,-309,-308,-307,-306,-304,-303,-302,-300,-299,-297,-296,-294,-293,-291,-290,-288,-286,-285,-283,-281,-279,-278,-276,-274,-272,-270,-268,-266,-264,-262,-260,-258,-256,-253,-251,-249,-247,-244,-242,-240,-237,-235,-232,-230,-227,-225}, +{-224,-228,-232,-236,-240,-244,-248,-252,-255,-259,-262,-265,-268,-271,-274,-277,-280,-282,-285,-287,-290,-292,-294,-296,-298,-300,-302,-303,-305,-307,-308,-310,-311,-312,-313,-314,-315,-316,-317,-318,-319,-320,-320,-321,-321,-322,-322,-323,-323,-323,-323,-323,-324,-324,-324,-323,-323,-323,-323,-323,-322,-322,-322,-321,-321,-320,-320,-319,-318,-318,-317,-316,-315,-315,-314,-313,-312,-311,-310,-309,-308,-307,-306,-304,-303,-302,-301,-299,-298,-297,-295,-294,-292,-291,-289,-288,-286,-284,-283,-281,-279,-278,-276,-274,-272,-270,-269,-267,-265,-263,-261,-259,-257,-254,-252,-250,-248,-246,-243,-241,-239,-236,-234,-232,-229,-227,-224,-222}, +{-218,-223,-227,-231,-235,-239,-243,-246,-250,-253,-257,-260,-263,-266,-269,-272,-274,-277,-280,-282,-284,-287,-289,-291,-293,-295,-297,-298,-300,-302,-303,-304,-306,-307,-308,-309,-310,-311,-312,-313,-314,-315,-315,-316,-317,-317,-318,-318,-318,-318,-319,-319,-319,-319,-319,-319,-319,-319,-319,-318,-318,-318,-317,-317,-317,-316,-315,-315,-314,-314,-313,-312,-311,-311,-310,-309,-308,-307,-306,-305,-304,-303,-302,-301,-299,-298,-297,-296,-294,-293,-292,-290,-289,-287,-286,-284,-283,-281,-279,-278,-276,-274,-272,-271,-269,-267,-265,-263,-261,-259,-257,-255,-253,-251,-249,-247,-245,-242,-240,-238,-236,-233,-231,-228,-226,-224,-221,-218}, +{-213,-217,-221,-225,-229,-233,-237,-241,-244,-248,-251,-254,-258,-261,-263,-266,-269,-272,-274,-277,-279,-281,-283,-286,-288,-290,-291,-293,-295,-296,-298,-299,-301,-302,-303,-304,-306,-307,-307,-308,-309,-310,-311,-311,-312,-312,-313,-313,-314,-314,-314,-314,-314,-315,-315,-315,-314,-314,-314,-314,-314,-313,-313,-313,-312,-312,-311,-311,-310,-310,-309,-308,-307,-307,-306,-305,-304,-303,-302,-301,-300,-299,-298,-297,-296,-294,-293,-292,-291,-289,-288,-286,-285,-284,-282,-280,-279,-277,-276,-274,-272,-271,-269,-267,-265,-264,-262,-260,-258,-256,-254,-252,-250,-248,-246,-244,-241,-239,-237,-235,-232,-230,-228,-225,-223,-220,-218,-215}, +{-207,-212,-216,-220,-224,-228,-232,-235,-239,-242,-246,-249,-252,-255,-258,-261,-264,-266,-269,-271,-274,-276,-278,-280,-282,-284,-286,-288,-290,-291,-293,-294,-296,-297,-298,-299,-301,-302,-303,-304,-304,-305,-306,-307,-307,-308,-308,-309,-309,-309,-310,-310,-310,-310,-310,-310,-310,-310,-310,-310,-309,-309,-309,-308,-308,-308,-307,-307,-306,-305,-305,-304,-303,-303,-302,-301,-300,-299,-298,-297,-296,-295,-294,-293,-292,-291,-289,-288,-287,-285,-284,-283,-281,-280,-278,-277,-275,-274,-272,-271,-269,-267,-265,-264,-262,-260,-258,-256,-254,-252,-251,-249,-246,-244,-242,-240,-238,-236,-234,-231,-229,-227,-224,-222,-220,-217,-215,-212}, +{-202,-206,-211,-215,-219,-223,-226,-230,-234,-237,-240,-244,-247,-250,-253,-256,-258,-261,-264,-266,-269,-271,-273,-275,-277,-279,-281,-283,-285,-286,-288,-289,-291,-292,-293,-295,-296,-297,-298,-299,-300,-300,-301,-302,-302,-303,-304,-304,-304,-305,-305,-305,-305,-306,-306,-306,-306,-306,-305,-305,-305,-305,-305,-304,-304,-303,-303,-302,-302,-301,-301,-300,-299,-299,-298,-297,-296,-295,-294,-293,-292,-291,-290,-289,-288,-287,-286,-284,-283,-282,-280,-279,-278,-276,-275,-273,-272,-270,-269,-267,-265,-264,-262,-260,-258,-257,-255,-253,-251,-249,-247,-245,-243,-241,-239,-237,-235,-233,-230,-228,-226,-224,-221,-219,-216,-214,-211,-209}, +{-197,-201,-205,-209,-213,-217,-221,-225,-228,-232,-235,-238,-242,-245,-248,-250,-253,-256,-258,-261,-263,-266,-268,-270,-272,-274,-276,-278,-280,-281,-283,-284,-286,-287,-288,-290,-291,-292,-293,-294,-295,-296,-296,-297,-298,-298,-299,-299,-300,-300,-300,-301,-301,-301,-301,-301,-301,-301,-301,-301,-301,-301,-300,-300,-300,-299,-299,-298,-298,-297,-297,-296,-295,-295,-294,-293,-292,-291,-290,-289,-288,-287,-286,-285,-284,-283,-282,-281,-279,-278,-277,-275,-274,-273,-271,-270,-268,-267,-265,-263,-262,-260,-258,-257,-255,-253,-251,-250,-248,-246,-244,-242,-240,-238,-236,-234,-231,-229,-227,-225,-223,-220,-218,-216,-213,-211,-208,-206}, +{-192,-196,-200,-204,-208,-212,-216,-220,-223,-227,-230,-233,-236,-239,-242,-245,-248,-251,-253,-256,-258,-261,-263,-265,-267,-269,-271,-273,-275,-276,-278,-279,-281,-282,-284,-285,-286,-287,-288,-289,-290,-291,-292,-292,-293,-294,-294,-295,-295,-296,-296,-296,-296,-297,-297,-297,-297,-297,-297,-297,-297,-296,-296,-296,-295,-295,-295,-294,-294,-293,-293,-292,-291,-291,-290,-289,-288,-287,-286,-286,-285,-284,-283,-281,-280,-279,-278,-277,-276,-274,-273,-272,-270,-269,-268,-266,-265,-263,-262,-260,-258,-257,-255,-253,-252,-250,-248,-246,-244,-242,-240,-238,-236,-234,-232,-230,-228,-226,-224,-222,-219,-217,-215,-212,-210,-207,-205,-203}, +{-187,-191,-195,-199,-203,-207,-211,-214,-218,-221,-225,-228,-231,-234,-237,-240,-243,-246,-248,-251,-253,-256,-258,-260,-262,-264,-266,-268,-270,-271,-273,-275,-276,-277,-279,-280,-281,-282,-283,-284,-285,-286,-287,-288,-288,-289,-290,-290,-291,-291,-291,-292,-292,-292,-292,-292,-293,-293,-292,-292,-292,-292,-292,-292,-291,-291,-290,-290,-290,-289,-288,-288,-287,-287,-286,-285,-284,-283,-283,-282,-281,-280,-279,-278,-277,-275,-274,-273,-272,-271,-269,-268,-267,-265,-264,-262,-261,-260,-258,-256,-255,-253,-251,-250,-248,-246,-244,-243,-241,-239,-237,-235,-233,-231,-229,-227,-225,-223,-220,-218,-216,-214,-211,-209,-207,-204,-202,-199}, +{-182,-186,-190,-194,-198,-202,-206,-209,-213,-216,-220,-223,-226,-229,-232,-235,-238,-241,-243,-246,-248,-250,-253,-255,-257,-259,-261,-263,-265,-266,-268,-270,-271,-273,-274,-275,-276,-278,-279,-280,-281,-282,-282,-283,-284,-285,-285,-286,-286,-287,-287,-287,-288,-288,-288,-288,-288,-288,-288,-288,-288,-288,-288,-287,-287,-287,-286,-286,-285,-285,-284,-284,-283,-283,-282,-281,-280,-280,-279,-278,-277,-276,-275,-274,-273,-272,-271,-269,-268,-267,-266,-264,-263,-262,-260,-259,-257,-256,-254,-253,-251,-250,-248,-246,-245,-243,-241,-239,-237,-236,-234,-232,-230,-228,-226,-224,-221,-219,-217,-215,-213,-210,-208,-206,-203,-201,-199,-196}, +{-177,-181,-185,-189,-193,-197,-201,-204,-208,-211,-215,-218,-221,-224,-227,-230,-233,-235,-238,-241,-243,-245,-248,-250,-252,-254,-256,-258,-260,-262,-263,-265,-266,-268,-269,-270,-272,-273,-274,-275,-276,-277,-278,-279,-279,-280,-281,-281,-282,-282,-283,-283,-283,-283,-284,-284,-284,-284,-284,-284,-284,-284,-283,-283,-283,-283,-282,-282,-281,-281,-280,-280,-279,-279,-278,-277,-276,-276,-275,-274,-273,-272,-271,-270,-269,-268,-267,-266,-265,-263,-262,-261,-259,-258,-257,-255,-254,-252,-251,-249,-248,-246,-244,-243,-241,-239,-238,-236,-234,-232,-230,-228,-226,-224,-222,-220,-218,-216,-214,-212,-209,-207,-205,-203,-200,-198,-195,-193}, +{-172,-176,-180,-184,-188,-192,-196,-199,-203,-206,-210,-213,-216,-219,-222,-225,-228,-230,-233,-236,-238,-241,-243,-245,-247,-249,-251,-253,-255,-257,-258,-260,-261,-263,-264,-266,-267,-268,-269,-270,-271,-272,-273,-274,-275,-275,-276,-277,-277,-278,-278,-278,-279,-279,-279,-279,-280,-280,-280,-280,-280,-279,-279,-279,-279,-278,-278,-278,-277,-277,-276,-276,-275,-275,-274,-273,-272,-272,-271,-270,-269,-268,-267,-266,-265,-264,-263,-262,-261,-260,-258,-257,-256,-254,-253,-252,-250,-249,-247,-246,-244,-243,-241,-239,-238,-236,-234,-232,-231,-229,-227,-225,-223,-221,-219,-217,-215,-213,-211,-208,-206,-204,-202,-199,-197,-195,-192,-190}, +{-167,-171,-175,-179,-183,-187,-191,-194,-198,-201,-205,-208,-211,-214,-217,-220,-223,-226,-228,-231,-233,-236,-238,-240,-242,-244,-246,-248,-250,-252,-254,-255,-257,-258,-260,-261,-262,-263,-265,-266,-267,-268,-269,-269,-270,-271,-272,-272,-273,-273,-274,-274,-274,-275,-275,-275,-275,-275,-275,-275,-275,-275,-275,-275,-275,-274,-274,-274,-273,-273,-272,-272,-271,-271,-270,-269,-269,-268,-267,-266,-265,-264,-263,-263,-261,-260,-259,-258,-257,-256,-255,-253,-252,-251,-249,-248,-247,-245,-244,-242,-241,-239,-238,-236,-234,-232,-231,-229,-227,-225,-223,-222,-220,-218,-216,-214,-212,-209,-207,-205,-203,-201,-198,-196,-194,-191,-189,-186}, +{-162,-166,-170,-174,-178,-182,-186,-189,-193,-196,-200,-203,-206,-209,-212,-215,-218,-221,-223,-226,-228,-231,-233,-235,-237,-239,-241,-243,-245,-247,-249,-250,-252,-253,-255,-256,-258,-259,-260,-261,-262,-263,-264,-265,-266,-266,-267,-268,-268,-269,-269,-270,-270,-270,-271,-271,-271,-271,-271,-271,-271,-271,-271,-271,-270,-270,-270,-270,-269,-269,-268,-268,-267,-267,-266,-265,-265,-264,-263,-262,-261,-261,-260,-259,-258,-257,-256,-255,-253,-252,-251,-250,-249,-247,-246,-245,-243,-242,-240,-239,-237,-236,-234,-232,-231,-229,-227,-226,-224,-222,-220,-218,-216,-214,-212,-210,-208,-206,-204,-202,-200,-197,-195,-193,-190,-188,-186,-183}, +{-157,-161,-165,-169,-173,-177,-181,-184,-188,-191,-195,-198,-201,-204,-207,-210,-213,-216,-218,-221,-223,-226,-228,-230,-233,-235,-237,-239,-241,-242,-244,-246,-247,-249,-250,-252,-253,-254,-255,-256,-258,-258,-259,-260,-261,-262,-263,-263,-264,-264,-265,-265,-266,-266,-266,-266,-267,-267,-267,-267,-267,-267,-267,-267,-266,-266,-266,-266,-265,-265,-264,-264,-263,-263,-262,-261,-261,-260,-259,-258,-258,-257,-256,-255,-254,-253,-252,-251,-250,-249,-247,-246,-245,-244,-242,-241,-240,-238,-237,-235,-234,-232,-231,-229,-227,-226,-224,-222,-220,-218,-217,-215,-213,-211,-209,-207,-205,-203,-201,-199,-196,-194,-192,-190,-187,-185,-182,-180}, +{-152,-156,-160,-164,-168,-172,-176,-180,-183,-186,-190,-193,-196,-199,-202,-205,-208,-211,-214,-216,-219,-221,-223,-226,-228,-230,-232,-234,-236,-238,-239,-241,-243,-244,-246,-247,-248,-250,-251,-252,-253,-254,-255,-256,-257,-257,-258,-259,-259,-260,-260,-261,-261,-262,-262,-262,-262,-263,-263,-263,-263,-263,-263,-262,-262,-262,-262,-261,-261,-261,-260,-260,-259,-259,-258,-258,-257,-256,-255,-255,-254,-253,-252,-251,-250,-249,-248,-247,-246,-245,-244,-242,-241,-240,-239,-237,-236,-235,-233,-232,-230,-229,-227,-225,-224,-222,-220,-219,-217,-215,-213,-211,-209,-208,-206,-204,-202,-199,-197,-195,-193,-191,-189,-186,-184,-182,-179,-177}, +{-147,-152,-156,-160,-164,-167,-171,-175,-178,-182,-185,-188,-191,-195,-198,-200,-203,-206,-209,-211,-214,-216,-219,-221,-223,-225,-227,-229,-231,-233,-235,-236,-238,-239,-241,-242,-244,-245,-246,-247,-248,-249,-250,-251,-252,-253,-254,-254,-255,-256,-256,-257,-257,-257,-258,-258,-258,-258,-258,-258,-258,-258,-258,-258,-258,-258,-258,-257,-257,-257,-256,-256,-255,-255,-254,-254,-253,-252,-252,-251,-250,-249,-248,-247,-246,-245,-244,-243,-242,-241,-240,-239,-238,-236,-235,-234,-232,-231,-230,-228,-227,-225,-224,-222,-220,-219,-217,-215,-213,-212,-210,-208,-206,-204,-202,-200,-198,-196,-194,-192,-190,-188,-185,-183,-181,-178,-176,-174}, +{-143,-147,-151,-155,-159,-163,-166,-170,-173,-177,-180,-183,-187,-190,-193,-196,-199,-201,-204,-207,-209,-211,-214,-216,-218,-220,-222,-224,-226,-228,-230,-232,-233,-235,-236,-238,-239,-240,-242,-243,-244,-245,-246,-247,-248,-249,-249,-250,-251,-251,-252,-252,-253,-253,-253,-254,-254,-254,-254,-254,-254,-254,-254,-254,-254,-254,-254,-253,-253,-253,-252,-252,-251,-251,-250,-250,-249,-248,-248,-247,-246,-245,-245,-244,-243,-242,-241,-240,-239,-237,-236,-235,-234,-233,-231,-230,-229,-227,-226,-225,-223,-222,-220,-218,-217,-215,-213,-212,-210,-208,-206,-205,-203,-201,-199,-197,-195,-193,-191,-189,-186,-184,-182,-180,-177,-175,-173,-170}, +{-138,-142,-146,-150,-154,-158,-162,-165,-169,-172,-176,-179,-182,-185,-188,-191,-194,-197,-199,-202,-204,-207,-209,-211,-214,-216,-218,-220,-222,-224,-225,-227,-229,-230,-232,-233,-235,-236,-237,-238,-239,-240,-241,-242,-243,-244,-245,-246,-246,-247,-247,-248,-248,-249,-249,-249,-250,-250,-250,-250,-250,-250,-250,-250,-250,-250,-250,-249,-249,-249,-248,-248,-247,-247,-246,-246,-245,-245,-244,-243,-242,-242,-241,-240,-239,-238,-237,-236,-235,-234,-233,-232,-230,-229,-228,-227,-225,-224,-222,-221,-220,-218,-217,-215,-213,-212,-210,-208,-207,-205,-203,-201,-199,-197,-195,-194,-192,-189,-187,-185,-183,-181,-179,-176,-174,-172,-169,-167}, +{-134,-138,-142,-146,-150,-153,-157,-161,-164,-167,-171,-174,-177,-180,-183,-186,-189,-192,-194,-197,-200,-202,-204,-207,-209,-211,-213,-215,-217,-219,-221,-222,-224,-226,-227,-229,-230,-231,-233,-234,-235,-236,-237,-238,-239,-240,-241,-241,-242,-243,-243,-244,-244,-245,-245,-245,-245,-246,-246,-246,-246,-246,-246,-246,-246,-246,-246,-245,-245,-245,-244,-244,-244,-243,-243,-242,-241,-241,-240,-239,-239,-238,-237,-236,-235,-234,-233,-232,-231,-230,-229,-228,-227,-225,-224,-223,-222,-220,-219,-217,-216,-215,-213,-211,-210,-208,-207,-205,-203,-201,-200,-198,-196,-194,-192,-190,-188,-186,-184,-182,-180,-178,-175,-173,-171,-169,-166,-164}, +{-129,-133,-137,-141,-145,-149,-152,-156,-159,-163,-166,-169,-173,-176,-179,-182,-184,-187,-190,-192,-195,-197,-200,-202,-204,-206,-209,-211,-212,-214,-216,-218,-220,-221,-223,-224,-225,-227,-228,-229,-230,-232,-233,-234,-234,-235,-236,-237,-238,-238,-239,-239,-240,-240,-241,-241,-241,-241,-242,-242,-242,-242,-242,-242,-242,-242,-242,-241,-241,-241,-240,-240,-240,-239,-239,-238,-237,-237,-236,-235,-235,-234,-233,-232,-231,-231,-230,-229,-228,-226,-225,-224,-223,-222,-221,-219,-218,-217,-215,-214,-212,-211,-210,-208,-206,-205,-203,-201,-200,-198,-196,-194,-193,-191,-189,-187,-185,-183,-181,-179,-176,-174,-172,-170,-168,-165,-163,-160}, +{-125,-129,-133,-137,-140,-144,-148,-151,-155,-158,-162,-165,-168,-171,-174,-177,-180,-183,-185,-188,-190,-193,-195,-197,-200,-202,-204,-206,-208,-210,-212,-213,-215,-217,-218,-220,-221,-222,-224,-225,-226,-227,-228,-229,-230,-231,-232,-233,-233,-234,-235,-235,-236,-236,-236,-237,-237,-237,-238,-238,-238,-238,-238,-238,-238,-238,-237,-237,-237,-237,-236,-236,-236,-235,-235,-234,-234,-233,-232,-232,-231,-230,-229,-229,-228,-227,-226,-225,-224,-223,-222,-221,-219,-218,-217,-216,-214,-213,-212,-210,-209,-208,-206,-204,-203,-201,-200,-198,-196,-195,-193,-191,-189,-187,-185,-183,-181,-179,-177,-175,-173,-171,-169,-167,-164,-162,-160,-157}, +{-120,-124,-128,-132,-136,-140,-143,-147,-150,-154,-157,-160,-163,-166,-169,-172,-175,-178,-181,-183,-186,-188,-191,-193,-195,-197,-199,-201,-203,-205,-207,-209,-210,-212,-214,-215,-217,-218,-219,-220,-222,-223,-224,-225,-226,-227,-227,-228,-229,-230,-230,-231,-231,-232,-232,-233,-233,-233,-233,-234,-234,-234,-234,-234,-234,-234,-233,-233,-233,-233,-232,-232,-232,-231,-231,-230,-230,-229,-229,-228,-227,-226,-226,-225,-224,-223,-222,-221,-220,-219,-218,-217,-216,-215,-213,-212,-211,-210,-208,-207,-205,-204,-203,-201,-199,-198,-196,-195,-193,-191,-189,-188,-186,-184,-182,-180,-178,-176,-174,-172,-170,-168,-165,-163,-161,-159,-156,-154}, +{-116,-120,-124,-128,-131,-135,-139,-142,-146,-149,-152,-156,-159,-162,-165,-168,-171,-173,-176,-179,-181,-184,-186,-188,-191,-193,-195,-197,-199,-201,-203,-204,-206,-208,-209,-211,-212,-213,-215,-216,-217,-218,-219,-220,-221,-222,-223,-224,-225,-225,-226,-227,-227,-228,-228,-228,-229,-229,-229,-229,-230,-230,-230,-230,-230,-230,-229,-229,-229,-229,-229,-228,-228,-227,-227,-226,-226,-225,-225,-224,-223,-223,-222,-221,-220,-219,-218,-217,-216,-215,-214,-213,-212,-211,-210,-209,-207,-206,-205,-203,-202,-200,-199,-197,-196,-194,-193,-191,-189,-188,-186,-184,-182,-181,-179,-177,-175,-173,-171,-169,-166,-164,-162,-160,-158,-155,-153,-151}, +{-111,-115,-119,-123,-127,-131,-134,-138,-141,-145,-148,-151,-154,-157,-160,-163,-166,-169,-171,-174,-177,-179,-181,-184,-186,-188,-190,-192,-194,-196,-198,-200,-202,-203,-205,-206,-208,-209,-210,-212,-213,-214,-215,-216,-217,-218,-219,-220,-220,-221,-222,-222,-223,-223,-224,-224,-225,-225,-225,-225,-225,-226,-226,-226,-226,-226,-225,-225,-225,-225,-225,-224,-224,-224,-223,-223,-222,-221,-221,-220,-220,-219,-218,-217,-216,-216,-215,-214,-213,-212,-211,-210,-209,-207,-206,-205,-204,-202,-201,-200,-198,-197,-195,-194,-192,-191,-189,-188,-186,-184,-183,-181,-179,-177,-175,-173,-171,-169,-167,-165,-163,-161,-159,-157,-154,-152,-150,-147}, +{-107,-111,-115,-119,-122,-126,-130,-133,-137,-140,-143,-147,-150,-153,-156,-159,-162,-164,-167,-170,-172,-175,-177,-179,-182,-184,-186,-188,-190,-192,-194,-195,-197,-199,-200,-202,-203,-205,-206,-207,-209,-210,-211,-212,-213,-214,-215,-215,-216,-217,-218,-218,-219,-219,-220,-220,-220,-221,-221,-221,-221,-222,-222,-222,-222,-222,-221,-221,-221,-221,-221,-220,-220,-220,-219,-219,-218,-218,-217,-216,-216,-215,-214,-214,-213,-212,-211,-210,-209,-208,-207,-206,-205,-204,-203,-201,-200,-199,-198,-196,-195,-193,-192,-191,-189,-187,-186,-184,-183,-181,-179,-177,-176,-174,-172,-170,-168,-166,-164,-162,-160,-158,-156,-153,-151,-149,-146,-144}, +{-103,-107,-110,-114,-118,-122,-125,-129,-132,-136,-139,-142,-145,-148,-151,-154,-157,-160,-162,-165,-168,-170,-172,-175,-177,-179,-181,-183,-185,-187,-189,-191,-193,-194,-196,-197,-199,-200,-202,-203,-204,-205,-206,-208,-209,-209,-210,-211,-212,-213,-213,-214,-215,-215,-216,-216,-216,-217,-217,-217,-217,-217,-218,-218,-218,-218,-218,-217,-217,-217,-217,-216,-216,-216,-215,-215,-214,-214,-213,-213,-212,-211,-211,-210,-209,-208,-207,-206,-205,-204,-203,-202,-201,-200,-199,-198,-197,-195,-194,-193,-191,-190,-188,-187,-186,-184,-182,-181,-179,-177,-176,-174,-172,-170,-168,-167,-165,-163,-161,-159,-156,-154,-152,-150,-148,-145,-143,-141}, +{-98,-102,-106,-110,-114,-117,-121,-124,-128,-131,-135,-138,-141,-144,-147,-150,-153,-155,-158,-161,-163,-166,-168,-170,-173,-175,-177,-179,-181,-183,-185,-187,-188,-190,-192,-193,-195,-196,-197,-199,-200,-201,-202,-203,-204,-205,-206,-207,-208,-208,-209,-210,-210,-211,-211,-212,-212,-213,-213,-213,-213,-213,-214,-214,-214,-214,-214,-213,-213,-213,-213,-213,-212,-212,-211,-211,-211,-210,-209,-209,-208,-208,-207,-206,-205,-204,-204,-203,-202,-201,-200,-199,-198,-197,-195,-194,-193,-192,-190,-189,-188,-186,-185,-184,-182,-180,-179,-177,-176,-174,-172,-171,-169,-167,-165,-163,-161,-159,-157,-155,-153,-151,-149,-147,-144,-142,-140,-137}, +{-94,-98,-102,-106,-109,-113,-117,-120,-123,-127,-130,-133,-136,-139,-142,-145,-148,-151,-154,-156,-159,-161,-164,-166,-168,-170,-173,-175,-177,-179,-180,-182,-184,-186,-187,-189,-190,-192,-193,-194,-196,-197,-198,-199,-200,-201,-202,-203,-204,-204,-205,-206,-206,-207,-207,-208,-208,-208,-209,-209,-209,-209,-210,-210,-210,-210,-210,-209,-209,-209,-209,-209,-208,-208,-208,-207,-207,-206,-206,-205,-204,-204,-203,-202,-202,-201,-200,-199,-198,-197,-196,-195,-194,-193,-192,-191,-189,-188,-187,-186,-184,-183,-181,-180,-179,-177,-175,-174,-172,-171,-169,-167,-165,-164,-162,-160,-158,-156,-154,-152,-150,-148,-146,-143,-141,-139,-136,-134}, +{-90,-94,-98,-101,-105,-109,-112,-116,-119,-122,-126,-129,-132,-135,-138,-141,-144,-147,-149,-152,-154,-157,-159,-162,-164,-166,-168,-170,-172,-174,-176,-178,-180,-181,-183,-184,-186,-187,-189,-190,-191,-192,-194,-195,-196,-197,-198,-199,-199,-200,-201,-201,-202,-203,-203,-204,-204,-204,-205,-205,-205,-205,-206,-206,-206,-206,-206,-206,-205,-205,-205,-205,-205,-204,-204,-203,-203,-202,-202,-201,-201,-200,-199,-199,-198,-197,-196,-195,-194,-194,-193,-192,-190,-189,-188,-187,-186,-185,-183,-182,-181,-179,-178,-177,-175,-174,-172,-170,-169,-167,-165,-164,-162,-160,-158,-156,-154,-153,-151,-148,-146,-144,-142,-140,-138,-135,-133,-131}, +{-86,-89,-93,-97,-101,-104,-108,-111,-115,-118,-121,-125,-128,-131,-134,-137,-139,-142,-145,-147,-150,-152,-155,-157,-159,-162,-164,-166,-168,-170,-172,-173,-175,-177,-179,-180,-182,-183,-184,-186,-187,-188,-189,-190,-192,-193,-193,-194,-195,-196,-197,-197,-198,-199,-199,-200,-200,-200,-201,-201,-201,-201,-202,-202,-202,-202,-202,-202,-202,-201,-201,-201,-201,-200,-200,-200,-199,-199,-198,-198,-197,-196,-196,-195,-194,-193,-193,-192,-191,-190,-189,-188,-187,-186,-185,-184,-182,-181,-180,-179,-177,-176,-174,-173,-172,-170,-168,-167,-165,-164,-162,-160,-158,-157,-155,-153,-151,-149,-147,-145,-143,-141,-139,-137,-134,-132,-130,-127}, +{-81,-85,-89,-93,-97,-100,-104,-107,-111,-114,-117,-120,-123,-126,-129,-132,-135,-138,-141,-143,-146,-148,-151,-153,-155,-157,-159,-162,-164,-165,-167,-169,-171,-173,-174,-176,-177,-179,-180,-182,-183,-184,-185,-186,-187,-188,-189,-190,-191,-192,-193,-193,-194,-194,-195,-195,-196,-196,-197,-197,-197,-197,-198,-198,-198,-198,-198,-198,-198,-197,-197,-197,-197,-196,-196,-196,-195,-195,-194,-194,-193,-193,-192,-191,-190,-190,-189,-188,-187,-186,-185,-184,-183,-182,-181,-180,-179,-178,-176,-175,-174,-172,-171,-170,-168,-167,-165,-163,-162,-160,-159,-157,-155,-153,-151,-150,-148,-146,-144,-142,-140,-138,-135,-133,-131,-129,-126,-124}, +{-77,-81,-85,-89,-92,-96,-99,-103,-106,-110,-113,-116,-119,-122,-125,-128,-131,-134,-136,-139,-141,-144,-146,-149,-151,-153,-155,-157,-159,-161,-163,-165,-167,-168,-170,-172,-173,-175,-176,-177,-179,-180,-181,-182,-183,-184,-185,-186,-187,-188,-188,-189,-190,-190,-191,-191,-192,-192,-193,-193,-193,-193,-194,-194,-194,-194,-194,-194,-194,-194,-193,-193,-193,-193,-192,-192,-192,-191,-191,-190,-189,-189,-188,-188,-187,-186,-185,-184,-184,-183,-182,-181,-180,-179,-177,-176,-175,-174,-173,-171,-170,-169,-167,-166,-165,-163,-162,-160,-158,-157,-155,-153,-152,-150,-148,-146,-144,-142,-140,-138,-136,-134,-132,-130,-128,-125,-123,-121}, +{-73,-77,-81,-85,-88,-92,-95,-99,-102,-105,-109,-112,-115,-118,-121,-124,-127,-129,-132,-135,-137,-140,-142,-144,-147,-149,-151,-153,-155,-157,-159,-161,-162,-164,-166,-167,-169,-170,-172,-173,-174,-176,-177,-178,-179,-180,-181,-182,-183,-184,-184,-185,-186,-186,-187,-187,-188,-188,-189,-189,-189,-189,-190,-190,-190,-190,-190,-190,-190,-190,-190,-189,-189,-189,-188,-188,-188,-187,-187,-186,-186,-185,-184,-184,-183,-182,-182,-181,-180,-179,-178,-177,-176,-175,-174,-173,-172,-170,-169,-168,-167,-165,-164,-163,-161,-160,-158,-157,-155,-153,-152,-150,-148,-146,-145,-143,-141,-139,-137,-135,-133,-131,-129,-127,-124,-122,-120,-117}, +{-69,-73,-77,-80,-84,-88,-91,-95,-98,-101,-104,-108,-111,-114,-117,-119,-122,-125,-128,-130,-133,-135,-138,-140,-142,-144,-147,-149,-151,-153,-155,-156,-158,-160,-162,-163,-165,-166,-168,-169,-170,-171,-173,-174,-175,-176,-177,-178,-179,-179,-180,-181,-182,-182,-183,-183,-184,-184,-185,-185,-185,-185,-186,-186,-186,-186,-186,-186,-186,-186,-186,-185,-185,-185,-185,-184,-184,-183,-183,-183,-182,-181,-181,-180,-179,-179,-178,-177,-176,-175,-174,-173,-172,-171,-170,-169,-168,-167,-166,-164,-163,-162,-160,-159,-158,-156,-155,-153,-151,-150,-148,-147,-145,-143,-141,-139,-137,-136,-134,-132,-130,-127,-125,-123,-121,-119,-116,-114}, +{-65,-69,-73,-76,-80,-84,-87,-90,-94,-97,-100,-103,-106,-109,-112,-115,-118,-121,-123,-126,-129,-131,-133,-136,-138,-140,-142,-144,-146,-148,-150,-152,-154,-156,-157,-159,-160,-162,-163,-165,-166,-167,-168,-170,-171,-172,-173,-174,-175,-175,-176,-177,-178,-178,-179,-179,-180,-180,-181,-181,-181,-182,-182,-182,-182,-182,-182,-182,-182,-182,-182,-182,-181,-181,-181,-181,-180,-180,-179,-179,-178,-178,-177,-176,-176,-175,-174,-173,-173,-172,-171,-170,-169,-168,-167,-166,-164,-163,-162,-161,-160,-158,-157,-156,-154,-153,-151,-150,-148,-146,-145,-143,-141,-140,-138,-136,-134,-132,-130,-128,-126,-124,-122,-120,-118,-115,-113,-111}, +{-61,-65,-69,-72,-76,-79,-83,-86,-90,-93,-96,-99,-102,-105,-108,-111,-114,-117,-119,-122,-124,-127,-129,-132,-134,-136,-138,-140,-142,-144,-146,-148,-150,-151,-153,-155,-156,-158,-159,-161,-162,-163,-164,-165,-167,-168,-169,-170,-170,-171,-172,-173,-174,-174,-175,-175,-176,-176,-177,-177,-177,-178,-178,-178,-178,-178,-178,-178,-178,-178,-178,-178,-178,-177,-177,-177,-176,-176,-176,-175,-174,-174,-173,-173,-172,-171,-171,-170,-169,-168,-167,-166,-165,-164,-163,-162,-161,-160,-159,-157,-156,-155,-153,-152,-151,-149,-148,-146,-145,-143,-141,-140,-138,-136,-134,-133,-131,-129,-127,-125,-123,-121,-119,-116,-114,-112,-110,-107}, +{-57,-61,-65,-68,-72,-75,-79,-82,-86,-89,-92,-95,-98,-101,-104,-107,-110,-112,-115,-118,-120,-123,-125,-127,-130,-132,-134,-136,-138,-140,-142,-144,-146,-147,-149,-151,-152,-154,-155,-156,-158,-159,-160,-161,-162,-164,-165,-166,-166,-167,-168,-169,-169,-170,-171,-171,-172,-172,-173,-173,-173,-174,-174,-174,-174,-174,-174,-174,-174,-174,-174,-174,-174,-174,-173,-173,-173,-172,-172,-171,-171,-170,-170,-169,-168,-168,-167,-166,-165,-164,-163,-163,-162,-161,-160,-158,-157,-156,-155,-154,-153,-151,-150,-148,-147,-146,-144,-143,-141,-139,-138,-136,-134,-133,-131,-129,-127,-125,-123,-121,-119,-117,-115,-113,-111,-109,-106,-104}, +{-53,-57,-61,-64,-68,-71,-75,-78,-81,-85,-88,-91,-94,-97,-100,-103,-106,-108,-111,-113,-116,-118,-121,-123,-125,-128,-130,-132,-134,-136,-138,-140,-141,-143,-145,-146,-148,-149,-151,-152,-154,-155,-156,-157,-158,-159,-160,-161,-162,-163,-164,-165,-165,-166,-167,-167,-168,-168,-169,-169,-169,-170,-170,-170,-170,-170,-170,-171,-170,-170,-170,-170,-170,-170,-169,-169,-169,-168,-168,-168,-167,-166,-166,-165,-165,-164,-163,-162,-162,-161,-160,-159,-158,-157,-156,-155,-154,-153,-151,-150,-149,-148,-146,-145,-144,-142,-141,-139,-138,-136,-134,-133,-131,-129,-127,-126,-124,-122,-120,-118,-116,-114,-112,-110,-107,-105,-103,-101}, +{-49,-53,-57,-60,-64,-67,-71,-74,-77,-81,-84,-87,-90,-93,-96,-99,-101,-104,-107,-109,-112,-114,-117,-119,-121,-124,-126,-128,-130,-132,-134,-135,-137,-139,-141,-142,-144,-145,-147,-148,-150,-151,-152,-153,-154,-155,-156,-157,-158,-159,-160,-161,-161,-162,-163,-163,-164,-164,-165,-165,-166,-166,-166,-166,-166,-167,-167,-167,-167,-167,-166,-166,-166,-166,-166,-165,-165,-165,-164,-164,-163,-163,-162,-162,-161,-160,-160,-159,-158,-157,-156,-155,-154,-153,-152,-151,-150,-149,-148,-147,-145,-144,-143,-141,-140,-139,-137,-136,-134,-133,-131,-129,-128,-126,-124,-122,-120,-118,-117,-115,-113,-111,-108,-106,-104,-102,-100,-97}, +{-45,-49,-53,-56,-60,-63,-67,-70,-73,-77,-80,-83,-86,-89,-92,-95,-97,-100,-103,-105,-108,-110,-113,-115,-117,-119,-122,-124,-126,-128,-130,-131,-133,-135,-137,-138,-140,-141,-143,-144,-145,-147,-148,-149,-150,-151,-152,-153,-154,-155,-156,-157,-157,-158,-159,-159,-160,-160,-161,-161,-162,-162,-162,-162,-163,-163,-163,-163,-163,-163,-163,-163,-162,-162,-162,-162,-161,-161,-161,-160,-160,-159,-159,-158,-157,-157,-156,-155,-154,-153,-153,-152,-151,-150,-149,-148,-147,-146,-144,-143,-142,-141,-139,-138,-137,-135,-134,-132,-131,-129,-127,-126,-124,-122,-121,-119,-117,-115,-113,-111,-109,-107,-105,-103,-101,-98,-96,-94}, +{-41,-45,-49,-52,-56,-59,-63,-66,-69,-73,-76,-79,-82,-85,-88,-90,-93,-96,-99,-101,-104,-106,-108,-111,-113,-115,-117,-120,-122,-124,-125,-127,-129,-131,-132,-134,-136,-137,-139,-140,-141,-143,-144,-145,-146,-147,-148,-149,-150,-151,-152,-153,-153,-154,-155,-155,-156,-156,-157,-157,-158,-158,-158,-158,-159,-159,-159,-159,-159,-159,-159,-159,-159,-158,-158,-158,-158,-157,-157,-156,-156,-155,-155,-154,-154,-153,-152,-151,-151,-150,-149,-148,-147,-146,-145,-144,-143,-142,-141,-140,-138,-137,-136,-134,-133,-132,-130,-129,-127,-126,-124,-122,-121,-119,-117,-115,-114,-112,-110,-108,-106,-104,-102,-99,-97,-95,-93,-90}, +{-37,-41,-45,-48,-52,-55,-59,-62,-65,-69,-72,-75,-78,-81,-84,-86,-89,-92,-94,-97,-100,-102,-104,-107,-109,-111,-113,-115,-117,-119,-121,-123,-125,-127,-128,-130,-132,-133,-135,-136,-137,-139,-140,-141,-142,-143,-144,-145,-146,-147,-148,-149,-150,-150,-151,-151,-152,-153,-153,-153,-154,-154,-154,-155,-155,-155,-155,-155,-155,-155,-155,-155,-155,-155,-154,-154,-154,-153,-153,-153,-152,-152,-151,-151,-150,-149,-149,-148,-147,-146,-145,-145,-144,-143,-142,-141,-140,-138,-137,-136,-135,-134,-132,-131,-130,-128,-127,-125,-124,-122,-121,-119,-117,-115,-114,-112,-110,-108,-106,-104,-102,-100,-98,-96,-94,-92,-89,-87}, +{-34,-37,-41,-45,-48,-51,-55,-58,-61,-65,-68,-71,-74,-77,-80,-82,-85,-88,-90,-93,-96,-98,-100,-103,-105,-107,-109,-111,-113,-115,-117,-119,-121,-123,-124,-126,-128,-129,-131,-132,-133,-135,-136,-137,-138,-139,-140,-141,-142,-143,-144,-145,-146,-146,-147,-148,-148,-149,-149,-150,-150,-150,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-151,-150,-150,-150,-149,-149,-148,-148,-147,-147,-146,-146,-145,-144,-143,-143,-142,-141,-140,-139,-138,-137,-136,-135,-134,-133,-131,-130,-129,-127,-126,-125,-123,-122,-120,-119,-117,-115,-114,-112,-110,-108,-107,-105,-103,-101,-99,-97,-95,-93,-90,-88,-86,-84}, +{-30,-34,-37,-41,-44,-48,-51,-54,-57,-61,-64,-67,-70,-73,-76,-78,-81,-84,-86,-89,-91,-94,-96,-99,-101,-103,-105,-107,-109,-111,-113,-115,-117,-119,-120,-122,-123,-125,-126,-128,-129,-131,-132,-133,-134,-135,-136,-137,-138,-139,-140,-141,-142,-142,-143,-144,-144,-145,-145,-146,-146,-146,-147,-147,-147,-147,-147,-147,-148,-148,-147,-147,-147,-147,-147,-147,-146,-146,-146,-145,-145,-144,-144,-143,-143,-142,-141,-141,-140,-139,-138,-137,-136,-135,-134,-133,-132,-131,-130,-129,-128,-127,-125,-124,-123,-121,-120,-118,-117,-115,-114,-112,-110,-109,-107,-105,-103,-101,-99,-97,-95,-93,-91,-89,-87,-85,-83,-80}, +{-26,-30,-33,-37,-40,-44,-47,-50,-54,-57,-60,-63,-66,-69,-72,-74,-77,-80,-82,-85,-87,-90,-92,-95,-97,-99,-101,-103,-105,-107,-109,-111,-113,-115,-116,-118,-119,-121,-122,-124,-125,-127,-128,-129,-130,-131,-132,-133,-134,-135,-136,-137,-138,-138,-139,-140,-140,-141,-141,-142,-142,-142,-143,-143,-143,-143,-144,-144,-144,-144,-144,-144,-143,-143,-143,-143,-143,-142,-142,-142,-141,-141,-140,-140,-139,-138,-138,-137,-136,-135,-135,-134,-133,-132,-131,-130,-129,-128,-127,-125,-124,-123,-122,-120,-119,-118,-116,-115,-113,-112,-110,-108,-107,-105,-103,-102,-100,-98,-96,-94,-92,-90,-88,-86,-84,-81,-79,-77}, +{-22,-26,-29,-33,-36,-40,-43,-46,-50,-53,-56,-59,-62,-65,-68,-70,-73,-76,-78,-81,-83,-86,-88,-91,-93,-95,-97,-99,-101,-103,-105,-107,-109,-111,-112,-114,-115,-117,-118,-120,-121,-123,-124,-125,-126,-127,-128,-129,-130,-131,-132,-133,-134,-134,-135,-136,-136,-137,-137,-138,-138,-139,-139,-139,-139,-140,-140,-140,-140,-140,-140,-140,-140,-140,-139,-139,-139,-139,-138,-138,-137,-137,-136,-136,-135,-135,-134,-133,-133,-132,-131,-130,-129,-128,-127,-126,-125,-124,-123,-122,-121,-119,-118,-117,-116,-114,-113,-111,-110,-108,-107,-105,-103,-102,-100,-98,-96,-94,-93,-91,-89,-87,-84,-82,-80,-78,-76,-73}, +{-19,-22,-26,-29,-33,-36,-39,-43,-46,-49,-52,-55,-58,-61,-64,-66,-69,-72,-74,-77,-79,-82,-84,-87,-89,-91,-93,-95,-97,-99,-101,-103,-105,-107,-108,-110,-111,-113,-114,-116,-117,-119,-120,-121,-122,-123,-124,-125,-126,-127,-128,-129,-130,-131,-131,-132,-132,-133,-134,-134,-134,-135,-135,-135,-136,-136,-136,-136,-136,-136,-136,-136,-136,-136,-136,-135,-135,-135,-134,-134,-134,-133,-133,-132,-132,-131,-130,-130,-129,-128,-127,-126,-126,-125,-124,-123,-122,-121,-119,-118,-117,-116,-115,-113,-112,-111,-109,-108,-106,-105,-103,-102,-100,-98,-96,-95,-93,-91,-89,-87,-85,-83,-81,-79,-77,-74,-72,-70}, +{-15,-18,-22,-25,-29,-32,-35,-39,-42,-45,-48,-51,-54,-57,-60,-63,-65,-68,-71,-73,-76,-78,-80,-83,-85,-87,-89,-91,-93,-95,-97,-99,-101,-103,-104,-106,-108,-109,-111,-112,-113,-115,-116,-117,-118,-119,-121,-122,-123,-123,-124,-125,-126,-127,-127,-128,-129,-129,-130,-130,-131,-131,-131,-132,-132,-132,-132,-132,-132,-132,-132,-132,-132,-132,-132,-132,-131,-131,-131,-130,-130,-130,-129,-129,-128,-127,-127,-126,-125,-125,-124,-123,-122,-121,-120,-119,-118,-117,-116,-115,-114,-112,-111,-110,-108,-107,-106,-104,-103,-101,-100,-98,-96,-95,-93,-91,-89,-87,-86,-84,-82,-80,-78,-75,-73,-71,-69,-66}, +{-11,-15,-18,-22,-25,-28,-32,-35,-38,-41,-44,-47,-50,-53,-56,-59,-61,-64,-67,-69,-72,-74,-76,-79,-81,-83,-85,-87,-89,-91,-93,-95,-97,-99,-100,-102,-104,-105,-107,-108,-109,-111,-112,-113,-114,-116,-117,-118,-119,-120,-120,-121,-122,-123,-123,-124,-125,-125,-126,-126,-127,-127,-127,-128,-128,-128,-128,-128,-129,-129,-129,-129,-128,-128,-128,-128,-128,-127,-127,-127,-126,-126,-125,-125,-124,-124,-123,-122,-122,-121,-120,-119,-118,-117,-117,-116,-115,-113,-112,-111,-110,-109,-108,-106,-105,-104,-102,-101,-99,-98,-96,-95,-93,-91,-89,-88,-86,-84,-82,-80,-78,-76,-74,-72,-70,-68,-65,-63}, +{-7,-11,-14,-18,-21,-25,-28,-31,-34,-37,-40,-43,-46,-49,-52,-55,-57,-60,-63,-65,-68,-70,-72,-75,-77,-79,-81,-83,-85,-87,-89,-91,-93,-95,-96,-98,-100,-101,-103,-104,-105,-107,-108,-109,-110,-112,-113,-114,-115,-116,-117,-117,-118,-119,-120,-120,-121,-121,-122,-122,-123,-123,-124,-124,-124,-124,-125,-125,-125,-125,-125,-125,-125,-125,-124,-124,-124,-124,-123,-123,-123,-122,-122,-121,-121,-120,-119,-119,-118,-117,-116,-116,-115,-114,-113,-112,-111,-110,-109,-108,-107,-105,-104,-103,-101,-100,-99,-97,-96,-94,-93,-91,-89,-88,-86,-84,-82,-81,-79,-77,-75,-73,-71,-68,-66,-64,-62,-60}, +{-4,-7,-11,-14,-18,-21,-24,-27,-30,-34,-37,-40,-42,-45,-48,-51,-54,-56,-59,-61,-64,-66,-69,-71,-73,-75,-77,-79,-81,-83,-85,-87,-89,-91,-92,-94,-96,-97,-99,-100,-102,-103,-104,-105,-107,-108,-109,-110,-111,-112,-113,-114,-114,-115,-116,-116,-117,-118,-118,-119,-119,-119,-120,-120,-120,-121,-121,-121,-121,-121,-121,-121,-121,-121,-121,-121,-120,-120,-120,-119,-119,-119,-118,-118,-117,-116,-116,-115,-114,-114,-113,-112,-111,-110,-109,-108,-107,-106,-105,-104,-103,-102,-101,-99,-98,-97,-95,-94,-92,-91,-89,-88,-86,-84,-83,-81,-79,-77,-75,-73,-71,-69,-67,-65,-63,-61,-58,-56}, +{0,-4,-7,-10,-14,-17,-20,-24,-27,-30,-33,-36,-39,-42,-44,-47,-50,-52,-55,-57,-60,-62,-65,-67,-69,-71,-73,-76,-78,-80,-81,-83,-85,-87,-89,-90,-92,-93,-95,-96,-98,-99,-100,-101,-103,-104,-105,-106,-107,-108,-109,-110,-110,-111,-112,-113,-113,-114,-114,-115,-115,-116,-116,-116,-117,-117,-117,-117,-117,-117,-117,-117,-117,-117,-117,-117,-117,-116,-116,-116,-115,-115,-114,-114,-113,-113,-112,-111,-111,-110,-109,-108,-108,-107,-106,-105,-104,-103,-102,-101,-99,-98,-97,-96,-94,-93,-92,-90,-89,-87,-86,-84,-82,-81,-79,-77,-75,-74,-72,-70,-68,-66,-64,-62,-59,-57,-55,-53}, +{4,0,-3,-7,-10,-13,-17,-20,-23,-26,-29,-32,-35,-38,-40,-43,-46,-48,-51,-54,-56,-58,-61,-63,-65,-67,-70,-72,-74,-76,-78,-79,-81,-83,-85,-86,-88,-89,-91,-92,-94,-95,-96,-98,-99,-100,-101,-102,-103,-104,-105,-106,-107,-107,-108,-109,-109,-110,-111,-111,-111,-112,-112,-113,-113,-113,-113,-113,-113,-114,-114,-114,-114,-113,-113,-113,-113,-113,-112,-112,-112,-111,-111,-110,-110,-109,-109,-108,-107,-106,-106,-105,-104,-103,-102,-101,-100,-99,-98,-97,-96,-95,-93,-92,-91,-89,-88,-87,-85,-84,-82,-81,-79,-77,-76,-74,-72,-70,-68,-66,-64,-62,-60,-58,-56,-54,-51,-49}, +{7,4,0,-3,-6,-10,-13,-16,-19,-22,-25,-28,-31,-34,-37,-39,-42,-45,-47,-50,-52,-55,-57,-59,-61,-64,-66,-68,-70,-72,-74,-75,-77,-79,-81,-82,-84,-86,-87,-88,-90,-91,-92,-94,-95,-96,-97,-98,-99,-100,-101,-102,-103,-104,-104,-105,-106,-106,-107,-107,-108,-108,-108,-109,-109,-109,-109,-110,-110,-110,-110,-110,-110,-110,-110,-109,-109,-109,-109,-108,-108,-108,-107,-107,-106,-105,-105,-104,-104,-103,-102,-101,-100,-100,-99,-98,-97,-96,-95,-93,-92,-91,-90,-89,-87,-86,-85,-83,-82,-80,-79,-77,-75,-74,-72,-70,-68,-67,-65,-63,-61,-59,-57,-55,-52,-50,-48,-46}, +{11,7,4,1,-3,-6,-9,-12,-15,-19,-21,-24,-27,-30,-33,-36,-38,-41,-43,-46,-48,-51,-53,-55,-58,-60,-62,-64,-66,-68,-70,-72,-73,-75,-77,-78,-80,-82,-83,-85,-86,-87,-89,-90,-91,-92,-93,-94,-95,-96,-97,-98,-99,-100,-100,-101,-102,-102,-103,-103,-104,-104,-105,-105,-105,-106,-106,-106,-106,-106,-106,-106,-106,-106,-106,-106,-105,-105,-105,-105,-104,-104,-103,-103,-102,-102,-101,-101,-100,-99,-98,-98,-97,-96,-95,-94,-93,-92,-91,-90,-89,-88,-86,-85,-84,-82,-81,-80,-78,-77,-75,-74,-72,-70,-69,-67,-65,-63,-61,-59,-57,-55,-53,-51,-49,-47,-44,-42}, +{14,11,8,4,1,-2,-6,-9,-12,-15,-18,-21,-24,-26,-29,-32,-34,-37,-40,-42,-45,-47,-49,-51,-54,-56,-58,-60,-62,-64,-66,-68,-70,-71,-73,-75,-76,-78,-79,-81,-82,-83,-85,-86,-87,-88,-89,-91,-92,-92,-93,-94,-95,-96,-97,-97,-98,-99,-99,-100,-100,-100,-101,-101,-102,-102,-102,-102,-102,-102,-102,-102,-102,-102,-102,-102,-102,-102,-101,-101,-101,-100,-100,-99,-99,-98,-98,-97,-96,-96,-95,-94,-93,-92,-91,-91,-90,-89,-87,-86,-85,-84,-83,-82,-80,-79,-78,-76,-75,-73,-72,-70,-68,-67,-65,-63,-61,-60,-58,-56,-54,-52,-50,-48,-45,-43,-41,-39}, +{18,15,11,8,5,1,-2,-5,-8,-11,-14,-17,-20,-23,-25,-28,-31,-33,-36,-38,-41,-43,-45,-48,-50,-52,-54,-56,-58,-60,-62,-64,-66,-67,-69,-71,-72,-74,-75,-77,-78,-80,-81,-82,-83,-85,-86,-87,-88,-89,-90,-90,-91,-92,-93,-93,-94,-95,-95,-96,-96,-97,-97,-97,-98,-98,-98,-98,-99,-99,-99,-99,-99,-99,-98,-98,-98,-98,-98,-97,-97,-97,-96,-96,-95,-95,-94,-93,-93,-92,-91,-90,-90,-89,-88,-87,-86,-85,-84,-83,-82,-80,-79,-78,-77,-75,-74,-73,-71,-70,-68,-66,-65,-63,-61,-60,-58,-56,-54,-52,-50,-48,-46,-44,-42,-40,-37,-35}, +{22,18,15,11,8,5,2,-1,-4,-7,-10,-13,-16,-19,-22,-24,-27,-30,-32,-34,-37,-39,-42,-44,-46,-48,-50,-52,-54,-56,-58,-60,-62,-64,-65,-67,-69,-70,-72,-73,-74,-76,-77,-78,-80,-81,-82,-83,-84,-85,-86,-87,-87,-88,-89,-90,-90,-91,-92,-92,-93,-93,-93,-94,-94,-94,-94,-95,-95,-95,-95,-95,-95,-95,-95,-95,-94,-94,-94,-94,-93,-93,-92,-92,-91,-91,-90,-90,-89,-88,-88,-87,-86,-85,-84,-83,-82,-81,-80,-79,-78,-77,-76,-74,-73,-72,-70,-69,-68,-66,-65,-63,-61,-60,-58,-56,-54,-53,-51,-49,-47,-45,-43,-40,-38,-36,-34,-31}, +{25,22,18,15,12,9,5,2,-1,-4,-7,-10,-12,-15,-18,-21,-23,-26,-28,-31,-33,-36,-38,-40,-42,-44,-47,-49,-51,-53,-54,-56,-58,-60,-61,-63,-65,-66,-68,-69,-71,-72,-73,-75,-76,-77,-78,-79,-80,-81,-82,-83,-84,-84,-85,-86,-87,-87,-88,-88,-89,-89,-90,-90,-90,-91,-91,-91,-91,-91,-91,-91,-91,-91,-91,-91,-91,-91,-90,-90,-90,-89,-89,-88,-88,-87,-87,-86,-85,-85,-84,-83,-82,-82,-81,-80,-79,-78,-77,-76,-75,-73,-72,-71,-70,-68,-67,-65,-64,-63,-61,-59,-58,-56,-54,-53,-51,-49,-47,-45,-43,-41,-39,-37,-35,-33,-30,-28}, +{29,25,22,19,15,12,9,6,3,0,-3,-6,-9,-11,-14,-17,-19,-22,-25,-27,-29,-32,-34,-36,-38,-41,-43,-45,-47,-49,-51,-52,-54,-56,-58,-59,-61,-62,-64,-65,-67,-68,-69,-71,-72,-73,-74,-75,-76,-77,-78,-79,-80,-81,-81,-82,-83,-83,-84,-85,-85,-85,-86,-86,-87,-87,-87,-87,-87,-87,-88,-88,-88,-87,-87,-87,-87,-87,-87,-86,-86,-86,-85,-85,-84,-84,-83,-82,-82,-81,-80,-80,-79,-78,-77,-76,-75,-74,-73,-72,-71,-70,-69,-67,-66,-65,-63,-62,-60,-59,-57,-56,-54,-53,-51,-49,-47,-45,-44,-42,-40,-38,-36,-33,-31,-29,-27,-24}, +{32,29,25,22,19,16,13,10,7,4,1,-2,-5,-8,-10,-13,-16,-18,-21,-23,-26,-28,-30,-33,-35,-37,-39,-41,-43,-45,-47,-49,-50,-52,-54,-56,-57,-59,-60,-62,-63,-64,-66,-67,-68,-69,-70,-71,-72,-73,-74,-75,-76,-77,-78,-78,-79,-80,-80,-81,-81,-82,-82,-82,-83,-83,-83,-83,-84,-84,-84,-84,-84,-84,-84,-84,-83,-83,-83,-83,-82,-82,-82,-81,-81,-80,-79,-79,-78,-78,-77,-76,-75,-74,-74,-73,-72,-71,-70,-69,-67,-66,-65,-64,-62,-61,-60,-58,-57,-55,-54,-52,-51,-49,-47,-46,-44,-42,-40,-38,-36,-34,-32,-30,-28,-25,-23,-21}, +{36,32,29,26,22,19,16,13,10,7,4,1,-1,-4,-7,-9,-12,-15,-17,-20,-22,-24,-27,-29,-31,-33,-35,-37,-39,-41,-43,-45,-47,-48,-50,-52,-53,-55,-56,-58,-59,-61,-62,-63,-64,-65,-67,-68,-69,-70,-71,-71,-72,-73,-74,-75,-75,-76,-76,-77,-78,-78,-78,-79,-79,-79,-80,-80,-80,-80,-80,-80,-80,-80,-80,-80,-80,-80,-79,-79,-79,-78,-78,-77,-77,-76,-76,-75,-75,-74,-73,-72,-72,-71,-70,-69,-68,-67,-66,-65,-64,-63,-61,-60,-59,-58,-56,-55,-53,-52,-50,-49,-47,-45,-44,-42,-40,-38,-36,-35,-33,-31,-28,-26,-24,-22,-20,-17}, +{39,36,32,29,26,23,20,17,14,11,8,5,2,0,-3,-6,-8,-11,-13,-16,-18,-21,-23,-25,-27,-29,-31,-33,-35,-37,-39,-41,-43,-45,-46,-48,-50,-51,-53,-54,-55,-57,-58,-59,-61,-62,-63,-64,-65,-66,-67,-68,-69,-69,-70,-71,-72,-72,-73,-73,-74,-74,-75,-75,-75,-76,-76,-76,-76,-76,-76,-76,-76,-76,-76,-76,-76,-76,-76,-75,-75,-75,-74,-74,-73,-73,-72,-72,-71,-70,-70,-69,-68,-67,-66,-65,-64,-63,-62,-61,-60,-59,-58,-57,-55,-54,-53,-51,-50,-48,-47,-45,-44,-42,-40,-38,-37,-35,-33,-31,-29,-27,-25,-23,-20,-18,-16,-14}, +{43,39,36,33,30,26,23,20,17,14,12,9,6,3,1,-2,-5,-7,-10,-12,-15,-17,-19,-21,-24,-26,-28,-30,-32,-34,-36,-37,-39,-41,-43,-44,-46,-47,-49,-50,-52,-53,-54,-56,-57,-58,-59,-60,-61,-62,-63,-64,-65,-66,-66,-67,-68,-68,-69,-70,-70,-71,-71,-71,-72,-72,-72,-72,-73,-73,-73,-73,-73,-73,-73,-73,-72,-72,-72,-72,-71,-71,-71,-70,-70,-69,-69,-68,-67,-67,-66,-65,-64,-64,-63,-62,-61,-60,-59,-58,-57,-56,-54,-53,-52,-50,-49,-48,-46,-45,-43,-42,-40,-38,-37,-35,-33,-31,-29,-27,-25,-23,-21,-19,-17,-15,-12,-10}, +{46,43,39,36,33,30,27,24,21,18,15,12,10,7,4,2,-1,-4,-6,-8,-11,-13,-15,-18,-20,-22,-24,-26,-28,-30,-32,-34,-35,-37,-39,-40,-42,-44,-45,-46,-48,-49,-51,-52,-53,-54,-55,-56,-57,-58,-59,-60,-61,-62,-63,-63,-64,-65,-65,-66,-66,-67,-67,-68,-68,-68,-68,-69,-69,-69,-69,-69,-69,-69,-69,-69,-69,-69,-68,-68,-68,-67,-67,-67,-66,-66,-65,-64,-64,-63,-62,-62,-61,-60,-59,-58,-57,-56,-55,-54,-53,-52,-51,-50,-48,-47,-46,-44,-43,-41,-40,-38,-36,-35,-33,-31,-30,-28,-26,-24,-22,-20,-18,-16,-13,-11,-9,-6}, +{49,46,43,40,37,33,30,27,24,22,19,16,13,10,8,5,3,0,-2,-5,-7,-9,-12,-14,-16,-18,-20,-22,-24,-26,-28,-30,-32,-33,-35,-37,-38,-40,-41,-43,-44,-45,-47,-48,-49,-50,-52,-53,-54,-55,-56,-56,-57,-58,-59,-60,-60,-61,-62,-62,-63,-63,-63,-64,-64,-65,-65,-65,-65,-65,-65,-65,-65,-65,-65,-65,-65,-65,-65,-64,-64,-64,-63,-63,-62,-62,-61,-61,-60,-59,-59,-58,-57,-56,-56,-55,-54,-53,-52,-51,-50,-48,-47,-46,-45,-43,-42,-41,-39,-38,-36,-35,-33,-31,-30,-28,-26,-24,-22,-20,-18,-16,-14,-12,-10,-7,-5,-3}, +{53,50,46,43,40,37,34,31,28,25,22,19,17,14,11,9,6,4,1,-1,-3,-6,-8,-10,-12,-15,-17,-19,-21,-22,-24,-26,-28,-30,-31,-33,-35,-36,-38,-39,-40,-42,-43,-44,-46,-47,-48,-49,-50,-51,-52,-53,-54,-54,-55,-56,-57,-57,-58,-58,-59,-59,-60,-60,-61,-61,-61,-61,-61,-62,-62,-62,-62,-62,-62,-62,-61,-61,-61,-61,-60,-60,-60,-59,-59,-58,-58,-57,-57,-56,-55,-54,-54,-53,-52,-51,-50,-49,-48,-47,-46,-45,-44,-42,-41,-40,-38,-37,-36,-34,-33,-31,-29,-28,-26,-24,-22,-21,-19,-17,-15,-13,-10,-8,-6,-4,-1,1}, +{56,53,50,47,44,40,37,34,32,29,26,23,20,18,15,12,10,7,5,3,0,-2,-4,-7,-9,-11,-13,-15,-17,-19,-21,-22,-24,-26,-28,-29,-31,-32,-34,-35,-37,-38,-39,-41,-42,-43,-44,-45,-46,-47,-48,-49,-50,-51,-51,-52,-53,-54,-54,-55,-55,-56,-56,-56,-57,-57,-57,-58,-58,-58,-58,-58,-58,-58,-58,-58,-58,-58,-57,-57,-57,-56,-56,-56,-55,-55,-54,-54,-53,-52,-52,-51,-50,-49,-48,-47,-47,-46,-44,-43,-42,-41,-40,-39,-37,-36,-35,-33,-32,-30,-29,-27,-26,-24,-22,-21,-19,-17,-15,-13,-11,-9,-7,-5,-2,0,2,5}, +{60,56,53,50,47,44,41,38,35,32,29,27,24,21,19,16,13,11,9,6,4,2,-1,-3,-5,-7,-9,-11,-13,-15,-17,-19,-20,-22,-24,-26,-27,-29,-30,-32,-33,-34,-36,-37,-38,-39,-40,-41,-42,-43,-44,-45,-46,-47,-48,-48,-49,-50,-50,-51,-51,-52,-52,-53,-53,-53,-54,-54,-54,-54,-54,-54,-54,-54,-54,-54,-54,-54,-54,-53,-53,-53,-52,-52,-52,-51,-50,-50,-49,-49,-48,-47,-46,-46,-45,-44,-43,-42,-41,-40,-39,-38,-36,-35,-34,-33,-31,-30,-28,-27,-25,-24,-22,-20,-19,-17,-15,-13,-11,-9,-7,-5,-3,-1,1,3,6,8}, +{63,60,57,54,50,47,44,41,39,36,33,30,27,25,22,20,17,15,12,10,7,5,3,1,-1,-3,-6,-8,-9,-11,-13,-15,-17,-19,-20,-22,-23,-25,-26,-28,-29,-31,-32,-33,-34,-36,-37,-38,-39,-40,-41,-42,-42,-43,-44,-45,-45,-46,-47,-47,-48,-48,-49,-49,-49,-50,-50,-50,-50,-51,-51,-51,-51,-51,-51,-51,-50,-50,-50,-50,-49,-49,-49,-48,-48,-47,-47,-46,-46,-45,-44,-44,-43,-42,-41,-40,-39,-38,-37,-36,-35,-34,-33,-32,-30,-29,-28,-26,-25,-23,-22,-20,-19,-17,-15,-13,-12,-10,-8,-6,-4,-2,0,3,5,7,10,12}, +{66,63,60,57,54,51,48,45,42,39,36,34,31,28,26,23,21,18,16,13,11,9,7,4,2,0,-2,-4,-6,-8,-10,-11,-13,-15,-16,-18,-20,-21,-23,-24,-26,-27,-28,-29,-31,-32,-33,-34,-35,-36,-37,-38,-39,-40,-40,-41,-42,-42,-43,-44,-44,-45,-45,-45,-46,-46,-46,-47,-47,-47,-47,-47,-47,-47,-47,-47,-47,-47,-46,-46,-46,-46,-45,-45,-44,-44,-43,-43,-42,-41,-41,-40,-39,-38,-38,-37,-36,-35,-34,-33,-32,-30,-29,-28,-27,-25,-24,-23,-21,-20,-18,-17,-15,-13,-12,-10,-8,-6,-4,-2,0,2,4,6,9,11,13,16}, +{70,67,63,60,57,54,51,48,46,43,40,37,34,32,29,27,24,22,19,17,15,12,10,8,6,4,2,0,-2,-4,-6,-8,-9,-11,-13,-14,-16,-18,-19,-20,-22,-23,-24,-26,-27,-28,-29,-30,-31,-32,-33,-34,-35,-36,-37,-37,-38,-39,-39,-40,-40,-41,-41,-42,-42,-42,-43,-43,-43,-43,-43,-43,-43,-43,-43,-43,-43,-43,-43,-43,-42,-42,-42,-41,-41,-40,-40,-39,-38,-38,-37,-36,-36,-35,-34,-33,-32,-31,-30,-29,-28,-27,-26,-24,-23,-22,-20,-19,-18,-16,-15,-13,-11,-10,-8,-6,-4,-2,0,1,4,6,8,10,12,15,17,19}, +{73,70,67,64,61,58,55,52,49,46,43,41,38,35,33,30,28,25,23,21,18,16,14,12,10,7,5,3,1,0,-2,-4,-6,-7,-9,-11,-12,-14,-15,-17,-18,-19,-21,-22,-23,-24,-26,-27,-28,-29,-30,-30,-31,-32,-33,-34,-34,-35,-36,-36,-37,-37,-38,-38,-38,-39,-39,-39,-39,-40,-40,-40,-40,-40,-40,-40,-39,-39,-39,-39,-39,-38,-38,-37,-37,-37,-36,-35,-35,-34,-33,-33,-32,-31,-30,-29,-28,-28,-26,-25,-24,-23,-22,-21,-19,-18,-17,-15,-14,-12,-11,-9,-8,-6,-4,-2,-1,1,3,5,7,9,11,14,16,18,21,23}, +{77,73,70,67,64,61,58,55,52,50,47,44,42,39,36,34,31,29,26,24,22,20,17,15,13,11,9,7,5,3,1,0,-2,-4,-5,-7,-9,-10,-12,-13,-14,-16,-17,-18,-20,-21,-22,-23,-24,-25,-26,-27,-28,-28,-29,-30,-31,-31,-32,-33,-33,-34,-34,-34,-35,-35,-35,-36,-36,-36,-36,-36,-36,-36,-36,-36,-36,-36,-35,-35,-35,-35,-34,-34,-33,-33,-32,-32,-31,-31,-30,-29,-28,-28,-27,-26,-25,-24,-23,-22,-21,-20,-18,-17,-16,-15,-13,-12,-10,-9,-7,-6,-4,-2,-1,1,3,5,7,9,11,13,15,17,20,22,24,27}, +{80,77,74,71,68,65,62,59,56,53,50,48,45,42,40,37,35,32,30,28,25,23,21,19,17,15,13,11,9,7,5,3,2,0,-2,-3,-5,-7,-8,-9,-11,-12,-13,-15,-16,-17,-18,-19,-20,-21,-22,-23,-24,-25,-26,-26,-27,-28,-28,-29,-29,-30,-30,-31,-31,-31,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-31,-31,-31,-30,-30,-29,-29,-28,-28,-27,-26,-26,-25,-24,-23,-22,-21,-20,-19,-18,-17,-16,-15,-14,-12,-11,-10,-8,-7,-5,-4,-2,0,1,3,5,7,9,10,12,15,17,19,21,23,26,28,31}, +{83,80,77,74,71,68,65,62,59,57,54,51,48,46,43,41,38,36,34,31,29,27,25,22,20,18,16,14,12,11,9,7,5,3,2,0,-1,-3,-4,-6,-7,-8,-10,-11,-12,-13,-15,-16,-17,-18,-19,-19,-20,-21,-22,-23,-23,-24,-25,-25,-26,-26,-27,-27,-27,-28,-28,-28,-28,-29,-29,-29,-29,-29,-29,-29,-29,-28,-28,-28,-28,-27,-27,-27,-26,-26,-25,-25,-24,-23,-23,-22,-21,-20,-19,-19,-18,-17,-16,-15,-13,-12,-11,-10,-9,-7,-6,-5,-3,-2,0,2,3,5,7,8,10,12,14,16,18,20,23,25,27,29,32,34}, +{86,83,80,77,74,71,68,66,63,60,57,55,52,49,47,44,42,39,37,35,33,30,28,26,24,22,20,18,16,14,12,11,9,7,5,4,2,1,-1,-2,-3,-5,-6,-7,-9,-10,-11,-12,-13,-14,-15,-16,-17,-17,-18,-19,-20,-20,-21,-21,-22,-23,-23,-23,-24,-24,-24,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,-24,-24,-24,-23,-23,-22,-22,-21,-21,-20,-20,-19,-18,-17,-17,-16,-15,-14,-13,-12,-11,-10,-9,-7,-6,-5,-4,-2,-1,1,2,4,5,7,9,10,12,14,16,18,20,22,24,26,28,31,33,36,38}, +{90,87,84,81,78,75,72,69,66,63,61,58,55,53,50,48,45,43,41,38,36,34,32,30,27,25,23,21,20,18,16,14,12,11,9,7,6,4,3,2,0,-1,-2,-4,-5,-6,-7,-8,-9,-10,-11,-12,-13,-14,-15,-15,-16,-17,-17,-18,-18,-19,-19,-20,-20,-20,-21,-21,-21,-21,-21,-21,-22,-22,-21,-21,-21,-21,-21,-21,-20,-20,-20,-19,-19,-18,-18,-17,-17,-16,-15,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-1,0,1,3,4,6,7,9,11,12,14,16,18,20,22,24,26,28,30,32,35,37,39,42}, +{93,90,87,84,81,78,75,72,70,67,64,62,59,56,54,51,49,47,44,42,40,37,35,33,31,29,27,25,23,21,20,18,16,14,13,11,10,8,7,5,4,2,1,0,-1,-2,-4,-5,-6,-7,-8,-8,-9,-10,-11,-12,-12,-13,-14,-14,-15,-15,-16,-16,-16,-17,-17,-17,-17,-18,-18,-18,-18,-18,-18,-18,-18,-17,-17,-17,-17,-16,-16,-16,-15,-15,-14,-14,-13,-12,-12,-11,-10,-9,-9,-8,-7,-6,-5,-4,-3,-1,0,1,2,4,5,6,8,9,11,13,14,16,18,20,21,23,25,27,29,32,34,36,38,41,43,46}, +{96,93,90,87,84,81,79,76,73,70,68,65,62,60,57,55,52,50,48,45,43,41,39,37,35,33,31,29,27,25,23,21,20,18,16,15,13,12,10,9,7,6,5,4,2,1,0,-1,-2,-3,-4,-5,-6,-6,-7,-8,-9,-9,-10,-11,-11,-12,-12,-12,-13,-13,-13,-14,-14,-14,-14,-14,-14,-14,-14,-14,-14,-14,-14,-13,-13,-13,-12,-12,-12,-11,-11,-10,-9,-9,-8,-7,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,5,6,7,9,10,12,13,15,16,18,20,21,23,25,27,29,31,33,35,38,40,42,45,47,50}, +{100,97,94,91,88,85,82,79,76,74,71,68,66,63,61,58,56,54,51,49,47,44,42,40,38,36,34,32,30,28,27,25,23,22,20,18,17,15,14,12,11,10,8,7,6,5,4,3,2,1,0,-1,-2,-3,-4,-4,-5,-6,-6,-7,-7,-8,-8,-9,-9,-9,-10,-10,-10,-10,-10,-11,-11,-11,-11,-10,-10,-10,-10,-10,-9,-9,-9,-8,-8,-7,-7,-6,-6,-5,-4,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,10,11,12,14,15,17,18,20,22,23,25,27,29,31,33,35,37,39,41,44,46,48,51,53}, +{103,100,97,94,91,88,85,83,80,77,74,72,69,67,64,62,59,57,55,52,50,48,46,44,42,40,38,36,34,32,30,29,27,25,24,22,20,19,17,16,15,13,12,11,10,9,7,6,5,4,3,2,2,1,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-5,-6,-6,-6,-7,-7,-7,-7,-7,-7,-7,-7,-7,-7,-6,-6,-6,-5,-5,-5,-4,-4,-3,-3,-2,-1,-1,0,1,2,2,3,4,5,6,7,8,10,11,12,13,15,16,17,19,20,22,24,25,27,29,31,33,34,36,39,41,43,45,47,50,52,55,57}, +{106,103,100,97,94,92,89,86,83,80,78,75,73,70,68,65,63,60,58,56,54,52,49,47,45,43,41,39,37,36,34,32,30,29,27,26,24,23,21,20,18,17,16,14,13,12,11,10,9,8,7,6,5,4,4,3,2,2,1,0,0,-1,-1,-1,-2,-2,-2,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-2,-2,-2,-1,-1,-1,0,0,1,2,2,3,4,4,5,6,7,8,9,10,11,12,13,14,16,17,18,20,21,23,24,26,27,29,31,33,34,36,38,40,42,44,47,49,51,54,56,59,61}, +{109,106,104,101,98,95,92,89,87,84,81,79,76,74,71,69,66,64,62,59,57,55,53,51,49,47,45,43,41,39,37,36,34,32,31,29,28,26,25,23,22,21,19,18,17,16,15,14,13,12,11,10,9,8,7,7,6,5,5,4,4,3,3,2,2,2,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,2,2,3,3,3,4,5,5,6,7,7,8,9,10,11,12,13,14,15,16,17,18,19,21,22,23,25,26,28,29,31,33,35,36,38,40,42,44,46,48,50,53,55,57,60,62,65}, +{113,110,107,104,101,98,95,93,90,87,85,82,79,77,75,72,70,67,65,63,61,59,56,54,52,50,48,46,45,43,41,39,38,36,34,33,31,30,28,27,26,24,23,22,21,19,18,17,16,15,14,13,13,12,11,10,10,9,8,8,7,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,4,4,5,5,5,5,6,6,7,7,8,8,9,9,10,11,12,12,13,14,15,16,17,18,19,21,22,23,24,26,27,29,30,32,33,35,36,38,40,42,44,46,48,50,52,54,57,59,61,64,66,69}, +{116,113,110,107,104,101,99,96,93,91,88,85,83,80,78,76,73,71,69,66,64,62,60,58,56,54,52,50,48,46,45,43,41,39,38,36,35,33,32,30,29,28,27,25,24,23,22,21,20,19,18,17,16,15,15,14,13,13,12,11,11,10,10,9,9,9,9,8,8,8,8,8,8,8,8,8,8,8,8,8,9,9,9,10,10,11,11,12,12,13,14,15,15,16,17,18,19,20,21,22,23,24,25,27,28,29,31,32,34,35,37,39,40,42,44,46,48,50,52,54,56,58,60,63,65,68,70,73}, +{119,116,113,110,108,105,102,99,97,94,91,89,86,84,81,79,77,74,72,70,68,65,63,61,59,57,55,53,52,50,48,46,45,43,41,40,38,37,35,34,33,31,30,29,28,27,26,24,23,22,22,21,20,19,18,17,17,16,16,15,14,14,14,13,13,12,12,12,12,12,11,11,11,11,11,11,12,12,12,12,12,13,13,14,14,14,15,16,16,17,17,18,19,20,21,22,23,24,25,26,27,28,29,30,32,33,35,36,37,39,41,42,44,46,48,49,51,53,55,58,60,62,64,67,69,72,74,77}, +{122,120,117,114,111,108,105,103,100,97,95,92,90,87,85,82,80,78,75,73,71,69,67,65,63,61,59,57,55,53,52,50,48,47,45,43,42,40,39,38,36,35,34,33,31,30,29,28,27,26,25,24,23,23,22,21,20,20,19,19,18,18,17,17,16,16,16,16,15,15,15,15,15,15,15,15,15,15,16,16,16,16,17,17,18,18,19,19,20,20,21,22,23,23,24,25,26,27,28,29,30,32,33,34,35,37,38,40,41,43,44,46,48,50,51,53,55,57,59,61,64,66,68,71,73,76,78,81}, +{126,123,120,117,114,111,109,106,103,101,98,96,93,91,88,86,83,81,79,77,75,72,70,68,66,64,62,61,59,57,55,53,52,50,49,47,46,44,43,41,40,39,37,36,35,34,33,32,31,30,29,28,27,26,25,25,24,23,23,22,22,21,21,20,20,20,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,21,21,22,22,23,23,24,25,26,26,27,28,29,30,31,32,33,34,35,37,38,39,41,42,43,45,47,48,50,52,53,55,57,59,61,63,65,68,70,72,75,77,80,82,85}, +{129,126,123,120,117,115,112,109,107,104,101,99,96,94,92,89,87,85,82,80,78,76,74,72,70,68,66,64,62,60,59,57,55,54,52,51,49,48,46,45,43,42,41,40,39,37,36,35,34,33,32,32,31,30,29,28,28,27,26,26,25,25,24,24,24,23,23,23,23,22,22,22,22,22,22,22,22,23,23,23,23,24,24,24,25,25,26,27,27,28,28,29,30,31,32,33,34,35,36,37,38,39,40,42,43,44,46,47,49,50,52,54,55,57,59,61,63,65,67,69,71,74,76,78,81,84,86,89}, +{132,129,126,124,121,118,115,113,110,107,105,102,100,97,95,93,90,88,86,84,81,79,77,75,73,71,69,68,66,64,62,61,59,57,56,54,53,51,50,48,47,46,45,43,42,41,40,39,38,37,36,35,34,33,33,32,31,31,30,30,29,29,28,28,27,27,27,26,26,26,26,26,26,26,26,26,26,26,27,27,27,27,28,28,29,29,30,30,31,31,32,33,34,35,35,36,37,38,39,40,42,43,44,45,47,48,49,51,53,54,56,57,59,61,63,65,67,69,71,73,75,78,80,82,85,88,90,93}, +{135,132,130,127,124,121,119,116,113,111,108,106,103,101,98,96,94,91,89,87,85,83,81,79,77,75,73,71,69,67,66,64,62,61,59,58,56,55,53,52,51,49,48,47,46,45,44,42,41,41,40,39,38,37,36,36,35,34,34,33,33,32,32,31,31,31,30,30,30,30,30,30,30,30,30,30,30,30,30,30,31,31,31,32,32,33,33,34,35,35,36,37,37,38,39,40,41,42,43,44,45,47,48,49,50,52,53,55,56,58,60,61,63,65,67,69,71,73,75,77,79,82,84,86,89,92,94,97}, +{139,136,133,130,127,125,122,119,117,114,111,109,107,104,102,99,97,95,93,90,88,86,84,82,80,78,76,75,73,71,69,68,66,64,63,61,60,58,57,56,54,53,52,50,49,48,47,46,45,44,43,42,42,41,40,39,39,38,37,37,36,36,35,35,35,34,34,34,34,33,33,33,33,33,33,33,33,34,34,34,34,35,35,35,36,36,37,38,38,39,40,40,41,42,43,44,45,46,47,48,49,50,52,53,54,56,57,59,60,62,63,65,67,69,71,73,75,77,79,81,83,86,88,90,93,96,98,101}, +{142,139,136,133,131,128,125,122,120,117,115,112,110,107,105,103,101,98,96,94,92,90,88,86,84,82,80,78,76,74,73,71,69,68,66,65,63,62,60,59,58,56,55,54,53,52,51,50,49,48,47,46,45,44,44,43,42,42,41,40,40,39,39,39,38,38,38,37,37,37,37,37,37,37,37,37,37,37,38,38,38,38,39,39,40,40,41,41,42,43,43,44,45,46,47,47,48,49,51,52,53,54,55,57,58,59,61,62,64,66,67,69,71,73,74,76,78,81,83,85,87,90,92,95,97,100,103,105}, +{145,142,139,137,134,131,128,126,123,121,118,116,113,111,108,106,104,102,99,97,95,93,91,89,87,85,83,82,80,78,76,75,73,71,70,68,67,65,64,63,61,60,59,58,56,55,54,53,52,51,50,50,49,48,47,46,46,45,45,44,44,43,43,42,42,42,41,41,41,41,41,41,41,41,41,41,41,41,41,41,42,42,42,43,43,44,44,45,46,46,47,48,49,49,50,51,52,53,54,55,57,58,59,60,62,63,65,66,68,69,71,73,75,76,78,80,82,84,87,89,91,94,96,99,101,104,107,110}, +{148,145,143,140,137,134,132,129,127,124,121,119,117,114,112,110,107,105,103,101,99,97,95,93,91,89,87,85,83,81,80,78,76,75,73,72,70,69,68,66,65,64,62,61,60,59,58,57,56,55,54,53,52,52,51,50,49,49,48,48,47,47,46,46,46,45,45,45,45,44,44,44,44,44,44,44,44,45,45,45,45,46,46,47,47,48,48,49,49,50,51,51,52,53,54,55,56,57,58,59,60,62,63,64,66,67,68,70,72,73,75,77,78,80,82,84,86,88,91,93,95,98,100,103,105,108,111,114}, +{151,149,146,143,140,138,135,132,130,127,125,122,120,118,115,113,111,108,106,104,102,100,98,96,94,92,90,88,87,85,83,82,80,78,77,75,74,72,71,70,68,67,66,65,64,63,61,60,59,59,58,57,56,55,54,54,53,52,52,51,51,50,50,50,49,49,49,48,48,48,48,48,48,48,48,48,48,48,49,49,49,49,50,50,51,51,52,52,53,54,54,55,56,57,58,59,60,61,62,63,64,65,67,68,69,71,72,74,75,77,79,81,82,84,86,88,90,92,95,97,99,102,104,107,109,112,115,118}, +{155,152,149,146,144,141,138,136,133,131,128,126,123,121,119,116,114,112,110,108,105,103,101,99,98,96,94,92,90,88,87,85,83,82,80,79,77,76,75,73,72,71,70,68,67,66,65,64,63,62,61,60,60,59,58,57,57,56,55,55,54,54,54,53,53,52,52,52,52,52,52,52,51,52,52,52,52,52,52,52,53,53,54,54,54,55,55,56,57,57,58,59,60,61,61,62,63,64,66,67,68,69,70,72,73,75,76,78,79,81,83,84,86,88,90,92,94,96,99,101,103,106,108,111,114,116,119,122}, +{158,155,152,149,147,144,141,139,136,134,131,129,127,124,122,120,117,115,113,111,109,107,105,103,101,99,97,95,94,92,90,89,87,85,84,82,81,80,78,77,76,74,73,72,71,70,69,68,67,66,65,64,63,62,62,61,60,60,59,59,58,58,57,57,56,56,56,56,55,55,55,55,55,55,55,55,55,56,56,56,56,57,57,58,58,59,59,60,60,61,62,63,63,64,65,66,67,68,69,71,72,73,74,76,77,78,80,82,83,85,87,88,90,92,94,96,98,100,103,105,107,110,112,115,118,121,124,127}, +{161,158,155,153,150,147,145,142,140,137,135,132,130,128,125,123,121,119,116,114,112,110,108,106,104,103,101,99,97,95,94,92,90,89,87,86,84,83,82,80,79,78,77,75,74,73,72,71,70,69,68,68,67,66,65,65,64,63,63,62,62,61,61,60,60,60,60,59,59,59,59,59,59,59,59,59,59,59,60,60,60,61,61,61,62,62,63,64,64,65,66,66,67,68,69,70,71,72,73,74,76,77,78,79,81,82,84,85,87,89,90,92,94,96,98,100,102,104,107,109,112,114,117,119,122,125,128,131}, +{164,161,159,156,153,151,148,145,143,140,138,136,133,131,129,126,124,122,120,118,116,114,112,110,108,106,104,102,101,99,97,96,94,92,91,89,88,87,85,84,83,81,80,79,78,77,76,75,74,73,72,71,70,70,69,68,68,67,66,66,65,65,64,64,64,63,63,63,63,63,63,63,62,63,63,63,63,63,63,64,64,64,65,65,66,66,67,67,68,69,69,70,71,72,73,74,75,76,77,78,79,81,82,83,85,86,88,89,91,93,94,96,98,100,102,104,106,109,111,113,116,118,121,124,126,129,132,135}, +{167,165,162,159,156,154,151,149,146,144,141,139,137,134,132,130,128,125,123,121,119,117,115,113,111,109,108,106,104,102,101,99,97,96,94,93,92,90,89,87,86,85,84,83,81,80,79,78,77,76,76,75,74,73,72,72,71,71,70,69,69,68,68,68,67,67,67,67,66,66,66,66,66,66,66,66,67,67,67,67,68,68,68,69,69,70,70,71,72,72,73,74,75,76,77,78,79,80,81,82,83,84,86,87,89,90,92,93,95,97,98,100,102,104,106,108,110,113,115,117,120,122,125,128,131,134,137,140}, +{170,168,165,162,160,157,155,152,150,147,145,142,140,138,135,133,131,129,127,125,123,120,119,117,115,113,111,109,108,106,104,103,101,99,98,96,95,94,92,91,90,89,87,86,85,84,83,82,81,80,79,78,78,77,76,75,75,74,74,73,73,72,72,71,71,71,70,70,70,70,70,70,70,70,70,70,70,70,71,71,71,72,72,73,73,74,74,75,75,76,77,78,79,79,80,81,82,83,85,86,87,88,90,91,93,94,96,97,99,101,102,104,106,108,110,112,114,117,119,122,124,127,129,132,135,138,141,144}, +{174,171,168,166,163,160,158,155,153,150,148,146,143,141,139,136,134,132,130,128,126,124,122,120,118,116,114,113,111,109,108,106,104,103,101,100,99,97,96,95,93,92,91,90,89,88,87,86,85,84,83,82,81,80,80,79,78,78,77,77,76,76,75,75,75,74,74,74,74,74,74,74,74,74,74,74,74,74,74,75,75,75,76,76,77,77,78,79,79,80,81,81,82,83,84,85,86,87,88,90,91,92,94,95,96,98,99,101,103,105,106,108,110,112,114,116,119,121,123,126,128,131,134,136,139,142,145,149}, +{177,174,171,169,166,164,161,159,156,154,151,149,147,144,142,140,138,135,133,131,129,127,125,123,122,120,118,116,114,113,111,110,108,106,105,103,102,101,99,98,97,96,94,93,92,91,90,89,88,87,86,86,85,84,83,83,82,81,81,80,80,79,79,79,78,78,78,78,77,77,77,77,77,77,77,77,78,78,78,78,79,79,80,80,80,81,82,82,83,84,84,85,86,87,88,89,90,91,92,94,95,96,97,99,100,102,103,105,107,109,110,112,114,116,118,121,123,125,127,130,132,135,138,141,144,147,150,153}, +{180,177,175,172,169,167,164,162,159,157,155,152,150,148,145,143,141,139,137,135,133,131,129,127,125,123,121,120,118,116,115,113,111,110,108,107,106,104,103,102,100,99,98,97,96,95,94,93,92,91,90,89,88,88,87,86,86,85,84,84,83,83,83,82,82,82,81,81,81,81,81,81,81,81,81,81,81,82,82,82,82,83,83,84,84,85,85,86,87,87,88,89,90,91,92,93,94,95,96,97,99,100,101,103,104,106,107,109,111,113,114,116,118,120,122,125,127,129,132,134,137,139,142,145,148,151,154,158}, +{183,180,178,175,173,170,168,165,163,160,158,155,153,151,149,146,144,142,140,138,136,134,132,130,128,127,125,123,121,120,118,117,115,113,112,111,109,108,106,105,104,103,102,100,99,98,97,96,95,94,94,93,92,91,91,90,89,89,88,88,87,87,86,86,86,85,85,85,85,85,85,85,85,85,85,85,85,85,86,86,86,87,87,87,88,89,89,90,91,91,92,93,94,95,96,97,98,99,100,101,103,104,105,107,108,110,111,113,115,117,118,120,122,124,127,129,131,133,136,138,141,144,147,150,153,156,159,162}, +{186,184,181,178,176,173,171,168,166,163,161,159,156,154,152,150,148,146,144,141,139,138,136,134,132,130,128,127,125,123,122,120,118,117,115,114,113,111,110,109,107,106,105,104,103,102,101,100,99,98,97,96,96,95,94,93,93,92,92,91,91,90,90,90,89,89,89,89,88,88,88,88,88,88,88,89,89,89,89,90,90,90,91,91,92,92,93,94,94,95,96,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,117,119,121,123,124,127,129,131,133,135,138,140,143,145,148,151,154,157,160,164,167}, +{189,187,184,182,179,176,174,172,169,167,164,162,160,158,155,153,151,149,147,145,143,141,139,137,135,133,132,130,128,127,125,123,122,120,119,118,116,115,113,112,111,110,109,108,106,105,104,103,103,102,101,100,99,98,98,97,96,96,95,95,94,94,94,93,93,93,93,92,92,92,92,92,92,92,92,92,93,93,93,93,94,94,95,95,96,96,97,97,98,99,100,101,101,102,103,104,106,107,108,109,110,112,113,115,116,118,119,121,123,125,127,129,131,133,135,137,140,142,145,147,150,153,156,159,162,165,168,172}, +{193,190,187,185,182,180,177,175,172,170,168,165,163,161,159,157,154,152,150,148,146,144,142,141,139,137,135,133,132,130,129,127,125,124,122,121,120,118,117,116,115,113,112,111,110,109,108,107,106,105,104,104,103,102,101,101,100,100,99,99,98,98,97,97,97,96,96,96,96,96,96,96,96,96,96,96,96,97,97,97,97,98,98,99,99,100,101,101,102,103,104,104,105,106,107,108,109,111,112,113,114,116,117,119,120,122,123,125,127,129,131,133,135,137,139,141,144,146,149,152,154,157,160,163,166,170,173,177}, +{196,193,191,188,185,183,180,178,176,173,171,169,166,164,162,160,158,156,154,152,150,148,146,144,142,140,139,137,135,134,132,130,129,127,126,125,123,122,121,119,118,117,116,115,114,113,112,111,110,109,108,107,106,106,105,104,104,103,103,102,102,101,101,101,100,100,100,100,100,99,99,99,99,100,100,100,100,100,101,101,101,102,102,103,103,104,104,105,106,107,107,108,109,110,111,112,113,115,116,117,118,120,121,123,124,126,128,129,131,133,135,137,139,141,143,146,148,151,153,156,159,162,165,168,171,174,178,181}, +{199,196,194,191,189,186,184,181,179,177,174,172,170,167,165,163,161,159,157,155,153,151,149,147,146,144,142,140,139,137,135,134,132,131,129,128,127,125,124,123,122,120,119,118,117,116,115,114,113,112,112,111,110,109,109,108,107,107,106,106,105,105,105,104,104,104,104,103,103,103,103,103,103,103,103,104,104,104,104,105,105,105,106,106,107,108,108,109,110,110,111,112,113,114,115,116,117,118,120,121,122,124,125,127,128,130,132,133,135,137,139,141,143,145,148,150,153,155,158,160,163,166,169,172,176,179,183,186}, +{202,200,197,194,192,189,187,185,182,180,178,175,173,171,169,167,164,162,160,158,156,154,153,151,149,147,145,144,142,141,139,137,136,134,133,132,130,129,128,126,125,124,123,122,121,120,119,118,117,116,115,114,114,113,112,112,111,110,110,109,109,109,108,108,108,107,107,107,107,107,107,107,107,107,107,107,108,108,108,108,109,109,110,110,111,111,112,113,113,114,115,116,117,118,119,120,121,122,124,125,126,128,129,131,132,134,136,138,139,141,143,145,148,150,152,154,157,159,162,165,168,171,174,177,180,184,188,191}, +{205,203,200,198,195,193,190,188,185,183,181,179,176,174,172,170,168,166,164,162,160,158,156,154,152,151,149,147,146,144,142,141,139,138,136,135,134,132,131,130,129,128,126,125,124,123,122,121,120,120,119,118,117,117,116,115,115,114,114,113,113,112,112,112,111,111,111,111,111,111,111,111,111,111,111,111,111,112,112,112,113,113,114,114,115,115,116,117,117,118,119,120,121,122,123,124,125,126,128,129,130,132,133,135,136,138,140,142,144,146,148,150,152,154,156,159,161,164,167,169,172,175,179,182,185,189,192,196}, +{208,206,203,201,198,196,193,191,189,186,184,182,180,177,175,173,171,169,167,165,163,161,159,158,156,154,152,151,149,147,146,144,143,141,140,139,137,136,135,133,132,131,130,129,128,127,126,125,124,123,122,122,121,120,120,119,118,118,117,117,116,116,116,115,115,115,115,115,114,114,114,114,114,115,115,115,115,115,116,116,116,117,117,118,118,119,120,120,121,122,123,124,125,126,127,128,129,130,132,133,134,136,137,139,141,142,144,146,148,150,152,154,156,158,161,163,166,168,171,174,177,180,183,187,190,194,198,201}, +{212,209,207,204,202,199,197,194,192,190,187,185,183,181,179,177,174,172,170,168,167,165,163,161,159,158,156,154,153,151,149,148,146,145,143,142,141,139,138,137,136,135,134,132,131,130,129,129,128,127,126,125,125,124,123,123,122,121,121,120,120,120,119,119,119,119,118,118,118,118,118,118,118,118,118,119,119,119,119,120,120,121,121,122,122,123,124,124,125,126,127,128,129,130,131,132,133,134,136,137,138,140,141,143,145,146,148,150,152,154,156,158,160,163,165,168,170,173,176,179,182,185,188,191,195,199,203,207}, +{215,212,210,207,205,202,200,198,195,193,191,188,186,184,182,180,178,176,174,172,170,168,166,164,163,161,159,158,156,154,153,151,150,148,147,146,144,143,142,141,139,138,137,136,135,134,133,132,131,130,130,129,128,127,127,126,126,125,125,124,124,123,123,123,123,122,122,122,122,122,122,122,122,122,122,122,123,123,123,124,124,125,125,126,126,127,128,128,129,130,131,132,133,134,135,136,137,138,140,141,143,144,146,147,149,151,152,154,156,158,160,163,165,167,170,172,175,178,180,183,186,190,193,196,200,204,208,212}, +{218,215,213,210,208,206,203,201,198,196,194,192,190,187,185,183,181,179,177,175,173,171,170,168,166,164,163,161,159,158,156,155,153,152,151,149,148,147,145,144,143,142,141,140,139,138,137,136,135,134,133,133,132,131,130,130,129,129,128,128,127,127,127,126,126,126,126,126,126,126,126,126,126,126,126,126,126,127,127,127,128,128,129,129,130,131,131,132,133,134,135,136,137,138,139,140,141,142,144,145,147,148,150,151,153,155,157,159,161,163,165,167,169,172,174,177,179,182,185,188,191,194,198,201,205,209,213,217}, +{221,219,216,214,211,209,206,204,202,199,197,195,193,191,189,187,185,183,181,179,177,175,173,171,170,168,166,164,163,161,160,158,157,155,154,153,151,150,149,148,146,145,144,143,142,141,140,139,139,138,137,136,135,135,134,134,133,132,132,132,131,131,130,130,130,130,130,129,129,129,129,129,129,130,130,130,130,131,131,131,132,132,133,133,134,135,135,136,137,138,139,140,141,142,143,144,145,147,148,149,151,152,154,156,157,159,161,163,165,167,169,171,174,176,179,181,184,187,190,193,196,199,203,206,210,214,218,223}, +{224,222,219,217,214,212,210,207,205,203,201,198,196,194,192,190,188,186,184,182,180,178,176,175,173,171,170,168,166,165,163,162,160,159,158,156,155,154,152,151,150,149,148,147,146,145,144,143,142,141,141,140,139,138,138,137,137,136,136,135,135,134,134,134,134,133,133,133,133,133,133,133,133,133,134,134,134,134,135,135,136,136,137,137,138,139,139,140,141,142,143,144,145,146,147,148,149,151,152,153,155,156,158,160,162,163,165,167,169,171,174,176,178,181,183,186,189,192,195,198,201,204,208,212,216,220,224,228}, +{227,225,222,220,218,215,213,211,208,206,204,202,199,197,195,193,191,189,187,185,184,182,180,178,176,175,173,171,170,168,167,165,164,162,161,160,158,157,156,155,154,152,151,150,149,148,147,147,146,145,144,143,143,142,141,141,140,140,139,139,139,138,138,138,137,137,137,137,137,137,137,137,137,137,137,138,138,138,139,139,139,140,141,141,142,142,143,144,145,146,147,148,149,150,151,152,153,155,156,158,159,161,162,164,166,168,170,172,174,176,178,180,183,185,188,191,193,196,199,203,206,209,213,217,221,225,229,234}, +{231,228,226,223,221,218,216,214,212,209,207,205,203,201,199,197,195,193,191,189,187,185,183,182,180,178,176,175,173,172,170,169,167,166,165,163,162,161,159,158,157,156,155,154,153,152,151,150,149,149,148,147,146,146,145,145,144,144,143,143,142,142,142,141,141,141,141,141,141,141,141,141,141,141,141,141,142,142,142,143,143,144,144,145,146,146,147,148,149,150,151,152,153,154,155,156,158,159,160,162,163,165,167,168,170,172,174,176,178,180,182,185,187,190,193,195,198,201,204,208,211,215,218,222,226,231,235,240}}; + diff --git a/implementation/software/include/asteroids_font.h b/implementation/software/include/asteroids_font.h new file mode 100644 index 0000000..93b99d4 --- /dev/null +++ b/implementation/software/include/asteroids_font.h @@ -0,0 +1,27 @@ +/** \file + * Asteroids simple font. + */ +#ifndef _asteroids_font_h_ +#define _asteroids_font_h_ + +#include + +typedef struct +{ + uint8_t points[8]; // 4 bits x, 4 bits y +} asteroids_char_t; + +#define FONT_UP 0xFE +#define FONT_LAST 0xFF + +#ifdef __cplusplus +extern "C" { +#endif + +extern const asteroids_char_t asteroids_font[]; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/implementation/software/include/controller.h b/implementation/software/include/controller.h index 4320220..3284f63 100644 --- a/implementation/software/include/controller.h +++ b/implementation/software/include/controller.h @@ -5,6 +5,7 @@ #include "gb_math.h" #include "stepper.h" #include "path.h" +#include "angle.h" #define VEL_DIV 1024 @@ -21,35 +22,45 @@ enum { }; typedef struct { - event_t event; - event_timeout_t event_timeout; - event_queue_t *queue; stepper_t *stepper_a; stepper_t *stepper_b; - float arm_a; - float arm_b; - float angle1_setpoint; - float angle2_setpoint; uint32_t time_step; - gbVec2 setpoint; path_t *path; - float error; + thread_flags_t flags; } controller_t; +/** + * @brief Initialize controller + * + * @param[out] control struct describing the controller + */ int controller_init(controller_t *control); -void controller_update(event_t *event); - -int controller_setpoint(controller_t *control, gbVec2 *point); - -void controller_inverse_kinematics(controller_t *control, gbVec2 *point, float *angle1, float *angle2); - -void controller_current_position(controller_t *control, gbVec2 *point); - -int controller_calculate_velocity(controller_t *control); - -int controller_sub_setpoint(controller_t *control, gbVec2 *setpoint, float distance); - +/** + * @brief execute main loop of the controller + * + * @param[in] control struct describing the controller + */ +int controller_loop(controller_t *control); + +//void controller_update(event_t *event); + +//int controller_setpoint(controller_t *control, gbVec2 *point); +// +//void controller_inverse_kinematics(controller_t *control, gbVec2 *point, float *angle1, float *angle2); +// +//void controller_current_position(controller_t *control, gbVec2 *point); +// +//int controller_calculate_velocity(controller_t *control); +// +//int controller_sub_setpoint(controller_t *control, gbVec2 *setpoint, float distance); + + +/** + * @brief home both stepper motors + * + * @param[in] control struct describing the controller + */ int controller_home(controller_t *control); diff --git a/implementation/software/include/path.h b/implementation/software/include/path.h new file mode 100644 index 0000000..bf5781f --- /dev/null +++ b/implementation/software/include/path.h @@ -0,0 +1,71 @@ +#pragma once +#include "list.h" +#include "gb_math.h" +#include +#include +#include +#include "asteroids_font.h" +#include "xtimer.h" + +typedef struct{ + struct {int16_t x, y; }; + int16_t e[2]; +} point_t; + +typedef enum{ + PATH_MOVE = 0x0, + PATH_DRAW = 0x1 +} path_modus_t; + +typedef struct{ + list_node_t list; + point_t point; + path_modus_t modus; +} path_node_t; + +typedef struct{ + list_node_t list; + int16_t step_pos_a; + int16_t step_pos_b; +} step_pos_node_t; + +typedef struct{ + list_node_t set_point_start; + list_node_t start; + list_node_t current; + uint8_t char_count; +} path_t; + +void path_add(path_t *path, path_node_t *point); + +void path_add_vec(path_t *node, point_t *point, path_modus_t modus); + +//void path_add_rect(path_t *node, gbRect2 *rect); + +void path_generate(path_t *path); + +void path_reset(path_t *path); + +void path_add_circle(path_t *node, gbVec2 *point, float radius, uint8_t division); + +void path_reverse(path_t *node); + +void path_increment(path_t *path); + +void path_init(path_t *path); + +void path_add_char(path_t *path, char character); + +path_node_t* path_next_point(path_t *path); + +path_node_t* path_next(path_node_t *point); + +path_node_t* path_pop(path_node_t *point); + +point_t point_sub(point_t *a, point_t *b); + +point_t point_add(point_t *a, point_t *b); + +point_t point_interval(point_t *a, point_t*b); + +int16_t point_mag2(point_t *a); diff --git a/implementation/software/include/stepper.h b/implementation/software/include/stepper.h index e61e1d5..009b662 100644 --- a/implementation/software/include/stepper.h +++ b/implementation/software/include/stepper.h @@ -12,6 +12,8 @@ #include #include #include +#include "event.h" +#include "event/timeout.h" #ifdef __cplusplus extern "C" { @@ -45,7 +47,7 @@ extern "C" { // default datagram => 05 ff 6c 17 01 00 53 3e #define STEPPER_CHOPCONF_ADDR (0x6c) // 6C -#define STEPPER_CHOPCONF_VALUES (0xB5810132UL)//(0xCA00004CUL) // 32000053 set dedge=0x1, intpol=0x1, mres=0x2, hstrt=0x5, toff=0x3. others are 0x0. +#define STEPPER_CHOPCONF_VALUES (0xB5810134UL)//(0xCA00004CUL) // 32000053 set dedge=0x1, intpol=0x1, mres=0x2, hstrt=0x5, toff=0x3. others are 0x0. //#define STEPPER_CHOPCONF_VALUES [0x32,0x00,0x00,0x53] // set dedge=0x1, intpol=0x1, mres=0x2, hstrt=0x5, toff=0x3. others are 0x0. @@ -55,7 +57,8 @@ extern "C" { */ enum { STEPPER_OK = 0, - STEPPER_NO = -1, + STEPPER_ERR = -1, + STEPPER_DISABLED = -2, }; /** @@ -67,20 +70,18 @@ extern "C" { } stepper_direction_t; /** - * @brief Data structure holding the device parameters needed for initialization + * @brief Data structure holding the stepperice parameters needed for initialization */ typedef struct { gpio_t step_pin; gpio_t dir_pin; + gpio_t enable_pin; uint8_t uart; uint8_t vel_max; uint8_t acc_max; uint8_t microstep; uint16_t division; float angle; - float velocity; - sensor_t sensor; - float homing_angle; } stepper_params_t; /** @@ -88,21 +89,115 @@ typedef struct { */ typedef struct { stepper_params_t p; + float velocity_setpoint; + stepper_direction_t direction; + int16_t step_count; + int16_t step_setpoint; + uint32_t time_step; + float step_angle; + bool enable; + event_t event; + event_timeout_t event_timeout; + event_queue_t *queue; + thread_t *thread; + thread_flags_t flags; + char id; } stepper_t; -int stepper_init(stepper_t *dev, const stepper_params_t *params); +typedef struct { + event_queue_t* queue; + sensor_t* sensor; +} stepper_init_t; + +/** + * @brief Initialize the stepper + * + * @param[out] stepper struct describing the stepper + * @param[in] params static configuration parameters of stepper + * + * @return STEPPER_OK on success + * @return STEPPER_ERR on error + */ +int stepper_init(stepper_t *stepper, const stepper_params_t *params); + +/** + * @brief Instruct the stepper to move to setpoint + * + * @param[in] stepper struct describing the stepper + * @param[in] count stepcount setpoint + * @param[in] time_step time span in which to complete the move + */ +void stepper_set_setpoint(stepper_t *stepper, int16_t count, uint32_t time_step); -int stepper_set_velocity(stepper_t *dev, float *velocity); +//void stepper_set_velocity(stepper_t *stepper, float velocity); -int stepper_homing(stepper_t *dev); +/** + * @brief Change rotation direction of stepper + * + * @param[in] stepper struct describing the stepper + * @param[in] direction move direction of stepper + */ +void stepper_set_direction(stepper_t *stepper, stepper_direction_t direction); -int stepper_get_angle(stepper_t *dev, float *angle); +//int stepper_time_step(stepper_t *stepper); -int stepper_step(stepper_t *dev, stepper_direction_t *direction); +int32_t stepper_get_count(stepper_t *stepper, float angle); -int stepper_write(stepper_t *dev, uint8_t reg, le_uint32_t *data); +/** + * @brief Update next action. + * Schedules a new event or when the set point is reached, signal the controller. + * + * @param[in] stepper struct describing the stepper + */ +void stepper_update(stepper_t *stepper); + +/** + * @brief Return the current angle in radiansa + * + * @param[in] stepper struct describing the stepper + * @param[out] angle angle in radians + */ +void stepper_get_angle(stepper_t *stepper, float *angle); -int stepper_read(stepper_t *dev, uint8_t reg); +/** + * @brief Move stepper by a single step. + * + * @param[in] stepper struct describing the stepper + */ +int stepper_step(stepper_t *stepper); + +/** + * @brief write to stepper register + * + * @param[in] stepper struct describing the stepper + * @param[in] reg register adress + * @param[in] data data to write in register + */ +void stepper_write(stepper_t *stepper, uint8_t reg, le_uint32_t *data); + +/** + * @brief trigger read from stepper register + * + * @param[in] stepper struct describing the stepper + * @param[in] reg register adress + * + * @note This function does not parse the answer from the stepper. Use a logic analyser for that. + */ +void stepper_read(stepper_t *stepper, uint8_t reg); + +/** + * @brief enable stepper motor + * + * @param[in] stepper struct describing the stepper + */ +void stepper_enable(stepper_t *stepper); + +/** + * @brief disable stepper motor + * + * @param[in] stepper struct describing the stepper + */ +void stepper_disable(stepper_t *stepper); #ifdef __cplusplus } diff --git a/implementation/software/include/stepper_params.h b/implementation/software/include/stepper_params.h index 82c2777..efc6c1f 100644 --- a/implementation/software/include/stepper_params.h +++ b/implementation/software/include/stepper_params.h @@ -8,10 +8,13 @@ extern "C" { #include "board.h" #ifndef STEPPER_PARAM_STEP_PIN -#define STEPPER_PARAM_STEP_PIN GPIO_PIN(0, 0) +#define STEPPER_PARAM_STEP_PIN GPIO_PIN(1, 14) #endif #ifndef STEPPER_PARAM_DIR_PIN -#define STEPPER_PARAM_DIR_PIN GPIO_PIN(0, 1) +#define STEPPER_PARAM_DIR_PIN GPIO_PIN(1, 13) +#endif +#ifndef STEPPER_PARAM_ENABLE_PIN +#define STEPPER_PARAM_ENABLE_PIN GPIO_PIN(1, 15) #endif #ifndef STEPPER_PARAM_UART #define STEPPER_PARAM_UART UART_DEV(1) @@ -28,31 +31,17 @@ extern "C" { #ifndef STEPPER_PARAM_DIVISION #define STEPPER_PARAM_DIVISION STEPPER_PARAM_DIVISION_DEFAULT #endif -#ifndef STEPPER_PARAM_ANGLE -#define STEPPER_PARAM_ANGLE STEPPER_PARAM_ANGLE_DEFAULT -#endif -#ifndef STEPPER_PARAM_VELOCITY -#define STEPPER_PARAM_VELOCITY STEPPER_PARAM_VELOCITY_DEFAULT -#endif -#ifndef STEPPER_PARAM_SENSOR -#define STEPPER_PARAM_SENSOR STEPPER_PARAM_SENSOR_DEFAULT -#endif -#ifndef STEPPER_PARAM_HOMING_ANGLE -#define STEPPER_PARAM_HOMING_ANGLE STEPPER_PARAM_HOMING_ANGLE_DEFAULT -#endif #ifndef STEPPER_PARAMS #define STEPPER_PARAMS \ { .step_pin = STEPPER_PARAM_STEP_PIN, \ .dir_pin = STEPPER_PARAM_DIR_PIN, \ + .enable_pin = STEPPER_PARAM_ENABLE_PIN, \ .uart = STEPPER_PARAM_UART, \ .vel_max = STEPPER_PARAM_VEL_MAX, \ .acc_max = STEPPER_PARAM_ACC_MAX, \ .microstep = STEPPER_PARAM_MICROSTEP, \ .division = STEPPER_PARAM_DIVISION, \ - .angle = STEPPER_PARAM_ANGLE, \ - .velocity = STEPPER_PARAM_VELOCITY, \ - .homing_angle = STEPPER_PARAM_HOMING_ANGLE, \ } #endif diff --git a/implementation/software/main.c b/implementation/software/main.c index 40c656c..29c4d37 100644 --- a/implementation/software/main.c +++ b/implementation/software/main.c @@ -1,27 +1,214 @@ #include #include +#define GB_MATH_IMPLEMENTATION +#include "include/gb_math.h" #include "include/stepper.h" +#include "include/path.h" #include "include/stepper_params.h" #include "include/sensor.h" +#include "include/controller.h" #include "xtimer.h" +#include "thread.h" +#include "servo.h" +#include "thread_flags.h" +#define STACKSIZE THREAD_STACKSIZE_DEFAULT +#define PRIO (THREAD_PRIORITY_MAIN - 1) + + +static char stack[STACKSIZE]; +//static event_queue_t queue; + +void test_velocity(stepper_t *stepper, int steps){ + //float angle; + stepper_set_direction(stepper, STEPPER_FORWARD); + for ( int i = 0; i < steps; i++) + { + stepper_step(stepper); + xtimer_usleep(400); + //stepper_get_angle(stepper, &angle); + //printf("Angle: %f | Steps: %i\n",angle,i); + } + printf("reverse\n"); + stepper_set_direction(stepper, STEPPER_REVERSE); + for ( int i = 0; i < steps; i++) + { + stepper_step(stepper); + xtimer_usleep(400); + //stepper_get_angle(stepper, &angle); + //printf("Angle: %f | Steps: %i\n",angle,i); + } +} + +typedef struct{ + event_t event; + thread_t *thread; + thread_flags_t flags; +} test_t; + +static void *claiming_thread(void *arg) +{ + event_queue_t *dqs = arg; + + event_queue_claim(dqs); + + event_loop(dqs); + + return NULL; +} + +/*int main(void) +{ + event_queue_t event_queue = EVENT_QUEUE_INIT_DETACHED; + event_queue_init_detached(&event_queue); + thread_create(stack, sizeof(stack), PRIO, 0, claiming_thread, &event_queue, "ct"); + event_t event1 = {.handler = set1}; + event_t event2 = {.handler = set1}; + thread_t *main_thread = thread_get_active(); + test_t test1 = { + .event = event1, + .thread = main_thread, + .flags = 0x1 + }; + test_t test2 = { + .event = event2, + .thread = main_thread, + .flags = 0x2 + }; + event_timeout_t timeout1; + event_timeout_t timeout2; + event_timeout_init(&timeout1, &event_queue, (event_t*)&test1); + event_timeout_init(&timeout2, &event_queue, (event_t*)&test2); + event_timeout_set(&timeout1, 1000000); + event_timeout_set(&timeout2, 3000000); + printf("Timeouts are set\n"); + thread_flags_wait_all(0x3); + printf("Flags are set\n"); +}*/ + + +/* int main(void) { + event_queue_init(&queue); + stepper_t stepper_a; + stepper_a.queue = &queue; + stepper_init(&stepper_a, &stepper_params[0]); + test_velocity(&stepper_a,800); + //stepper_set_velocity(&stepper_a, 20); + //event_loop(&queue); + stepper_disable(&stepper_a); + return 0; +} +*/ + +/*int main(void) +{ + + stepper_t stepper_a; + stepper_t stepper_b; + controller_t controller_scara; + controller_scara.stepper_a = &stepper_a; + controller_scara.stepper_b = &stepper_b; + controller_scara.queue = &queue; + controller_scara.time_step = 10000; + controller_scara.arm_a = 0.070; + controller_scara.arm_b = 0.055; + gbVec2 setpoint = { + .x = 0.015, + .y = 0.085, + }; + float anglea; + float angleb; + controller_inverse_kinematics(&controller_scara, &setpoint, &anglea, &angleb); + printf("Angle A: %f, B: %f\n", anglea,angleb); +} +*/ + +int main(void) +{ + //printf("Frequentie: %lu Hz\n"); + servo_t servo; + int servo_ret = servo_init(&servo, PWM_DEV(0), 2, 0, 1000); + printf("Servo_set: %i\n", servo_ret); + servo_set(&servo,350); + xtimer_usleep(1000000); + servo_set(&servo,750); + xtimer_usleep(1000000); + return 0; + - stepper_t dev; - stepper_init(&dev, &stepper_params[0]); + event_queue_t queue = EVENT_QUEUE_INIT_DETACHED; + event_queue_init_detached(&queue); + thread_create(stack, sizeof(stack), PRIO, 0, claiming_thread, &queue, "ct"); + + thread_t* main_thread = thread_get_active(); + + + path_t path; + path_init(&path); + //point_t point = {.x = 0, .y = 0}; + //path_add_vec(&path, &point, PATH_DRAW); + //point_t point1= {.x = 72, .y = 90}; + //path_add_vec(&path, &point1, PATH_DRAW); + path_add_char(&path, 'S'); + path_add_char(&path, 'Q'); + path_add_char(&path, 'X'); + point_t point1= {.x = 72, .y = 89}; + path_add_vec(&path, &point1, PATH_MOVE); + point_t point2= {.x = 72, .y = 89}; + path_add_vec(&path, &point2, PATH_MOVE); + //path_add_char(&path, '!'); + path_reverse(&path); + path_reset(&path); + + // Set stepper A + stepper_t stepper_a; + stepper_a.queue = &queue; + stepper_a.thread = main_thread; + stepper_a.flags = 0x1; + stepper_a.id = 'A'; + stepper_init(&stepper_a, &stepper_params[0]); + + // Set stepper B + stepper_t stepper_b; + stepper_b.queue = &queue; + stepper_b.thread = main_thread; + stepper_b.flags = 0x2; + stepper_b.id = 'B'; + stepper_params_t stepper_params_b; + memcpy(&stepper_params_b, &stepper_params[0], sizeof(stepper_params_t)); + stepper_params_b.dir_pin = GPIO_PIN(1,1); + stepper_params_b.step_pin = GPIO_PIN(1,2); + stepper_params_b.enable_pin = GPIO_PIN(1,12); + stepper_init(&stepper_b, &stepper_params_b); + + controller_t controller_scara; + controller_scara.stepper_a = &stepper_a; + controller_scara.stepper_b = &stepper_b; + controller_scara.time_step = 4000; + controller_scara.path = &path; + controller_init(&controller_scara); + for (int i = 0; i < 50; i++){ + controller_loop(&controller_scara); + } + printf("einde\n"); + + + + //event_loop(&queue); + return 0; +} + + +int test_registers(stepper_t *dev) { xtimer_usleep(10000); - stepper_read(&dev, 0x0); + stepper_read(dev, 0x0); xtimer_usleep(10000); - stepper_read(&dev, 0x6C); + stepper_read(dev, 0x6C); xtimer_usleep(10000); - stepper_read(&dev, 0x70); + stepper_read(dev, 0x70); xtimer_usleep(10000); - while (1) { - xtimer_usleep(100); - stepper_step(&dev, STEPPER_FORWARD); - } - - return 0; + return STEPPER_OK; } diff --git a/implementation/software/path.c b/implementation/software/path.c new file mode 100644 index 0000000..05084f7 --- /dev/null +++ b/implementation/software/path.c @@ -0,0 +1,184 @@ +#include "include/path.h" + +#define STEPMULTI_X (4) +#define CHAR_OFFSET_X (40) +#define STEPMULTI_Y (5) +#define CHAR_OFFSET_Y (20) + + +void pp(point_t *point) +{ + printf("%i, %i\n", point->x, point->y); +} + +void path_add(path_t *path, path_node_t *point){ + list_add(&path->start, &point->list); + pp(&point->point); +} + +void path_add_vec(path_t *node, point_t *point, path_modus_t modus){ + path_node_t* new_point_ptr = (path_node_t*) malloc(sizeof(path_node_t)); + new_point_ptr->point = *point; + new_point_ptr->modus = modus; + path_add(node, new_point_ptr); +} + +void path_add_interpolated(path_t *path, point_t *point, path_modus_t modus) +{ + if(modus == PATH_MOVE){ + path_add_vec(path,point,modus); + return; + } + path_node_t* current_node = (path_node_t*)path->start.next; + //printf("Current node @ "); + //pp(¤t_node->point); + point_t point_diff = point_sub(point, ¤t_node->point); + while(point_mag2(&point_diff) > 64 ) + { + point_t interval = point_interval(¤t_node->point, point); + path_add_interpolated(path, &(interval), modus); + current_node = (path_node_t*)path->start.next; + point_diff = point_sub(point, ¤t_node->point); + } + path_add_vec(path, point, modus); +} + +/* +void path_add_rect(path_t *node, gbRect2 *rect){ + gbVec2 corner = rect->pos; + path_add_vec(node, &corner, PATH_MOVE); + corner.x = corner.x + rect->dim.x; + path_add_vec(node, &corner, PATH_DRAW); + gb_vec2_add(&corner, rect->pos, rect->dim); + path_add_vec(node, &corner, PATH_DRAW); + corner.x = corner.x - rect->dim.x; + path_add_vec(node, &corner, PATH_DRAW); + corner = rect->pos; + path_add_vec(node, &corner, PATH_DRAW); +} +*/ + +void path_add_char(path_t *path, char character) +{ + path_modus_t modus = PATH_MOVE; + asteroids_char_t char_path = asteroids_font[(uint8_t)character - 0x20]; + for(int i = 0; i<8; i++) + { + uint8_t char_point = char_path.points[i]; + if (char_point == FONT_LAST){ + path->char_count++; + return; + } + if (char_point == FONT_UP){ + modus = PATH_MOVE; + continue; + } + point_t point = { + .x = ((char_point >> 4) & 0xF) * STEPMULTI_X + CHAR_OFFSET_X * path->char_count, + .y = ((char_point >> 0) & 0xF) * STEPMULTI_Y + CHAR_OFFSET_Y + }; + path_add_interpolated(path, &point, modus); + modus = PATH_DRAW; + } + path->char_count++; +} + +void path_init(path_t *path) +{ + path->current = path->start; + path->char_count = 0; + point_t origin = {.x = 0, .y = 0}; + path_add_vec(path, &origin, PATH_MOVE); +} + +void path_reset(path_t *path) +{ + path->current = path->start; +} + +/*void path_add_circle(path_t *node, gbVec2 *point, float radius, uint8_t division) +{ + +} + +void path_add_arc(path_t *node, gbVec2 *point, float radius, float angle_start, float angle_end, uint8_t division) +{ + +} +*/ + +void path_reverse(path_t *node){ + if (node->start.next == 0x0) + { + return; + } + list_node_t* curr_node = node->start.next; + list_node_t* next_node = NULL; + list_node_t* prev_node = NULL; + while(curr_node){ + next_node = curr_node->next; + curr_node->next = prev_node; + prev_node = curr_node; + curr_node = next_node; + } + node->start.next = prev_node; +} + +void path_increment(path_t *path) +{ + if (path->current.next != NULL){ + path_node_t* point = path_next_point(path); + path->current = point->list; + } +} + +path_node_t* path_next_point(path_t *path) +{ + return (path_node_t*) path->current.next; +} + +path_node_t* path_next(path_node_t *point){ + return (path_node_t*) point->list.next; +} + +path_node_t* path_pop(path_node_t *point){ + return (path_node_t*) list_remove_head(&point->list); +} + +/*gbVec2 path_next_setpoint(path_t *path, gbVec2 *current_position, float distance){ + gbVec2 position_error; + gb_vec2_sub(&position_error, control->setpoint, current_position); + float error_magnitude = gb_vec2_mag(&position_error); +}*/ + +point_t point_sub(point_t *a, point_t *b) +{ + point_t point = { + .x = a->x - b->x, + .y = a->y - b->y + }; + return point; +} + +point_t point_add(point_t *a, point_t *b) +{ + point_t point = { + .x = a->x + b->x, + .y = a->y + b->y + }; + return point; +} + +point_t point_interval(point_t *a, point_t*b) +{ + point_t point = { + .x = a->x + (b->x - a->x)/2, + .y = a->y + (b->y - a->y)/2 + }; + return point; +} + +int16_t point_mag2(point_t *a) +{ + return a->x * a->x + a->y * a->y; +} diff --git a/implementation/software/stepper.c b/implementation/software/stepper.c index d97d19f..0446427 100644 --- a/implementation/software/stepper.c +++ b/implementation/software/stepper.c @@ -1,46 +1,135 @@ - #include "periph/gpio.h" #include "periph/uart.h" -#include "checksum/crc8.h" #include "include/stepper.h" #include "include/stepper_params.h" #include "include/sensor.h" +#include "include/gb_math.h" #define ENABLE_DEBUG (0) #include "debug.h" +#define STEP_PIN (stepper->p.step_pin) +#define DIR_PIN (stepper->p.dir_pin) +#define ENABLE_PIN (stepper->p.enable_pin) +#define UART (stepper->p.uart) + -#define STEP_PIN (dev->p.step_pin) -#define DIR_PIN (dev->p.dir_pin) -#define UART (dev->p.uart) +static void stepper_event(event_t *_event) +{ + stepper_t *stepper = container_of(_event, stepper_t, event); + stepper_step(stepper); + stepper_update(stepper); +} -int stepper_init(stepper_t *dev, const stepper_params_t *params) +int stepper_init(stepper_t *stepper, const stepper_params_t *params) { - assert(dev && params); + stepper->p = *params; + event_t event = { .handler = stepper_event }; + stepper->event = event; + stepper->velocity_setpoint = 0.0; + stepper->step_count = 0; + stepper->time_step = 0; + stepper->step_angle = GB_MATH_TAU / (float)(stepper->p.division * stepper->p.microstep); - dev->p = *params; + event_timeout_init(&(stepper->event_timeout), stepper->queue, (event_t*)&(stepper->event)); gpio_init(STEP_PIN, GPIO_OUT); + gpio_init(DIR_PIN, GPIO_OUT); + gpio_init(ENABLE_PIN, GPIO_OD); - uart_init(UART, 38400, NULL, NULL); + stepper_enable(stepper); + + if(uart_init(UART, 38400, NULL, NULL)) + return STEPPER_ERR; le_uint32_t data; data.u32 = STEPPER_GCONF_VALUES; - stepper_write(dev, STEPPER_GCONF_ADDR, &data); + stepper_write(stepper, STEPPER_GCONF_ADDR, &data); data.u32 = STEPPER_CHOPCONF_VALUES; - stepper_write(dev, STEPPER_CHOPCONF_ADDR, &data); + stepper_write(stepper, STEPPER_CHOPCONF_ADDR, &data); + //event_post(stepper->queue, &(stepper->event)); + printf("initialized descriptor 0x%08x\n", (unsigned)stepper); + printf("initialized event 0x%08x\n", (unsigned)&(stepper->event)); + printf("initialized queue 0x%08x\n", (unsigned)stepper->queue); return STEPPER_OK; } +void stepper_set_setpoint(stepper_t *stepper, int16_t count, uint32_t time_step) +{ + //Write the count to the setpoint field. + stepper->step_setpoint = count; + //Set direction + if (stepper->step_setpoint < stepper->step_count) + { + stepper_set_direction(stepper, STEPPER_REVERSE); + //Write the time_step to the time_step field. + stepper->time_step = time_step/(stepper->step_count - stepper->step_setpoint); + } + else + { + stepper_set_direction(stepper, STEPPER_FORWARD); + //Write the time_step to the time_step field. + stepper->time_step = time_step/(stepper->step_setpoint - stepper->step_count); + } + if (stepper->time_step <= 400){ + stepper->time_step = 400; + } + //Call update to set a timeout. + stepper_update(stepper); +} -int stepper_step(stepper_t *dev, stepper_direction_t *direction) +void stepper_get_angle(stepper_t *stepper, float *angle) { - assert(direction); - gpio_toggle(STEP_PIN); + *angle = stepper->step_count * stepper->step_angle; + return; +} +int32_t stepper_get_count(stepper_t *stepper, float angle) +{ + return (int32_t) gb_round(angle/stepper->step_angle); +} + +void stepper_update(stepper_t *stepper) +{ + // Set thread flags and return if the stepper is at the desired position. + if(stepper->step_count == stepper->step_setpoint) + { + thread_flags_set(stepper->thread, stepper->flags); + return; + } + // Set a new timeout event. + event_timeout_set(&stepper->event_timeout, stepper->time_step); +} + +/* +int stepper_time_step(stepper_t *stepper){ + if (stepper->velocity_setpoint == 0.0) { + return STEPPER_ERR; + } + float step_time = stepper->step_angle / stepper->velocity_setpoint; + stepper->time_step = (uint32_t)(step_time*1000000.0); + return STEPPER_OK; +} +*/ + +int stepper_step(stepper_t *stepper) +{ + if (!stepper->enable) { + return STEPPER_DISABLED; + } + if (stepper->direction == STEPPER_FORWARD) + { + stepper->step_count++; + } + else + { + stepper->step_count--; + } + gpio_toggle(STEP_PIN); + //printf("Stepper %c @ %i\n", stepper->id, stepper->step_count); return STEPPER_OK; } @@ -58,14 +147,39 @@ uint8_t stepper_crc8(const uint8_t *data, size_t len, uint8_t g_polynom, uint8_t } return crc; } - +/* +void stepper_set_velocity(stepper_t *stepper, float velocity) +{ + if (velocity > 0) + { + stepper->velocity_setpoint = gb_min(velocity,20);//20 + stepper_set_direction(stepper, STEPPER_FORWARD); + } + else + { + stepper->velocity_setpoint = gb_min(-velocity,20);//20 + stepper_set_direction(stepper, STEPPER_REVERSE); + } + stepper_update(stepper); +} +*/ + +void stepper_set_direction(stepper_t *stepper, stepper_direction_t direction){ + stepper->direction = direction; + if (direction == STEPPER_REVERSE) + { + gpio_set(DIR_PIN); + } + else + { + gpio_clear(DIR_PIN); + } +} -int stepper_write(stepper_t *dev, uint8_t reg, le_uint32_t *data) +void stepper_write(stepper_t *stepper, uint8_t reg, le_uint32_t *data) { uint8_t* message; - uint32_t be_data; - be_data = byteorder_swapl(data->u32); message = (uint8_t*) malloc(8 * sizeof(uint8_t)); message[0] = STEPPER_UART_SYNC; message[1] = STEPPER_UART_SLAVE_ADDR; @@ -73,22 +187,21 @@ int stepper_write(stepper_t *dev, uint8_t reg, le_uint32_t *data) memcpy(&message[3], data->u8, 4); message[7] = 0x0; - printf(data); - uint8_t crc = stepper_crc8(message, 7, 0x07, 0x0); message[7] = crc; uart_write(UART, message, 8); - printf("\n"); +/* printf("\n"); for (int i = 0; i<8; i++) { printf("%0.2x",message[i]); } printf("\n"); - return STEPPER_OK; + */ + return; } -int stepper_read(stepper_t *dev, uint8_t reg) +void stepper_read(stepper_t *stepper, uint8_t reg) { uint8_t* message; message = (uint8_t*) malloc(4 * sizeof(uint8_t)); @@ -96,8 +209,18 @@ int stepper_read(stepper_t *dev, uint8_t reg) message[1] = STEPPER_UART_SLAVE_ADDR; message[2] = reg; message[3] = stepper_crc8(message, 3, 0x07, 0x0); - uart_write(UART, message, 4); + return; +} + +void stepper_enable(stepper_t *stepper){ + stepper->enable = true; + gpio_clear(ENABLE_PIN); +} + +void stepper_disable(stepper_t *stepper){ + stepper->enable = false; + gpio_set(ENABLE_PIN); }